@arcgis/core 4.24.0-next.20220430 → 4.24.0-next.20220503

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 (998) hide show
  1. package/Basemap.js +1 -1
  2. package/Color.js +1 -1
  3. package/Ground.js +1 -1
  4. package/Map.js +1 -1
  5. package/PopupTemplate.js +1 -1
  6. package/WebMap.js +1 -1
  7. package/WebScene.js +1 -1
  8. package/analysis/LinearDimension.js +1 -1
  9. package/analysis/SliceAnalysis.js +1 -1
  10. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  11. package/arcade/Dictionary.js +1 -1
  12. package/arcade/Feature.js +1 -1
  13. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  14. package/arcade/featureset/support/FeatureSet.js +1 -1
  15. package/assets/esri/core/workers/RemoteClient.js +1 -1
  16. package/assets/esri/core/workers/chunks/{e06461703e6f1acfcfdc.js → 076d1b1101b59af0d389.js} +1 -1
  17. package/assets/esri/core/workers/chunks/0b72d123386dc4ec7538.js +1 -0
  18. package/assets/esri/core/workers/chunks/0d53e575f11198867619.js +1 -0
  19. package/assets/esri/core/workers/chunks/0e6e3cf07c84d9f040c0.js +1 -0
  20. package/assets/esri/core/workers/chunks/105728404ddd9e73d5c9.js +1 -0
  21. package/assets/esri/core/workers/chunks/11106873b009b98e4286.js +1 -0
  22. package/assets/esri/core/workers/chunks/11a7b156591d1feca952.js +1 -0
  23. package/assets/esri/core/workers/chunks/{94325f920a125610e1f5.js → 12feeace7215248be23f.js} +1 -1
  24. package/assets/esri/core/workers/chunks/17be5bd0d1c233d73d7a.js +1 -0
  25. package/assets/esri/core/workers/chunks/1b53bd65407ba5c479d7.js +1 -0
  26. package/assets/esri/core/workers/chunks/1d91aa745b49b2ab36cf.js +1 -0
  27. package/assets/esri/core/workers/chunks/{fd35b69872ac9393924f.js → 1db8bfb1731be3ae320c.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{3433361f09c84b31aec4.js → 2290bd6dc2e6bb136e14.js} +1 -1
  29. package/assets/esri/core/workers/chunks/24217129d492e170f0f0.js +1 -0
  30. package/assets/esri/core/workers/chunks/24e194107e0e5090125b.js +1 -0
  31. package/assets/esri/core/workers/chunks/2a1301a1d0cd4c0c17cf.js +1 -0
  32. package/assets/esri/core/workers/chunks/{178831b0d0bdabcc45e7.js → 2a676221ca1fc8e0cf34.js} +1 -1
  33. package/assets/esri/core/workers/chunks/2aede0d1dcac8592436b.js +1 -0
  34. package/assets/esri/core/workers/chunks/2b93ad626f5e75b97692.js +1 -0
  35. package/assets/esri/core/workers/chunks/2d03210fc6b5884c6bf9.js +1 -0
  36. package/assets/esri/core/workers/chunks/{b10c333abe4f4e52841c.js → 2dfd3def105005fc72c7.js} +1 -1
  37. package/assets/esri/core/workers/chunks/2f8ff35b8ab15c0e39c2.js +1 -0
  38. package/assets/esri/core/workers/chunks/36272141b3c33cb19026.js +1 -0
  39. package/assets/esri/core/workers/chunks/36c8e8de9c3f67d32572.js +1 -0
  40. package/assets/esri/core/workers/chunks/3ab8c6ae2f2713f637b0.js +1 -0
  41. package/assets/esri/core/workers/chunks/3c058381adcfdc407aa1.js +1 -0
  42. package/assets/esri/core/workers/chunks/3f39df1dfc0a685e5f9d.js +1 -0
  43. package/assets/esri/core/workers/chunks/3fd52a03b3126556aee6.js +1 -0
  44. package/assets/esri/core/workers/chunks/4082d8573f41f952c72e.js +1 -0
  45. package/assets/esri/core/workers/chunks/40b11eea270f6688ff9c.js +1 -0
  46. package/assets/esri/core/workers/chunks/4281b4b27f4767cdd3ae.js +1 -0
  47. package/assets/esri/core/workers/chunks/43fcaaeb6fd179e9199b.js +1 -0
  48. package/assets/esri/core/workers/chunks/4c65b27d80b23c0c3101.js +1 -0
  49. package/assets/esri/core/workers/chunks/{a6406a248b7b2ed65f35.js → 4ec7d59b0c814dbaa7a4.js} +1 -1
  50. package/assets/esri/core/workers/chunks/4f378ad6f4299183df85.js +1 -0
  51. package/assets/esri/core/workers/chunks/505b0aa5ee3e5a26c351.js +1 -0
  52. package/assets/esri/core/workers/chunks/509a9cdd0228a730bcea.js +1 -0
  53. package/assets/esri/core/workers/chunks/52255ad573cec0a34720.js +1 -0
  54. package/assets/esri/core/workers/chunks/52d4fdc451a58a858af1.js +1 -0
  55. package/assets/esri/core/workers/chunks/5405f478af3563580926.js +1 -0
  56. package/assets/esri/core/workers/chunks/54577c2522ca3ff08f7e.js +1 -0
  57. package/assets/esri/core/workers/chunks/54d67e450da6ce2641b4.js +1 -0
  58. package/assets/esri/core/workers/chunks/56d3cb0ae0069a8eadde.js +1 -0
  59. package/assets/esri/core/workers/chunks/5b4efe0014162f777534.js +1 -0
  60. package/assets/esri/core/workers/chunks/5baa162351551817838b.js +1 -0
  61. package/assets/esri/core/workers/chunks/5cf2064bfd9d0847d9ec.js +1 -0
  62. package/assets/esri/core/workers/chunks/620dc3c13c345d5aa9f6.js +1 -0
  63. package/assets/esri/core/workers/chunks/7c290763920f52a1f504.js +1 -0
  64. package/assets/esri/core/workers/chunks/7dc266be958e34e81007.js +972 -0
  65. package/assets/esri/core/workers/chunks/7dfd70f4fa1096e56641.js +1 -0
  66. package/assets/esri/core/workers/chunks/7f097de06972a68cd08a.js +1 -0
  67. package/assets/esri/core/workers/chunks/8033531b0cc706b40d86.js +1 -0
  68. package/assets/esri/core/workers/chunks/814234844a056d9f1ddc.js +1 -0
  69. package/assets/esri/core/workers/chunks/83700cdd60ceecc639cd.js +1 -0
  70. package/assets/esri/core/workers/chunks/857df84cea67079a91e5.js +1 -0
  71. package/assets/esri/core/workers/chunks/8793070d288878d6f49b.js +1 -0
  72. package/assets/esri/core/workers/chunks/8865c5cc28df60364e60.js +1 -0
  73. package/assets/esri/core/workers/chunks/{e9f786d4ba3143ed9644.js → 8cc85d1d46dda16ad041.js} +1 -1
  74. package/assets/esri/core/workers/chunks/958a7ef2cbf048819988.js +1 -0
  75. package/assets/esri/core/workers/chunks/967af0aa4dc4da032fdc.js +1 -0
  76. package/assets/esri/core/workers/chunks/9722880bd7f455b2bd07.js +1 -0
  77. package/assets/esri/core/workers/chunks/9d738aab0d907cd09a9d.js +1 -0
  78. package/assets/esri/core/workers/chunks/{86b31ae136f931d7884a.js → 9e6df034d7949880471f.js} +1 -1
  79. package/assets/esri/core/workers/chunks/a056a79f31cddb066f15.js +1 -0
  80. package/assets/esri/core/workers/chunks/a2c9fd78d42df7314a3e.js +1 -0
  81. package/assets/esri/core/workers/chunks/a4dcb50f6622cb1444c8.js +1 -0
  82. package/assets/esri/core/workers/chunks/a6bfbe449b8c2fa5334c.js +1 -0
  83. package/assets/esri/core/workers/chunks/a8ed1a938dc164b401d9.js +1 -0
  84. package/assets/esri/core/workers/chunks/a9a73bc4875a5aeaf1b9.js +1 -0
  85. package/assets/esri/core/workers/chunks/ac0df52b2f2a4874e4ea.js +1 -0
  86. package/assets/esri/core/workers/chunks/{431efa172901ab8e4d53.js → acfa8eb19225f7862b1d.js} +1 -1
  87. package/assets/esri/core/workers/chunks/adae54f116f311d72d97.js +1 -0
  88. package/assets/esri/core/workers/chunks/{718073d13d3de67b629b.js → aeeb364b7c1876f6e7db.js} +1 -1
  89. package/assets/esri/core/workers/chunks/afddfe620e6539991e6b.js +1 -0
  90. package/assets/esri/core/workers/chunks/b02a83845d3da4caee9d.js +1 -0
  91. package/assets/esri/core/workers/chunks/{0d21506b7d4f9afdbb09.js → b3847a6bbd45d813f03c.js} +1 -1
  92. package/assets/esri/core/workers/chunks/b4c23630d6c85f7b59c0.js +1 -0
  93. package/assets/esri/core/workers/chunks/{c318b229911b60fc3cbf.js → b50ae3dc7e43ff452568.js} +1 -1
  94. package/assets/esri/core/workers/chunks/b5ede4df4620097c6528.js +1 -0
  95. package/assets/esri/core/workers/chunks/b7d7ad127f8939cbdec2.js +1 -0
  96. package/assets/esri/core/workers/chunks/bf1d1c02d12b526b0750.js +1 -0
  97. package/assets/esri/core/workers/chunks/c0e6dbecdbd30066a82c.js +1 -0
  98. package/assets/esri/core/workers/chunks/c2a36243eb105d570bff.js +1 -0
  99. package/assets/esri/core/workers/chunks/c8a3a28809542396c6fd.js +1 -0
  100. package/assets/esri/core/workers/chunks/cf1047ad176a25dcd2d6.js +1 -0
  101. package/assets/esri/core/workers/chunks/d03de043d43691665a93.js +1 -0
  102. package/assets/esri/core/workers/chunks/d3fecbaca51ef8844026.js +1 -0
  103. package/assets/esri/core/workers/chunks/dafe120243db6648a4ab.js +1 -0
  104. package/assets/esri/core/workers/chunks/dccc33d87cb7d902f5c7.js +1 -0
  105. package/assets/esri/core/workers/chunks/dd43f5647900ee27af22.js +1 -0
  106. package/assets/esri/core/workers/chunks/{52489e2f7748dc610263.js → dfdd853dd6c023089963.js} +1 -1
  107. package/assets/esri/core/workers/chunks/e6f76f62cf58fb1e67c6.js +1 -0
  108. package/assets/esri/core/workers/chunks/ea73a1d9cad5e1a5d861.js +1 -0
  109. package/assets/esri/core/workers/chunks/{4130ea1f5a9f197168d7.js → ed4519ac9533a4d340f1.js} +1 -1
  110. package/assets/esri/core/workers/chunks/f0e462f5a16852f33225.js +1 -0
  111. package/assets/esri/core/workers/chunks/f13c29bcc71aed8f3a2e.js +1 -0
  112. package/assets/esri/core/workers/chunks/f356e505c36397fda3cf.js +1 -0
  113. package/assets/esri/core/workers/chunks/f55cbaf5a1d6ee6ac171.js +1 -0
  114. package/assets/esri/core/workers/chunks/f6e613ae6812a347a26c.js +1 -0
  115. package/assets/esri/core/workers/chunks/fb3279408bd5323ec612.js +1 -0
  116. package/assets/esri/core/workers/chunks/fdf80a371b7b2a45f1ff.js +1 -0
  117. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  118. package/chunks/ChapmanAtmosphere.glsl.js +15 -15
  119. package/chunks/CheckerBoard.glsl.js +3 -3
  120. package/chunks/Clouds.glsl.js +2 -3
  121. package/chunks/CloudsComposition.glsl.js +3 -3
  122. package/chunks/ColorMaterial.glsl.js +11 -11
  123. package/chunks/DefaultMaterial.glsl.js +26 -26
  124. package/chunks/EdgeShader.glsl.js +3 -3
  125. package/chunks/Fog.glsl.js +6 -6
  126. package/chunks/HUDMaterial.glsl.js +48 -48
  127. package/chunks/HeatmapDensity.glsl.js +7 -7
  128. package/chunks/HighlightApply.glsl.js +3 -3
  129. package/chunks/LineCallout.glsl.js +3 -3
  130. package/chunks/LineMarker.glsl.js +22 -22
  131. package/chunks/MeasurementArrow.glsl.js +4 -4
  132. package/chunks/NativeLine.glsl.js +11 -11
  133. package/chunks/Path.glsl.js +16 -16
  134. package/chunks/Pattern.glsl.js +30 -30
  135. package/chunks/RasterColorizer.glsl.js +4 -4
  136. package/chunks/RealisticTree.glsl.js +20 -20
  137. package/chunks/RibbonLine.glsl.js +39 -39
  138. package/chunks/ShadedColorMaterial.glsl.js +10 -10
  139. package/chunks/ShadowCastVisualize.glsl.js +5 -5
  140. package/chunks/ShadowHighlight.glsl.js +2 -2
  141. package/chunks/SlicePlaneMaterial.glsl.js +3 -3
  142. package/chunks/Stars.glsl.js +2 -2
  143. package/chunks/WaterSurface.glsl.js +20 -20
  144. package/chunks/languageUtils.js +1 -1
  145. package/chunks/persistableUrlUtils.js +1 -1
  146. package/chunks/vec22.js +1 -1
  147. package/chunks/vec2f64.js +1 -1
  148. package/chunks/vec3.js +1 -1
  149. package/chunks/vec33.js +1 -1
  150. package/chunks/vec43.js +1 -1
  151. package/colorUtils.js +1 -1
  152. package/config.js +1 -1
  153. package/core/Accessor.js +1 -1
  154. package/core/AsyncUpdate.js +1 -1
  155. package/core/Clonable.js +1 -1
  156. package/core/Collection.js +1 -1
  157. package/core/HandleOwner.js +1 -1
  158. package/core/Loadable.js +1 -1
  159. package/core/NestedMap.js +1 -1
  160. package/core/accessorSupport/DefaultsStore.js +1 -1
  161. package/core/accessorSupport/Properties.js +1 -1
  162. package/core/accessorSupport/decorators/enumeration.js +1 -1
  163. package/core/accessorSupport/extensions/serializableProperty/reader.js +1 -1
  164. package/core/accessorSupport/extensions/serializableProperty/writePolicyUtils.js +1 -1
  165. package/core/accessorSupport/extensions/serializableProperty/writer.js +1 -1
  166. package/core/accessorSupport/read.js +1 -1
  167. package/core/accessorSupport/tracking.js +1 -1
  168. package/core/accessorSupport/write.js +1 -1
  169. package/core/devEnvironmentUtils.js +1 -1
  170. package/core/has.js +1 -1
  171. package/core/libs/gl-matrix-2/factories/vec2f64.js +1 -1
  172. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  173. package/core/libs/rbush/PooledRBush.js +1 -1
  174. package/core/promiseUtils.js +1 -1
  175. package/core/reactiveUtils.js +1 -1
  176. package/core/scheduling.js +1 -1
  177. package/core/throttle.js +1 -1
  178. package/core/urlUtils.js +1 -1
  179. package/core/watchUtils.js +1 -1
  180. package/core/workers/RemoteClient.js +1 -1
  181. package/core/workers/WorkerOwner.js +1 -1
  182. package/core/workers/loaderConfig.js +1 -1
  183. package/core/workers/workerFactory.js +1 -1
  184. package/geometry/Mesh.js +1 -1
  185. package/geometry/geometryEngine.js +1 -1
  186. package/geometry/geometryEngineAsync.js +1 -1
  187. package/geometry/projection.js +1 -1
  188. package/geometry/support/axisAngleDegrees.js +1 -1
  189. package/geometry/support/meshUtils/centerAt.js +1 -1
  190. package/geometry/support/meshUtils/deduplicate.js +1 -1
  191. package/geometry/support/meshUtils/elevation.js +1 -1
  192. package/geometry/support/meshUtils/geographicUtils.js +1 -1
  193. package/geometry/support/meshUtils/georeference.js +1 -1
  194. package/geometry/support/meshUtils/loadExternal.js +1 -1
  195. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  196. package/geometry/support/meshUtils/offset.js +1 -1
  197. package/geometry/support/meshUtils/rotate.js +1 -1
  198. package/geometry/support/meshUtils/scale.js +1 -1
  199. package/geometry/support/normalizeUtils.js +1 -1
  200. package/geometry/support/normalizeUtilsCommon.js +1 -1
  201. package/geometry/support/offset.js +1 -1
  202. package/geometry/support/rotate.js +1 -1
  203. package/identity/IdentityManagerBase.js +1 -1
  204. package/identity/IdentityModal.js +1 -1
  205. package/interfaces.d.ts +109 -2
  206. package/intl/locale.js +1 -1
  207. package/intl/messages.js +1 -1
  208. package/kernel.js +1 -1
  209. package/layers/AnalysisLayer.js +1 -1
  210. package/layers/CSVLayer.js +1 -1
  211. package/layers/FeatureLayer.js +1 -1
  212. package/layers/GeoJSONLayer.js +1 -1
  213. package/layers/GeoRSSLayer.js +1 -1
  214. package/layers/ImageryLayer.js +1 -1
  215. package/layers/ImageryTileLayer.js +1 -1
  216. package/layers/Layer.js +1 -1
  217. package/layers/MapImageLayer.js +1 -1
  218. package/layers/MapNotesLayer.js +1 -1
  219. package/layers/OGCFeatureLayer.js +1 -1
  220. package/layers/RouteLayer.js +1 -1
  221. package/layers/SceneLayer.js +1 -1
  222. package/layers/StreamLayer.js +1 -1
  223. package/layers/SubtypeGroupLayer.js +1 -1
  224. package/layers/TileLayer.js +1 -1
  225. package/layers/VectorTileLayer.js +1 -1
  226. package/layers/VoxelLayer.js +1 -1
  227. package/layers/VoxelWasmPerScene.js +1 -1
  228. package/layers/WCSLayer.js +1 -1
  229. package/layers/WFSLayer.js +1 -1
  230. package/layers/WMSLayer.js +1 -1
  231. package/layers/WMTSLayer.js +1 -1
  232. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  233. package/layers/effects/EffectView.js +1 -1
  234. package/layers/effects/FeatureEffectView.js +1 -1
  235. package/layers/effects/jsonUtils.js +1 -1
  236. package/layers/graphics/OptimizedGeometry.js +1 -1
  237. package/layers/graphics/centroid.js +1 -1
  238. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  239. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  240. package/layers/graphics/data/QueryEngineResult.js +1 -1
  241. package/layers/graphics/data/StreamFeatureManager.js +1 -1
  242. package/layers/graphics/editingSupport.js +1 -1
  243. package/layers/graphics/objectIdUtils.js +1 -1
  244. package/layers/graphics/sources/CSVSource.js +1 -1
  245. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  246. package/layers/graphics/sources/GeoJSONSource.js +1 -1
  247. package/layers/graphics/sources/MemorySource.js +1 -1
  248. package/layers/graphics/sources/OGCFeatureSource.js +1 -1
  249. package/layers/graphics/sources/WFSSource.js +1 -1
  250. package/layers/graphics/sources/WFSSourceWorker.js +1 -1
  251. package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
  252. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  253. package/layers/graphics/sources/geojson/geojson.js +1 -1
  254. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  255. package/layers/graphics/sources/support/QueryTask.js +1 -1
  256. package/layers/mixins/APIKeyMixin.js +1 -1
  257. package/layers/mixins/ArcGISImageService.js +1 -1
  258. package/layers/mixins/ArcGISMapService.js +1 -1
  259. package/layers/mixins/ImageryTileMixin.js +1 -1
  260. package/layers/mixins/OperationalLayer.js +1 -1
  261. package/layers/mixins/PortalLayer.js +1 -1
  262. package/layers/mixins/SceneService.js +1 -1
  263. package/layers/mixins/refresh.js +1 -1
  264. package/layers/ogc/dateUtils.js +1 -1
  265. package/layers/ogc/ogcFeatureUtils.js +1 -1
  266. package/layers/ogc/wfsUtils.js +1 -1
  267. package/layers/save/featureLayerUtils.js +1 -1
  268. package/layers/support/ExportImageParameters.js +1 -1
  269. package/layers/support/ExportImageServiceParameters.js +1 -1
  270. package/layers/support/ExportWMSImageParameters.js +1 -1
  271. package/layers/support/FeatureEffect.js +1 -1
  272. package/layers/support/FeatureType.js +1 -1
  273. package/layers/support/FetchAssociatedFeatureLayer.js +1 -1
  274. package/layers/support/LabelClass.js +1 -1
  275. package/layers/support/LayerContingentValuesCache.js +1 -1
  276. package/layers/support/RasterFunction.js +1 -1
  277. package/layers/support/RasterInfo.js +1 -1
  278. package/layers/support/RasterJobHandler.js +1 -1
  279. package/layers/support/RasterWorker.js +1 -1
  280. package/layers/support/Sublayer.js +1 -1
  281. package/layers/support/SubtypeSublayer.js +1 -1
  282. package/layers/support/TilemapCache.js +1 -1
  283. package/layers/support/TimeReference.d.ts +4 -0
  284. package/layers/support/WMTSSublayer.js +1 -1
  285. package/layers/support/arcgisLayers.js +1 -1
  286. package/layers/support/commonProperties.js +1 -1
  287. package/layers/support/editableLayers.js +1 -1
  288. package/layers/support/fieldUtils.js +1 -1
  289. package/layers/support/floorFilterUtils.js +1 -1
  290. package/layers/support/imageryRendererUtils.js +1 -1
  291. package/layers/support/layerUtils.js +1 -1
  292. package/layers/support/layersCreator.js +1 -1
  293. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  294. package/layers/support/rasterDatasets/CloudRaster.js +1 -1
  295. package/layers/support/rasterDatasets/ImageAuxRaster.js +1 -1
  296. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  297. package/layers/support/rasterDatasets/InMemoryRaster.js +1 -1
  298. package/layers/support/rasterDatasets/MRFRaster.js +1 -1
  299. package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
  300. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  301. package/layers/support/rasterDatasets/multipartParser.js +1 -1
  302. package/layers/support/rasterDatasets/pamParser.js +1 -1
  303. package/layers/support/rasterDatasets/wcsCapabilitiesParser.js +1 -1
  304. package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
  305. package/layers/support/rasterDatasets/xmlUtilities.js +1 -1
  306. package/layers/support/rasterFormats/Lerc.js +1 -1
  307. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  308. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  309. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  310. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  311. package/layers/support/rasterFunctions/stretchUtils.js +1 -1
  312. package/layers/support/rasterFunctions/vectorFieldUtils.js +1 -1
  313. package/layers/support/rasterTransforms/PolynomialTransform.js +1 -1
  314. package/layers/support/rasterTransforms/utils.js +1 -1
  315. package/layers/support/source/DataLayerSource.js +1 -1
  316. package/layers/support/source/QueryTableDataSource.js +1 -1
  317. package/layers/support/vectorTileLayerLoader.js +1 -1
  318. package/layers/support/wmsUtils.js +1 -1
  319. package/layers/support/wmtsUtils.js +1 -1
  320. package/libs/maquette-advanced-projector/projector.js +1 -1
  321. package/networks/Network.js +1 -1
  322. package/networks/UtilityNetwork.js +1 -1
  323. package/networks/support/utils.js +1 -1
  324. package/package.json +1 -1
  325. package/popup/content/ExpressionContent.js +1 -1
  326. package/portal/Portal.js +1 -1
  327. package/portal/PortalItem.js +1 -1
  328. package/portal/support/geometryServiceUtils.js +1 -1
  329. package/portal/support/layersLoader.js +1 -1
  330. package/portal/support/portalItemUtils.js +1 -1
  331. package/portal/support/portalLayers.js +1 -1
  332. package/renderers/DictionaryRenderer.js +1 -1
  333. package/renderers/FlowRenderer.js +1 -1
  334. package/renderers/RasterColormapRenderer.js +1 -1
  335. package/renderers/RasterStretchRenderer.js +1 -1
  336. package/renderers/VectorFieldRenderer.js +1 -1
  337. package/renderers/support/RasterSymbolizer.js +1 -1
  338. package/renderers/support/UniqueValueInfo.js +1 -1
  339. package/renderers/support/colorRampUtils.js +1 -1
  340. package/renderers/support/heatmapUtils.js +1 -1
  341. package/renderers/support/rasterRendererHelper.js +1 -1
  342. package/request.js +1 -1
  343. package/rest/identify.js +1 -1
  344. package/rest/imageService.js +1 -1
  345. package/rest/networkService.js +1 -1
  346. package/rest/networks/support/SynthesizeAssociationGeometriesParameters.js +1 -1
  347. package/rest/operations/identify.js +1 -1
  348. package/rest/print.js +1 -1
  349. package/rest/query/executeQuery.js +1 -1
  350. package/rest/query/operations/query.js +1 -1
  351. package/rest/query/operations/queryRelatedRecords.js +1 -1
  352. package/rest/query/operations/queryTopFeatures.js +1 -1
  353. package/rest/route.js +1 -1
  354. package/rest/support/DirectionLine.js +1 -1
  355. package/rest/support/DirectionPoint.js +1 -1
  356. package/rest/support/DirectionsFeatureSet.js +1 -1
  357. package/rest/support/FeatureSet.js +1 -1
  358. package/rest/support/ImageSampleParameters.js +1 -1
  359. package/rest/support/PointBarrier.js +1 -1
  360. package/rest/support/PolygonBarrier.js +1 -1
  361. package/rest/support/PolylineBarrier.js +1 -1
  362. package/rest/support/RouteInfo.js +1 -1
  363. package/rest/support/Stop.js +1 -1
  364. package/rest/support/meshFeatureSet.js +1 -1
  365. package/rest/support/printTaskUtils.js +1 -1
  366. package/smartMapping/labels/clusters.js +1 -1
  367. package/smartMapping/raster/renderers/rgb.js +1 -1
  368. package/smartMapping/raster/renderers/uniqueValue.js +1 -1
  369. package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
  370. package/smartMapping/raster/support/adapters/RasterLayerAdapter.js +1 -1
  371. package/smartMapping/raster/support/utils.js +1 -1
  372. package/smartMapping/renderers/color.js +1 -1
  373. package/smartMapping/renderers/size.js +1 -1
  374. package/smartMapping/renderers/support/utils.js +1 -1
  375. package/smartMapping/renderers/univariateColorSize.js +1 -1
  376. package/smartMapping/statistics/support/WorkerClient.js +1 -1
  377. package/smartMapping/support/adapters/CSVLayerAdapter.js +1 -1
  378. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  379. package/smartMapping/support/adapters/OGCFeatureLayerAdapter.js +1 -1
  380. package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
  381. package/smartMapping/support/adapters/support/utils.js +1 -1
  382. package/statistics/utils.js +1 -1
  383. package/support/LayersMixin.js +1 -1
  384. package/support/TablesMixin.js +1 -1
  385. package/support/arcadeUtils.js +1 -1
  386. package/support/basemapUtils.js +1 -1
  387. package/support/popupUtils.js +1 -1
  388. package/support/revision.js +1 -1
  389. package/support/timeUtils.js +1 -1
  390. package/symbols/FillSymbol3DLayer.js +1 -1
  391. package/symbols/LineSymbol3DLayer.js +1 -1
  392. package/symbols/LineSymbolMarker.js +1 -1
  393. package/symbols/PictureFillSymbol.js +1 -1
  394. package/symbols/PointSymbol3D.js +1 -1
  395. package/symbols/SimpleLineSymbol.js +1 -1
  396. package/symbols/SimpleMarkerSymbol.js +1 -1
  397. package/symbols/cim/CIMResourceManager.js +1 -1
  398. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  399. package/symbols/cim/CIMSymbolHelper.js +1 -1
  400. package/symbols/cim/ExpandedCIM.js +1 -1
  401. package/symbols/cim/SDFHelper.js +1 -1
  402. package/symbols/cim/cimAnalyzer.js +1 -1
  403. package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
  404. package/symbols/cim/effects/EffectDashes.js +1 -1
  405. package/symbols/cim/effects/EffectOffset.js +1 -1
  406. package/symbols/cim/placements/PlacementAlongLineSameSize.js +1 -1
  407. package/symbols/cim/utils.js +1 -1
  408. package/symbols/support/cimSymbolUtils.js +1 -1
  409. package/symbols/support/jsonUtils.js +1 -1
  410. package/symbols/support/previewCIMSymbol.js +1 -1
  411. package/symbols/support/previewSymbol2D.js +1 -1
  412. package/symbols/support/previewSymbol3D.js +1 -1
  413. package/symbols/support/previewWebStyleSymbol.js +1 -1
  414. package/symbols/support/svgUtils.js +1 -1
  415. package/symbols/support/symbolConversion.js +1 -1
  416. package/symbols/support/symbolUtils.js +1 -1
  417. package/tasks/GenerateRendererTask.js +1 -1
  418. package/views/2d/MapViewConstraints.js +1 -1
  419. package/views/2d/constraints/GeometryConstraint.js +1 -1
  420. package/views/2d/engine/Bitmap.js +1 -1
  421. package/views/2d/engine/Container.js +1 -1
  422. package/views/2d/engine/DisplayObject.js +1 -1
  423. package/views/2d/engine/Stage.js +1 -1
  424. package/views/2d/engine/imagery/BrushRasterBitmap.js +1 -1
  425. package/views/2d/engine/imagery/RasterBitmap.js +1 -1
  426. package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
  427. package/views/2d/engine/vectorTiles/TilemapRequest.js +1 -1
  428. package/views/2d/engine/vectorTiles/WorkerTileHandler.js +1 -1
  429. package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
  430. package/views/2d/engine/vectorTiles/buckets/LineBucket.js +1 -1
  431. package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
  432. package/views/2d/engine/vectorTiles/shaders/VTLMaterial.js +1 -1
  433. package/views/2d/engine/vectorTiles/style/StyleLayer.js +1 -1
  434. package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
  435. package/views/2d/engine/vectorTiles/style/VectorTileSource.js +1 -1
  436. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  437. package/views/2d/engine/webgl/GraphicTile.js +1 -1
  438. package/views/2d/engine/webgl/TextureManager.js +1 -1
  439. package/views/2d/engine/webgl/brushes/WGLBrushHeatmap.js +1 -1
  440. package/views/2d/engine/webgl/brushes/WGLBrushVTLCircle.js +1 -1
  441. package/views/2d/engine/webgl/brushes/WGLBrushVTLFill.js +1 -1
  442. package/views/2d/engine/webgl/brushes/WGLBrushVTLLine.js +1 -1
  443. package/views/2d/engine/webgl/collisions/CollisionEngine.js +1 -1
  444. package/views/2d/engine/webgl/collisions/MetricReader.js +1 -1
  445. package/views/2d/engine/webgl/cpuMapped/DisplayRecordReader.js +1 -1
  446. package/views/2d/engine/webgl/cpuMapped/FreeList.js +1 -1
  447. package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
  448. package/views/2d/engine/webgl/mesh/templates/WGLBaseLineTemplate.js +1 -1
  449. package/views/2d/engine/webgl/mesh/templates/WGLBaseMarkerTemplate.js +1 -1
  450. package/views/2d/engine/webgl/mesh/templates/WGLBaseTextTemplate.js +1 -1
  451. package/views/2d/engine/webgl/mesh/templates/WGLDynamicFillTemplate.js +1 -1
  452. package/views/2d/engine/webgl/mesh/templates/WGLLabelTemplate.js +1 -1
  453. package/views/2d/engine/webgl/mesh/templates/WGLLineTemplate.js +1 -1
  454. package/views/2d/engine/webgl/mesh/templates/WGLMeshTemplate.js +1 -1
  455. package/views/2d/engine/webgl/painter/RenderPass.js +1 -1
  456. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  457. package/views/2d/engine/webgl/techniques/dotDensity/TechniqueDotDensity.js +1 -1
  458. package/views/2d/input/MapViewInputManager.js +1 -1
  459. package/views/2d/input/handlers/GamepadNavigation.js +1 -1
  460. package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
  461. package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
  462. package/views/2d/layers/BaseLayerView2D.js +1 -1
  463. package/views/2d/layers/BaseLayerViewGL2D.js +1 -1
  464. package/views/2d/layers/BitmapTileLayerView2D.js +1 -1
  465. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  466. package/views/2d/layers/GeoRSSLayerView2D.js +1 -1
  467. package/views/2d/layers/GraphicsLayerView2D.js +1 -1
  468. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  469. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  470. package/views/2d/layers/KMLLayerView2D.js +1 -1
  471. package/views/2d/layers/LayerView2D.js +1 -1
  472. package/views/2d/layers/SubtypeGroupLayerView2D.js +1 -1
  473. package/views/2d/layers/TileLayerView2D.js +1 -1
  474. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  475. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  476. package/views/2d/layers/features/FeatureStore2D.js +1 -1
  477. package/views/2d/layers/features/Pipeline.js +1 -1
  478. package/views/2d/layers/features/batchUtils.js +1 -1
  479. package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
  480. package/views/2d/layers/features/controllers/support/sourceAdapters.js +1 -1
  481. package/views/2d/layers/features/createSymbolSchema.js +1 -1
  482. package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
  483. package/views/2d/layers/features/schemaUtils.js +1 -1
  484. package/views/2d/layers/features/sources/BaseFeatureSource.js +1 -1
  485. package/views/2d/layers/features/sources/DataTileSource.js +1 -1
  486. package/views/2d/layers/features/sources/DataTileSubscription.js +1 -1
  487. package/views/2d/layers/features/sources/SnapshotFeatureSource.js +1 -1
  488. package/views/2d/layers/features/support/ClusterStore.js +1 -1
  489. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  490. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  491. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  492. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  493. package/views/2d/layers/features/support/ResourceManagerProxy.js +1 -1
  494. package/views/2d/layers/features/tileRenderers/SymbolTileRenderer.js +1 -1
  495. package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
  496. package/views/2d/layers/graphics/graphicsUtils.js +1 -1
  497. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  498. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  499. package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
  500. package/views/2d/layers/support/ExportStrategy.js +1 -1
  501. package/views/2d/layers/support/FeatureCommandQueue.js +1 -1
  502. package/views/2d/magnifier/MagnifierView2D.js +1 -1
  503. package/views/2d/support/engineHelpers.js +1 -1
  504. package/views/2d/tiling/TileManager.js +1 -1
  505. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
  506. package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
  507. package/views/3d/analysis/Dimensioning/DimensioningVisualization.js +5 -0
  508. package/views/3d/analysis/Dimensioning/LinearDimensionVisualization.js +5 -0
  509. package/views/3d/analysis/DimensioningAnalysisView3D.js +1 -1
  510. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  511. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
  512. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  513. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  514. package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
  515. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  516. package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
  517. package/views/3d/environment/ChapmanAtmosphere.glsl.js +1 -1
  518. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  519. package/views/3d/environment/Clouds.glsl.js +1 -1
  520. package/views/3d/environment/CloudsComposition.glsl.js +1 -1
  521. package/views/3d/environment/CloudsComposition.js +1 -1
  522. package/views/3d/environment/CloudsCompositionParameters.js +5 -0
  523. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  524. package/views/3d/environment/Fog.glsl.js +1 -1
  525. package/views/3d/environment/Fog.js +1 -1
  526. package/views/3d/environment/Precipitation.js +1 -1
  527. package/views/3d/environment/SceneViewEnvironment.js +1 -1
  528. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  529. package/views/3d/environment/SimpleAtmosphere.js +1 -1
  530. package/views/3d/environment/Stars.glsl.js +1 -1
  531. package/views/3d/environment/Stars.js +1 -1
  532. package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
  533. package/views/3d/glTF/internal/Resource.js +1 -1
  534. package/views/3d/glTF/loader.js +1 -1
  535. package/views/3d/input/SceneInputManager.js +1 -1
  536. package/views/3d/input/handlers/TwoFingerTilt.js +1 -1
  537. package/views/3d/interactive/Manipulator3D.js +1 -1
  538. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  539. package/views/3d/interactive/editingTools/manipulations/MoveManipulation.js +1 -1
  540. package/views/3d/interactive/editingTools/moveGraphic/isSupportedGraphic.js +1 -1
  541. package/views/3d/interactive/editingTools/reshapeGraphic/GraphicReshapeTool.js +1 -1
  542. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  543. package/views/3d/interactive/editingTools/reshapeGraphic/isSupportedGraphic.js +1 -1
  544. package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
  545. package/views/3d/interactive/editingTools/transformGraphic/isSupportedGraphic.js +1 -1
  546. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  547. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  548. package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
  549. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  550. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  551. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  552. package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
  553. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  554. package/views/3d/layers/ElevationLayerView3D.js +1 -1
  555. package/views/3d/layers/FeatureLayerView3D.js +1 -1
  556. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  557. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  558. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  559. package/views/3d/layers/GraphicsView3D.js +1 -1
  560. package/views/3d/layers/I3SMeshView3D.js +1 -1
  561. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  562. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  563. package/views/3d/layers/LayerView3D.js +1 -1
  564. package/views/3d/layers/RouteLayerView3D.js +1 -1
  565. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  566. package/views/3d/layers/SceneLayerView3D.js +1 -1
  567. package/views/3d/layers/SceneLayerWorker.js +1 -1
  568. package/views/3d/layers/StreamLayerView3D.js +1 -1
  569. package/views/3d/layers/TiledLayerView3D.js +1 -1
  570. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  571. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  572. package/views/3d/layers/WMSLayerView3D.js +1 -1
  573. package/views/3d/layers/WMTSLayerView3D.js +1 -1
  574. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  575. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  576. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  577. package/views/3d/layers/graphics/Graphics3DFilterVisibility.js +1 -1
  578. package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
  579. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  580. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  581. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  582. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  583. package/views/3d/layers/graphics/Graphics3DPointSymbol.js +1 -1
  584. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  585. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  586. package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
  587. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  588. package/views/3d/layers/graphics/Labeler.js +1 -1
  589. package/views/3d/layers/i3s/I3SAttributeOverrides.js +1 -1
  590. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  591. package/views/3d/layers/i3s/I3SStreamDataController.js +1 -1
  592. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  593. package/views/3d/layers/support/FeatureTileTree3D.js +1 -1
  594. package/views/3d/layers/support/FeatureTileTree3DDebugger.js +1 -1
  595. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  596. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  597. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  598. package/views/3d/state/ConstraintsManager.js +1 -1
  599. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  600. package/views/3d/support/ResourceController.js +1 -1
  601. package/views/3d/support/SharedSymbolResources.js +1 -1
  602. package/views/3d/support/TextureCollection.js +1 -1
  603. package/views/3d/support/cameraUtils.js +1 -1
  604. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  605. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  606. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  607. package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
  608. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  609. package/views/3d/terrain/OverlayManager.js +1 -1
  610. package/views/3d/terrain/OverlayRenderer.js +1 -1
  611. package/views/3d/terrain/PatchGeometry.js +1 -1
  612. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  613. package/views/3d/terrain/PatchRenderData.js +1 -1
  614. package/views/3d/terrain/PlanarPatch.js +1 -1
  615. package/views/3d/terrain/RasterColorizerTechnique.js +1 -1
  616. package/views/3d/terrain/RasterTile.js +1 -1
  617. package/views/3d/terrain/SphericalPatch.js +1 -1
  618. package/views/3d/terrain/TerrainRenderer.js +1 -1
  619. package/views/3d/terrain/TerrainSurface.js +1 -1
  620. package/views/3d/terrain/Tile.js +1 -1
  621. package/views/3d/terrain/TileCompositor.js +1 -1
  622. package/views/3d/terrain/TileRenderer.js +1 -1
  623. package/views/3d/terrain/TilingSchemeLogic.js +1 -1
  624. package/views/3d/terrain/terrainUtils.js +1 -1
  625. package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
  626. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  627. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  628. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +2 -2
  629. package/views/3d/webgl-engine/core/material/MaterialBase.js +1 -1
  630. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSizeScaling.glsl.js +1 -1
  631. package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +5 -5
  632. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +8 -8
  633. package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +6 -6
  634. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +4 -4
  635. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +2 -2
  636. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js +5 -5
  637. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +13 -13
  638. package/views/3d/webgl-engine/core/shaderLibrary/raster/BasicGrid.glsl.js +2 -2
  639. package/views/3d/webgl-engine/core/shaderLibrary/raster/Colormap.glsl.js +1 -1
  640. package/views/3d/webgl-engine/core/shaderLibrary/raster/Common.glsl.js +2 -2
  641. package/views/3d/webgl-engine/core/shaderLibrary/raster/Projection.glsl.js +1 -1
  642. package/views/3d/webgl-engine/core/shaderLibrary/raster/RasterColorizer.glsl.js +1 -1
  643. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeMaterialColor.glsl.js +1 -1
  644. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js +5 -5
  645. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js +3 -3
  646. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +13 -13
  647. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +17 -17
  648. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +1 -1
  649. package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +7 -7
  650. package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterDistortion.glsl.js +2 -2
  651. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +5 -5
  652. package/views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js +2 -2
  653. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +15 -15
  654. package/views/3d/webgl-engine/core/shaderLibrary/util/ScreenSizePerspective.glsl.js +2 -2
  655. package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
  656. package/views/3d/webgl-engine/core/shaderModules/BooleanPassUniform.js +5 -0
  657. package/views/3d/webgl-engine/core/shaderModules/Float4DrawUniform.js +5 -0
  658. package/views/3d/webgl-engine/core/shaderModules/{Matrix3Uniform.js → Float4PassUniform.js} +1 -1
  659. package/views/3d/webgl-engine/core/shaderModules/Float4Uniform.js +1 -1
  660. package/views/3d/webgl-engine/core/shaderModules/Matrix3DrawUniform.js +5 -0
  661. package/views/3d/webgl-engine/core/shaderModules/Matrix3PassUniform.js +5 -0
  662. package/views/3d/webgl-engine/core/shaderModules/{TextureCubeUniform.js → TextureCubePassUniform.js} +1 -1
  663. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js +1 -1
  664. package/views/3d/webgl-engine/lib/AutoDisposable.js +1 -1
  665. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  666. package/views/3d/webgl-engine/lib/GLTextureMaterial.js +1 -1
  667. package/views/3d/webgl-engine/lib/RenderPluginManager.js +1 -1
  668. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  669. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  670. package/views/3d/webgl-engine/lib/ShadowHighlight.js +1 -1
  671. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  672. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  673. package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
  674. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  675. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  676. package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
  677. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  678. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  679. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  680. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  681. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  682. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  683. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  684. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  685. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  686. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  687. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  688. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  689. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  690. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  691. package/views/3d/webgl-engine/materials/{VisualVariableMaterialParameters.js → VisualVariablePassParameters.js} +1 -1
  692. package/views/3d/webgl-engine/materials/WaterGLMaterial.js +1 -1
  693. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  694. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  695. package/views/3d/webgl-engine/parts/requireUtils.js +1 -1
  696. package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
  697. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  698. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  699. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  700. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  701. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  702. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  703. package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +1 -1
  704. package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +1 -1
  705. package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +1 -1
  706. package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
  707. package/views/3d/webgl-engine/shaders/LineCallout.glsl.js +1 -1
  708. package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
  709. package/views/3d/webgl-engine/shaders/Magnifier.glsl.js +3 -3
  710. package/views/3d/webgl-engine/shaders/MeasurementArrow.glsl.js +1 -1
  711. package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +1 -1
  712. package/views/3d/webgl-engine/shaders/Path.glsl.js +1 -1
  713. package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
  714. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  715. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  716. package/views/3d/webgl-engine/shaders/ShadedColorMaterial.glsl.js +1 -1
  717. package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +1 -1
  718. package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
  719. package/views/3d/webgl-engine/shaders/SlicePlaneMaterial.glsl.js +1 -1
  720. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  721. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +3 -3
  722. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeShader.glsl.js +1 -1
  723. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +5 -5
  724. package/views/BasemapView.js +1 -1
  725. package/views/GroundView.js +1 -1
  726. package/views/LayerViewManager.js +1 -1
  727. package/views/MapView.js +1 -1
  728. package/views/SceneView.js +1 -1
  729. package/views/ToolViewManager.js +1 -1
  730. package/views/View.js +1 -1
  731. package/views/draw/DrawAction.js +1 -1
  732. package/views/draw/DrawGraphicTool.js +1 -1
  733. package/views/draw/DrawOperation.js +1 -1
  734. package/views/draw/DrawTool.js +1 -1
  735. package/views/draw/support/Box.js +1 -1
  736. package/views/draw/support/GraphicMover.js +1 -1
  737. package/views/draw/support/Reshape.js +1 -1
  738. package/views/interactive/coordinateHelper.js +1 -1
  739. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  740. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  741. package/views/interactive/snapping/SnappingManager.js +1 -1
  742. package/views/interactive/snapping/featureSources/WorkerTileTreeDebugger.js +1 -1
  743. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
  744. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
  745. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  746. package/views/layers/FeatureLayerView.js +1 -1
  747. package/views/layers/GroupLayerView.js +1 -1
  748. package/views/layers/ImageryLayerView.js +1 -1
  749. package/views/layers/ImageryTileLayerView.js +1 -1
  750. package/views/layers/LayerView.js +1 -1
  751. package/views/layers/MapImageLayerView.js +1 -1
  752. package/views/layers/WMSLayerView.js +1 -1
  753. package/views/support/AllocationTracer.js +1 -1
  754. package/views/support/DefaultsFromMap.js +1 -1
  755. package/views/support/geometry2dUtils.js +1 -1
  756. package/views/support/layerViewUtils.js +1 -1
  757. package/views/support/waitForResources.js +1 -1
  758. package/views/ui/UI.js +1 -1
  759. package/views/webgl/BufferObject.js +1 -1
  760. package/views/webgl/FramebufferObject.js +1 -1
  761. package/views/webgl/RenderingContext.js +1 -1
  762. package/views/webgl/Texture.js +1 -1
  763. package/views/webgl/UniformBufferLayout.js +1 -1
  764. package/views/webgl/VertexArrayObject.js +1 -1
  765. package/views/webgl/capabilities.js +1 -1
  766. package/views/webgl/rasterUtils.js +1 -1
  767. package/views/webgl/testFloatBufferBlend.js +1 -1
  768. package/webdoc/widgets/TimeSlider.js +1 -1
  769. package/webmap/Bookmark.js +1 -1
  770. package/webscene/Slide.js +1 -1
  771. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  772. package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.js +1 -1
  773. package/widgets/AreaMeasurement2D.js +1 -1
  774. package/widgets/AreaMeasurement3D.js +1 -1
  775. package/widgets/Attribution.js +1 -1
  776. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  777. package/widgets/BasemapGallery/support/BasemapGalleryItem.js +1 -1
  778. package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
  779. package/widgets/BasemapLayerList.js +1 -1
  780. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  781. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  782. package/widgets/Bookmarks.js +1 -1
  783. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
  784. package/widgets/BuildingExplorer/BuildingExplorerViewModel.js +1 -1
  785. package/widgets/BuildingExplorer/BuildingLevel.js +1 -1
  786. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  787. package/widgets/BuildingExplorer/BuildingNumericFilterViewModel.js +1 -1
  788. package/widgets/BuildingExplorer/BuildingPhase.js +1 -1
  789. package/widgets/BuildingExplorer/support/buildingLayerUtils.js +1 -1
  790. package/widgets/BuildingExplorer.js +1 -1
  791. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  792. package/widgets/CoordinateConversion/support/Format.js +1 -1
  793. package/widgets/Daylight/DaylightViewModel.js +1 -1
  794. package/widgets/Daylight/support/SliderWithDropdown.js +1 -1
  795. package/widgets/Daylight.js +1 -1
  796. package/widgets/DirectLineMeasurement3D.js +1 -1
  797. package/widgets/Directions/DirectionsViewModel.js +1 -1
  798. package/widgets/Directions.js +1 -1
  799. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
  800. package/widgets/DistanceMeasurement2D.js +1 -1
  801. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  802. package/widgets/Editor/CreateWorkflow.js +1 -1
  803. package/widgets/Editor/EditorViewModel.js +1 -1
  804. package/widgets/Editor/UpdateWorkflow.js +1 -1
  805. package/widgets/Editor/workflowUtils.js +1 -1
  806. package/widgets/Editor.js +1 -1
  807. package/widgets/ElevationProfile/ElevationProfileLineGround.js +1 -1
  808. package/widgets/ElevationProfile/ElevationProfileLineInput.js +1 -1
  809. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  810. package/widgets/ElevationProfile/ElevationProfileTool.js +1 -1
  811. package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
  812. package/widgets/ElevationProfile/components/Statistics.js +1 -1
  813. package/widgets/ElevationProfile/support/elevationQuerySourceUtils.js +1 -1
  814. package/widgets/ElevationProfile/support/profileUtils.js +1 -1
  815. package/widgets/ElevationProfile.js +1 -1
  816. package/widgets/Expand.js +1 -1
  817. package/widgets/Feature/FeatureAttachments.js +1 -1
  818. package/widgets/Feature/FeatureContent.js +1 -1
  819. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  820. package/widgets/Feature/FeatureExpression.js +1 -1
  821. package/widgets/Feature/FeatureFields/FeatureFieldsViewModel.js +1 -1
  822. package/widgets/Feature/FeatureFields.js +1 -1
  823. package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
  824. package/widgets/Feature/FeatureMedia.js +1 -1
  825. package/widgets/Feature/FeatureViewModel.js +1 -1
  826. package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
  827. package/widgets/Feature/support/featureUtils.js +1 -1
  828. package/widgets/Feature/support/relatedFeatureUtils.js +1 -1
  829. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  830. package/widgets/FeatureForm/InputField.js +1 -1
  831. package/widgets/FeatureForm/support/formTemplateUtils.js +1 -1
  832. package/widgets/FeatureForm.js +1 -1
  833. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  834. package/widgets/FeatureTable/FieldColumn.js +1 -1
  835. package/widgets/FeatureTable/Grid/Column.js +1 -1
  836. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  837. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  838. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  839. package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
  840. package/widgets/FeatureTable/Grid/support/LocalStore.js +1 -1
  841. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  842. package/widgets/FeatureTable.js +1 -1
  843. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  844. package/widgets/FeatureTemplates/ItemList.js +1 -1
  845. package/widgets/FeatureTemplates/TemplateItem.js +1 -1
  846. package/widgets/FeatureTemplates.js +1 -1
  847. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  848. package/widgets/FloorFilter.js +1 -1
  849. package/widgets/Fullscreen.js +1 -1
  850. package/widgets/Home.js +1 -1
  851. package/widgets/LayerList/LayerListViewModel.js +1 -1
  852. package/widgets/LayerList/support/layerListUtils.js +1 -1
  853. package/widgets/LayerList.js +1 -1
  854. package/widgets/Legend/LegendViewModel.js +1 -1
  855. package/widgets/Legend/styles/Card.js +1 -1
  856. package/widgets/Legend/styles/support/univariateUtils.js +1 -1
  857. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  858. package/widgets/Legend/support/clusterUtils.js +1 -1
  859. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  860. package/widgets/Locate/LocateViewModel.js +1 -1
  861. package/widgets/Popup/PopupViewModel.js +1 -1
  862. package/widgets/Popup/actionUtils.js +1 -1
  863. package/widgets/Popup.js +1 -1
  864. package/widgets/Print/PrintViewModel.js +1 -1
  865. package/widgets/Print.js +1 -1
  866. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  867. package/widgets/Search/LayerSearchSource.js +1 -1
  868. package/widgets/Search/SearchResultRenderer.js +1 -1
  869. package/widgets/Search/SearchViewModel.js +1 -1
  870. package/widgets/Search/support/geometryUtils.js +1 -1
  871. package/widgets/Search/support/layerSearchUtils.js +1 -1
  872. package/widgets/Search/support/locatorUtils.js +1 -1
  873. package/widgets/Search.js +1 -1
  874. package/widgets/ShadowCast/components/DiscreteConfigurator.js +1 -1
  875. package/widgets/ShadowCast/components/Label.js +1 -1
  876. package/widgets/ShadowCast/components/TimezonePicker.js +1 -1
  877. package/widgets/ShadowCast.js +1 -1
  878. package/widgets/Sketch/SketchViewModel.js +1 -1
  879. package/widgets/Sketch.js +1 -1
  880. package/widgets/Slider.js +1 -1
  881. package/widgets/Swipe/SwipeViewModel.js +1 -1
  882. package/widgets/TableList/TableListViewModel.js +1 -1
  883. package/widgets/TableList/support/tableListUtils.js +1 -1
  884. package/widgets/TableList.js +1 -1
  885. package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
  886. package/widgets/TimeSlider/utils.js +1 -1
  887. package/widgets/TimeSlider.js +1 -1
  888. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  889. package/widgets/Weather.js +1 -1
  890. package/widgets/Widget.js +1 -1
  891. package/widgets/smartMapping/BinaryColorSizeSlider/BinaryColorSizeSliderViewModel.js +1 -1
  892. package/widgets/smartMapping/BinaryColorSizeSlider.js +1 -1
  893. package/widgets/smartMapping/ClassedColorSlider.js +1 -1
  894. package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
  895. package/widgets/smartMapping/ColorSizeSlider.js +1 -1
  896. package/widgets/smartMapping/SizeSlider/SizeSliderViewModel.js +1 -1
  897. package/widgets/smartMapping/SmartMappingSliderBase.js +1 -1
  898. package/widgets/smartMapping/SmartMappingSliderViewModel.js +1 -1
  899. package/widgets/support/AnalysisViewModel.js +1 -1
  900. package/widgets/support/ColorPicker.js +1 -1
  901. package/widgets/support/DatePicker.js +1 -1
  902. package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
  903. package/widgets/support/Popover.js +1 -1
  904. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  905. package/widgets/support/SelectionToolbar.js +1 -1
  906. package/widgets/support/Selector2D/SelectionOperation2D.js +1 -1
  907. package/widgets/support/Selector2D.js +1 -1
  908. package/widgets/support/SnappingControls/SnappingControlsViewModel.js +1 -1
  909. package/widgets/support/SnappingControls.js +1 -1
  910. package/widgets/support/jsxWidgetSupport.js +1 -1
  911. package/widgets/support/widgetUtils.js +1 -1
  912. package/assets/esri/core/workers/chunks/049c5c30bd37693dddb7.js +0 -1
  913. package/assets/esri/core/workers/chunks/055a0ebf22a82f859474.js +0 -1
  914. package/assets/esri/core/workers/chunks/0b12ff7b2ed2838afbb8.js +0 -1
  915. package/assets/esri/core/workers/chunks/0e25548573baf855e394.js +0 -1
  916. package/assets/esri/core/workers/chunks/0edd4c3ca6e7d749d0e5.js +0 -1
  917. package/assets/esri/core/workers/chunks/0fcbf7e2db58e38ee6d1.js +0 -1
  918. package/assets/esri/core/workers/chunks/133f971e72a1a6277ac4.js +0 -1
  919. package/assets/esri/core/workers/chunks/135a90ae61f3b3cae91b.js +0 -1
  920. package/assets/esri/core/workers/chunks/13fde7fd56c39fa3f2d5.js +0 -1
  921. package/assets/esri/core/workers/chunks/1c90855c3b0e5dcff908.js +0 -1
  922. package/assets/esri/core/workers/chunks/1dbef1919c7ac10a6bcc.js +0 -1
  923. package/assets/esri/core/workers/chunks/1facbda248863cf72cbd.js +0 -1
  924. package/assets/esri/core/workers/chunks/1fb2d7abe6c8efa84695.js +0 -1
  925. package/assets/esri/core/workers/chunks/2068377c2a796d5f2245.js +0 -1
  926. package/assets/esri/core/workers/chunks/28a5878cbe5880476855.js +0 -1
  927. package/assets/esri/core/workers/chunks/2cf3934b3ecabdf207c8.js +0 -1
  928. package/assets/esri/core/workers/chunks/2d42711a629384144625.js +0 -1
  929. package/assets/esri/core/workers/chunks/3021fda52083fc67d18c.js +0 -1
  930. package/assets/esri/core/workers/chunks/30333a95dc0a44e23fb5.js +0 -1
  931. package/assets/esri/core/workers/chunks/30837d93116f0337972f.js +0 -1
  932. package/assets/esri/core/workers/chunks/320543485c8e22485075.js +0 -1
  933. package/assets/esri/core/workers/chunks/3f0f7da92a6e4493686e.js +0 -1
  934. package/assets/esri/core/workers/chunks/42057f252ba4e82a8b45.js +0 -1
  935. package/assets/esri/core/workers/chunks/45a3f6033cdf4bc74a4c.js +0 -1
  936. package/assets/esri/core/workers/chunks/492b65fe99641f5740f0.js +0 -1
  937. package/assets/esri/core/workers/chunks/4d1cd7df617273c489f4.js +0 -1
  938. package/assets/esri/core/workers/chunks/4df9dfa80dbbae9b743d.js +0 -1
  939. package/assets/esri/core/workers/chunks/515c1c055666ff4740f3.js +0 -1
  940. package/assets/esri/core/workers/chunks/541e644fc77dbe527124.js +0 -1
  941. package/assets/esri/core/workers/chunks/59e341b2db44351bf557.js +0 -1
  942. package/assets/esri/core/workers/chunks/5a10b58533b4116115ac.js +0 -1
  943. package/assets/esri/core/workers/chunks/5f940853341d7e2bc852.js +0 -1
  944. package/assets/esri/core/workers/chunks/5ff2cdecf95e0136dd52.js +0 -1
  945. package/assets/esri/core/workers/chunks/6147bfbe2bd7292d6ad0.js +0 -1
  946. package/assets/esri/core/workers/chunks/6467f996fe9f136c370b.js +0 -1
  947. package/assets/esri/core/workers/chunks/682a8f15f352de76df69.js +0 -1
  948. package/assets/esri/core/workers/chunks/6a06635089761ee3e6d4.js +0 -972
  949. package/assets/esri/core/workers/chunks/725828a41917d3d56f2d.js +0 -1
  950. package/assets/esri/core/workers/chunks/794b47764ebb0257ed41.js +0 -1
  951. package/assets/esri/core/workers/chunks/7fd03a75eb07a09cda35.js +0 -1
  952. package/assets/esri/core/workers/chunks/86ad6b020c01850d9095.js +0 -1
  953. package/assets/esri/core/workers/chunks/86f9d1ce36661781d962.js +0 -1
  954. package/assets/esri/core/workers/chunks/8dcf6c836b53b40dfbf1.js +0 -1
  955. package/assets/esri/core/workers/chunks/8e98ff9404a802352037.js +0 -1
  956. package/assets/esri/core/workers/chunks/94e51fe1c539df6257c2.js +0 -1
  957. package/assets/esri/core/workers/chunks/9519a02b9b8db88a3150.js +0 -1
  958. package/assets/esri/core/workers/chunks/9a8b50ed75219b4a42e1.js +0 -1
  959. package/assets/esri/core/workers/chunks/9f3a094aa4b47e4eb046.js +0 -1
  960. package/assets/esri/core/workers/chunks/a0ebf25c9c9a7f839b93.js +0 -1
  961. package/assets/esri/core/workers/chunks/a25f0a195f9217665530.js +0 -1
  962. package/assets/esri/core/workers/chunks/a2be1e0b632cef87f6a4.js +0 -1
  963. package/assets/esri/core/workers/chunks/a4d8cf9829da9cfc5f36.js +0 -1
  964. package/assets/esri/core/workers/chunks/a562059dbdd1bf1fab66.js +0 -1
  965. package/assets/esri/core/workers/chunks/a59ee7d2b98c85f27dd2.js +0 -1
  966. package/assets/esri/core/workers/chunks/a5dbab94697757c87c49.js +0 -1
  967. package/assets/esri/core/workers/chunks/a5e65d5a7a536759d1cc.js +0 -1
  968. package/assets/esri/core/workers/chunks/a8ac0b6a3eba35e3a5b6.js +0 -1
  969. package/assets/esri/core/workers/chunks/acbd0f4d72d1f5d8e4e8.js +0 -1
  970. package/assets/esri/core/workers/chunks/acc97a210f36bff2d1b0.js +0 -1
  971. package/assets/esri/core/workers/chunks/ad68fe924456d6d7d4f0.js +0 -1
  972. package/assets/esri/core/workers/chunks/b06c949fc7d08e376a5f.js +0 -1
  973. package/assets/esri/core/workers/chunks/b26bd8fde2fc65bb67fb.js +0 -1
  974. package/assets/esri/core/workers/chunks/b4405e9fe6c0cf7250d3.js +0 -1
  975. package/assets/esri/core/workers/chunks/bc08fe3b03767bd694c5.js +0 -1
  976. package/assets/esri/core/workers/chunks/c11501e96ffd81bf39a0.js +0 -1
  977. package/assets/esri/core/workers/chunks/c44116378cc1bc627044.js +0 -1
  978. package/assets/esri/core/workers/chunks/c9b09099488d0e719dfb.js +0 -1
  979. package/assets/esri/core/workers/chunks/cbea4f1eb814115748db.js +0 -1
  980. package/assets/esri/core/workers/chunks/ce262a2accd982988ef1.js +0 -1
  981. package/assets/esri/core/workers/chunks/d15e6662d90718411d62.js +0 -1
  982. package/assets/esri/core/workers/chunks/d16aac3461af9cee0c29.js +0 -1
  983. package/assets/esri/core/workers/chunks/d60dd3e1028f714f2258.js +0 -1
  984. package/assets/esri/core/workers/chunks/d6c150c243ca1f6108f9.js +0 -1
  985. package/assets/esri/core/workers/chunks/d85748b57a71999caf3a.js +0 -1
  986. package/assets/esri/core/workers/chunks/d8c59b1d73650c060dfb.js +0 -1
  987. package/assets/esri/core/workers/chunks/dcb6e1b33402d7fa455b.js +0 -1
  988. package/assets/esri/core/workers/chunks/df653bca2b14dffc82d1.js +0 -1
  989. package/assets/esri/core/workers/chunks/e2a12142439d3037a3a7.js +0 -1
  990. package/assets/esri/core/workers/chunks/e3e1d87b8532bf84a18d.js +0 -1
  991. package/assets/esri/core/workers/chunks/e7744b7e0c16bba93151.js +0 -1
  992. package/assets/esri/core/workers/chunks/ea50effc5c39870dc871.js +0 -1
  993. package/assets/esri/core/workers/chunks/f1665a64564593f2a438.js +0 -1
  994. package/assets/esri/core/workers/chunks/f4c12f3a5e7f89106ae0.js +0 -1
  995. package/assets/esri/core/workers/chunks/fbefdc74b3aab716187f.js +0 -1
  996. package/assets/esri/core/workers/chunks/fc4fd9db056579e09bfe.js +0 -1
  997. package/assets/esri/core/workers/chunks/fd4907fa96f55128764d.js +0 -1
  998. package/views/3d/webgl-engine/core/shaderModules/BooleanUniform.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.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{isSome as r,isNone as s}from"../../../core/maybe.js";import n from"../../../core/ObjectPool.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{j as l}from"../../../chunks/mat4.js";import{c as d,I as h}from"../../../chunks/mat4f64.js";import{b as c,s as u,n as p,e as g}from"../../../chunks/vec3.js";import{Z as f,c as m}from"../../../chunks/vec3f64.js";import{Z as _,c as T}from"../../../chunks/vec4f64.js";import{create as b,set as R}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as A}from"../../../geometry/support/buffer/BufferView.js";import{requestImage as y}from"../../../support/requestImageUtils.js";import{ViewingMode as O}from"../../ViewingMode.js";import{TextureUpdate as v}from"./interfaces.js";import{LayerClass as P}from"./LayerClass.js";import{OverlaySource as E}from"./Overlay.js";import{overlayRenderOccludedFlag as x}from"./OverlayRenderer.js";import{clearCaches as D}from"./PatchGeometry.js";import{PatchRenderData as C}from"./PatchRenderData.js";import{RenderOrder as q}from"./RenderOrder.js";import{ScaleRangeQueries as S}from"./ScaleRangeQueries.js";import{DEFAULT_TILE_BACKGROUND as I}from"./TerrainConst.js";import"./terrainUtils.js";import{TileRenderer as N}from"./TileRenderer.js";import{TileUpdate as L}from"./TileUpdate.js";import{IteratorPreorder as w,sortTiles as G,compareTiles as k}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as j,ComponentIntersectionData as U}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as M}from"../webgl-engine/core/shaderLibrary/ShaderOutputOptions.js";import{OverlayMode as B}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as F}from"../../../chunks/Terrain.glsl.js";import{RenderRequestType as H}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as z}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as V}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as Q,StoreResults as W}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as Y}from"../webgl-engine/lib/Material.js";import{RenderPass as X}from"../webgl-engine/lib/RenderPass.js";import{RenderSlot as Z}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as K}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as J}from"../webgl-engine/lib/VertexAttribute.js";import{TERRAIN_ID as $,getVerticalOffsetTerrain as ee}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as te}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as ie,intersectTriangles as re}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as se}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ne}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{ClearBufferBit as ae,PrimitiveType as oe}from"../../webgl/enums.js";const le=7,de=10,he=b(),ce=T();let ue=class extends i{constructor(e){super(e),this.type=Q.TERRAIN,this.isGround=!0,this.tileSize=256,this._passParameters=new F,this.rctx=null,this._isTransparent=!1,this._scaleRangeQueries=new S,this.renderDataPool=new n(C),this._patchGroups=new Map,this.patchGroupsDirty=!0,this.tileIterator=new w,this.highestVisibleLODTile=null,this.visible=!0,this._opaque=!0,this._velvetOverground=!0,this.castShadows=!0,this._ssrEnabled=!1,this.emptyTex=null,this.tileRenderer=null,this.tileBackgroundInitialized=!1,this.tileBackgroundUpdating=!1,this.stencilEnabledLayerExtents=[],this.numTilesRendered=0,this.numTilesCulled=0,this.numOriginsRendered=0,this.needsHighlight=!1,this.renderOccludedFlags=Y.Occlude}get isGlobal(){return this.stage.viewingMode===O.Global}initialize(){const e=[Z.OPAQUE_TERRAIN,Z.TRANSPARENT_TERRAIN,Z.OCCLUDED_TERRAIN];this.stage.addRenderPlugin(e,this)}destroy(){this.stage.removeRenderPlugin(this),D()}get updating(){return!this.tileBackgroundInitialized||this.tileBackgroundUpdating}get canRender(){return this.visible&&!!this._rootTiles&&this.tileBackgroundInitialized&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setNeedsRender()}set opaque(e){this._opaque!==e&&(this._opaque=e,this.setNeedsRender())}get opaque(){return this._opaque&&!this._techniqueConfiguration.hasSlicePlane}get needsLinearDepth(){return this.overlayRenderer.hasWater}set isTransparent(e){this._isTransparent!==e&&(this._isTransparent=e,this.setNeedsRender())}get isTransparent(){return this._isTransparent}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this.setNeedsRender()}set velvetOverground(e){this._velvetOverground!==e&&(this._velvetOverground=e,this.setNeedsRender())}get layerUid(){return $}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setNeedsRender()}setNeedsHighlight(e){this.needsHighlight=e,this.setNeedsRender()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?x:Y.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this.stencilEnabledLayerExtents=e,this.setNeedsRender()}setTileSize(e){this.tileSize=e,this.tileRenderer&&(this.tileRenderer.tileSize=e),this.setNeedsRender()}_prepareTileForLoading(e){e.renderData||(e.renderData=this.renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometry(e),this.updateTileTexture(e,L.TEXTURE_FADING)}queryVisibleLevelRange(e,t,i,r){this._scaleRangeQueries.queryVisibleLevelRange(e,t,i,r),this.setNeedsRender()}updateTileTexture(e,t){this.tileRenderer&&this.tileBackgroundInitialized&&(this.tileRenderer.updateTileTexture(e,t===L.TEXTURE_FADING?v.FADING:v.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){this._prepareTileForLoading(e),e.renderData.updateGeometryStateAndPrepareForGeometryGeneration(this.wireframe)}updateTileGeometry(e){for(const t of e.layerInfo[P.ELEVATION])t.pendingUpdates&=~L.GEOMETRY;e.resetPendingUpdate(L.GEOMETRY);e.renderData.updateGeometryIfChanged(this.rctx,this.wireframe)&&this.setNeedsRender()}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this.renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setNeedsRender())}_getLocalOriginOfTile(e){const t=de-le,i=Math.max(0,Math.floor((e.level-t)/le)*le);if(this.isGlobal&&0===i)return f;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}setVisibility(e){this.visible=e,this.setNeedsRender()}getStats(){return{numTilesRendered:this.numTilesRendered,numTilesCulled:this.numTilesCulled,numOriginsRendered:this.numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.allTiles.forAll((e=>{e.isLoaded&&(this.updateTileGeometry(e),e.updateNeighborsAfterGeometryChange())})),this.setNeedsRender())}setNeedsRender(e=H.UPDATE){this.patchGroupsDirty=!0,this._context.requestRender(e)}setTileBackground(e){this.tileBackground=e,this._updateTileBackground()}initializeRenderContext(e){this._context=e,this.rctx=e.renderContext.rctx,this._techniqueRepository=e.shaderTechniqueRepository,this._techniqueConfiguration=new ne,this.tileRenderer=new N(this.rctx,this.tileSize,this._techniqueRepository),this.tileBackground&&this._updateTileBackground(),this.emptyTex=z(this.rctx)}uninitializeRenderContext(){null!=this.emptyTex&&(this.emptyTex.dispose(),this.emptyTex=null),this.tileRenderer&&(this.tileRenderer.dispose(),this.tileRenderer=null)}intersect(e,t,i,n){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&!this._opaque)return;const a=_e,o=Te;c(a,n,i),u(o,1/a[0],1/a[1],1/a[2]);const l=e.results.min,d=e.results.max,p=e.results.ground,f=e.options.store===W.MIN,m=!!e.results.ground.target,_=ee(e.verticalOffset),T=e.tolerance;let b,y=f&&r(l.dist)?l.dist:1/0;const O=u=>{const m=u.renderData;if(null==m||!m.vao)return;const O=m.geometryInfo;R(he,O.boundingBox);const v=m.localOrigin;r(_)&&(_.localOrigin=v,_.applyToAabb(he));const P=he;if(be[0]=i[0]-v[0],be[1]=i[1]-v[1],be[2]=i[2]-v[2],!ie(P,be,o,T,y))return;const E=(e,t,i)=>{e.set(this.type,u,t,i,h),y=f&&r(l.dist)?l.dist:1/0},x=(o,h)=>{if(r(h)&&o>=0&&(e.options.backfacesTerrain||g(h,a)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(i,n,o))){if((null==p.dist||o<p.dist)&&E(p,o,h),e.options.isFiltered)return;e.options.store===W.ALL&&(s(b)?(b=V(e.ray),E(b,o,h),e.results.all.push(b)):o<b.dist&&E(b,o,h)),(null==l.dist||o<l.dist)&&E(l,o,h),e.options.store!==W.MIN&&(null==d.dist||o>d.dist)&&E(d,o,h)}},D=Re;c(D,n,v);const C=O.indices,q=O.vertexAttributes,S={data:q.getField(J.POSITION,A).typedBuffer,size:3,stride:q.stride/4},I=O.indexCount/3;if(s(_)&&I>j){const e=u.renderData;s(e.intersectionData)&&(e.intersectionData=new U(C,0,I,S)),e.intersectionData.intersectRay({r0:be,r1:D},x)}else re(be,D,0,I,C,S,null,_,x)},v=this._rootTiles;if(r(v)){(()=>{const t=this.tileIterator;t.reset(v);const s=e.options.invisibleTerrain;for(;!t.done;){const e=t.next();!(e.visible||s&&e.intersectsClippingArea)||!r(_)&&!e.intersectsRay(i,a,T,y)||m&&this._useStencilForTile(e)?t.skipSubtree():O(e)}})()}}prepareTechnique(e){if(e.bindParameters.slot===Z.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&x))return null}else{const t=this.opaque?Z.OPAQUE_TERRAIN:Z.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}switch(e.pass){case X.MATERIAL:{this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=e.bindParameters.ssaoHelper.ready,this._techniqueConfiguration.overlayMode=this.overlayRenderer.isEmpty()?B.Disabled:this.overlayRenderer.hasWater?B.EnabledWithWater:B.Enabled;const t=e.bindParameters.slot===Z.OCCLUDED_TERRAIN?E.Occluded:E.ColorAndWater;return this._updateTechnique(M.Color,t===E.Occluded)}case X.MATERIAL_DEPTH_SHADOWMAP_ALL:case X.MATERIAL_DEPTH_SHADOWMAP_DEFAULT:return this.castShadows&&1===e.bindParameters.lighting.globalFactor?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(M.Shadow,!1)):null;case X.MATERIAL_DEPTH:return this.isTransparent&&this.overlayRenderer.isEmpty()?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(M.Depth,!1));case X.MATERIAL_NORMAL:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(M.Normal,!1);case X.MATERIAL_HIGHLIGHT:return this.needsHighlight?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(M.Highlight,!1)):null}return null}render(e,t){const i=e.pass,r=1===e.bindParameters.lighting.globalFactor;switch(this._updatePatchGroups(),t.useStencil=!1,i){case X.MATERIAL:{const i=e.bindParameters.slot===Z.OCCLUDED_TERRAIN?E.Occluded:E.ColorAndWater;this._renderMaterialPass(e,t,i);break}case X.MATERIAL_DEPTH_SHADOWMAP_ALL:case X.MATERIAL_DEPTH_SHADOWMAP_DEFAULT:this.castShadows&&r&&this._renderAuxiliaryPass(e,t,E.None);break;case X.MATERIAL_DEPTH:this.isTransparent&&this.overlayRenderer.isEmpty()||this._renderAuxiliaryPass(e,t,E.None);break;case X.MATERIAL_NORMAL:this._renderAuxiliaryPass(e,t,E.None);break;case X.MATERIAL_HIGHLIGHT:this.needsHighlight&&(this._renderAuxiliaryPass(e,t,E.Highlight),e.rctx.clearSafe(ae.DEPTH_BUFFER_BIT))}this._scaleRangeQueries.hasPendingQueries()&&this.setNeedsRender()}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlaySource=i,this._ssrEnabled=e.bindParameters.ssr.enabled;const s=r.bindTechnique(t,this._passParameters,e.bindParameters),n=e.bindParameters.camera.viewMatrix;u(me,n[12],n[13],n[14]),p(me,me),s.setUniform3fv("viewDirection",me),this.numTilesRendered=0,this.numTilesCulled=0,this.numOriginsRendered=0,this._scaleRangeQueries.prepareQueries(),this.opaque?this._renderPatchGroups(e,t,i):e.offscreenRenderingHelper.renderToTargets((()=>this._renderPatchGroups(e,t,i)),e.offscreenRenderingHelper.tmpColor,e.offscreenRenderingHelper.mainDepth,[0,0,0,0]),this._scaleRangeQueries.processQueries()}_renderAuxiliaryPass(e,t,i){const r=e.rctx;this._passParameters.overlaySource=i;const s=r.bindTechnique(t,this._passParameters,e.bindParameters),n=e.bindParameters.camera;e.pass!==X.MATERIAL_DEPTH&&e.pass!==X.MATERIAL_DEPTH_SHADOWMAP_ALL&&e.pass!==X.MATERIAL_DEPTH_SHADOWMAP_DEFAULT||s.setUniform2fv("nearFar",n.nearFar),this._renderPatchGroupsAuxiliary(e,t,i)}_updateTileBackground(){if(!this.tileRenderer)return;this.tileBackgroundUpdating=!0;const e=()=>{this.tileBackgroundInitialized=!0,this.tileBackgroundUpdating=!1,this._techniqueConfiguration.useGrid=this.tileRenderer.backgroundIsGrid,this._techniqueConfiguration.hasBackgroundColor=!this.tileRenderer.backgroundIsGrid&&r(this.tileRenderer.backgroundColor),this.allTiles.forAll((e=>this.tileRenderer.updateTileTexture(e,v.FADING))),this.setNeedsRender()};if("string"==typeof this.tileBackground){const t=this.tileBackground;y(t).then((i=>{t===this.tileBackground&&this.tileRenderer&&(this.tileRenderer.setBackground(i,this.tileBackground===I),e())}))}else{const i=this.tileBackground?t.toUnitRGBA(this.tileBackground):[0,0,0,0];this.tileRenderer.setBackground(i,!1),e()}}_updatePatchGroups(){if(this.patchGroupsDirty){if(this.highestVisibleLODTile=null,this._rebuildPatchGroups(),this.renderOrder!==q.NONE){const e=Array.from(this._patchGroups.values());e.forEach((e=>G(this.renderOrder,e))),e.sort(((e,t)=>k(e[0],t[0],this.renderOrder))),this._patchGroups=new Map(e.map((e=>[e[0].renderData.localOrigin,e])))}this.patchGroupsDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(!s(e)){e[0].surface.checkAllTileWaterproofness(),this._patchGroups.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this.tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i||e.visible)if(e.rendered){if(i){const r=this._patchGroups.get(i.localOrigin)||new Array;this._patchGroups.set(i.localOrigin,r),r.push(e),(!this.highestVisibleLODTile||e.vlevel>this.highestVisibleLODTile.vlevel)&&(this.highestVisibleLODTile=e),t.skipSubtree()}}else this.numTilesCulled++;else this.numTilesCulled++,t.skipSubtree()}}_useStencilForTile(e){for(const t of this.stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,i){const r=e.bindParameters.camera;t.program.setUniformMatrix4fv("proj",r.projectionMatrix);const s=this.stencilEnabledLayerExtents.length>0;this._patchGroups.forEach((r=>{const n=r[0].renderData.localOrigin;this._bindPatchGroupData(t.program,n,e.bindParameters);for(let a=0;a<r.length;a++)this._renderPatch(e,t,r[a],oe.TRIANGLES,s,i)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,i){const n=e.rctx,a=e.bindParameters.camera,o=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=K(this.stage.viewingMode,this.ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:a.fovY})}const l=this.stencilEnabledLayerExtents.length>0,d=i===E.Occluded;d&&(o.bindTexture("tex",this.emptyTex),o.setUniform1f("blend",1),o.setUniform4fv("texOffsetAndScale",_));const h=r(this.tileRenderer.backgroundColor)?this.tileRenderer.backgroundColor:f;this._techniqueConfiguration.hasBackgroundColor&&o.setUniform3fv("backgroundColor",h);const c=this.wireframe?oe.LINES:oe.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&o.bindTexture("texNext",this.emptyTex),this._patchGroups.forEach((n=>{const a=n[0].renderData.localOrigin;this._bindPatchGroupData(o,a,e.bindParameters),this.numOriginsRendered++;for(let h=0;h<n.length;h++){const a=n[h],u=a.renderData.textureReference;if(!s(u)){if(!d){this._scaleRangeQueries.scaleQueriesForTile(a),ge(a.renderData.geometryInfo.uvOffsetAndScale,u.offsetAndScale,ce),o.setUniform4fv("texOffsetAndScale",ce),o.bindTexture("tex",u.texture.texture);const e=a.renderData.textureFadeFactor,t=e<1?a.renderData.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&r(t)&&e<1?(ge(a.renderData.geometryInfo.uvOffsetAndScale,t.offsetAndScale,ce),o.setUniform1f("fadeFactor",e),o.setUniform4fv("nextTexOffsetAndScale",ce),o.setUniform3fv("nextTexOpacities",t.opacities),o.bindTexture("texNext",t.texture.texture)):o.setUniform1f("fadeFactor",1),a.renderData.textureIsFading&&this.setNeedsRender(),o.setUniform3fv("textureOpacities",u.opacities)}this._renderPatch(e,t,a,c,l,i),a.renderOrder=this.numTilesRendered,this.numTilesRendered++}}})),n.bindVAO(null)}_renderPatch(e,t,i,r,n,a){const o=i.renderData,l=o.vao,d=l.indexBuffer;if(s(d))return;const h=t.program;a!==E.None&&this._bindOverlayPatchData(h,o.overlay),n&&(t.useStencil=this._useStencilForTile(i),t.bindPipelineState(e.rctx,e.bindParameters.slot));const c=o.geometryInfo.indexCount;e.rctx.bindVAO(l),h.assertCompatibleVertexAttributeLocations(l),e.rctx.drawElements(r,c,d.indexType,0)}_bindPatchGroupData(e,t,i){e.bindDraw(new te(t),i),e.setUniform3fv("origin",t),l(fe,i.camera.viewMatrix,t),e.setUniformMatrix4fv("view",fe);const r=i.camera.eye;e.setUniform3f("cameraPosition",r[0]-t[0],r[1]-t[1],r[2]-t[2])}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,e===M.Color&&(this._techniqueConfiguration.atmosphere=this.isGlobal&&this._velvetOverground,this._techniqueConfiguration.hasScreenSpaceReflections=this._ssrEnabled),this._techniqueConfiguration.renderOccluded=t,this._techniqueConfiguration.stencilEnabled=!1,this._shaderTechnique=this._techniqueRepository.releaseAndAcquire(se,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this.tileRenderer}}};e([a()],ue.prototype,"tileBackgroundInitialized",void 0),e([a()],ue.prototype,"tileBackgroundUpdating",void 0),e([a({constructOnly:!0})],ue.prototype,"overlayRenderer",void 0),e([a({constructOnly:!0})],ue.prototype,"stage",void 0),e([a({readOnly:!0})],ue.prototype,"isGlobal",null),e([a({constructOnly:!0})],ue.prototype,"allTiles",void 0),e([a({constructOnly:!0})],ue.prototype,"ellipsoidRadius",void 0),e([a({readOnly:!0})],ue.prototype,"updating",null),e([a({value:!1})],ue.prototype,"renderingDisabled",null),e([a()],ue.prototype,"renderPatchBorders",null),e([a()],ue.prototype,"cullBackFaces",null),e([a({value:q.FRONT_TO_BACK})],ue.prototype,"renderOrder",null),e([a()],ue.prototype,"wireframe",null),ue=e([o("esri.views.3d.terrain.TerrainRenderer")],ue);const pe=ue;function ge(e,t,i){i[0]=e[0]*t[2]+t[0],i[1]=e[1]*t[3]+t[1],i[2]=e[2]*t[2],i[3]=e[3]*t[3]}const fe=d(),me=m(),_e=m(),Te=m(),be=m(),Re=m();export{pe as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{isSome as r,isNone as s}from"../../../core/maybe.js";import n from"../../../core/ObjectPool.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{j as l}from"../../../chunks/mat4.js";import{c as d,I as h}from"../../../chunks/mat4f64.js";import{b as c,s as u,n as p,e as g}from"../../../chunks/vec3.js";import{Z as f,c as m}from"../../../chunks/vec3f64.js";import{Z as _,c as T}from"../../../chunks/vec4f64.js";import{create as b,set as R}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as A}from"../../../geometry/support/buffer/BufferView.js";import{requestImage as y}from"../../../support/requestImageUtils.js";import{ViewingMode as O}from"../../ViewingMode.js";import{TextureUpdate as v}from"./interfaces.js";import{LayerClass as P}from"./LayerClass.js";import{OverlaySource as E}from"./Overlay.js";import{overlayRenderOccludedFlag as x}from"./OverlayRenderer.js";import{clearCaches as D}from"./PatchGeometry.js";import{PatchRenderData as C}from"./PatchRenderData.js";import{RenderOrder as q}from"./RenderOrder.js";import{ScaleRangeQueries as S}from"./ScaleRangeQueries.js";import{DEFAULT_TILE_BACKGROUND as I}from"./TerrainConst.js";import"./terrainUtils.js";import{TileRenderer as N}from"./TileRenderer.js";import{TileUpdate as L}from"./TileUpdate.js";import{IteratorPreorder as w,sortTiles as G,compareTiles as k}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as j,ComponentIntersectionData as U}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as M}from"../webgl-engine/core/shaderLibrary/ShaderOutputOptions.js";import{OverlayMode as B}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as F}from"../../../chunks/Terrain.glsl.js";import{RenderRequestType as H}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as z}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as V}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as Q,StoreResults as W}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as Y}from"../webgl-engine/lib/Material.js";import{RenderPass as X}from"../webgl-engine/lib/RenderPass.js";import{RenderSlot as Z}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as K}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as J}from"../webgl-engine/lib/VertexAttribute.js";import{TERRAIN_ID as $,getVerticalOffsetTerrain as ee}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as te}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as ie,intersectTriangles as re}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as se}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ne}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{ClearBufferBit as ae,PrimitiveType as oe}from"../../webgl/enums.js";const le=7,de=10,he=b(),ce=T();let ue=class extends i{constructor(e){super(e),this.type=Q.TERRAIN,this.isGround=!0,this.tileSize=256,this._passParameters=new F,this.rctx=null,this._isTransparent=!1,this._scaleRangeQueries=new S,this.renderDataPool=new n(C),this._patchGroups=new Map,this.patchGroupsDirty=!0,this.tileIterator=new w,this.highestVisibleLODTile=null,this.visible=!0,this._opaque=!0,this._velvetOverground=!0,this.castShadows=!0,this._ssrEnabled=!1,this.emptyTex=null,this.tileRenderer=null,this.tileBackgroundInitialized=!1,this.tileBackgroundUpdating=!1,this.stencilEnabledLayerExtents=[],this.numTilesRendered=0,this.numTilesCulled=0,this.numOriginsRendered=0,this.needsHighlight=!1,this.renderOccludedFlags=Y.Occlude}get isGlobal(){return this.stage.viewingMode===O.Global}initialize(){const e=[Z.OPAQUE_TERRAIN,Z.TRANSPARENT_TERRAIN,Z.OCCLUDED_TERRAIN];this.stage.addRenderPlugin(e,this)}destroy(){this.stage.removeRenderPlugin(this),D()}get updating(){return!this.tileBackgroundInitialized||this.tileBackgroundUpdating}get canRender(){return this.visible&&!!this._rootTiles&&this.tileBackgroundInitialized&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setNeedsRender()}set opaque(e){this._opaque!==e&&(this._opaque=e,this.setNeedsRender())}get opaque(){return this._opaque&&!this._techniqueConfiguration.hasSlicePlane}get needsLinearDepth(){return this.overlayRenderer.hasWater}set isTransparent(e){this._isTransparent!==e&&(this._isTransparent=e,this.setNeedsRender())}get isTransparent(){return this._isTransparent}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this.setNeedsRender()}set velvetOverground(e){this._velvetOverground!==e&&(this._velvetOverground=e,this.setNeedsRender())}get layerUid(){return $}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setNeedsRender()}setNeedsHighlight(e){this.needsHighlight=e,this.setNeedsRender()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?x:Y.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this.stencilEnabledLayerExtents=e,this.setNeedsRender()}setTileSize(e){this.tileSize=e,this.tileRenderer&&(this.tileRenderer.tileSize=e),this.setNeedsRender()}_prepareTileForLoading(e){e.renderData||(e.renderData=this.renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometry(e),this.updateTileTexture(e,L.TEXTURE_FADING)}queryVisibleLevelRange(e,t,i,r){this._scaleRangeQueries.queryVisibleLevelRange(e,t,i,r),this.setNeedsRender()}updateTileTexture(e,t){this.tileRenderer&&this.tileBackgroundInitialized&&(this.tileRenderer.updateTileTexture(e,t===L.TEXTURE_FADING?v.FADING:v.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){this._prepareTileForLoading(e),e.renderData.updateGeometryStateAndPrepareForGeometryGeneration(this.wireframe)}updateTileGeometry(e){for(const t of e.layerInfo[P.ELEVATION])t.pendingUpdates&=~L.GEOMETRY;e.resetPendingUpdate(L.GEOMETRY);e.renderData.updateGeometryIfChanged(this.rctx,this.wireframe)&&this.setNeedsRender()}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this.renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setNeedsRender())}_getLocalOriginOfTile(e){const t=de-le,i=Math.max(0,Math.floor((e.level-t)/le)*le);if(this.isGlobal&&0===i)return f;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}setVisibility(e){this.visible=e,this.setNeedsRender()}getStats(){return{numTilesRendered:this.numTilesRendered,numTilesCulled:this.numTilesCulled,numOriginsRendered:this.numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.allTiles.forAll((e=>{e.isLoaded&&(this.updateTileGeometry(e),e.updateNeighborsAfterGeometryChange())})),this.setNeedsRender())}setNeedsRender(e=H.UPDATE){this.patchGroupsDirty=!0,this._context.requestRender(e)}setTileBackground(e){this.tileBackground=e,this._updateTileBackground()}initializeRenderContext(e){this._context=e,this.rctx=e.renderContext.rctx,this._techniqueRepository=e.shaderTechniqueRepository,this._techniqueConfiguration=new ne,this.tileRenderer=new N(this.rctx,this.tileSize,this._techniqueRepository),this.tileBackground&&this._updateTileBackground(),this.emptyTex=z(this.rctx)}uninitializeRenderContext(){null!=this.emptyTex&&(this.emptyTex.dispose(),this.emptyTex=null),this.tileRenderer&&(this.tileRenderer.dispose(),this.tileRenderer=null)}intersect(e,t,i,n){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&!this._opaque)return;const a=_e,o=Te;c(a,n,i),u(o,1/a[0],1/a[1],1/a[2]);const l=e.results.min,d=e.results.max,p=e.results.ground,f=e.options.store===W.MIN,m=!!e.results.ground.target,_=ee(e.verticalOffset),T=e.tolerance;let b,y=f&&r(l.dist)?l.dist:1/0;const O=u=>{const m=u.renderData;if(!m?.vao)return;const O=m.geometryInfo;R(he,O.boundingBox);const v=m.localOrigin;r(_)&&(_.localOrigin=v,_.applyToAabb(he));const P=he;if(be[0]=i[0]-v[0],be[1]=i[1]-v[1],be[2]=i[2]-v[2],!ie(P,be,o,T,y))return;const E=(e,t,i)=>{e.set(this.type,u,t,i,h),y=f&&r(l.dist)?l.dist:1/0},x=(o,h)=>{if(r(h)&&o>=0&&(e.options.backfacesTerrain||g(h,a)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(i,n,o))){if((null==p.dist||o<p.dist)&&E(p,o,h),e.options.isFiltered)return;e.options.store===W.ALL&&(s(b)?(b=V(e.ray),E(b,o,h),e.results.all.push(b)):o<b.dist&&E(b,o,h)),(null==l.dist||o<l.dist)&&E(l,o,h),e.options.store!==W.MIN&&(null==d.dist||o>d.dist)&&E(d,o,h)}},D=Re;c(D,n,v);const C=O.indices,q=O.vertexAttributes,S={data:q.getField(J.POSITION,A).typedBuffer,size:3,stride:q.stride/4},I=O.indexCount/3;if(s(_)&&I>j){const e=u.renderData;s(e.intersectionData)&&(e.intersectionData=new U(C,0,I,S)),e.intersectionData.intersectRay({r0:be,r1:D},x)}else re(be,D,0,I,C,S,null,_,x)},v=this._rootTiles;if(r(v)){(()=>{const t=this.tileIterator;t.reset(v);const s=e.options.invisibleTerrain;for(;!t.done;){const e=t.next();!(e.visible||s&&e.intersectsClippingArea)||!r(_)&&!e.intersectsRay(i,a,T,y)||m&&this._useStencilForTile(e)?t.skipSubtree():O(e)}})()}}prepareTechnique(e){if(e.bindParameters.slot===Z.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&x))return null}else{const t=this.opaque?Z.OPAQUE_TERRAIN:Z.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}switch(e.pass){case X.MATERIAL:{this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=e.bindParameters.ssaoHelper.ready,this._techniqueConfiguration.overlayMode=this.overlayRenderer.isEmpty()?B.Disabled:this.overlayRenderer.hasWater?B.EnabledWithWater:B.Enabled;const t=e.bindParameters.slot===Z.OCCLUDED_TERRAIN?E.Occluded:E.ColorAndWater;return this._updateTechnique(M.Color,t===E.Occluded)}case X.MATERIAL_DEPTH_SHADOWMAP_ALL:case X.MATERIAL_DEPTH_SHADOWMAP_DEFAULT:return this.castShadows&&1===e.bindParameters.lighting.globalFactor?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(M.Shadow,!1)):null;case X.MATERIAL_DEPTH:return this.isTransparent&&this.overlayRenderer.isEmpty()?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(M.Depth,!1));case X.MATERIAL_NORMAL:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(M.Normal,!1);case X.MATERIAL_HIGHLIGHT:return this.needsHighlight?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(M.Highlight,!1)):null}return null}render(e,t){const i=e.pass,r=1===e.bindParameters.lighting.globalFactor;switch(this._updatePatchGroups(),t.useStencil=!1,i){case X.MATERIAL:{const i=e.bindParameters.slot===Z.OCCLUDED_TERRAIN?E.Occluded:E.ColorAndWater;this._renderMaterialPass(e,t,i);break}case X.MATERIAL_DEPTH_SHADOWMAP_ALL:case X.MATERIAL_DEPTH_SHADOWMAP_DEFAULT:this.castShadows&&r&&this._renderAuxiliaryPass(e,t,E.None);break;case X.MATERIAL_DEPTH:this.isTransparent&&this.overlayRenderer.isEmpty()||this._renderAuxiliaryPass(e,t,E.None);break;case X.MATERIAL_NORMAL:this._renderAuxiliaryPass(e,t,E.None);break;case X.MATERIAL_HIGHLIGHT:this.needsHighlight&&(this._renderAuxiliaryPass(e,t,E.Highlight),e.rctx.clearSafe(ae.DEPTH_BUFFER_BIT))}this._scaleRangeQueries.hasPendingQueries()&&this.setNeedsRender()}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlaySource=i,this._ssrEnabled=e.bindParameters.ssr.enabled;const s=r.bindTechnique(t,this._passParameters,e.bindParameters),n=e.bindParameters.camera.viewMatrix;u(me,n[12],n[13],n[14]),p(me,me),s.setUniform3fv("viewDirection",me),this.numTilesRendered=0,this.numTilesCulled=0,this.numOriginsRendered=0,this._scaleRangeQueries.prepareQueries(),this.opaque?this._renderPatchGroups(e,t,i):e.offscreenRenderingHelper.renderToTargets((()=>this._renderPatchGroups(e,t,i)),e.offscreenRenderingHelper.tmpColor,e.offscreenRenderingHelper.mainDepth,[0,0,0,0]),this._scaleRangeQueries.processQueries()}_renderAuxiliaryPass(e,t,i){const r=e.rctx;this._passParameters.overlaySource=i;const s=r.bindTechnique(t,this._passParameters,e.bindParameters),n=e.bindParameters.camera;e.pass!==X.MATERIAL_DEPTH&&e.pass!==X.MATERIAL_DEPTH_SHADOWMAP_ALL&&e.pass!==X.MATERIAL_DEPTH_SHADOWMAP_DEFAULT||s.setUniform2fv("nearFar",n.nearFar),this._renderPatchGroupsAuxiliary(e,t,i)}_updateTileBackground(){if(!this.tileRenderer)return;this.tileBackgroundUpdating=!0;const e=()=>{this.tileBackgroundInitialized=!0,this.tileBackgroundUpdating=!1,this._techniqueConfiguration.useGrid=this.tileRenderer.backgroundIsGrid,this._techniqueConfiguration.hasBackgroundColor=!this.tileRenderer.backgroundIsGrid&&r(this.tileRenderer.backgroundColor),this.allTiles.forAll((e=>this.tileRenderer.updateTileTexture(e,v.FADING))),this.setNeedsRender()};if("string"==typeof this.tileBackground){const t=this.tileBackground;y(t).then((i=>{t===this.tileBackground&&this.tileRenderer&&(this.tileRenderer.setBackground(i,this.tileBackground===I),e())}))}else{const i=this.tileBackground?t.toUnitRGBA(this.tileBackground):[0,0,0,0];this.tileRenderer.setBackground(i,!1),e()}}_updatePatchGroups(){if(this.patchGroupsDirty){if(this.highestVisibleLODTile=null,this._rebuildPatchGroups(),this.renderOrder!==q.NONE){const e=Array.from(this._patchGroups.values());e.forEach((e=>G(this.renderOrder,e))),e.sort(((e,t)=>k(e[0],t[0],this.renderOrder))),this._patchGroups=new Map(e.map((e=>[e[0].renderData.localOrigin,e])))}this.patchGroupsDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(!s(e)){e[0].surface.checkAllTileWaterproofness(),this._patchGroups.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this.tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i||e.visible)if(e.rendered){if(i){const r=this._patchGroups.get(i.localOrigin)||new Array;this._patchGroups.set(i.localOrigin,r),r.push(e),(!this.highestVisibleLODTile||e.vlevel>this.highestVisibleLODTile.vlevel)&&(this.highestVisibleLODTile=e),t.skipSubtree()}}else this.numTilesCulled++;else this.numTilesCulled++,t.skipSubtree()}}_useStencilForTile(e){for(const t of this.stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,i){const r=e.bindParameters.camera;t.program.setUniformMatrix4fv("proj",r.projectionMatrix);const s=this.stencilEnabledLayerExtents.length>0;this._patchGroups.forEach((r=>{const n=r[0].renderData.localOrigin;this._bindPatchGroupData(t.program,n,e.bindParameters);for(let a=0;a<r.length;a++)this._renderPatch(e,t,r[a],oe.TRIANGLES,s,i)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,i){const n=e.rctx,a=e.bindParameters.camera,o=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=K(this.stage.viewingMode,this.ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:a.fovY})}const l=this.stencilEnabledLayerExtents.length>0,d=i===E.Occluded;d&&(o.bindTexture("tex",this.emptyTex),o.setUniform1f("blend",1),o.setUniform4fv("texOffsetAndScale",_));const h=r(this.tileRenderer.backgroundColor)?this.tileRenderer.backgroundColor:f;this._techniqueConfiguration.hasBackgroundColor&&o.setUniform3fv("backgroundColor",h);const c=this.wireframe?oe.LINES:oe.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&o.bindTexture("texNext",this.emptyTex),this._patchGroups.forEach((n=>{const a=n[0].renderData.localOrigin;this._bindPatchGroupData(o,a,e.bindParameters),this.numOriginsRendered++;for(let h=0;h<n.length;h++){const a=n[h],u=a.renderData.textureReference;if(!s(u)){if(!d){this._scaleRangeQueries.scaleQueriesForTile(a),ge(a.renderData.geometryInfo.uvOffsetAndScale,u.offsetAndScale,ce),o.setUniform4fv("texOffsetAndScale",ce),o.bindTexture("tex",u.texture.texture);const e=a.renderData.textureFadeFactor,t=e<1?a.renderData.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&r(t)&&e<1?(ge(a.renderData.geometryInfo.uvOffsetAndScale,t.offsetAndScale,ce),o.setUniform1f("fadeFactor",e),o.setUniform4fv("nextTexOffsetAndScale",ce),o.setUniform3fv("nextTexOpacities",t.opacities),o.bindTexture("texNext",t.texture.texture)):o.setUniform1f("fadeFactor",1),a.renderData.textureIsFading&&this.setNeedsRender(),o.setUniform3fv("textureOpacities",u.opacities)}this._renderPatch(e,t,a,c,l,i),a.renderOrder=this.numTilesRendered,this.numTilesRendered++}}})),n.bindVAO(null)}_renderPatch(e,t,i,r,n,a){const o=i.renderData,l=o.vao,d=l.indexBuffer;if(s(d))return;const h=t.program;a!==E.None&&this._bindOverlayPatchData(h,o.overlay),n&&(t.useStencil=this._useStencilForTile(i),t.bindPipelineState(e.rctx,e.bindParameters.slot));const c=o.geometryInfo.indexCount;e.rctx.bindVAO(l),h.assertCompatibleVertexAttributeLocations(l),e.rctx.drawElements(r,c,d.indexType,0)}_bindPatchGroupData(e,t,i){e.bindDraw(new te(t),i),e.setUniform3fv("origin",t),l(fe,i.camera.viewMatrix,t),e.setUniformMatrix4fv("view",fe);const r=i.camera.eye;e.setUniform3f("cameraPosition",r[0]-t[0],r[1]-t[1],r[2]-t[2])}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,e===M.Color&&(this._techniqueConfiguration.atmosphere=this.isGlobal&&this._velvetOverground,this._techniqueConfiguration.hasScreenSpaceReflections=this._ssrEnabled),this._techniqueConfiguration.renderOccluded=t,this._techniqueConfiguration.stencilEnabled=!1,this._shaderTechnique=this._techniqueRepository.releaseAndAcquire(se,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this.tileRenderer}}};e([a()],ue.prototype,"tileBackgroundInitialized",void 0),e([a()],ue.prototype,"tileBackgroundUpdating",void 0),e([a({constructOnly:!0})],ue.prototype,"overlayRenderer",void 0),e([a({constructOnly:!0})],ue.prototype,"stage",void 0),e([a({readOnly:!0})],ue.prototype,"isGlobal",null),e([a({constructOnly:!0})],ue.prototype,"allTiles",void 0),e([a({constructOnly:!0})],ue.prototype,"ellipsoidRadius",void 0),e([a({readOnly:!0})],ue.prototype,"updating",null),e([a({value:!1})],ue.prototype,"renderingDisabled",null),e([a()],ue.prototype,"renderPatchBorders",null),e([a()],ue.prototype,"cullBackFaces",null),e([a({value:q.FRONT_TO_BACK})],ue.prototype,"renderOrder",null),e([a()],ue.prototype,"wireframe",null),ue=e([o("esri.views.3d.terrain.TerrainRenderer")],ue);const pe=ue;function ge(e,t,i){i[0]=e[0]*t[2]+t[0],i[1]=e[1]*t[3]+t[1],i[2]=e[2]*t[2],i[3]=e[3]*t[3]}const fe=d(),me=m(),_e=m(),Te=m(),be=m(),Re=m();export{pe 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import a from"../../../core/Evented.js";import n from"../../../core/Handles.js";import l from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{releaseMaybe as h,destroyMaybe as d,isNone as p,isSome as u}from"../../../core/maybe.js";import c from"../../../core/ObjectPool.js";import _ from"../../../core/PooledArray.js";import{isAbortError as g,isAborted as m,createAbortError as T}from"../../../core/promiseUtils.js";import{watch as f,syncAndInitial as y,sync as v,initial as w}from"../../../core/reactiveUtils.js";import{aliasOf as S}from"../../../core/accessorSupport/decorators/aliasOf.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{property as L}from"../../../core/accessorSupport/decorators/property.js";import{subclass as E}from"../../../core/accessorSupport/decorators/subclass.js";import{m as b}from"../../../chunks/mat4.js";import{c as x}from"../../../chunks/mat4f64.js";import{c as D}from"../../../chunks/vec3.js";import{c as U}from"../../../chunks/vec3f64.js";import{c as P}from"../../../chunks/vec4f64.js";import{WatchUpdatingTracking as R}from"../../../core/support/WatchUpdatingTracking.js";import{projectVectorToVector as C,projectPointToVector as j}from"../../../geometry/projection.js";import{getReferenceEllipsoid as A}from"../../../geometry/projectionEllipsoid.js";import{create as M,equals as I,intersection as V,empty as k,expand as O,intersectsSphere as N}from"../../../geometry/support/aaBoundingRect.js";import{create as q,copy as B}from"../../../geometry/support/frustum.js";import{isRefreshableLayer as G}from"../../../layers/mixins/RefreshableLayer.js";import{ElevationQueryTileCache as W}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as F}from"../../../layers/support/layerUtils.js";import{acquireDecoder as H}from"../../../layers/support/LercDecoder.js";import{printAllocations as Q}from"../../2d/engine/vectorTiles/VectorTile.js";import{directionToHeadingTilt as X,scaleToZoom as z}from"../support/cameraUtils.js";import Y from"../support/debugFlags.js";import{toBoundingRect as $}from"../support/extentUtils.js";import{ClientType as K}from"../support/index.js";import{updatingProgress as J}from"../support/updatingProperties.js";import{ElevationBounds as Z}from"./ElevationBounds.js";import{sampleElevation as ee,ElevationData as te}from"./ElevationData.js";import{create as ie}from"./ExtentHelper.js";import{LODSnapping as re,TextureUpdate as se}from"./interfaces.js";import{LayerClass as ae,LayerClasses as ne}from"./LayerClass.js";import{OverlayManager as le}from"./OverlayManager.js";import{PlanarPatch as oe}from"./PlanarPatch.js";import{RenderOrder as he}from"./RenderOrder.js";import{SphericalPatch as de}from"./SphericalPatch.js";import{DEFAULT_TILE_BACKGROUND as pe,MAX_ROOT_TILES as ue,TOO_MANY_ROOT_TILES_AFTER_CHANGE_ERROR as ce,TOO_MANY_ROOT_TILES_FOR_LAYER_ERROR as _e,MAX_MEMORY_LOD_BIAS as ge,ELEVATION_NODATA_VALUE as me}from"./TerrainConst.js";import Te from"./TerrainRenderer.js";import fe from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as ye,internalAssert as ve,isSurfaceLayerView as we,isMapTileLayerView as Se,isElevationLayerView as Le,isVectorTileLayerView as Ee,useFetchTileForLayer as be,isImageryTileLayerView as xe,isTileLayerView as De,releaseTileData as Ue,ENABLE_WATERPROOFNESS_TESTS as Pe}from"./terrainUtils.js";import{SplitLimits as Re,Tile as Ce}from"./Tile.js";import{printAllocations as je}from"./TilePerLayerInfo.js";import{TileUpdate as Ae}from"./TileUpdate.js";import{IteratorPreorder as Me,IteratorPostorder as Ie,hasLoadableSiblings as Ve,sortTilesByPOI as ke,sortTiles as Oe}from"./tileUtils.js";import{TilingSchemeLogic as Ne}from"./TilingSchemeLogic.js";import{UpsampleInfo as qe}from"./UpsampleInfo.js";import{RenderRequestType as Be}from"../webgl-engine/lib/basicInterfaces.js";import{ImmediateTask as Ge,TaskPriority as We,noBudget as Fe}from"../../support/Scheduler.js";const He=l.getLogger("esri.views.3d.terrain.TerrainSurface"),Qe=.25;let Xe=class extends(a.EventedMixin(i)){constructor(e){var t,i;super(e),this._elevationBounds=new Z,this._iteratorPool=new c(Me,(e=>e.remove=()=>this._iteratorPool.release(e))),this._postorderIterator=new Ie,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._visible=!1,this._usedMemory=Je,this._performanceInfo=new fe,this._viewChanged=!1,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=U(),this._eyePosSurfaceSR=U(),this._splitLimits=new Re,this._snapLevel=1/0,this._frustum=q(),this._viewProjectionMatrix=x(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._handles=new n,this._watchUpdatingTracking=new R,this._frameTask=Ge,this._allTiles=new _,this._upsampleInfoPool=new c(qe),this._rootTilesExtent=M(),this._maxNumUpdating=1,this.maxTextureScale=1.2,this.backgroundImage=pe,this.backgroundColor=null,this._updatingRootTiles=!1,this.deferTileNeighborUpdate=!1,this.neighborTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._layerViewsDirty=!1,this._isGlobal=!(null!=(t=e.view)&&null!=(i=t.state)&&i.isLocal)}initialize(){this._lercDecoder=H(this.view.resourceController),this._tilePool=this.view.state.isLocal?new c(oe):new c(de);const e=this.view.resourceController.memoryController;this._upsampleMapCache=e.newCache("esri.views.3d.terrain.upsample",(e=>e.unloadMapData())),this._elevationQueryCache=new W(e.newCache("elevation-query")),this._set("overlayManager",new le({surface:this})),this._handles.add([f((()=>this.overlayManager.hasHighlights),(e=>this._renderer.setNeedsHighlight(e))),f((()=>this.overlayManager.rendersOccluded),(e=>this._renderer.setRenderOccludedOverlay(e)))],"overlayManager"),this._renderer=new Te({overlayRenderer:this.overlayManager.renderer,ellipsoidRadius:A(this.view.spatialReference).radius,stage:this.view._stage,allTiles:this._allTiles}),this._handles.add([f((()=>this.baseOpacity),(e=>{this._handleLayerViewChanges(),this._updateBaseOpacity(e)}),y),f((()=>this.renderingDisabled),(()=>this._updateTransparentTerrain()),v),f((()=>this._background),(()=>{this._handleLayerViewChanges(),this._renderer.setTileBackground(this._background)}),y),f((()=>this.view.pointsOfInterest),(e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add((()=>e.focus.renderLocation),(()=>()=>this._allTilesSorted=!1))})),f((()=>Y.TERRAIN_TILE_TREE_SHOW_TILES),(e=>{e&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then((({TerrainTileTree3DDebugger:e})=>{!this._treeDebugger&&Y.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new e({view:this.view}))})):e||(this._treeDebugger=d(this._treeDebugger))}),w)]),this._extentHelper=ie(this.viewingMode,{layers:this.view.map.allLayers,layerViews:this.view.allLayerViews,viewSpatialReference:this.view.spatialReference});const t=this.view.defaultsFromMap?new s({getCollections:()=>{var e,t,i;return null==(e=this.view)||null==(t=e.defaultsFromMap)||null==(i=t.mapCollections)?void 0:i.map((({layers:e})=>e))},getChildrenFunction:e=>e&&"layers"in e?e.layers:null}):this.view.map.allLayers,i=new Ne({layers:t,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:this.view.spatialReference});this._set("tilingSchemeLogic",i),this._updateTilingScheme(),this._elevationDataRequester=this.view.resourceController.createStreamDataRequester(K.ELEVATION),this._mapDataRequester=this.view.resourceController.createStreamDataRequester(K.BASEMAP);const r=this.view.resourceController.scheduler;this._frameTask=r.registerTask(We.TERRAIN_SURFACE,this),this._handles.add([f((()=>this._extentHelper.stencilEnabledExtents),(e=>this._renderer.setStencilEnabledLayerExtents(e)),w),f((()=>this.tilingSchemeLogic.tilingScheme),(()=>this._updateTilingScheme()),v),f((()=>this.extent),(()=>this._updateRootTiles()),w),this.view.on("resize",(()=>this._viewChangeUpdate())),f((()=>{var e,t;const i=this.view,r=i.state;return[this.lodBias,this.lodSnapping,null==(e=i.resourceController)||null==(t=e.memoryController)?void 0:t.memoryFactor,r.camera,r.contentCamera,r.fixedContentCamera]}),(()=>this._viewChangeUpdate()),y),f((()=>{var e,t;return null==(e=this.view.qualitySettings)||null==(t=e.tiledSurface)?void 0:t.textureFadeDuration}),(e=>this._renderer.textureFadingEnabled=e>0),w),f((()=>this._userClippingExtent),(()=>this._updateClippingExtent()),v)]),this._handles.add(this.view.allLayerViews.on("after-changes",(()=>this._layerViewsDirty=!0))),this._layerViewsDirty=!0,this._handleLayerViewChanges()}destroy(){this._frameTask.remove(),this._handles.destroy(),this._watchUpdatingTracking.destroy(),this._lercDecoder=h(this._lercDecoder),this._removeAllTiles(),this._upsampleMapCache=d(this._upsampleMapCache),this._elevationQueryCache=d(this._elevationQueryCache),this._set("tilingSchemeLogic",d(this.tilingSchemeLogic)),this._extentHelper=d(this._extentHelper),this._basemapLayerViewHandles.forEach(((e,t)=>this._unregisterTiledLayerView(t))),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",d(this.overlayManager)),this._tilePool=d(this._tilePool),Ce.prune(),this._treeDebugger&&(this._treeDebugger.destroy(),this._treeDebugger=null),this._renderer=d(this._renderer),this._iteratorPool=d(this._iteratorPool),this._set("view",null),this._upsampleInfoPool=d(this._upsampleInfoPool),Q(),je()}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){var e,t;const i=null==(e=this.view.pointsOfInterest)||null==(t=e.contentCameraOnSurface)?void 0:t.scale;if(i){const e=this.view.state.contentCamera;let t=X(this.view,e.eye,e.viewForward,e.up).tilt;t>90&&(t=180-t);const r=2*(t/90)**2,s=z(this.view,i)-r;Math.abs(this._snapLevel-s)>Qe&&(Math.round(s)!==Math.round(this._snapLevel)&&(this._viewChanged=!0),this._snapLevel=s)}return Math.round(this._snapLevel)}get lodSnapping(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences?re.ON:re.OFF}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get mapTileRequester(){return this._mapDataRequester}get _userClippingExtent(){const{spatialReference:e}=this,{clippingArea:t}=this.view;if(p(t)||p(e))return null;const i=M(),r=$(t,i,e)?i:null,s=this._get("extent");return I(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=V(this.groundExtent,this._userClippingExtent,M()),t=this._get("extent");return I(e,t)?t:e}get groundExtent(){return u(this._tilingSchemeExtent)?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){var e;return null==(e=this.tilingSchemeLogic)?void 0:e.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this._watchUpdatingTracking.updating||this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||this._asyncWorkItems>0||!this._allTilesSorted||this._renderer.updating||this._layerViewsDirty)&&this.ready&&!this.suspended||this.overlayManager.updating||this._frameTask.updating)}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get viewingMode(){return this.view.state.viewingMode}get ready(){return u(this.rootTiles)}set renderOrder(e){this._renderer.renderOrder=e,this._set("renderOrder",e)}get spatialReference(){var e,t;return null!=(e=null==(t=this.tilingScheme)?void 0:t.spatialReference)?e:null}get _background(){return null!=this.backgroundColor?this.backgroundColor:this.backgroundImage}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._updateTransparentTerrain()}_updateTransparentTerrain(){var e,t;const i=!this.renderingDisabled&&!this.opaque;null==(e=this.view)||null==(t=e._stage)||t.renderView.setRenderParameters({transparentTerrain:i})}set velvetOverground(e){e!==this.velvetOverground&&(this._renderer.velvetOverground=e),this._set("velvetOverground",e)}set visible(e){e!==this._visible&&(this._visible=e,this._renderer.setVisibility(e),this.suspended=!e)}get opaque(){return this._renderer.opaque}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevation(e,t,i,r){const s=this.getTileWithElevation(e,t,i,r,Ze);return p(s)?null:ee(Ze[0],Ze[1],s.renderData.geometryState.samplerData)}getTileWithElevation(e,t,i,r,s=Ze){var a;const n=this.rootTiles;if(p(n)||!n.length)return null;if(0===n[0].layerInfo[ae.ELEVATION].length)return null;if(s[0]=e,s[1]=t,s[2]=i,!C(s,r,s,null==(a=this.tilingScheme)?void 0:a.spatialReference))return He.error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;for(let l of n){if(!l.containsPoint(s))continue;for(;l&&!l.rendered&&!l.isLeaf;){let e=0;s[0]>.5*(l.extent[0]+l.extent[2])&&(e+=1),s[1]<.5*(l.extent[1]+l.extent[3])&&(e+=2),l=l.children[e]}const e=l.renderData;return(e?e.geometryState.samplerData:null)?l:null}return null}get elevationBounds(){return this._elevationBounds}getScale(e){if(this.tilingScheme){if(!j(e,Ze,this.spatialReference))return He.error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this.rootTiles;if(u(t))for(let e of t)if(e.containsPoint(Ze)){for(;null!=e.children[0];){let t=0;Ze[0]>e.children[0].extent[2]&&(t+=1),Ze[1]<e.children[0].extent[1]&&(t+=2),e=e.children[t]}return this._getLodBiasCorrectedScale(e.level)}}return 1e100}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!j(e,Ze,this.spatialReference))return He.error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;Ze[3]=t;let i=null;const r=e=>{if(e&&N(e.extent,Ze))if(null!=e.children[0])for(const t of e.children)r(t);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}},s=this.rootTiles;if(u(s))for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this.lodBias;this._renderer.queryVisibleLevelRange(e,s+n,a+n,r)}_updateBaseOpacity(e){const t=this._renderer.opaque;this._renderer.opaque=e>=1,this._renderer.isTransparent=this._allTransparentSurfaceLayers();const i=t!==this._renderer.opaque;i&&this._updateTransparentTerrain(),this._updateTileTextures(i?se.UNFADED:se.IMMEDIATE)}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;e!==this.tilingScheme&&(ye(!!e,"tiling scheme cannot be reset to undefined"),this.tilingScheme&&this._removeAllTiles(),this._set("tilingScheme",e),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.setTileSize(e.pixelSize),this.overlayManager.setSpatialReference(e.spatialReference),this._updateRootTiles()))}_acquireTile(e,t,i,r){const s=this._tilePool.acquire();return tt[0]=e,tt[1]=t,tt[2]=i,s.init(tt,r,this),s}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const i=et;let s=t.rootTilesInExtent(e,i,5*ue);if(u(this.rootTiles)){if(s.length>ue)return void He.warn(ce);const e=this.rootTiles.map((e=>e.lij)),t=r(e,s,Ye);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this.rootTiles.filter((e=>!(t.removed.findIndex((t=>Ye(t,e.lij)))>-1)||(this._purgeTile(e,!0),!1)));t.added.forEach((t=>e.push(this._newRootTile(t)))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>ue&&(He.warn(_e),s=t.rootTilesInExtent(e,i,ue)),this._setRootTiles(s.map((e=>this._newRootTile(e))));I(i,this._rootTilesExtent)||(this._rootTilesExtent=M(i)),this.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._allTiles.forEach((e=>{e.isLoaded&&this._prepareToLoadTile(e)})),this._allTiles.forAll((e=>{e.isLoaded&&(this._updateTileGeometry(e),this._updateTileNeighborsAfterGeometryChange(e))})),this._updatingRootTiles=!1,this.checkAllTileWaterproofness()}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return t.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===Ae.SPLIT&&t.setPendingUpdate(Ae.SPLIT),this._loadTile(t),t.checkGeometryWaterproofness(),t}_setRootTiles(e){if(this._set("rootTiles",e),this._allTiles.clear(),u(e)){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this.rootTiles),this._updateTilesVisibility(e)}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this._visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this.rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(Ae.GEOMETRY)&&this._updateTileGeometry(e)}_updateTilesVisibility(e){if(p(e))return;const t=Ve(e);let i=t?this._elevationBounds.min:1/0,r=t?this._elevationBounds.max:-1/0;const s=this.extent,a=this._viewProjectionMatrix;this.setTileTreeDirty();const n=this._iteratorPool.acquire();for(n.reset(e);!n.done;){const e=n.next();e.updateClippingStatus(s)&&e.resetPendingUpdate(Ae.GEOMETRY)&&this._updateTileGeometry(e),e.setPendingUpdate(Ae.RENDERDATA),e.computeVisibility(),e.updateScreenDepth(a),e.renderData&&(i=Math.min(e.elevationBounds[0],i),r=Math.max(e.elevationBounds[1],r))}n.remove(),this._viewChanged=!0,this._allTilesDirty=!0,isFinite(i)&&isFinite(r)&&(this._elevationBounds.min===i&&this._elevationBounds.max===r||(this._elevationBounds.min=i,this._elevationBounds.max=r,this.emit("elevation-bounds-change",null)))}_updateViewDependentParameters(){const e=this.view.state.camera,t=this.view.state.contentCamera,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this.lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?(p(this._splitLimits.frustum)&&(this._splitLimits.frustum=q()),B(this._splitLimits.frustum,t.frustum)):this._splitLimits.frustum=null,B(this._frustum,e.frustum),b(this._viewProjectionMatrix,t.projectionMatrix,t.viewMatrix),D(this._eyePosRenderSR,t.eye),C(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateRenderData(e){e.rendered&&!e.shouldLoad&&($e(e)?(this._loadChildren(e),this._checkTileNeighborsWaterproofness(e),e.children.forEach((e=>e.checkGeometryWaterproofness()))):Ke(e)&&this._loadParent(e))}_updateTileGeometry(e){e.updateVisibility(),this._renderer.updateTileGeometry(e),this._updateTileNeighborsAfterGeometryChange(e),this._elevationUpdate(e),this._usedMemory=Je,this.deferTileNeighborUpdate&&this.neighborTilesToUpdate.delete(e)}_updateTileNeighborsAfterGeometryChange(e,t){if(this.deferTileNeighborUpdate){const t=this.neighborTilesToUpdate;e.forEachLoadedNeighbor((e=>{t.add(e)}))}else e.updateNeighborsAfterGeometryChange(t)}_updateTileTexture(e,t){const i=e.resetPendingUpdate(Ae.TEXTURE_FADING)?Ae.TEXTURE_FADING:!!e.resetPendingUpdate(Ae.TEXTURE_NOFADING)&&Ae.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=Je,t.madeProgress())}_elevationUpdate(e){rt.spatialReference=this.spatialReference,rt.tile=e,rt.extent=e.extent,this.emit("elevation-change",rt)}get running(){return this.updating&&this.ready&&!this.suspended}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateTileStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;this._mergeAndSplit(e,t),e.run((()=>this._updateElevation(e))),e.run((()=>this._updateTextures(e))),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),e.done&&this.requestUpdate(),this.notifyChange("updatingProgressValue")}_updateTileStatus(e){if(!this._viewChanged||!this.rootTiles||e.done)return;this._viewChanged=!1;const t=this._iteratorPool.acquire();for(t.reset(this.rootTiles);!t.done;){const e=t.next(),i=e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping);if(i!==Ae.SPLIT){if(e.resetPendingUpdate(Ae.SPLIT)&&e.updateAgentSuspension(),i===Ae.VSPLITMERGE&&e.updateAgents(ae.ELEVATION),t.skipSubtree(),!e.isLeaf){e.setPendingUpdate(Ae.MERGE),e.resetPendingUpdate(Ae.SPLIT);const t=this._iteratorPool.acquire();t.resetOne(e);for(let e=t.next();!t.done;e=t.next())this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(this._viewProjectionMatrix);t.remove()}}else e.resetPendingUpdate(Ae.MERGE),e.isLeaf&&(e.setPendingUpdate(Ae.SPLIT),t.skipSubtree())}t.remove(),this.requestUpdate(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||(ke(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),e.madeProgress())}_prepareBatchTileGeometryUpdate(){ve(0===this.neighborTilesToUpdate.size),this.deferTileNeighborUpdate=!0}_batchUpdateUpdatedTileNeighbors(){this.deferTileNeighborUpdate=!1;const e=this.neighborTilesToUpdate;(()=>{const t=()=>{for(const t of e)t.updateNeighborsWithChangedEdgeResolution()};(()=>{for(const t of e)t.updateNeighborDataAndGeometryIfNeeded()})(),t(),e.clear()})()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=0;this._prepareBatchTileGeometryUpdate();let r=!1;for(;!e.done;){let s=!1;i=0;const a=!this._allTiles.some((a=>{if(r)i+=a.usedMemory;else if(!a.loadable)return e.done;if(a.resetPendingUpdate(Ae.MERGE)){if(!t)return a.setPendingUpdate(Ae.MERGE),e.done;this._mergeTile(a),s=!0,e.madeProgress()}else a.resetPendingUpdate(Ae.SPLIT)&&(this._splitTile(a),s=!0,e.madeProgress());return!e.done&&a.resetPendingUpdate(Ae.RENDERDATA)&&(this._updateRenderData(a),e.madeProgress()),e.done}));if(s&&(this._allTilesSorted=!1,this._allTilesDirty=!0),a){if(!r){r=!0;continue}if(this._usedMemory=i,!s)break;this._updateTilesVisibility(this.rootTiles)}else this._allTilesDirty=!0}0===i&&(this._allTilesDirty=!0),this._batchUpdateUpdatedTileNeighbors(),this._sortTiles(e)}_updateElevation(e){return this._prepareBatchTileGeometryUpdate(),this._allTiles.some((t=>(t.resetPendingUpdate(Ae.GEOMETRY)&&(this._updateTileGeometry(t),this._updateTileTexture(t,e),e.madeProgress()),e.done))),this._batchUpdateUpdatedTileNeighbors(),e.hasProgressed}_updateTextures(e){return this._allTiles.some((t=>(this._updateTileTexture(t,e),e.done))),e.hasProgressed}_updateClippingExtent(){this.spatialReference&&(this.updateTileOverlayParams(Be.UPDATE),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get lodBias(){const e=this.view.resourceController.memoryController.memoryFactor;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*ge}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=o(e-this.lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){u(this.rootTiles)&&(this.rootTiles.forEach((e=>this._purgeTile(e,!1))),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.visible=!1}_purgeDescendantTiles(e){if(e.isLeaf)return!1;let t=!1;for(let i=0;i<4;++i)t=this._purgeTile(e.children[i],!1)||t;return e.unsetChildren(),t}_purgeTile(e,t){const i=this._purgeDescendantTiles(e)||e.rendered;return this._allTiles.removeUnordered(e),this._unloadTile(e),t&&this._updateTileNeighborsAfterGeometryChange(e),this._tilePool.release(e),i}_unloadTile(e){this.deferTileNeighborUpdate&&this.neighborTilesToUpdate.delete(e),e.unload(this._renderer)}_splitTile(e){ye(e.isLeaf,"tile that is already split should not be split again!");const t=e.level+1,i=2*e.lij[1],r=2*e.lij[2];e.setChildren(this._createTile(t,i,r,e),this._createTile(t,i,r+1,e),this._createTile(t,i+1,r,e),this._createTile(t,i+1,r+1,e)),e.setPendingUpdate(Ae.RENDERDATA),e.updateAgentSuspension(),this._allTiles.pushArray(e.children),this._allTilesDirty=!0,this._emitTileScaleChange(e,t),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){st.spatialReference=this.spatialReference,st.extent=e.extent,st.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",st)}_createTile(e,t,i,r){ye(!!r,"_createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.updateScreenDepth(this._viewProjectionMatrix),s.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===Ae.SPLIT&&s.setPendingUpdate(Ae.SPLIT),s}_mergeTile(e){ye(!e.hasPendingUpdate(Ae.SPLIT),"_mergeTile sanity check"),this._purgeDescendantTiles(e)&&(ye(!e.renderData,"_mergeTile sanity check"),this._loadTile(e),this._updateTileNeighborsAfterGeometryChange(e),this._checkTileAndNeighborsWaterproofness(e)),this._allTilesDirty=!0,++this._performanceInfo.numMerged,this._emitTileScaleChange(e)}_checkTileAndNeighborsWaterproofness(e){e.checkGeometryWaterproofness(),this._checkTileNeighborsWaterproofness(e)}_checkTileNeighborsWaterproofness(e){Pe&&e.forallNeighbors((e=>!!e.isLoaded&&(e.checkGeometryWaterproofness(),!0)))}_loadChildren(e){this._checkTileAndNeighborsWaterproofness(e),ye(e.rendered,"parent should be rendered"),this._unloadTile(e);const t=e.children;t.forEach((e=>this._prepareToLoadTile(e))),t.forEach((e=>this._loadTilePrepared(e))),this._updateTileNeighborsAfterGeometryChange(e,e.level+1),this.deferTileNeighborUpdate||t.forEach((e=>e.updateNeighborsWithChangedEdgeResolution())),t.forEach((e=>e.checkGeometryWaterproofness())),this._checkTileNeighborsWaterproofness(e)}_loadParent(e){this._checkTileAndNeighborsWaterproofness(e);const t=e.parent;this._unloadChildren(t),this._loadTile(t),this._updateTileNeighborsAfterGeometryChange(t),this._checkTileAndNeighborsWaterproofness(t)}_unloadChildren(e){if(!e.isLeaf)for(let t=0;t<4;++t){const i=e.children[t];this._unloadChildren(i),this._unloadTile(i)}}_postLoadTile(e){e.setPendingUpdate(Ae.RENDERDATA),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager&&this.overlayManager.hasOverlays&&this.overlayManager.setTileParameters(e),this._elevationUpdate(e)}_loadTile(e){e.load(this._renderer),this._postLoadTile(e)}_loadTilePrepared(e){e.loadPrepared(this._renderer),this._postLoadTile(e)}_prepareToLoadTile(e){e.prepareToLoad(this._renderer)}_elevationDataArrived(e,t,i){const r=new te(e.lij,e.extent,i);e.dataArrived(t,ae.ELEVATION,r);const s=[e],a=e.level,n=this._iteratorPool.acquire();for(n.reset(s);!n.done;){const e=n.next();e.findElevationBoundsForLayer(t,a),e.computeElevationBounds()}n.remove(),this._updateTilesVisibility(s)}_handleLayerViewChanges(e=Fe){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(const s of this.view.allLayerViews.items)if(i.add(s.uid),we(s))if(this._basemapLayerViewHandles.has(s.uid)){const e=this._layerClassFromLayerView(s),i=this._layerIndexByUid[e].get(s.uid);i<r&&(t=!0),r=i}else this._registerTiledLayerView(s),s.layer.loaded&&(t=!0);this._basemapLayerViewHandles.forEach(((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)})),t&&this._updateTiledLayers(),this._renderer.isTransparent=this._allTransparentSurfaceLayers(),e.madeProgress()}_allTransparentSurfaceLayers(){var e,t;let i=0===(null==(e=this.view.map)||null==(t=e.ground)?void 0:t.opacity);for(const r of this.view.allLayerViews.items)if(Se(r)&&!F(r.layer)&&0!==r.fullOpacity)return i=!1,i;return i}_layerClassFromLayerView(e){return Le(e)?ae.ELEVATION:ae.MAP}_registerTiledLayerView(e){const t=[],i=this._layerClassFromLayerView(e);t.push(f((()=>e.suspended),(()=>this._updateTiledLayers()))),t.push(f((()=>e.fullOpacity),(()=>this._updateTileTextures(se.UNFADED)))),t.push(f((()=>"effectiveScaleRange"in e.layer?e.layer.effectiveScaleRange:null),(()=>this._restartAllAgents(i)))),e.on("data-changed",(()=>{const t=this._layerIndexByUid[i].get(e.uid);null!=t&&this._invalidateLayerData(t,i)})),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(let e=0;e<t.length;e++)t[e].remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;const r=k();e.forEach((e=>{const s=e.layer;if(!s||e.suspended||!we(e))return;const a=e.fullExtent;if(!a)return void He.warn("Terrain: Map or elevation layer does not have fullExtent: "+s.id);O(r,a,r);const n=this._layerClassFromLayerView(e);if(n===ae.MAP){const t=e.displayLevelRange;t.maxLevel!==1/0&&(null===i||t.maxLevel>i)&&(i=t.maxLevel)}t[n].push(e)}));for(const s of ne){const e=this._layerViews[s],i=t[s];i.reverse();const r=i.length;let a=e.length!==r;const n=new Array(r),l=new Array(e.length);this._layerIndexByUid[s].clear();for(let t=0;t<r;t++){const r=i[t].uid;this._layerIndexByUid[s].set(r,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this.rootTiles);!e.done;)e.next().modifyLayers(l,n,s);this._layerViews[s]=i,this._restartAllAgents(s),this._updateTilesVisibility(this.rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&this._viewChangeUpdate()}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this.rootTiles);!t.done;){const i=t.next();i.restartAgents(e),e===ae.ELEVATION&&i.computeElevationBounds()}}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll((t=>{t.updateAgents(ae.MAP),e===se.IMMEDIATE?this.renderer.updateTileTexture(t,Ae.TEXTURE_NOFADING):t.updateRenderData(ae.MAP,e)})),this._renderer.isTransparent=this._allTransparentSurfaceLayers()}_invalidateLayerData(e,t){this._allTiles.forAll((i=>i.removeLayerAgent(e,t))),this._allTiles.forAll((i=>i.invalidateLayerData(e,t)))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=Be.UPDATE){this.renderer.setNeedsRender(e)}requestUpdate(){1==++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||Ee(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.lij[0],e.lij[1],e.lij[2],{...r,timeout:6e3}).then((()=>--this._asyncWorkItems)).catch((t=>{throw--this._asyncWorkItems,g(t)||this._dataMissing(e,i,s,{notInTilemap:!0}),t})).then((()=>this._frameTask.schedule((()=>this._requestTileData(e,i,s,r)),r.signal))))}_requestTileData(e,t,i,r){return t===ae.ELEVATION?Le(i)?this._requestElevationTileData(e,i,r):Promise.reject():Se(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{if(--this._asyncWorkItems,m(i))return;const s=this._layerIndexByUid[ae.ELEVATION].get(t.uid);null!=s?(this._usedMemory=Je,this.requestUpdate(),this._elevationDataArrived(e,s,r)):He.warn("TerrainSurface: received data from unknown layer %d %s",ae.ELEVATION,e.lij.toString())},s=i=>{--this._asyncWorkItems,g(i)||(this._dataMissing(e,ae.ELEVATION,t,i),this.requestUpdate())};if(be(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],{noDataValue:me,signal:i.signal}).then((e=>{if(m(i))return He.warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),void s(T());this._frameTask.schedule((()=>r(e)),i.signal,s)}),s);const a=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);return this._elevationDataRequester.request(a,"binary",i).then((e=>this._lercDecoder.decode(e,{noDataValue:me},i.signal))).then((e=>{r({values:e.pixelData,width:e.width,height:e.height,noDataValue:e.noDataValue,minValue:e.minValue,maxValue:e.maxValue})}),s)}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{--this._asyncWorkItems,Ue(s),m(i)||(this._dataMissing(e,ae.MAP,t,r),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule((()=>{--this._asyncWorkItems,this.requestUpdate(),m(i)?Ue(r):this._mapTileDataArrived(e,t,r)}),i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule((()=>r(e,t)));if(Ee(t)){const r=t.schemaHelper.getLevelRowColumn(e.lij);return t.fetchTile(r[0],r[1],r[2],i).then(a,n)}if(xe(t))return t.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then(a,n);if(De(t)&&be(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then((e=>{if(m(i))return He.warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),void n(T());a(e)}),n);let l=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);G(t.layer)&&t.layer.refreshTimestamp&&(l+=`${l.includes("?")?"&":"?"}_ts=${t.layer.refreshTimestamp}`);const o=t.hasMixedImageFormats?"image+type":"image";return this._mapDataRequester.request(l,o,i).then(a,n)}_mapTileDataArrived(e,t,i){const r=this._layerIndexByUid[ae.MAP].get(t.uid);null!=r?e.dataArrived(r,ae.MAP,i):(Ue(i),He.warn("TerrainSurface: received data from unknown layer"))}_dataMissing(e,t,i,r){const s=this._layerIndexByUid[t].get(i.uid);null!=s?e.dataMissing(s,t,r):He.warn("TerrainSurface: received data from unknown layer")}updateTileOverlayParams(e){this.rootTiles&&this.overlayManager&&(this._allTiles.forAll((e=>{e.renderData&&this.overlayManager.setTileParameters(e)})),this._renderer.setNeedsRender(e))}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll((t=>{t.isLeaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))})),e}getUsedMemory(){return this.tilingScheme?(this._usedMemory===Je&&(this._usedMemory=0,this._allTiles.forAll((e=>this._usedMemory+=e.usedMemory))),this._usedMemory):0}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this._layerIndexByUid[i].get(e.uid);return this._allTiles.forAll((e=>t+=e.getUsedMemoryForLayer(i,r))),t}getTile(e){if(p(e)||p(this.rootTiles))return null;const t=e.split("/").map((e=>+e));if(0===t[0])return this.rootTiles.find((e=>e.lij[1]===t[1]&&e.lij[2]===t[2]));const i=2**t[0],r=Math.floor(t[1]/i),s=Math.floor(t[2]/i);let a;if(this.rootTiles.some((e=>e.lij[1]===r&&e.lij[2]===s&&(a=e,!0))),a){let e=1<<t[0]-1;for(;a.lij[0]<t[0];){let i=t[1]&e?2:0;if((t[2]&e)>0&&i++,!a.children[i])return null;a=a.children[i],e>>=1}return ye(a.lij[0]===t[0]&&a.lij[1]===t[1]&&a.lij[2]===t[2],"not the right tile?"),a}return null}get test(){const e=this;return{renderer:e._renderer,lercDecoder:e._lercDecoder,forceReload:()=>{u(e.rootTiles)&&(e._mergeTile(e.rootTiles[0]),e._viewChangeUpdate())},getTiles:()=>e._allTiles.toArray(),getRenderedTiles(){it.clear(),e._allTiles.forAll((e=>{e.visible&&e.rendered&&it.push(e)}));const t=it.toArray();return Oe(e.renderOrder,t),t},lockTilingScheme(t,i){e._extentHelper.defaultTiledLayersExtent=i,e.tilingSchemeLogic.test.lockTilingScheme(t)}}}checkAllTileWaterproofness(){if(!Pe)return;const e=this.rootTiles;if(p(e))return;const t=e=>{var t,i,r,s;return null!=(t=(null==e||null==(i=e.renderData)||null==(r=i.geometryInfo)||null==(s=r.indices)?void 0:s.length)>0)&&t},i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{var s,a,n;if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometryInfo&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),null==(s=e.renderData)||!s.geometryInfo||(null!=(a=null==(n=e.renderData.geometryInfo.indices)?void 0:n.length)?a:0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometryInfo),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.isLeaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{var t,i;const r=null==(t=null==(i=e.parent)?void 0:i.visible)||t,a=e.visible;e.computeVisibility();const n=e.visible;if(a!==n&&r&&console.error(" Tile[",e.lij,"] has out of date visibility: ",a," instead of ",n),!e.isLeaf)for(const l of e.children)s(l)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}isEastEndWrap(e){return this.isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this.isGlobal&&0===e[2]}lijEastEnd(e){return 2**(e+(this.spatialReference.isGeographic?1:0))}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this.isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}};e([L()],Xe.prototype,"_renderer",void 0),e([L()],Xe.prototype,"_hasPendingUpdates",void 0),e([L()],Xe.prototype,"_asyncWorkItems",void 0),e([L()],Xe.prototype,"_allTilesDirty",void 0),e([L()],Xe.prototype,"_allTilesSorted",void 0),e([L()],Xe.prototype,"_viewChanged",void 0),e([L({readOnly:!0})],Xe.prototype,"_watchUpdatingTracking",void 0),e([L()],Xe.prototype,"_frameTask",void 0),e([L({readOnly:!0})],Xe.prototype,"snapLevel",null),e([L({readOnly:!0})],Xe.prototype,"lodSnapping",null),e([L({constructOnly:!0})],Xe.prototype,"view",void 0),e([L()],Xe.prototype,"_userClippingExtent",null),e([L()],Xe.prototype,"_rootTilesExtent",void 0),e([L({readOnly:!0})],Xe.prototype,"extent",null),e([L({readOnly:!0})],Xe.prototype,"groundExtent",null),e([L({readOnly:!0})],Xe.prototype,"_tilingSchemeExtent",null),e([L({readOnly:!0})],Xe.prototype,"updating",null),e([L(J)],Xe.prototype,"updatingProgress",void 0),e([L({readOnly:!0})],Xe.prototype,"updatingProgressValue",null),e([L()],Xe.prototype,"_maxNumUpdating",void 0),e([L({aliasOf:"view.map.ground.opacity"})],Xe.prototype,"baseOpacity",void 0),e([L({readOnly:!0})],Xe.prototype,"overlayManager",void 0),e([L({readOnly:!0})],Xe.prototype,"viewingMode",null),e([L()],Xe.prototype,"maxTextureScale",void 0),e([L({readOnly:!0})],Xe.prototype,"ready",null),e([L({value:he.FRONT_TO_BACK})],Xe.prototype,"renderOrder",null),e([L({readOnly:!0})],Xe.prototype,"rootTiles",void 0),e([L({readOnly:!0})],Xe.prototype,"spatialReference",null),e([L()],Xe.prototype,"backgroundImage",void 0),e([L({type:t,aliasOf:"view.map.ground.surfaceColor"})],Xe.prototype,"backgroundColor",void 0),e([L()],Xe.prototype,"_background",null),e([L({value:!1})],Xe.prototype,"slicePlaneEnabled",null),e([L({readOnly:!0})],Xe.prototype,"tilingScheme",void 0),e([L({readOnly:!0,aliasOf:"tilingSchemeLogic.tilingSchemeLocked"})],Xe.prototype,"tilingSchemeLocked",void 0),e([L({readOnly:!0})],Xe.prototype,"tilingSchemeLogic",void 0),e([L({value:!0})],Xe.prototype,"velvetOverground",null),e([S("_renderer.wireframe")],Xe.prototype,"wireframe",void 0),e([L({value:!1})],Xe.prototype,"suspended",null),e([L({readOnly:!0,aliasOf:"view.qualitySettings.tiledSurface.textureFadeDuration"})],Xe.prototype,"textureFadeDuration",void 0),e([L()],Xe.prototype,"_layerViewsDirty",void 0),e([S("_renderer.renderPatchBorders")],Xe.prototype,"renderPatchBorders",void 0),e([S("_renderer.renderingDisabled")],Xe.prototype,"renderingDisabled",void 0),Xe=e([E("esri.views.3d.terrain.TerrainSurface")],Xe);const ze=Xe;function Ye(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function $e(e){return!e.isLeaf&&(e.children.some((e=>e.shouldLoad))||e.children.some((e=>$e(e))))}function Ke(e){return e.isLeaf&&e.parent&&e.parent.shouldLoad}const Je=-1,Ze=P(),et=M(),tt=[0,0,0],it=new _,rt={spatialReference:null,tile:null,extent:null,context:"ground"},st={spatialReference:null,extent:null,scale:0};export{ze as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import a from"../../../core/Evented.js";import n from"../../../core/Handles.js";import o from"../../../core/Logger.js";import{clamp as l}from"../../../core/mathUtils.js";import{releaseMaybe as h,destroyMaybe as d,isNone as p,isSome as u}from"../../../core/maybe.js";import c from"../../../core/ObjectPool.js";import _ from"../../../core/PooledArray.js";import{isAbortError as g,isAborted as m,createAbortError as f}from"../../../core/promiseUtils.js";import{watch as T,syncAndInitial as y,sync as v,initial as w}from"../../../core/reactiveUtils.js";import{aliasOf as S}from"../../../core/accessorSupport/decorators/aliasOf.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{property as L}from"../../../core/accessorSupport/decorators/property.js";import{subclass as E}from"../../../core/accessorSupport/decorators/subclass.js";import{m as b}from"../../../chunks/mat4.js";import{c as x}from"../../../chunks/mat4f64.js";import{c as D}from"../../../chunks/vec3.js";import{c as P}from"../../../chunks/vec3f64.js";import{c as U}from"../../../chunks/vec4f64.js";import{WatchUpdatingTracking as R}from"../../../core/support/WatchUpdatingTracking.js";import{projectVectorToVector as C,projectPointToVector as j}from"../../../geometry/projection.js";import{getReferenceEllipsoid as M}from"../../../geometry/projectionEllipsoid.js";import{create as A,equals as I,intersection as V,empty as k,expand as O,intersectsSphere as N}from"../../../geometry/support/aaBoundingRect.js";import{create as q,copy as B}from"../../../geometry/support/frustum.js";import{isPlateCarree as G}from"../../../geometry/support/spatialReferenceUtils.js";import{isRefreshableLayer as W}from"../../../layers/mixins/RefreshableLayer.js";import{ElevationQueryTileCache as F}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as H}from"../../../layers/support/layerUtils.js";import{acquireDecoder as Q}from"../../../layers/support/LercDecoder.js";import{printAllocations as X}from"../../2d/engine/vectorTiles/VectorTile.js";import{directionToHeadingTilt as z,scaleToZoom as Y}from"../support/cameraUtils.js";import $ from"../support/debugFlags.js";import{toBoundingRect as K}from"../support/extentUtils.js";import{ClientType as J}from"../support/index.js";import{updatingProgress as Z}from"../support/updatingProperties.js";import{ElevationBounds as ee}from"./ElevationBounds.js";import{sampleElevation as te,ElevationData as ie}from"./ElevationData.js";import{create as re}from"./ExtentHelper.js";import{LODSnapping as se,TextureUpdate as ae}from"./interfaces.js";import{LayerClass as ne,LayerClasses as oe}from"./LayerClass.js";import{OverlayManager as le}from"./OverlayManager.js";import{PlanarPatch as he}from"./PlanarPatch.js";import{RenderOrder as de}from"./RenderOrder.js";import{SphericalPatch as pe}from"./SphericalPatch.js";import{DEFAULT_TILE_BACKGROUND as ue,MAX_ROOT_TILES as ce,TOO_MANY_ROOT_TILES_AFTER_CHANGE_ERROR as _e,TOO_MANY_ROOT_TILES_FOR_LAYER_ERROR as ge,MAX_MEMORY_LOD_BIAS as me,ELEVATION_NODATA_VALUE as fe}from"./TerrainConst.js";import Te from"./TerrainRenderer.js";import ye from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as ve,internalAssert as we,isSurfaceLayerView as Se,isMapTileLayerView as Le,isElevationLayerView as Ee,isVectorTileLayerView as be,useFetchTileForLayer as xe,isImageryTileLayerView as De,isTileLayerView as Pe,releaseTileData as Ue,ENABLE_WATERPROOFNESS_TESTS as Re}from"./terrainUtils.js";import{SplitLimits as Ce,Tile as je}from"./Tile.js";import{printAllocations as Me}from"./TilePerLayerInfo.js";import{TileUpdate as Ae}from"./TileUpdate.js";import{IteratorPreorder as Ie,IteratorPostorder as Ve,hasLoadableSiblings as ke,sortTilesByPOI as Oe,sortTiles as Ne}from"./tileUtils.js";import{TilingSchemeLogic as qe}from"./TilingSchemeLogic.js";import{UpsampleInfo as Be}from"./UpsampleInfo.js";import{RenderRequestType as Ge}from"../webgl-engine/lib/basicInterfaces.js";import{ImmediateTask as We,TaskPriority as Fe,noBudget as He}from"../../support/Scheduler.js";const Qe=o.getLogger("esri.views.3d.terrain.TerrainSurface"),Xe=.25;let ze=class extends(a.EventedMixin(i)){constructor(e){super(e),this._elevationBounds=new ee,this._iteratorPool=new c(Ie,(e=>e.remove=()=>this._iteratorPool.release(e))),this._postorderIterator=new Ve,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._visible=!1,this._usedMemory=Ze,this._performanceInfo=new ye,this._viewChanged=!1,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=P(),this._eyePosSurfaceSR=P(),this._splitLimits=new Ce,this._snapLevel=1/0,this._frustum=q(),this._viewProjectionMatrix=x(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._handles=new n,this._watchUpdatingTracking=new R,this._frameTask=We,this._allTiles=new _,this._upsampleInfoPool=new c(Be),this.isWebMercator=!1,this.isWebMercatorOnPlateeCarree=!1,this._rootTilesExtent=A(),this._maxNumUpdating=1,this.maxTextureScale=1.2,this.backgroundImage=ue,this.backgroundColor=null,this._updatingRootTiles=!1,this.deferTileNeighborUpdate=!1,this.neighborTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._layerViewsDirty=!1,this._isGlobal=!e.view?.state?.isLocal}initialize(){this._lercDecoder=Q(this.view.resourceController),this._tilePool=this.view.state.isLocal?new c(he):new c(pe);const e=this.view.resourceController.memoryController;this._upsampleMapCache=e.newCache("esri.views.3d.terrain.upsample",(e=>e.unloadMapData())),this._elevationQueryCache=new F(e.newCache("elevation-query")),this._set("overlayManager",new le({surface:this})),this._handles.add([T((()=>this.overlayManager.hasHighlights),(e=>this._renderer.setNeedsHighlight(e))),T((()=>this.overlayManager.rendersOccluded),(e=>this._renderer.setRenderOccludedOverlay(e)))],"overlayManager"),this._renderer=new Te({overlayRenderer:this.overlayManager.renderer,ellipsoidRadius:M(this.view.spatialReference).radius,stage:this.view._stage,allTiles:this._allTiles}),this._handles.add([T((()=>this.baseOpacity),(e=>{this._handleLayerViewChanges(),this._updateBaseOpacity(e)}),y),T((()=>this.renderingDisabled),(()=>this._updateTransparentTerrain()),v),T((()=>this._background),(()=>{this._handleLayerViewChanges(),this._renderer.setTileBackground(this._background)}),y),T((()=>this.view.pointsOfInterest),(e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add((()=>e.focus.renderLocation),(()=>()=>this._allTilesSorted=!1))})),T((()=>$.TERRAIN_TILE_TREE_SHOW_TILES),(e=>{e&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then((({TerrainTileTree3DDebugger:e})=>{!this._treeDebugger&&$.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new e({view:this.view}))})):e||(this._treeDebugger=d(this._treeDebugger))}),w)]),this._extentHelper=re(this.viewingMode,{layers:this.view.map.allLayers,layerViews:this.view.allLayerViews,viewSpatialReference:this.view.spatialReference});const t=this.view.defaultsFromMap?new s({getCollections:()=>this.view?.defaultsFromMap?.mapCollections?.map((({layers:e})=>e)),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}):this.view.map.allLayers,i=new qe({layers:t,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:this.view.spatialReference});this._set("tilingSchemeLogic",i),this._updateTilingScheme(),this._elevationDataRequester=this.view.resourceController.createStreamDataRequester(J.ELEVATION),this._mapDataRequester=this.view.resourceController.createStreamDataRequester(J.BASEMAP);const r=this.view.resourceController.scheduler;this._frameTask=r.registerTask(Fe.TERRAIN_SURFACE,this),this._handles.add([T((()=>this._extentHelper.stencilEnabledExtents),(e=>this._renderer.setStencilEnabledLayerExtents(e)),w),T((()=>this.tilingSchemeLogic.tilingScheme),(()=>this._updateTilingScheme()),v),T((()=>this.extent),(()=>this._updateRootTiles()),w),this.view.on("resize",(()=>this._viewChangeUpdate())),T((()=>{const e=this.view,t=e.state;return[this.lodBias,this.lodSnapping,e.resourceController?.memoryController?.memoryFactor,t.camera,t.contentCamera,t.fixedContentCamera]}),(()=>this._viewChangeUpdate()),y),T((()=>this.view.qualitySettings?.tiledSurface?.textureFadeDuration),(e=>this._renderer.textureFadingEnabled=e>0),w),T((()=>this._userClippingExtent),(()=>this._updateClippingExtent()),v)]),this._handles.add(this.view.allLayerViews.on("after-changes",(()=>this._layerViewsDirty=!0))),this._layerViewsDirty=!0,this._handleLayerViewChanges()}destroy(){this._frameTask.remove(),this._handles.destroy(),this._watchUpdatingTracking.destroy(),this._lercDecoder=h(this._lercDecoder),this._removeAllTiles(),this._upsampleMapCache=d(this._upsampleMapCache),this._elevationQueryCache=d(this._elevationQueryCache),this._set("tilingSchemeLogic",d(this.tilingSchemeLogic)),this._extentHelper=d(this._extentHelper),this._basemapLayerViewHandles.forEach(((e,t)=>this._unregisterTiledLayerView(t))),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",d(this.overlayManager)),this._tilePool=d(this._tilePool),je.prune(),this._treeDebugger&&(this._treeDebugger.destroy(),this._treeDebugger=null),this._renderer=d(this._renderer),this._iteratorPool=d(this._iteratorPool),this._set("view",null),this._upsampleInfoPool=d(this._upsampleInfoPool),X(),Me()}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){const e=this.view.pointsOfInterest?.contentCameraOnSurface?.scale;if(e){const t=this.view.state.contentCamera;let i=z(this.view,t.eye,t.viewForward,t.up).tilt;i>90&&(i=180-i);const r=2*(i/90)**2,s=Y(this.view,e)-r;Math.abs(this._snapLevel-s)>Xe&&(Math.round(s)!==Math.round(this._snapLevel)&&(this._viewChanged=!0),this._snapLevel=s)}return Math.round(this._snapLevel)}get lodSnapping(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences?se.ON:se.OFF}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get mapTileRequester(){return this._mapDataRequester}get _userClippingExtent(){const{spatialReference:e}=this,{clippingArea:t}=this.view;if(p(t)||p(e))return null;const i=A(),r=K(t,i,e)?i:null,s=this._get("extent");return I(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=V(this.groundExtent,this._userClippingExtent,A()),t=this._get("extent");return I(e,t)?t:e}get groundExtent(){return u(this._tilingSchemeExtent)?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this._watchUpdatingTracking.updating||this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||this._asyncWorkItems>0||!this._allTilesSorted||this._renderer.updating||this._layerViewsDirty)&&this.ready&&!this.suspended||this.overlayManager.updating||this._frameTask.updating)}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get viewingMode(){return this.view.state.viewingMode}get ready(){return u(this.rootTiles)}set renderOrder(e){this._renderer.renderOrder=e,this._set("renderOrder",e)}get spatialReference(){return this.tilingScheme?.spatialReference??null}get _background(){return null!=this.backgroundColor?this.backgroundColor:this.backgroundImage}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._updateTransparentTerrain()}_updateTransparentTerrain(){const e=!this.renderingDisabled&&!this.opaque;this.view?._stage?.renderView.setRenderParameters({transparentTerrain:e})}set velvetOverground(e){e!==this.velvetOverground&&(this._renderer.velvetOverground=e),this._set("velvetOverground",e)}set visible(e){e!==this._visible&&(this._visible=e,this._renderer.setVisibility(e),this.suspended=!e)}get opaque(){return this._renderer.opaque}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevation(e,t,i,r){const s=this.getTileWithElevation(e,t,i,r,et);return p(s)?null:te(et[0],et[1],s.renderData.geometryState.samplerData)}getTileWithElevation(e,t,i,r,s=et){const a=this.rootTiles;if(p(a)||!a.length)return null;if(0===a[0].layerInfo[ne.ELEVATION].length)return null;if(s[0]=e,s[1]=t,s[2]=i,!C(s,r,s,this.tilingScheme?.spatialReference))return Qe.error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;for(let n of a){if(!n.containsPoint(s))continue;for(;n&&!n.rendered&&!n.isLeaf;){let e=0;s[0]>.5*(n.extent[0]+n.extent[2])&&(e+=1),s[1]<.5*(n.extent[1]+n.extent[3])&&(e+=2),n=n.children[e]}const e=n.renderData;return(e?e.geometryState.samplerData:null)?n:null}return null}get elevationBounds(){return this._elevationBounds}getScale(e){if(this.tilingScheme){if(!j(e,et,this.spatialReference))return Qe.error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this.rootTiles;if(u(t))for(let e of t)if(e.containsPoint(et)){for(;null!=e.children[0];){let t=0;et[0]>e.children[0].extent[2]&&(t+=1),et[1]<e.children[0].extent[1]&&(t+=2),e=e.children[t]}return this._getLodBiasCorrectedScale(e.level)}}return 1e100}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!j(e,et,this.spatialReference))return Qe.error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;et[3]=t;let i=null;const r=e=>{if(e&&N(e.extent,et))if(null!=e.children[0])for(const t of e.children)r(t);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}},s=this.rootTiles;if(u(s))for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this.lodBias;this._renderer.queryVisibleLevelRange(e,s+n,a+n,r)}_updateBaseOpacity(e){const t=this._renderer.opaque;this._renderer.opaque=e>=1,this._renderer.isTransparent=this._allTransparentSurfaceLayers();const i=t!==this._renderer.opaque;i&&this._updateTransparentTerrain(),this._updateTileTextures(i?ae.UNFADED:ae.IMMEDIATE)}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;if(!(e!==this.tilingScheme))return;ve(!!e,"tiling scheme cannot be reset to undefined"),this.tilingScheme&&this._removeAllTiles(),this._set("tilingScheme",e),this.isWebMercator=this.tilingScheme?.spatialReference.isWebMercator;const t=this.view?.renderSpatialReference,i=u(t)&&G(t);this.isWebMercatorOnPlateeCarree=this.isWebMercator&&i,this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.setTileSize(e.pixelSize),this.overlayManager.setSpatialReference(e.spatialReference),this._updateRootTiles())}_acquireTile(e,t,i,r){const s=this._tilePool.acquire();return it[0]=e,it[1]=t,it[2]=i,s.init(it,r,this),s}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const i=tt;let s=t.rootTilesInExtent(e,i,5*ce);if(u(this.rootTiles)){if(s.length>ce)return void Qe.warn(_e);const e=this.rootTiles.map((e=>e.lij)),t=r(e,s,$e);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this.rootTiles.filter((e=>!(t.removed.findIndex((t=>$e(t,e.lij)))>-1)||(this._purgeTile(e,!0),!1)));t.added.forEach((t=>e.push(this._newRootTile(t)))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>ce&&(Qe.warn(ge),s=t.rootTilesInExtent(e,i,ce)),this._setRootTiles(s.map((e=>this._newRootTile(e))));I(i,this._rootTilesExtent)||(this._rootTilesExtent=A(i)),this.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._allTiles.forEach((e=>{e.isLoaded&&this._prepareToLoadTile(e)})),this._allTiles.forAll((e=>{e.isLoaded&&(this._updateTileGeometry(e),this._updateTileNeighborsAfterGeometryChange(e))})),this._updatingRootTiles=!1,this.checkAllTileWaterproofness()}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return t.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===Ae.SPLIT&&t.setPendingUpdate(Ae.SPLIT),this._loadTile(t),t.checkGeometryWaterproofness(),t}_setRootTiles(e){if(this._set("rootTiles",e),this._allTiles.clear(),u(e)){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this.rootTiles),this._updateTilesVisibility(e)}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this._visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this.rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(Ae.GEOMETRY)&&this._updateTileGeometry(e)}_updateTilesVisibility(e){if(p(e))return;const t=ke(e);let i=t?this._elevationBounds.min:1/0,r=t?this._elevationBounds.max:-1/0;const s=this.extent,a=this._viewProjectionMatrix;this.setTileTreeDirty();const n=this._iteratorPool.acquire();for(n.reset(e);!n.done;){const e=n.next();e.updateClippingStatus(s)&&e.resetPendingUpdate(Ae.GEOMETRY)&&this._updateTileGeometry(e),e.setPendingUpdate(Ae.RENDERDATA),e.computeVisibility(),e.updateScreenDepth(a),e.renderData&&(i=Math.min(e.elevationBounds[0],i),r=Math.max(e.elevationBounds[1],r))}n.remove(),this._viewChanged=!0,this._allTilesDirty=!0,isFinite(i)&&isFinite(r)&&(this._elevationBounds.min===i&&this._elevationBounds.max===r||(this._elevationBounds.min=i,this._elevationBounds.max=r,this.emit("elevation-bounds-change",null)))}_updateViewDependentParameters(){const e=this.view.state.camera,t=this.view.state.contentCamera,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this.lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?(p(this._splitLimits.frustum)&&(this._splitLimits.frustum=q()),B(this._splitLimits.frustum,t.frustum)):this._splitLimits.frustum=null,B(this._frustum,e.frustum),b(this._viewProjectionMatrix,t.projectionMatrix,t.viewMatrix),D(this._eyePosRenderSR,t.eye),C(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateRenderData(e){e.rendered&&!e.shouldLoad&&(Ke(e)?(this._loadChildren(e),this._checkTileNeighborsWaterproofness(e),e.children.forEach((e=>e.checkGeometryWaterproofness()))):Je(e)&&this._loadParent(e))}_updateTileGeometry(e){e.updateVisibility(),this._renderer.updateTileGeometry(e),this._updateTileNeighborsAfterGeometryChange(e),this._elevationUpdate(e),this._usedMemory=Ze,this.deferTileNeighborUpdate&&this.neighborTilesToUpdate.delete(e)}_updateTileNeighborsAfterGeometryChange(e,t){if(this.deferTileNeighborUpdate){const t=this.neighborTilesToUpdate;e.forEachLoadedNeighbor((e=>{t.add(e)}))}else e.updateNeighborsAfterGeometryChange(t)}_updateTileTexture(e,t){const i=e.resetPendingUpdate(Ae.TEXTURE_FADING)?Ae.TEXTURE_FADING:!!e.resetPendingUpdate(Ae.TEXTURE_NOFADING)&&Ae.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=Ze,t.madeProgress())}_elevationUpdate(e){st.spatialReference=this.spatialReference,st.tile=e,st.extent=e.extent,this.emit("elevation-change",st)}get running(){return this.updating&&this.ready&&!this.suspended}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateTileStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;this._mergeAndSplit(e,t),e.run((()=>this._updateElevation(e))),e.run((()=>this._updateTextures(e))),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),e.done&&this.requestUpdate(),this.notifyChange("updatingProgressValue")}_updateTileStatus(e){if(!this._viewChanged||!this.rootTiles||e.done)return;this._viewChanged=!1;const t=this._iteratorPool.acquire();for(t.reset(this.rootTiles);!t.done;){const e=t.next(),i=e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping);if(i!==Ae.SPLIT){if(e.resetPendingUpdate(Ae.SPLIT)&&e.updateAgentSuspension(),i===Ae.VSPLITMERGE&&e.updateAgents(ne.ELEVATION),t.skipSubtree(),!e.isLeaf){e.setPendingUpdate(Ae.MERGE),e.resetPendingUpdate(Ae.SPLIT);const t=this._iteratorPool.acquire();t.resetOne(e);for(let e=t.next();!t.done;e=t.next())this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(this._viewProjectionMatrix);t.remove()}}else e.resetPendingUpdate(Ae.MERGE),e.isLeaf&&(e.setPendingUpdate(Ae.SPLIT),t.skipSubtree())}t.remove(),this.requestUpdate(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||(Oe(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),e.madeProgress())}_prepareBatchTileGeometryUpdate(){we(0===this.neighborTilesToUpdate.size),this.deferTileNeighborUpdate=!0}_batchUpdateUpdatedTileNeighbors(){this.deferTileNeighborUpdate=!1;const e=this.neighborTilesToUpdate;(()=>{const t=()=>{for(const t of e)t.updateNeighborsWithChangedEdgeResolution()};(()=>{for(const t of e)t.updateNeighborDataAndGeometryIfNeeded()})(),t(),e.clear()})()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=0;this._prepareBatchTileGeometryUpdate();let r=!1;for(;!e.done;){let s=!1;i=0;const a=!this._allTiles.some((a=>{if(r)i+=a.usedMemory;else if(!a.loadable)return e.done;if(a.resetPendingUpdate(Ae.MERGE)){if(!t)return a.setPendingUpdate(Ae.MERGE),e.done;this._mergeTile(a),s=!0,e.madeProgress()}else a.resetPendingUpdate(Ae.SPLIT)&&(this._splitTile(a),s=!0,e.madeProgress());return!e.done&&a.resetPendingUpdate(Ae.RENDERDATA)&&(this._updateRenderData(a),e.madeProgress()),e.done}));if(s&&(this._allTilesSorted=!1,this._allTilesDirty=!0),a){if(!r){r=!0;continue}if(this._usedMemory=i,!s)break;this._updateTilesVisibility(this.rootTiles)}else this._allTilesDirty=!0}0===i&&(this._allTilesDirty=!0),this._batchUpdateUpdatedTileNeighbors(),this._sortTiles(e)}_updateElevation(e){return this._prepareBatchTileGeometryUpdate(),this._allTiles.some((t=>(t.resetPendingUpdate(Ae.GEOMETRY)&&(this._updateTileGeometry(t),this._updateTileTexture(t,e),e.madeProgress()),e.done))),this._batchUpdateUpdatedTileNeighbors(),e.hasProgressed}_updateTextures(e){return this._allTiles.some((t=>(this._updateTileTexture(t,e),e.done))),e.hasProgressed}_updateClippingExtent(){this.spatialReference&&(this.updateTileOverlayParams(Ge.UPDATE),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get lodBias(){const e=this.view.resourceController.memoryController.memoryFactor;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*me}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=l(e-this.lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){u(this.rootTiles)&&(this.rootTiles.forEach((e=>this._purgeTile(e,!1))),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.visible=!1}_purgeDescendantTiles(e){if(e.isLeaf)return!1;let t=!1;for(let i=0;i<4;++i)t=this._purgeTile(e.children[i],!1)||t;return e.unsetChildren(),t}_purgeTile(e,t){const i=this._purgeDescendantTiles(e)||e.rendered;return this._allTiles.removeUnordered(e),this._unloadTile(e),t&&this._updateTileNeighborsAfterGeometryChange(e),this._tilePool.release(e),i}_unloadTile(e){this.deferTileNeighborUpdate&&this.neighborTilesToUpdate.delete(e),e.unload(this._renderer)}_splitTile(e){ve(e.isLeaf,"tile that is already split should not be split again!");const t=e.level+1,i=2*e.lij[1],r=2*e.lij[2];e.setChildren(this._createTile(t,i,r,e),this._createTile(t,i,r+1,e),this._createTile(t,i+1,r,e),this._createTile(t,i+1,r+1,e)),e.setPendingUpdate(Ae.RENDERDATA),e.updateAgentSuspension(),this._allTiles.pushArray(e.children),this._allTilesDirty=!0,this._emitTileScaleChange(e,t),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){at.spatialReference=this.spatialReference,at.extent=e.extent,at.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",at)}_createTile(e,t,i,r){ve(!!r,"_createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.updateScreenDepth(this._viewProjectionMatrix),s.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===Ae.SPLIT&&s.setPendingUpdate(Ae.SPLIT),s}_mergeTile(e){ve(!e.hasPendingUpdate(Ae.SPLIT),"_mergeTile sanity check"),this._purgeDescendantTiles(e)&&(ve(!e.renderData,"_mergeTile sanity check"),this._loadTile(e),this._updateTileNeighborsAfterGeometryChange(e),this._checkTileAndNeighborsWaterproofness(e)),this._allTilesDirty=!0,++this._performanceInfo.numMerged,this._emitTileScaleChange(e)}_checkTileAndNeighborsWaterproofness(e){e.checkGeometryWaterproofness(),this._checkTileNeighborsWaterproofness(e)}_checkTileNeighborsWaterproofness(e){Re&&e.forallNeighbors((e=>!!e.isLoaded&&(e.checkGeometryWaterproofness(),!0)))}_loadChildren(e){this._checkTileAndNeighborsWaterproofness(e),ve(e.rendered,"parent should be rendered"),this._unloadTile(e);const t=e.children;t.forEach((e=>this._prepareToLoadTile(e))),t.forEach((e=>this._loadTilePrepared(e))),this._updateTileNeighborsAfterGeometryChange(e,e.level+1),this.deferTileNeighborUpdate||t.forEach((e=>e.updateNeighborsWithChangedEdgeResolution())),t.forEach((e=>e.checkGeometryWaterproofness())),this._checkTileNeighborsWaterproofness(e)}_loadParent(e){this._checkTileAndNeighborsWaterproofness(e);const t=e.parent;this._unloadChildren(t),this._loadTile(t),this._updateTileNeighborsAfterGeometryChange(t),this._checkTileAndNeighborsWaterproofness(t)}_unloadChildren(e){if(!e.isLeaf)for(let t=0;t<4;++t){const i=e.children[t];this._unloadChildren(i),this._unloadTile(i)}}_postLoadTile(e){e.setPendingUpdate(Ae.RENDERDATA),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager&&this.overlayManager.hasOverlays&&this.overlayManager.setTileParameters(e),this._elevationUpdate(e)}_loadTile(e){e.load(this._renderer),this._postLoadTile(e)}_loadTilePrepared(e){e.loadPrepared(this._renderer),this._postLoadTile(e)}_prepareToLoadTile(e){e.prepareToLoad(this._renderer)}_elevationDataArrived(e,t,i){const r=new ie(e.lij,e.extent,i);e.dataArrived(t,ne.ELEVATION,r);const s=[e],a=e.level,n=this._iteratorPool.acquire();for(n.reset(s);!n.done;){const e=n.next();e.findElevationBoundsForLayer(t,a),e.computeElevationBounds()}n.remove(),this._updateTilesVisibility(s)}_handleLayerViewChanges(e=He){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(const s of this.view.allLayerViews.items)if(i.add(s.uid),Se(s))if(this._basemapLayerViewHandles.has(s.uid)){const e=this._layerClassFromLayerView(s),i=this._layerIndexByUid[e].get(s.uid);i<r&&(t=!0),r=i}else this._registerTiledLayerView(s),s.layer.loaded&&(t=!0);this._basemapLayerViewHandles.forEach(((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)})),t&&this._updateTiledLayers(),this._renderer.isTransparent=this._allTransparentSurfaceLayers(),e.madeProgress()}_allTransparentSurfaceLayers(){let e=0===this.view.map?.ground?.opacity;for(const t of this.view.allLayerViews.items)if(Le(t)&&!H(t.layer)&&0!==t.fullOpacity)return e=!1,e;return e}_layerClassFromLayerView(e){return Ee(e)?ne.ELEVATION:ne.MAP}_registerTiledLayerView(e){const t=[],i=this._layerClassFromLayerView(e);t.push(T((()=>e.suspended),(()=>this._updateTiledLayers()))),t.push(T((()=>e.fullOpacity),(()=>this._updateTileTextures(ae.UNFADED)))),t.push(T((()=>"effectiveScaleRange"in e.layer?e.layer.effectiveScaleRange:null),(()=>this._restartAllAgents(i)))),e.on("data-changed",(()=>{const t=this._layerIndexByUid[i].get(e.uid);null!=t&&this._invalidateLayerData(t,i)})),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(let e=0;e<t.length;e++)t[e].remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;const r=k();e.forEach((e=>{const s=e.layer;if(!s||e.suspended||!Se(e))return;const a=e.fullExtent;if(!a)return void Qe.warn("Terrain: Map or elevation layer does not have fullExtent: "+s.id);O(r,a,r);const n=this._layerClassFromLayerView(e);if(n===ne.MAP){const t=e.displayLevelRange;t.maxLevel!==1/0&&(null===i||t.maxLevel>i)&&(i=t.maxLevel)}t[n].push(e)}));for(const s of oe){const e=this._layerViews[s],i=t[s];i.reverse();const r=i.length;let a=e.length!==r;const n=new Array(r),o=new Array(e.length);this._layerIndexByUid[s].clear();for(let t=0;t<r;t++){const r=i[t].uid;this._layerIndexByUid[s].set(r,t);const l=e.indexOf(i[t]);n[t]=l,t!==l&&(a=!0),l>-1&&(o[l]=t)}if(a){const e=this._postorderIterator;for(e.reset(this.rootTiles);!e.done;)e.next().modifyLayers(o,n,s);this._layerViews[s]=i,this._restartAllAgents(s),this._updateTilesVisibility(this.rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&this._viewChangeUpdate()}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this.rootTiles);!t.done;){const i=t.next();i.restartAgents(e),e===ne.ELEVATION&&i.computeElevationBounds()}}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll((t=>{t.updateAgents(ne.MAP),e===ae.IMMEDIATE?this.renderer.updateTileTexture(t,Ae.TEXTURE_NOFADING):t.updateRenderData(ne.MAP,e)})),this._renderer.isTransparent=this._allTransparentSurfaceLayers()}_invalidateLayerData(e,t){this._allTiles.forAll((i=>i.removeLayerAgent(e,t))),this._allTiles.forAll((i=>i.invalidateLayerData(e,t)))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=Ge.UPDATE){this.renderer.setNeedsRender(e)}requestUpdate(){1==++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||be(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.lij[0],e.lij[1],e.lij[2],{...r,timeout:6e3}).then((()=>--this._asyncWorkItems)).catch((t=>{throw--this._asyncWorkItems,g(t)||this._dataMissing(e,i,s,{notInTilemap:!0}),t})).then((()=>this._frameTask.schedule((()=>this._requestTileData(e,i,s,r)),r.signal))))}_requestTileData(e,t,i,r){return t===ne.ELEVATION?Ee(i)?this._requestElevationTileData(e,i,r):Promise.reject():Le(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{if(m(i))return;const s=this._layerIndexByUid[ne.ELEVATION].get(t.uid);null!=s?(this._usedMemory=Ze,this.requestUpdate(),this._elevationDataArrived(e,s,r)):Qe.warn("TerrainSurface: received data from unknown layer %d %s",ne.ELEVATION,e.lij.toString())},s=i=>{g(i)||(this._dataMissing(e,ne.ELEVATION,t,i),this.requestUpdate())};if(xe(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],{noDataValue:fe,signal:i.signal}).then((e=>{if(!m(i))return this._frameTask.schedule((()=>r(e)),i.signal,s);Qe.warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true.")}),s).finally((()=>{--this._asyncWorkItems}));const a=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);return this._elevationDataRequester.request(a,"binary",i).then((e=>this._lercDecoder.decode(e,{noDataValue:fe},i.signal))).then((e=>{e?r({values:e.pixelData,width:e.width,height:e.height,noDataValue:e.noDataValue,minValue:e.minValue,maxValue:e.maxValue}):s(new Error("LERC decoding failed"))}),s).finally((()=>{--this._asyncWorkItems}))}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{--this._asyncWorkItems,Ue(s),m(i)||(this._dataMissing(e,ne.MAP,t,r),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule((()=>{--this._asyncWorkItems,this.requestUpdate(),m(i)?Ue(r):this._mapTileDataArrived(e,t,r)}),i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule((()=>r(e,t)));if(be(t)){const r=t.schemaHelper.getLevelRowColumn(e.lij);return t.fetchTile(r[0],r[1],r[2],i).then(a,n)}if(De(t))return t.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then(a,n);if(Pe(t)&&xe(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then((e=>{if(m(i))return Qe.warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),void n(f());a(e)}),n);let o=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);W(t.layer)&&t.layer.refreshTimestamp&&(o+=`${o.includes("?")?"&":"?"}_ts=${t.layer.refreshTimestamp}`);const l=t.hasMixedImageFormats?"image+type":"image";return this._mapDataRequester.request(o,l,i).then(a,n)}_mapTileDataArrived(e,t,i){const r=this._layerIndexByUid[ne.MAP].get(t.uid);null!=r?e.dataArrived(r,ne.MAP,i):(Ue(i),Qe.warn("TerrainSurface: received data from unknown layer"))}_dataMissing(e,t,i,r){const s=this._layerIndexByUid[t].get(i.uid);null!=s?e.dataMissing(s,t,r):Qe.warn("TerrainSurface: received data from unknown layer")}updateTileOverlayParams(e){this.rootTiles&&this.overlayManager&&(this._allTiles.forAll((e=>{e.renderData&&this.overlayManager.setTileParameters(e)})),this._renderer.setNeedsRender(e))}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll((t=>{t.isLeaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))})),e}getUsedMemory(){return this.tilingScheme?(this._usedMemory===Ze&&(this._usedMemory=0,this._allTiles.forAll((e=>this._usedMemory+=e.usedMemory))),this._usedMemory):0}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this._layerIndexByUid[i].get(e.uid);return this._allTiles.forAll((e=>t+=e.getUsedMemoryForLayer(i,r))),t}getTile(e){if(p(e)||p(this.rootTiles))return null;const t=e.split("/").map((e=>+e));if(0===t[0])return this.rootTiles.find((e=>e.lij[1]===t[1]&&e.lij[2]===t[2]));const i=2**t[0],r=Math.floor(t[1]/i),s=Math.floor(t[2]/i);let a;if(this.rootTiles.some((e=>e.lij[1]===r&&e.lij[2]===s&&(a=e,!0))),a){let e=1<<t[0]-1;for(;a.lij[0]<t[0];){let i=t[1]&e?2:0;if((t[2]&e)>0&&i++,!a.children[i])return null;a=a.children[i],e>>=1}return ve(a.lij[0]===t[0]&&a.lij[1]===t[1]&&a.lij[2]===t[2],"not the right tile?"),a}return null}get test(){const e=this;return{renderer:e._renderer,lercDecoder:e._lercDecoder,forceReload:()=>{u(e.rootTiles)&&(e._mergeTile(e.rootTiles[0]),e._viewChangeUpdate())},getTiles:()=>e._allTiles.toArray(),getRenderedTiles(){rt.clear(),e._allTiles.forAll((e=>{e.visible&&e.rendered&&rt.push(e)}));const t=rt.toArray();return Ne(e.renderOrder,t),t},lockTilingScheme(t,i){e._extentHelper.defaultTiledLayersExtent=i,e.tilingSchemeLogic.test.lockTilingScheme(t)}}}checkAllTileWaterproofness(){if(!Re)return;const e=this.rootTiles;if(p(e))return;const t=e=>e?.renderData?.geometryInfo?.indices?.length>0??!1,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometryInfo&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometryInfo||(e.renderData.geometryInfo.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometryInfo),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.isLeaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.isLeaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}isEastEndWrap(e){return this.isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this.isGlobal&&0===e[2]}lijEastEnd(e){return 2**(e+(this.spatialReference.isGeographic?1:0))}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this.isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}};e([L()],ze.prototype,"_renderer",void 0),e([L()],ze.prototype,"_hasPendingUpdates",void 0),e([L()],ze.prototype,"_asyncWorkItems",void 0),e([L()],ze.prototype,"_allTilesDirty",void 0),e([L()],ze.prototype,"_allTilesSorted",void 0),e([L()],ze.prototype,"_viewChanged",void 0),e([L({readOnly:!0})],ze.prototype,"_watchUpdatingTracking",void 0),e([L()],ze.prototype,"_frameTask",void 0),e([L({readOnly:!0})],ze.prototype,"snapLevel",null),e([L({readOnly:!0})],ze.prototype,"lodSnapping",null),e([L({constructOnly:!0})],ze.prototype,"view",void 0),e([L()],ze.prototype,"_userClippingExtent",null),e([L()],ze.prototype,"_rootTilesExtent",void 0),e([L({readOnly:!0})],ze.prototype,"extent",null),e([L({readOnly:!0})],ze.prototype,"groundExtent",null),e([L({readOnly:!0})],ze.prototype,"_tilingSchemeExtent",null),e([L({readOnly:!0})],ze.prototype,"updating",null),e([L(Z)],ze.prototype,"updatingProgress",void 0),e([L({readOnly:!0})],ze.prototype,"updatingProgressValue",null),e([L()],ze.prototype,"_maxNumUpdating",void 0),e([L({aliasOf:"view.map.ground.opacity"})],ze.prototype,"baseOpacity",void 0),e([L({readOnly:!0})],ze.prototype,"overlayManager",void 0),e([L({readOnly:!0})],ze.prototype,"viewingMode",null),e([L()],ze.prototype,"maxTextureScale",void 0),e([L({readOnly:!0})],ze.prototype,"ready",null),e([L({value:de.FRONT_TO_BACK})],ze.prototype,"renderOrder",null),e([L({readOnly:!0})],ze.prototype,"rootTiles",void 0),e([L({readOnly:!0})],ze.prototype,"spatialReference",null),e([L()],ze.prototype,"backgroundImage",void 0),e([L({type:t,aliasOf:"view.map.ground.surfaceColor"})],ze.prototype,"backgroundColor",void 0),e([L()],ze.prototype,"_background",null),e([L({value:!1})],ze.prototype,"slicePlaneEnabled",null),e([L({readOnly:!0})],ze.prototype,"tilingScheme",void 0),e([L({readOnly:!0,aliasOf:"tilingSchemeLogic.tilingSchemeLocked"})],ze.prototype,"tilingSchemeLocked",void 0),e([L({readOnly:!0})],ze.prototype,"tilingSchemeLogic",void 0),e([L({value:!0})],ze.prototype,"velvetOverground",null),e([S("_renderer.wireframe")],ze.prototype,"wireframe",void 0),e([L({value:!1})],ze.prototype,"suspended",null),e([L({readOnly:!0,aliasOf:"view.qualitySettings.tiledSurface.textureFadeDuration"})],ze.prototype,"textureFadeDuration",void 0),e([L()],ze.prototype,"_layerViewsDirty",void 0),e([S("_renderer.renderPatchBorders")],ze.prototype,"renderPatchBorders",void 0),e([S("_renderer.renderingDisabled")],ze.prototype,"renderingDisabled",void 0),ze=e([E("esri.views.3d.terrain.TerrainSurface")],ze);const Ye=ze;function $e(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Ke(e){return!e.isLeaf&&(e.children.some((e=>e.shouldLoad))||e.children.some((e=>Ke(e))))}function Je(e){return e.isLeaf&&e.parent&&e.parent.shouldLoad}const Ze=-1,et=U(),tt=A(),it=[0,0,0],rt=new _,st={spatialReference:null,tile:null,extent:null,context:"ground"},at={spatialReference:null,extent:null,scale:0};export{Ye 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as e}from"../../../core/mathUtils.js";import{isSome as t,abortMaybe as i,isNone as s}from"../../../core/maybe.js";import n from"../../../core/ObjectPool.js";import{c as r,b as a}from"../../../chunks/vec2.js";import{a as o}from"../../../chunks/vec2f64.js";import{b as l,p as h,e as d,g as u,a as c,l as g}from"../../../chunks/vec3.js";import{c as f,u as p}from"../../../chunks/vec3f64.js";import{E as m}from"../../../chunks/common.js";import{getReferenceEllipsoid as _}from"../../../geometry/projectionEllipsoid.js";import{create as T,equals as E}from"../../../geometry/support/aaBoundingRect.js";import{c as A}from"../../../chunks/sphere.js";import{VectorTile as y}from"../../2d/engine/vectorTiles/VectorTile.js";import{ImageWithType as v}from"../support/StreamDataLoader.js";import{ElevationBounds as S}from"./ElevationBounds.js";import{ElevationTileAgent as L}from"./ElevationTileAgent.js";import{NeighborIndex as M,LODSnapping as N,TextureUpdate as I}from"./interfaces.js";import{LayerClass as O,LayerClasses as D}from"./LayerClass.js";import{MapTileAgent as b}from"./MapTileAgent.js";import{RasterTile as U}from"./RasterTile.js";import{MAX_PATCH_TESSELATION as x,getElevationDesiredResolutionLevel as R}from"./TerrainConst.js";import{weakAssert as j,getLayerWithExtentRange as C,internalAssert as H,ENABLE_WATERPROOFNESS_TESTS as W}from"./terrainUtils.js";import{TILE_AGENT_DONE as P}from"./TileAgent.js";import{TilePerLayerInfo as B}from"./TilePerLayerInfo.js";import G from"./TileTexture.js";import{TileUpdate as V}from"./TileUpdate.js";import{fallsWithinLayer as w}from"./tileUtils.js";import{getGpuMemoryUsage as q}from"../../webgl/Util.js";const F=f(),k=f(),X=f(),z=.1;class J{constructor(){this.fovX=0,this.fovY=0,this.relativeWidthLimit=0,this.relativeHeightLimit=0,this.maxLod=0,this.angledSplitBias=0,this.aboveGround=!0}}class Y{constructor(){this.lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this._dirty=!0,this._previouslyRendered=!1,this.extent=T(),this._elevationBounds=o(),this.layerInfo=[[],[]],this.extentInRadians=T(),this.centerAtSeaLevel=f(),this._center=[f(),A(),f()],this.up=p(),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=te,this._mapTileMemory=0,this._mapDataRefCount=0,this._screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0}static prune(){K.prune(0),Z.prune(0),B.prune()}get usedMemory(){return this._usedMemory===te&&this._updateMemoryUsed(),this._usedMemory+(this.isCached?0:this.mapTileMemory)}get cachedMemory(){return this.isCached?this.mapTileMemory:0}get mapTileMemory(){this._usedMemory===te&&this._updateMemoryUsed();let e=this._mapTileMemory;for(const{data:t}of this.layerInfo[O.MAP])t instanceof y&&(e+=t.memoryUsage);return e}get isCached(){return!this.shouldLoad&&this._mapDataRefCount<=0}get maxTesselation(){return this._maxTesselation}get isWithinClippingArea(){return this._isWithinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBounds(){return this._elevationBounds}get level(){return this.lij[0]}get key(){return`${this.lij[0]}/${this.lij[1]}/${this.lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[ie.MIDDLE][3]}get screenDepth(){return this._screenDepth}get visible(){return this._dirty&&this.computeVisibility(),this._visible}computeVisibility(){this._dirty=!1;const e=this._intersectsClippingArea&&this._isVisible(this.surface.frustum);return e!==this._visible&&(this._visible=e,this._surface.emit("tiles-visibility-changed"),this._surface.renderer.setNeedsRender(),this.updateAgentSuspension()),this._visible}get loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){const e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit("tiles-visibility-changed"),this._previouslyRendered=e,this._surface.renderer.setNeedsRender()),e}get shouldLoad(){if(this._surface.lodSnapping===N.ON){const e=this.level-this._surface.snapLevel;if(0===e)return!0;if(1===e)return!1}return this.isLeaf}init(e,t,i){this.lij[0]=e[0],this.lij[1]=e[1],this.lij[2]=e[2],this.ellipsoid=_(i.tilingScheme.spatialReference),i.tilingScheme.getExtent(e[0],e[1],e[2],this.extent),i.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,i.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[ie.MIDDLE][3]=0,this.vlevel=e?e[0]:0,t&&t.elevationBounds?r(this._elevationBounds,t.elevationBounds):a(this._elevationBounds,0,0),this._pendingUpdates=0,this.renderData=null,this._screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=t,this.unsetChildren(),this._surface=i,this.updateVisibility();for(const s of D){const e=i.numLayers(s),t=this.layerInfo[s];for(const i of t)i.release();t.length=e;for(let i=0;i<e;i++)t[i]=B.acquire(this._surface.upsampleInfoPool),s===O.ELEVATION&&this.findElevationBoundsForLayer(i,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(i.tilingScheme.pixelSize,x)}release(){j(!this.renderData,"tile.renderData was not unloaded"),this._surface.upsampleMapCache.pop(this.key);for(const e of D){for(const t of this.layerInfo[e])t.release();this.layerInfo[e].length=0}this._parent=null,this._surface=null,this._usedMemory=te}refMapData(){++this._mapDataRefCount,this.isCached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){if(--this._mapDataRefCount,this.isCached){const e=this.cachedMemory;e>0&&(this._surface.upsampleMapCache.put(this.key,this,e),this.setMemoryDirty())}}setMemoryDirty(){this._usedMemory=te}get cpuImageMemorySize(){const e=4,t=this._surface.tilingScheme.pixelSize;return t*t*e}_updateMemoryUsed(){this._usedMemory=0,this._mapTileMemory=0;const e=this.cpuImageMemorySize;for(const{data:t}of this.layerInfo[O.MAP])t instanceof G?this._mapTileMemory+=q(t.texture):t instanceof HTMLImageElement||t instanceof v?this._mapTileMemory+=e:t instanceof U&&(this._mapTileMemory+=t.memoryUsage);for(const t of this.layerInfo[O.ELEVATION])this._usedMemory+=t.data?e:0;this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._mapTileMemory+=q(this.renderData.textureDescriptor)),this.isCached&&this._surface.upsampleMapCache.updateSize(this.key,this,this.cachedMemory)}getUsedMemoryForLayer(e,t){const i=this.layerInfo[e][t];if(!i||!i.data)return 0;if(e!==O.MAP||this.isCached){if(e===O.ELEVATION)return this.cpuImageMemorySize}else{const e=i.data;if(e instanceof G)return q(e.texture);if(e instanceof HTMLImageElement||e instanceof v)return this.cpuImageMemorySize;if(e instanceof y||e instanceof U)return e.memoryUsage}return 0}updateScreenDepth(e){const t=this._center[ie.MIDDLE],i=e,s=t[0],n=t[1],r=t[2],a=i[2]*s+i[6]*n+i[10]*r+i[14];this._screenDepth=a<0?0:a/(i[3]*s+i[7]*n+i[11]*r+i[15])}shouldSplit(e,i,s){if(t(e.frustum)&&(!this._intersectsClippingArea||!this._isVisible(e.frustum)))return V.NONE;const n=this.level;l(F,this._center[ie.MIDDLE],i);let r=h(F),a=ie.MIDDLE;l(k,this._center[ie.TOP],i);const o=h(k);o<r&&(r=o,a=ie.TOP),l(k,this._center[ie.BOTTOM],i);const f=h(k);if(f<r&&(r=f,a=ie.BOTTOM),this._edgeLen2>r&&n<e.maxLod)return V.SPLIT;const p=Math.sqrt(r),m=e.fovX*p*2,_=this._edgeLen/m,T=()=>{const t=n+Math.ceil(-Math.log2(e.relativeWidthLimit/_));return t!==this.vlevel?(this.vlevel=t,V.VSPLITMERGE):V.NONE_HIT_MAXLOD};if(s===N.ON){if(1===this._surface.snapLevel-n)return n>=e.maxLod?T():V.SPLIT}const E=d(this.up,F),A=this._elevationBounds[1]-this._elevationBounds[0],y=A/this.edgeLen;if(e.aboveGround&&E>0&&y<.001){if(E/p-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-y>0)return V.NONE}if(_<e.relativeWidthLimit)return this.vlevel!==this.level?(this.vlevel=this.level,V.VSPLITMERGE):V.NONE;if(n>=e.maxLod)return T();if(n>6){l(k,this._center[a],i),u(X,this.up,E),l(X,X,k);const t=h(X);if(t>this.radius*this.radius){u(X,X,this.radius/Math.sqrt(t)),c(X,X,this._center[a]),l(X,i,X);const s=Math.min(1,(Math.abs(d(X,this.up))+.5*A+this._curvatureHeight)/g(X)),n=z/e.angledSplitBias,r=e.fovY*p*2;if(s*(this._edgeLen/r)<n*e.relativeHeightLimit)return V.NONE}}return V.SPLIT}setChildren(e,t,i,s){j(!!(e&&t&&i&&s),"Null child passed"),this._children[0]=e,this._children[1]=t,this._children[2]=i,this._children[3]=s}unsetChildren(){this._children[0]=null,this._children[1]=null,this._children[2]=null,this._children[3]=null}get isLoaded(){var e,t;return null!=(e=null==(t=this.renderData)?void 0:t.hasGeometry)&&e}prepareToLoad(e){this.refMapData();for(const t of D)this._createOrUpdateAgents(0,t);e.updateTileGeometryState(this)}load(e){this.prepareToLoad(e),this.loadPrepared(e)}loadPrepared(e){e.loadTile(this)}unload(e){e.unloadTile(this);for(const t of D){const e=this.layerInfo[t];for(const t of e)t.loadingAgent&&t.loadingAgent!==P&&(Q(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0}this.resetPendingUpdate(V.GEOMETRY),this.resetPendingUpdate(V.TEXTURE_NOFADING),this.resetPendingUpdate(V.TEXTURE_FADING),this.unrefMapData()}unloadMapData(){const e=this.layerInfo[O.MAP];for(const t of e)t.loadingAgent&&t.loadingAgent!==P&&(Q(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0;this.renderData&&this.renderData.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(E(e,this._clippingArea))return!1;const i=this._intersectsClippingArea,s=this._isWithinClippingArea;t(e)?(this._intersectsClippingArea=this.intersectsExtent(e),this._isWithinClippingArea=this._isWithinExtent(e)):(this._intersectsClippingArea=!0,this._isWithinClippingArea=!0),this._clippingArea=e,this.updateVisibility();const n=s&&this._isWithinClippingArea,r=!(s||i||this._isWithinClippingArea||this._intersectsClippingArea);return!this.renderData||n||r||this.setPendingUpdate(V.GEOMETRY),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty()}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){const i=this.layerInfo[t][e];return!(!i||!i.data||i.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(const e of D){const t=this.layerInfo[e];for(const e of t)if(e.loadingAgent&&e.loadingAgent!==P&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return!!this.hasPendingUpdate(V.SPLIT)||e!==O.ELEVATION&&!this.loadable}get hasPendingUpdates(){return 0!==this._pendingUpdates}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){this._pendingUpdates|=e,e===V.SPLIT||e===V.MERGE?this._surface.setTileTreeDirty():this._surface.requestUpdate()}resetPendingUpdate(e){return!!this.hasPendingUpdate(e)&&(this._pendingUpdates&=~e,!0)}requestLayerData(e,t,s){const n=this.layerInfo[t][e];if(n.waitingAgents.has(s))return console.warn("agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)",this.lij.toString(),s.tile.lij.toString(),t,e),!0;if(n.waitingAgents.push(s),n.data&&!n.dataInvalidated)return console.warn("agent requested existing data (tile %s, agent tile %s, layer: %d/%d)",this.lij.toString(),s.tile.lij.toString(),t,e),s.dataArrived(this),!0;if(n.requestPromise)return!0;i(n.requestAbort),n.requestAbort=new AbortController;const r=this._surface.requestTileData(this,e,t,n.requestAbort);if(!r)return n.requestAbort=null,!1;const a=()=>{n.requestPromise===r&&(n.requestPromise=null,n.requestAbort=null)};return n.requestPromise=r,r.then(a,a),!0}get isLeaf(){return null==this._children[0]}hasLij(e){return this.lij[0]===e[0]&&this.lij[1]===e[1]&&this.lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;if(this.isLeaf)return null;const t=this._children[0].findByLij(e)||this._children[1].findByLij(e)||this._children[2].findByLij(e)||this._children[3].findByLij(e);return t||null}distanceToSquared(e){return h(l(X,this._center[ie.MIDDLE],e))}containsPoint(e){const t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}unrequestLayerData(e,t,i){const s=this.layerInfo[t][e],n=s.waitingAgents,r=null!=n.removeUnordered(i);j(r,"agent has not requested this piece of map data"),n.length<1&&(s.abortRequest(),this._updateMemoryUsed())}dataArrived(e,t,i){const s=this.layerInfo[t][e];s.data=i,s.dataInvalidated=!1,s.waitingAgents.forAll((e=>e.dataArrived(this))),s.waitingAgents.clear(),this._updateMemoryUsed()}dataMissing(e,t,i){i.notInTilemap||console.error(`Tile ${this.lij.toString()} layer ${t}/${e} error ${i}`);const s=this.layerInfo[t][e];s.dataMissing=!0,s.waitingAgents.forAll((e=>e.dataMissing())),s.waitingAgents.clear(),this._updateMemoryUsed()}updateRenderData(e,t){switch(e){case O.MAP:return this._updateTexture(t);case O.ELEVATION:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(e===I.FADING?V.TEXTURE_NOFADING:V.TEXTURE_FADING),this.setPendingUpdate(e===I.FADING?V.TEXTURE_FADING:V.TEXTURE_NOFADING))}_updateGeometry(){this.setPendingUpdate(V.GEOMETRY);for(const e of this.layerInfo[O.ELEVATION])e.pendingUpdates|=V.GEOMETRY}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData(),this.restartAgents(t)}computeElevationBounds(){const e=this._elevationBounds;a(e,Number.MAX_VALUE,-Number.MAX_VALUE);const i=this.layerInfo[O.ELEVATION];let s=!0;for(const n of i)t(n.elevationBounds)&&(e[0]=Math.min(e[0],n.elevationBounds.min),e[1]=Math.max(e[1],n.elevationBounds.max),n.elevationBounds.hasNoDataValues||(s=!1));s&&(e[0]=Math.min(e[0],0),e[1]=Math.max(e[1],0)),this.updateRadiusAndCenter(),this._surface.setTileTreeDirty()}_updateCenter(){const e=this._elevationBounds,t=.5*(e[0]+e[1]);u(X,this.up,t),c(this._center[ie.MIDDLE],this.centerAtSeaLevel,X),u(X,this.up,e[0]),c(this._center[ie.TOP],this.centerAtSeaLevel,X),u(X,this.up,e[1]),c(this._center[ie.BOTTOM],this.centerAtSeaLevel,X)}findElevationBoundsForLayer(e,i){const n=this.layerInfo[O.ELEVATION][e];if(t(n.elevationBounds)&&n.elevationBounds.level>=i)return;const r=this._surface.layerViewByIndex(e,O.ELEVATION),a=C(r);if(!w(this,a,!1))return;const o=ee;let l=!1;if(n.data){const e=n.data;o.min=e.bounds[0],o.max=e.bounds[1],o.hasNoDataValues=e.hasNoDataValues,o.level=this.level,l=!0}else{let t,i,s=0;for(let n=this._parent;n&&(!i||s<R(this.level))&&(s=this.vlevel-n.level,t=i||t,i=n.layerInfo[O.ELEVATION][e].data,!(!i&&t&&s>=R(this.level)));n=n.parent);i=i||t,i&&(i.computeMinMaxValue(this.lij[0],this.lij[1],this.lij[2],o),o.min!==1/0&&(o.level=i.level,l=!0))}l&&(s(n.elevationBounds)&&(n.elevationBounds=new S),n.elevationBounds.copyFrom(o))}modifyLayers(e,t,i){const s=this.layerInfo[i];for(const a of s)a.loadingAgent&&a.loadingAgent!==P&&(Q(a.loadingAgent),a.loadingAgent=null),a.waitingAgents.clear();for(let a=0;a<s.length;++a)void 0===e[a]&&s[a].release();const n=new Array(...s),r=t.length;s.length=r;for(let a=0;a<r;a++){const e=t[a];s[a]=e>-1?n[e]:B.acquire(this._surface.upsampleInfoPool)}this._updateMemoryUsed()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,I.FADING))}updateAgents(e){if(this.renderData){const t=this.layerInfo[e];for(const e of t)e.loadingAgent===P&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(const e of D){const t=this._isSuspended(e);for(const i of this.layerInfo[e])i.loadingAgent&&i.loadingAgent!==P&&(i.loadingAgent.setSuspension(t),i.loadingAgent===P&&this.updateRenderData(e,I.FADING))}}removeLayerAgent(e,t){const i=this.layerInfo[t][e];i.loadingAgent&&i.loadingAgent!==P&&i.loadingAgent.dispose(),i.loadingAgent=null}agentDone(e,t){const i=this.layerInfo[t][e];i.loadingAgent=P,!i.data&&s(i.upsampleInfo)&&this._createOrUpdateAgents(e+1,t)}_createOrUpdateAgents(e,t){const i=this._isSuspended(t),s=this.layerInfo[t];for(let n=e;n<s.length;++n){const e=s[n];let r=!1;const a=this._surface.layerViewByIndex(n,t),o=C(a);if(e.loadingAgent?w(this,o,!1)?(e.loadingAgent!==P&&e.loadingAgent.setSuspension(i),e.loadingAgent!==P&&(r=e.loadingAgent.update())):e.dispose():w(this,o,!1)&&(e.loadingAgent=$(this,n,t,i),r=e.loadingAgent.startLoading(),r?e.loadingAgent===P&&this.setPendingUpdate(V.GEOMETRY):(Q(e.loadingAgent),e.loadingAgent=P)),e.loadingAgent===P&&this.updateRenderData(t,I.FADING),r&&a.isOpaque)return}}_isWithinExtent(e){const t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){const t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationBasedVerticesPerSide(t){const i=this.vlevel-this.level,s=Math.max(this.level-t,R(this.level)-i);return e(1+(this.maxTesselation>>s),2,this.maxTesselation+1)}get test(){return{cachedMemory:this.cachedMemory}}_findLIJ(e,i){if(!e)return null;const s=this.surface.rootTiles;if(t(s))for(const t of s)if(se(t,e)){let s=t,n=e[0]-s.level-1;for(;n>=0&&!s.isLeaf&&!i(s);){const t=e[1]>>n&1,i=e[2]>>n&1;s=s.children[2*t+i],n--}return i(s)?s:null}return null}findNeighborTile(e,t){const i=this.lij,s=this.getNeighborLIJ(i,e);return s?ne(i,s)?t(this)?this:null:this._findLIJ(s,t):null}findCorner(e,t){const i=e===M.NORTH_EAST?1:e===M.NORTH_WEST?0:e===M.SOUTH_WEST?2:3;let s=this;for(;!(s.isLeaf||t&&t(s));)s=s.children[i];return s}findNeighborCornerTileExact(e,t){var i;return null==(i=this.findNeighborTile(e,(e=>t(e)||e.level===this.level)))?void 0:i.findCorner(de(e),t)}forAllSubtreeOnSide(e,t){const i=e===M.NORTH?[0,1]:e===M.NORTH_EAST?[1]:e===M.EAST?[1,3]:e===M.SOUTH_EAST?[3]:e===M.SOUTH?[2,3]:e===M.SOUTH_WEST?[2]:e===M.WEST?[0,2]:[0],s=e=>{t(e)||e.isLeaf||i.forEach((t=>s(e.children[t])))};s(this)}forallNeighbors(e){Ee.forEach((t=>this.findNeighborCornerTileExact(t,e))),Te.forEach((t=>{var i;return null==(i=this.findNeighborTile(t,(t=>t.level===this.level||e(t))))?void 0:i.forAllSubtreeOnSide(ue(t),e)}))}getNeighborEdgeStartVertexIndex(e,t){const i=null!=t?t:this.findNeighborTile(Te[e],(e=>e.isLoaded));if(!i||!this.isLoaded||!i.isLoaded)return 0;const s=this.level-i.level;if(0===s)return 0;const n=2**s,r=1==(1&e),a=r?0:1,o=i.lij[a+1]*n,l=this.lij[a+1]-o;return r?n-1-l:l}_updateNeighborsWithChangedEdgeResolution(){for(let e=0;e<4;++e)if(this.renderData.geometryState.neighborData.modifiedEdgeResolutions[e]){const t=Te[e],i=this.findNeighborTile(t,(e=>e.isLoaded||e.level===this.level));if(!i)continue;if(!i.isLoaded){H(!i.isLeaf);const s=(e+2)%4,n=ue(t);i.forAllSubtreeOnSide(n,(e=>e.isLoaded?(e.updateEdgeAfterResolutionChange(s),!0):(H(!e.isLeaf),!1)))}this.renderData.geometryState.neighborData.modifiedEdgeResolutions[e]=!1}}updateNeighborDataAndGeometryIfNeeded(){this.isLoaded&&this.renderData.updateNeighborDataAndGeometryIfNeeded()}updateNeighborsAfterGeometryChange(e=this.level){this.forEachLoadedNeighbor((e=>this._updateNeighbor(e))),Te.forEach((t=>{const i=this.findNeighborTile(t,(t=>t.isLoaded&&t.level<e));null==i||i.updateNeighborsWithChangedEdgeResolution()}))}updateNeighborsWithChangedEdgeResolution(){this.isLoaded&&this._updateNeighborsWithChangedEdgeResolution()}updateEdgeAfterResolutionChange(e){this.renderData.updateEdgeAfterResolutionChange(e)}forEachLoadedNeighbor(e){const t=this.level,i=e=>e.level===t||e.isLoaded;Te.forEach(((t,s)=>{var n,r;const a=this.findNeighborTile(t,i);null!=a&&a!==this&&a.forAllSubtreeOnSide(ue(t),(t=>!!t.isLoaded&&(e(t),!0)));const o=null==(n=this.renderData)||null==(r=n.geometryState)?void 0:r.neighborData;o&&(o.modifiedEdgeResolutions[s]=!1)})),Ee.forEach((t=>{var s;const n=null==(s=this.findNeighborTile(t,i))?void 0:s.findCorner(de(t),(e=>e.isLoaded));H(!n||oe(this,n,t)),null!=n&&n.isLoaded&&e(n)}))}_updateNeighbor(e){null!=e&&e.isLoaded&&e.updateNeighborDataAndGeometryIfNeeded()}getNeighborLIJ(e,t){const i=_e(t)?-1:me(t)?1:0,s=fe(t)?-1:pe(t)?1:0,n=[e[0],e[1]+i,e[2]+s];return n[1]<0?null:this.surface.isGlobal?this.wrapLIJ(n):n[2]<0?null:n}wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}get westNeighborWestExtent(){return this.extent[0]*(this.isWestEnd?-1:1)}get eastNeighborEastExtent(){return this.extent[2]*(this.isEastEnd?-1:1)}get isEastEnd(){return this.lij[2]===this.surface.lijEastEnd(this.level)-1}get isWestEnd(){return 0===this.lij[2]}get isNorthEnd(){return 0===this.lij[1]}get isSouthEnd(){return this.extent[1]+m>=this.surface.extent[1]}compareLIJs(e){const t=this.lij,i=t[0],s=e[0];if(i===s)return[t,e];const n=i-s;if(n<0){const i=2**-n;return[[s,t[1]*i,t[2]*i],e]}{const s=2**n;return[t,[i,e[1]*s,e[2]*s]]}}checkGeometryWaterproofness(){W&&(H(this.isLoaded),this.renderData.checkGeometryWaterproofness())}shouldHaveNeighbor(e){const t=this.extent,i=this.surface.rootTilesExtent,s=.25*(t[2]-t[0]);if(_e(e)&&t[3]+s>=i[3])return!1;if(me(e)&&t[1]-s<=i[1])return!1;const n=this.surface.isGlobal;return!(!n&&fe(e)&&t[0]-s<=i[0])&&!(!n&&pe(e)&&t[2]+s>=i[2])}}function $(e,t,i,s){const n=i===O.ELEVATION?Z.acquire():K.acquire();return n.init(e,t,i,s),n}function Q(e){e.dispose(),e instanceof L?Z.release(e):e instanceof b&&K.release(e)}const K=new n(b),Z=new n(L),ee=new S,te=-1;var ie;function se(e,t){const i=e.level,s=t[0];if(i>s)return!1;const n=s-i,r=t[1]>>n,a=t[2]>>n;return r===e.lij[1]&&a===e.lij[2]}function ne(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function re(e,t,i){return Math.abs(e-t)<=i}function ae(e,t,i){if(!e||!t)return!1;if(0===e.level&&0===t.level){if(e.isEastEnd&&t.isWestEnd&&i===M.EAST)return!0;if(e.isWestEnd&&t.isEastEnd&&i===M.WEST)return!0}const s=1e-6*(e.extent[2]-e.extent[0]);switch(i){case M.NORTH:return re(e.extent[3],t.extent[1],s);case M.SOUTH:return re(e.extent[1],t.extent[3],s);case M.EAST:return re(e.extent[2],t.extent[0],s)||re(e.extent[2],-t.extent[0],s);case M.WEST:return re(e.extent[0],t.extent[2],s)||re(e.extent[0],-t.extent[2],s)}}function oe(e,t,i){return!(!e||!t||t===e)&&(e.level>=t.level?le(e,t,i):le(t,e,de(i)))}function le(e,t,i){H(e.level>=t.level);const s=ce(i),n=ge(i),r=e.extent,a=t.extent,o=[s?r[0]:r[2],n?r[3]:r[1]],l=[s?a[2]:a[0],n?a[1]:a[3]],h=1e-5*(r[2]-r[0]),d=re(o[0],l[0],h)||e.surface.isGlobal&&re(o[0],-l[0],h),u=re(o[1],l[1],h);if(d&&u)return!0;if(e.level===t.level)return!1;if(!d&&!u)return!1;return d?he([a[1],a[3]],[r[1],r[3]],h):he([a[0],a[2]],[r[0],r[2]],h)}function he(e,t,i=m){return e[0]-i<=t[0]&&t[0]<=t[1]&&t[1]<=e[1]+i}function de(e){return e===M.NORTH_EAST?M.SOUTH_WEST:e===M.NORTH_WEST?M.SOUTH_EAST:e===M.SOUTH_WEST?M.NORTH_EAST:M.NORTH_WEST}function ue(e){return e===M.NORTH?M.SOUTH:e===M.EAST?M.WEST:e===M.SOUTH?M.NORTH:M.EAST}function ce(e){return e===M.NORTH_WEST||e===M.SOUTH_WEST}function ge(e){return e===M.NORTH_WEST||e===M.NORTH_EAST}function fe(e){return e===M.NORTH_WEST||e===M.WEST||e===M.SOUTH_WEST}function pe(e){return e===M.NORTH_EAST||e===M.EAST||e===M.SOUTH_EAST}function me(e){return e===M.SOUTH_EAST||e===M.SOUTH||e===M.SOUTH_WEST}function _e(e){return e===M.NORTH_EAST||e===M.NORTH||e===M.NORTH_WEST}!function(e){e[e.TOP=0]="TOP",e[e.MIDDLE=1]="MIDDLE",e[e.BOTTOM=2]="BOTTOM"}(ie||(ie={}));const Te=[M.NORTH,M.EAST,M.SOUTH,M.WEST],Ee=[M.NORTH_EAST,M.SOUTH_EAST,M.SOUTH_WEST,M.NORTH_WEST];export{ie as CenterPosition,J as SplitLimits,Y as Tile,re as almostEquals,oe as isCornerNeighbor,pe as isEast,ae as isEdgeNeighbor,_e as isNorth,ge as isNorthCorner,me as isSouth,fe as isWest,ce as isWestCorner,Ee as neighborCornerIndices,Te as neighborEdgeIndices,de as oppositeCorner,ue as oppositeEdge};
5
+ import{clamp as e}from"../../../core/mathUtils.js";import{isSome as t,abortMaybe as i,isNone as s}from"../../../core/maybe.js";import n from"../../../core/ObjectPool.js";import{c as r,b as a}from"../../../chunks/vec2.js";import{a as o}from"../../../chunks/vec2f64.js";import{b as h,p as l,e as d,g as u,a as c,l as g}from"../../../chunks/vec3.js";import{c as f,u as p}from"../../../chunks/vec3f64.js";import{E as m}from"../../../chunks/common.js";import{getReferenceEllipsoid as _}from"../../../geometry/projectionEllipsoid.js";import{create as T,equals as E}from"../../../geometry/support/aaBoundingRect.js";import{c as A}from"../../../chunks/sphere.js";import{VectorTile as y}from"../../2d/engine/vectorTiles/VectorTile.js";import{ImageWithType as v}from"../support/StreamDataLoader.js";import{ElevationBounds as S}from"./ElevationBounds.js";import{ElevationTileAgent as L}from"./ElevationTileAgent.js";import{NeighborIndex as M,LODSnapping as N,TextureUpdate as I}from"./interfaces.js";import{LayerClass as O,LayerClasses as D}from"./LayerClass.js";import{MapTileAgent as b}from"./MapTileAgent.js";import{RasterTile as U}from"./RasterTile.js";import{MAX_PATCH_TESSELATION as x,getElevationDesiredResolutionLevel as R}from"./TerrainConst.js";import{weakAssert as j,getLayerWithExtentRange as C,internalAssert as H,ENABLE_WATERPROOFNESS_TESTS as W}from"./terrainUtils.js";import{TILE_AGENT_DONE as P}from"./TileAgent.js";import{TilePerLayerInfo as B}from"./TilePerLayerInfo.js";import G from"./TileTexture.js";import{TileUpdate as V}from"./TileUpdate.js";import{fallsWithinLayer as w}from"./tileUtils.js";import{getGpuMemoryUsage as q}from"../../webgl/Util.js";const F=f(),k=f(),X=f(),z=.1;class J{constructor(){this.fovX=0,this.fovY=0,this.relativeWidthLimit=0,this.relativeHeightLimit=0,this.maxLod=0,this.angledSplitBias=0,this.aboveGround=!0}}class Y{constructor(){this.lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this._dirty=!0,this._previouslyRendered=!1,this.extent=T(),this._elevationBounds=o(),this.layerInfo=[[],[]],this.extentInRadians=T(),this.centerAtSeaLevel=f(),this._center=[f(),A(),f()],this.up=p(),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=te,this._mapTileMemory=0,this._mapDataRefCount=0,this._screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0}static prune(){K.prune(0),Z.prune(0),B.prune()}get usedMemory(){return this._usedMemory===te&&this._updateMemoryUsed(),this._usedMemory+(this.isCached?0:this.mapTileMemory)}get cachedMemory(){return this.isCached?this.mapTileMemory:0}get mapTileMemory(){this._usedMemory===te&&this._updateMemoryUsed();let e=this._mapTileMemory;for(const{data:t}of this.layerInfo[O.MAP])t instanceof y&&(e+=t.memoryUsage);return e}get isCached(){return!this.shouldLoad&&this._mapDataRefCount<=0}get maxTesselation(){return this._maxTesselation}get isWithinClippingArea(){return this._isWithinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBounds(){return this._elevationBounds}get level(){return this.lij[0]}get key(){return`${this.lij[0]}/${this.lij[1]}/${this.lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[ie.MIDDLE][3]}get screenDepth(){return this._screenDepth}get visible(){return this._dirty&&this.computeVisibility(),this._visible}computeVisibility(){this._dirty=!1;const e=this._intersectsClippingArea&&this._isVisible(this.surface.frustum);return e!==this._visible&&(this._visible=e,this._surface.emit("tiles-visibility-changed"),this._surface.renderer.setNeedsRender(),this.updateAgentSuspension()),this._visible}get loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){const e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit("tiles-visibility-changed"),this._previouslyRendered=e,this._surface.renderer.setNeedsRender()),e}get shouldLoad(){if(this._surface.lodSnapping===N.ON){const e=this.level-this._surface.snapLevel;if(0===e)return!0;if(1===e)return!1}return this.isLeaf}init(e,t,i){this.lij[0]=e[0],this.lij[1]=e[1],this.lij[2]=e[2],this.ellipsoid=_(i.tilingScheme.spatialReference),i.tilingScheme.getExtent(e[0],e[1],e[2],this.extent),i.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,i.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[ie.MIDDLE][3]=0,this.vlevel=e?e[0]:0,t&&t.elevationBounds?r(this._elevationBounds,t.elevationBounds):a(this._elevationBounds,0,0),this._pendingUpdates=0,this.renderData=null,this._screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=t,this.unsetChildren(),this._surface=i,this.updateVisibility();for(const s of D){const e=i.numLayers(s),t=this.layerInfo[s];for(const i of t)i.release();t.length=e;for(let i=0;i<e;i++)t[i]=B.acquire(this._surface.upsampleInfoPool),s===O.ELEVATION&&this.findElevationBoundsForLayer(i,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(i.tilingScheme.pixelSize,x)}release(){j(!this.renderData,"tile.renderData was not unloaded"),this._surface.upsampleMapCache.pop(this.key);for(const e of D){for(const t of this.layerInfo[e])t.release();this.layerInfo[e].length=0}this._parent=null,this._surface=null,this._usedMemory=te}refMapData(){++this._mapDataRefCount,this.isCached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){if(--this._mapDataRefCount,this.isCached){const e=this.cachedMemory;e>0&&(this._surface.upsampleMapCache.put(this.key,this,e),this.setMemoryDirty())}}setMemoryDirty(){this._usedMemory=te}get cpuImageMemorySize(){const e=4,t=this._surface.tilingScheme.pixelSize;return t*t*e}_updateMemoryUsed(){this._usedMemory=0,this._mapTileMemory=0;const e=this.cpuImageMemorySize;for(const{data:t}of this.layerInfo[O.MAP])t instanceof G?this._mapTileMemory+=q(t.texture):t instanceof HTMLImageElement||t instanceof v?this._mapTileMemory+=e:t instanceof U&&(this._mapTileMemory+=t.memoryUsage);for(const t of this.layerInfo[O.ELEVATION])this._usedMemory+=t.data?e:0;this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._mapTileMemory+=q(this.renderData.textureDescriptor)),this.isCached&&this._surface.upsampleMapCache.updateSize(this.key,this,this.cachedMemory)}getUsedMemoryForLayer(e,t){const i=this.layerInfo[e][t];if(!i||!i.data)return 0;if(e!==O.MAP||this.isCached){if(e===O.ELEVATION)return this.cpuImageMemorySize}else{const e=i.data;if(e instanceof G)return q(e.texture);if(e instanceof HTMLImageElement||e instanceof v)return this.cpuImageMemorySize;if(e instanceof y||e instanceof U)return e.memoryUsage}return 0}updateScreenDepth(e){const t=this._center[ie.MIDDLE],i=e,s=t[0],n=t[1],r=t[2],a=i[2]*s+i[6]*n+i[10]*r+i[14];this._screenDepth=a<0?0:a/(i[3]*s+i[7]*n+i[11]*r+i[15])}shouldSplit(e,i,s){if(t(e.frustum)&&(!this._intersectsClippingArea||!this._isVisible(e.frustum)))return V.NONE;const n=this.level;h(F,this._center[ie.MIDDLE],i);let r=l(F),a=ie.MIDDLE;h(k,this._center[ie.TOP],i);const o=l(k);o<r&&(r=o,a=ie.TOP),h(k,this._center[ie.BOTTOM],i);const f=l(k);if(f<r&&(r=f,a=ie.BOTTOM),this._edgeLen2>r&&n<e.maxLod)return V.SPLIT;const p=Math.sqrt(r),m=e.fovX*p*2,_=this._edgeLen/m,T=()=>{const t=n+Math.ceil(-Math.log2(e.relativeWidthLimit/_));return t!==this.vlevel?(this.vlevel=t,V.VSPLITMERGE):V.NONE_HIT_MAXLOD};if(s===N.ON){if(1===this._surface.snapLevel-n)return n>=e.maxLod?T():V.SPLIT}const E=d(this.up,F),A=this._elevationBounds[1]-this._elevationBounds[0],y=A/this.edgeLen;if(e.aboveGround&&E>0&&y<.001){if(E/p-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-y>0)return V.NONE}if(_<e.relativeWidthLimit)return this.vlevel!==this.level?(this.vlevel=this.level,V.VSPLITMERGE):V.NONE;if(n>=e.maxLod)return T();if(n>6){h(k,this._center[a],i),u(X,this.up,E),h(X,X,k);const t=l(X);if(t>this.radius*this.radius){u(X,X,this.radius/Math.sqrt(t)),c(X,X,this._center[a]),h(X,i,X);const s=Math.min(1,(Math.abs(d(X,this.up))+.5*A+this._curvatureHeight)/g(X)),n=z/e.angledSplitBias,r=e.fovY*p*2;if(s*(this._edgeLen/r)<n*e.relativeHeightLimit)return V.NONE}}return V.SPLIT}setChildren(e,t,i,s){j(!!(e&&t&&i&&s),"Null child passed"),this._children[0]=e,this._children[1]=t,this._children[2]=i,this._children[3]=s}unsetChildren(){this._children[0]=null,this._children[1]=null,this._children[2]=null,this._children[3]=null}get isLoaded(){return this.renderData?.hasGeometry??!1}prepareToLoad(e){this.refMapData();for(const t of D)this._createOrUpdateAgents(0,t);e.updateTileGeometryState(this)}load(e){this.prepareToLoad(e),this.loadPrepared(e)}loadPrepared(e){e.loadTile(this)}unload(e){e.unloadTile(this);for(const t of D){const e=this.layerInfo[t];for(const t of e)t.loadingAgent&&t.loadingAgent!==P&&(Q(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0}this.resetPendingUpdate(V.GEOMETRY),this.resetPendingUpdate(V.TEXTURE_NOFADING),this.resetPendingUpdate(V.TEXTURE_FADING),this.unrefMapData()}unloadMapData(){const e=this.layerInfo[O.MAP];for(const t of e)t.loadingAgent&&t.loadingAgent!==P&&(Q(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0;this.renderData&&this.renderData.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(E(e,this._clippingArea))return!1;const i=this._intersectsClippingArea,s=this._isWithinClippingArea;t(e)?(this._intersectsClippingArea=this.intersectsExtent(e),this._isWithinClippingArea=this._isWithinExtent(e)):(this._intersectsClippingArea=!0,this._isWithinClippingArea=!0),this._clippingArea=e,this.updateVisibility();const n=s&&this._isWithinClippingArea,r=!(s||i||this._isWithinClippingArea||this._intersectsClippingArea);return!this.renderData||n||r||this.setPendingUpdate(V.GEOMETRY),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty()}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){const i=this.layerInfo[t][e];return!(!i||!i.data||i.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(const e of D){const t=this.layerInfo[e];for(const e of t)if(e.loadingAgent&&e.loadingAgent!==P&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return!!this.hasPendingUpdate(V.SPLIT)||e!==O.ELEVATION&&!this.loadable}get hasPendingUpdates(){return 0!==this._pendingUpdates}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){this._pendingUpdates|=e,e===V.SPLIT||e===V.MERGE?this._surface.setTileTreeDirty():this._surface.requestUpdate()}resetPendingUpdate(e){return!!this.hasPendingUpdate(e)&&(this._pendingUpdates&=~e,!0)}requestLayerData(e,t,s){const n=this.layerInfo[t][e];if(n.waitingAgents.has(s))return console.warn("agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)",this.lij.toString(),s.tile.lij.toString(),t,e),!0;if(n.waitingAgents.push(s),n.data&&!n.dataInvalidated)return console.warn("agent requested existing data (tile %s, agent tile %s, layer: %d/%d)",this.lij.toString(),s.tile.lij.toString(),t,e),s.dataArrived(this),!0;if(n.requestPromise)return!0;i(n.requestAbort),n.requestAbort=new AbortController;const r=this._surface.requestTileData(this,e,t,n.requestAbort);if(!r)return n.requestAbort=null,!1;const a=()=>{n.requestPromise===r&&(n.requestPromise=null,n.requestAbort=null)};return n.requestPromise=r,r.then(a,a),!0}get isLeaf(){return null==this._children[0]}hasLij(e){return this.lij[0]===e[0]&&this.lij[1]===e[1]&&this.lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;if(this.isLeaf)return null;const t=this._children[0].findByLij(e)||this._children[1].findByLij(e)||this._children[2].findByLij(e)||this._children[3].findByLij(e);return t||null}distanceToSquared(e){return l(h(X,this._center[ie.MIDDLE],e))}containsPoint(e){const t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}unrequestLayerData(e,t,i){const s=this.layerInfo[t][e],n=s.waitingAgents,r=null!=n.removeUnordered(i);j(r,"agent has not requested this piece of map data"),n.length<1&&(s.abortRequest(),this._updateMemoryUsed())}dataArrived(e,t,i){const s=this.layerInfo[t][e];s.data=i,s.dataInvalidated=!1,s.waitingAgents.forAll((e=>e.dataArrived(this))),s.waitingAgents.clear(),this._updateMemoryUsed()}dataMissing(e,t,i){i.notInTilemap||console.error(`Tile ${this.lij.toString()} layer ${t}/${e} error ${i}`);const s=this.layerInfo[t][e];s.dataMissing=!0,s.waitingAgents.forAll((e=>e.dataMissing())),s.waitingAgents.clear(),this._updateMemoryUsed()}updateRenderData(e,t){switch(e){case O.MAP:return this._updateTexture(t);case O.ELEVATION:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(e===I.FADING?V.TEXTURE_NOFADING:V.TEXTURE_FADING),this.setPendingUpdate(e===I.FADING?V.TEXTURE_FADING:V.TEXTURE_NOFADING))}_updateGeometry(){this.setPendingUpdate(V.GEOMETRY);for(const e of this.layerInfo[O.ELEVATION])e.pendingUpdates|=V.GEOMETRY}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData(),this.restartAgents(t)}computeElevationBounds(){const e=this._elevationBounds;a(e,Number.MAX_VALUE,-Number.MAX_VALUE);const i=this.layerInfo[O.ELEVATION];let s=!0;for(const n of i)t(n.elevationBounds)&&(e[0]=Math.min(e[0],n.elevationBounds.min),e[1]=Math.max(e[1],n.elevationBounds.max),n.elevationBounds.hasNoDataValues||(s=!1));s&&(e[0]=Math.min(e[0],0),e[1]=Math.max(e[1],0)),this.updateRadiusAndCenter(),this._surface.setTileTreeDirty()}_updateCenter(){const e=this._elevationBounds,t=.5*(e[0]+e[1]);u(X,this.up,t),c(this._center[ie.MIDDLE],this.centerAtSeaLevel,X),u(X,this.up,e[0]),c(this._center[ie.TOP],this.centerAtSeaLevel,X),u(X,this.up,e[1]),c(this._center[ie.BOTTOM],this.centerAtSeaLevel,X)}findElevationBoundsForLayer(e,i){const n=this.layerInfo[O.ELEVATION][e];if(t(n.elevationBounds)&&n.elevationBounds.level>=i)return;const r=this._surface.layerViewByIndex(e,O.ELEVATION),a=C(r);if(!w(this,a,!1))return;const o=ee;let h=!1;if(n.data){const e=n.data;o.min=e.bounds[0],o.max=e.bounds[1],o.hasNoDataValues=e.hasNoDataValues,o.level=this.level,h=!0}else{let t,i,s=0;for(let n=this._parent;n&&(!i||s<R(this.level))&&(s=this.vlevel-n.level,t=i||t,i=n.layerInfo[O.ELEVATION][e].data,!(!i&&t&&s>=R(this.level)));n=n.parent);i=i||t,i&&(i.computeMinMaxValue(this.lij[0],this.lij[1],this.lij[2],o),o.min!==1/0&&(o.level=i.level,h=!0))}h&&(s(n.elevationBounds)&&(n.elevationBounds=new S),n.elevationBounds.copyFrom(o))}modifyLayers(e,t,i){const s=this.layerInfo[i];for(const a of s)a.loadingAgent&&a.loadingAgent!==P&&(Q(a.loadingAgent),a.loadingAgent=null),a.waitingAgents.clear();for(let a=0;a<s.length;++a)void 0===e[a]&&s[a].release();const n=new Array(...s),r=t.length;s.length=r;for(let a=0;a<r;a++){const e=t[a];s[a]=e>-1?n[e]:B.acquire(this._surface.upsampleInfoPool)}this._updateMemoryUsed()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,I.FADING))}updateAgents(e){if(this.renderData){const t=this.layerInfo[e];for(const e of t)e.loadingAgent===P&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(const e of D){const t=this._isSuspended(e);for(const i of this.layerInfo[e])i.loadingAgent&&i.loadingAgent!==P&&(i.loadingAgent.setSuspension(t),i.loadingAgent===P&&this.updateRenderData(e,I.FADING))}}removeLayerAgent(e,t){const i=this.layerInfo[t][e];i.loadingAgent&&i.loadingAgent!==P&&i.loadingAgent.dispose(),i.loadingAgent=null}agentDone(e,t){const i=this.layerInfo[t][e];i.loadingAgent=P,!i.data&&s(i.upsampleInfo)&&this._createOrUpdateAgents(e+1,t)}_createOrUpdateAgents(e,t){const i=this._isSuspended(t),s=this.layerInfo[t];for(let n=e;n<s.length;++n){const e=s[n];let r=!1;const a=this._surface.layerViewByIndex(n,t),o=C(a);if(e.loadingAgent?w(this,o,!1)?(e.loadingAgent!==P&&e.loadingAgent.setSuspension(i),e.loadingAgent!==P&&(r=e.loadingAgent.update())):e.dispose():w(this,o,!1)&&(e.loadingAgent=$(this,n,t,i),r=e.loadingAgent.startLoading(),r?e.loadingAgent===P&&this.setPendingUpdate(V.GEOMETRY):(Q(e.loadingAgent),e.loadingAgent=P)),e.loadingAgent===P&&this.updateRenderData(t,I.FADING),r&&a.isOpaque)return}}_isWithinExtent(e){const t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){const t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationBasedVerticesPerSide(t){const i=this.vlevel-this.level,s=Math.max(this.level-t,R(this.level)-i);return e(1+(this.maxTesselation>>s),2,this.maxTesselation+1)}get test(){return{cachedMemory:this.cachedMemory}}_findLIJ(e,i){if(!e)return null;const s=this.surface.rootTiles;if(t(s))for(const t of s)if(se(t,e)){let s=t,n=e[0]-s.level-1;for(;n>=0&&!s.isLeaf&&!i(s);){const t=e[1]>>n&1,i=e[2]>>n&1;s=s.children[2*t+i],n--}return i(s)?s:null}return null}findNeighborTile(e,t){const i=this.lij,s=this.getNeighborLIJ(i,e);return s?ne(i,s)?t(this)?this:null:this._findLIJ(s,t):null}findCorner(e,t){const i=e===M.NORTH_EAST?1:e===M.NORTH_WEST?0:e===M.SOUTH_WEST?2:3;let s=this;for(;!(s.isLeaf||t&&t(s));)s=s.children[i];return s}findNeighborCornerTileExact(e,t){return this.findNeighborTile(e,(e=>t(e)||e.level===this.level))?.findCorner(de(e),t)}forAllSubtreeOnSide(e,t){const i=e===M.NORTH?[0,1]:e===M.NORTH_EAST?[1]:e===M.EAST?[1,3]:e===M.SOUTH_EAST?[3]:e===M.SOUTH?[2,3]:e===M.SOUTH_WEST?[2]:e===M.WEST?[0,2]:[0],s=e=>{t(e)||e.isLeaf||i.forEach((t=>s(e.children[t])))};s(this)}forallNeighbors(e){Ee.forEach((t=>this.findNeighborCornerTileExact(t,e))),Te.forEach((t=>this.findNeighborTile(t,(t=>t.level===this.level||e(t)))?.forAllSubtreeOnSide(ue(t),e)))}getNeighborEdgeStartVertexIndex(e,t){const i=t??this.findNeighborTile(Te[e],(e=>e.isLoaded));if(!i||!this.isLoaded||!i.isLoaded)return 0;const s=this.level-i.level;if(0===s)return 0;const n=2**s,r=1==(1&e),a=r?0:1,o=i.lij[a+1]*n,h=this.lij[a+1]-o;return r?n-1-h:h}_updateNeighborsWithChangedEdgeResolution(){for(let e=0;e<4;++e)if(this.renderData.geometryState.neighborData.modifiedEdgeResolutions[e]){const t=Te[e],i=this.findNeighborTile(t,(e=>e.isLoaded||e.level===this.level));if(!i)continue;if(!i.isLoaded){H(!i.isLeaf);const s=(e+2)%4,n=ue(t);i.forAllSubtreeOnSide(n,(e=>e.isLoaded?(e.updateEdgeAfterResolutionChange(s),!0):(H(!e.isLeaf),!1)))}this.renderData.geometryState.neighborData.modifiedEdgeResolutions[e]=!1}}updateNeighborDataAndGeometryIfNeeded(){this.isLoaded&&this.renderData.updateNeighborDataAndGeometryIfNeeded()}updateNeighborsAfterGeometryChange(e=this.level){this.forEachLoadedNeighbor((e=>this._updateNeighbor(e))),Te.forEach((t=>{this.findNeighborTile(t,(t=>t.isLoaded&&t.level<e))?.updateNeighborsWithChangedEdgeResolution()}))}updateNeighborsWithChangedEdgeResolution(){this.isLoaded&&this._updateNeighborsWithChangedEdgeResolution()}updateEdgeAfterResolutionChange(e){this.renderData.updateEdgeAfterResolutionChange(e)}forEachLoadedNeighbor(e){const t=this.level,i=e=>e.level===t||e.isLoaded;Te.forEach(((t,s)=>{const n=this.findNeighborTile(t,i);null!=n&&n!==this&&n.forAllSubtreeOnSide(ue(t),(t=>!!t.isLoaded&&(e(t),!0)));const r=this.renderData?.geometryState?.neighborData;r&&(r.modifiedEdgeResolutions[s]=!1)})),Ee.forEach((t=>{const s=this.findNeighborTile(t,i)?.findCorner(de(t),(e=>e.isLoaded));H(!s||oe(this,s,t)),s?.isLoaded&&e(s)}))}_updateNeighbor(e){e?.isLoaded&&e.updateNeighborDataAndGeometryIfNeeded()}getNeighborLIJ(e,t){const i=_e(t)?-1:me(t)?1:0,s=fe(t)?-1:pe(t)?1:0,n=[e[0],e[1]+i,e[2]+s];return n[1]<0?null:this.surface.isGlobal?this.wrapLIJ(n):n[2]<0?null:n}wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}get westNeighborWestExtent(){return this.extent[0]*(this.isWestEnd?-1:1)}get eastNeighborEastExtent(){return this.extent[2]*(this.isEastEnd?-1:1)}get isEastEnd(){return this.lij[2]===this.surface.lijEastEnd(this.level)-1}get isWestEnd(){return 0===this.lij[2]}get isNorthEnd(){return 0===this.lij[1]}get isSouthEnd(){return this.extent[1]+m>=this.surface.extent[1]}compareLIJs(e){const t=this.lij,i=t[0],s=e[0];if(i===s)return[t,e];const n=i-s;if(n<0){const i=2**-n;return[[s,t[1]*i,t[2]*i],e]}{const s=2**n;return[t,[i,e[1]*s,e[2]*s]]}}checkGeometryWaterproofness(){W&&(H(this.isLoaded),this.renderData.checkGeometryWaterproofness())}shouldHaveNeighbor(e){const t=this.extent,i=this.surface.rootTilesExtent,s=.25*(t[2]-t[0]);if(_e(e)&&t[3]+s>=i[3])return!1;if(me(e)&&t[1]-s<=i[1])return!1;const n=this.surface.isGlobal;return!(!n&&fe(e)&&t[0]-s<=i[0])&&!(!n&&pe(e)&&t[2]+s>=i[2])}}function $(e,t,i,s){const n=i===O.ELEVATION?Z.acquire():K.acquire();return n.init(e,t,i,s),n}function Q(e){e.dispose(),e instanceof L?Z.release(e):e instanceof b&&K.release(e)}const K=new n(b),Z=new n(L),ee=new S,te=-1;var ie;function se(e,t){const i=e.level,s=t[0];if(i>s)return!1;const n=s-i,r=t[1]>>n,a=t[2]>>n;return r===e.lij[1]&&a===e.lij[2]}function ne(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function re(e,t,i){return Math.abs(e-t)<=i}function ae(e,t,i){if(!e||!t)return!1;if(0===e.level&&0===t.level){if(e.isEastEnd&&t.isWestEnd&&i===M.EAST)return!0;if(e.isWestEnd&&t.isEastEnd&&i===M.WEST)return!0}const s=1e-6*(e.extent[2]-e.extent[0]);switch(i){case M.NORTH:return re(e.extent[3],t.extent[1],s);case M.SOUTH:return re(e.extent[1],t.extent[3],s);case M.EAST:return re(e.extent[2],t.extent[0],s)||re(e.extent[2],-t.extent[0],s);case M.WEST:return re(e.extent[0],t.extent[2],s)||re(e.extent[0],-t.extent[2],s)}}function oe(e,t,i){return!(!e||!t||t===e)&&(e.level>=t.level?he(e,t,i):he(t,e,de(i)))}function he(e,t,i){H(e.level>=t.level);const s=ce(i),n=ge(i),r=e.extent,a=t.extent,o=[s?r[0]:r[2],n?r[3]:r[1]],h=[s?a[2]:a[0],n?a[1]:a[3]],l=1e-5*(r[2]-r[0]),d=re(o[0],h[0],l)||e.surface.isGlobal&&re(o[0],-h[0],l),u=re(o[1],h[1],l);if(d&&u)return!0;if(e.level===t.level)return!1;if(!d&&!u)return!1;return d?le([a[1],a[3]],[r[1],r[3]],l):le([a[0],a[2]],[r[0],r[2]],l)}function le(e,t,i=m){return e[0]-i<=t[0]&&t[0]<=t[1]&&t[1]<=e[1]+i}function de(e){return e===M.NORTH_EAST?M.SOUTH_WEST:e===M.NORTH_WEST?M.SOUTH_EAST:e===M.SOUTH_WEST?M.NORTH_EAST:M.NORTH_WEST}function ue(e){return e===M.NORTH?M.SOUTH:e===M.EAST?M.WEST:e===M.SOUTH?M.NORTH:M.EAST}function ce(e){return e===M.NORTH_WEST||e===M.SOUTH_WEST}function ge(e){return e===M.NORTH_WEST||e===M.NORTH_EAST}function fe(e){return e===M.NORTH_WEST||e===M.WEST||e===M.SOUTH_WEST}function pe(e){return e===M.NORTH_EAST||e===M.EAST||e===M.SOUTH_EAST}function me(e){return e===M.SOUTH_EAST||e===M.SOUTH||e===M.SOUTH_WEST}function _e(e){return e===M.NORTH_EAST||e===M.NORTH||e===M.NORTH_WEST}!function(e){e[e.TOP=0]="TOP",e[e.MIDDLE=1]="MIDDLE",e[e.BOTTOM=2]="BOTTOM"}(ie||(ie={}));const Te=[M.NORTH,M.EAST,M.SOUTH,M.WEST],Ee=[M.NORTH_EAST,M.SOUTH_EAST,M.SOUTH_WEST,M.NORTH_WEST];export{ie as CenterPosition,J as SplitLimits,Y as Tile,re as almostEquals,oe as isCornerNeighbor,pe as isEast,ae as isEdgeNeighbor,_e as isNorth,ge as isNorthCorner,me as isSouth,fe as isWest,ce as isWestCorner,Ee as neighborCornerIndices,Te as neighborEdgeIndices,de as oppositeCorner,ue as oppositeEdge};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{disposeMaybe as e,releaseMaybe as r,isNone as t,isSome as i}from"../../../core/maybe.js";import{Z as o}from"../../../chunks/vec2f64.js";import{RasterColorizerStretchType as s}from"../../2d/engine/imagery/enums.js";import{VectorTileRendererHelper3D as a}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechniqueConfiguration as l,BlendLayersTechnique as n}from"./BlendLayersTechnique.js";import{LayerClass as h}from"./LayerClass.js";import{RasterColorizerTechniqueConfiguration as c,RasterColorizerTechnique as u}from"./RasterColorizerTechnique.js";import{FBOPool as _}from"./support/FBOPool.js";import{BlendMode as f}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BindParameters as p}from"../webgl-engine/lib/BindParameters.js";import{Pos2Tex as d}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as y}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as b,ClearBufferBit as m}from"../../webgl/enums.js";import{vertexCount as T}from"../../webgl/Util.js";class x{constructor(e,r){this._rctx=e,this._techniqueRepository=r,this._vectorTileHelper=new a,this._bindParameters=new p(null,null,null),this._vaoQuad=y(this._rctx,d),this._fboPool=new _(this._rctx)}dispose(){this._fboPool&&(this._fboPool.clear(),this._fboPool=null),this._vaoQuad=e(this._vaoQuad),this._vectorTileHelper=e(this._vectorTileHelper),this._applyOpacityTechnique=r(this._applyOpacityTechnique),this._blendLayersTechnique=r(this._blendLayersTechnique)}get blendLayersTechnique(){if(t(this._blendLayersTechnique)){const e=new l;e.mode=f.OneMinusSourceAlpha,this._blendLayersTechnique=this._techniqueRepository.acquire(n,e)}return this._blendLayersTechnique}get applyOpacityTechnique(){if(t(this._applyOpacityTechnique)){const e=new l;e.mode=f.SourceAlpha,this._applyOpacityTechnique=this._techniqueRepository.acquire(n,e)}return this._applyOpacityTechnique}_render(e){this._rctx.bindVAO(this._vaoQuad),e.assertCompatibleVertexAttributeLocations(this._vaoQuad),this._rctx.drawArrays(b.TRIANGLE_STRIP,0,T(this._vaoQuad,"geometry"))}drawRasterData(e,r){if(t(r.texture))return;const i=this._rctx.bindTechnique(e,r,this._bindParameters);this._render(i)}drawImageryTileData(e,r=1){const t=e.sourceLayerInfo.data;if(!t.source)return;e.tile.surface.layerViewByIndex(e.layerIndex,h.MAP).ensureSymbolizerParameters(t);const i=this._getRasterColorizerTechnique(t),o=this._rctx,s=o.bindTechnique(i);t.bind(o)&&(t.opacity=r,t.scale=e.scale,t.offset=e.offset,t.bindRasterTextures(s),i.bindPass(t.getUniforms()),this._render(s),o.bindVAO())}_getRasterColorizerTechnique(e){const r=e.symbolizerParameters,i=["stretch","lut","hillshade"].indexOf(r.type);return t(this._rasterColorizerConfig)&&(this._rasterColorizerConfig=new c,this._rctx.gl.getExtension("WEBGL_color_buffer_float"),this._rctx.gl.getExtension("OES_texture_float")),this._rasterColorizerConfig.colorizerType=i,this._rasterColorizerConfig.applyColormap=!!r.colormap,this._rasterColorizerConfig.stretchType=e.hasStretchTypeNone()?s.Noop:s.PerBand,this._rasterColorizerTechnique=this._techniqueRepository.releaseAndAcquire(u,this._rasterColorizerConfig,this._rasterColorizerTechnique),this._rasterColorizerTechnique}drawVectorData(e,r,t,s,a,l,n){const c=this._rctx,u=t.sourceLayerInfo.data,_=t.tile.surface.layerViewByIndex(t.layerIndex,h.MAP);let f;return e.bindPipelineState(c),r.opacity<1?(f=this._fboPool.acquire(l),c.bindFramebuffer(f),c.setClearColor(1,1,1,0),c.clearSafe(m.COLOR_BUFFER_BIT|m.DEPTH_BUFFER_BIT)):n&&c.clearSafe(m.DEPTH_BUFFER_BIT),this._vectorTileHelper.render(c,t.sourceLod,u,_.painter,_.layer.styleRepository,_.schemaHelper,Math.round(1/t.scale),t.offset,a,s),!i(f)||(c.bindFramebuffer(this._currentlyBoundfbo),r.texture=f.colorTexture,r.offset=o,r.scale=1,this.drawRasterData(e,r),this._fboPool.release(f),n)}bindPool(e){this._currentlyBoundfbo=this._fboPool.acquire(e),this._rctx.bindFramebuffer(this._currentlyBoundfbo),this._rctx.setViewport(0,0,e,e),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.clearSafe(m.COLOR_BUFFER_BIT|m.DEPTH_BUFFER_BIT)}releasePool(){this._rctx.bindFramebuffer(null),this._fboPool.release(this._currentlyBoundfbo)}cleanupFBOPool(e,r){e===this._lastPixelRatio&&r===this._lastNumLayers||(this._fboPool.clear(),this._lastPixelRatio=e,this._lastNumLayers=r)}}export{x as TileCompositor};
5
+ import{disposeMaybe as e,releaseMaybe as r,isNone as t,isSome as i}from"../../../core/maybe.js";import{Z as o}from"../../../chunks/vec2f64.js";import{RasterColorizerStretchType as s}from"../../2d/engine/imagery/enums.js";import{VectorTileRendererHelper3D as a}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechniqueConfiguration as l,BlendLayersTechnique as n}from"./BlendLayersTechnique.js";import{LayerClass as h}from"./LayerClass.js";import{RasterColorizerTechniqueConfiguration as c,RasterColorizerTechnique as u}from"./RasterColorizerTechnique.js";import{FBOPool as _}from"./support/FBOPool.js";import{BlendMode as f}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BindParameters as p}from"../webgl-engine/lib/BindParameters.js";import{Pos2Tex as d}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as y}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as m,ClearBufferBit as b}from"../../webgl/enums.js";import{vertexCount as T}from"../../webgl/Util.js";class x{constructor(e,r){this._rctx=e,this._techniqueRepository=r,this._vectorTileHelper=new a,this._bindParameters=new p(null,null,null),this._vaoQuad=y(this._rctx,d),this._fboPool=new _(this._rctx)}dispose(){this._fboPool&&(this._fboPool.clear(),this._fboPool=null),this._vaoQuad=e(this._vaoQuad),this._vectorTileHelper=e(this._vectorTileHelper),this._applyOpacityTechnique=r(this._applyOpacityTechnique),this._blendLayersTechnique=r(this._blendLayersTechnique)}get blendLayersTechnique(){if(t(this._blendLayersTechnique)){const e=new l;e.mode=f.OneMinusSourceAlpha,this._blendLayersTechnique=this._techniqueRepository.acquire(n,e)}return this._blendLayersTechnique}get applyOpacityTechnique(){if(t(this._applyOpacityTechnique)){const e=new l;e.mode=f.SourceAlpha,this._applyOpacityTechnique=this._techniqueRepository.acquire(n,e)}return this._applyOpacityTechnique}_render(e){this._rctx.bindVAO(this._vaoQuad),e.assertCompatibleVertexAttributeLocations(this._vaoQuad),this._rctx.drawArrays(m.TRIANGLE_STRIP,0,T(this._vaoQuad,"geometry"))}drawRasterData(e,r){if(t(r.texture))return;const i=this._rctx.bindTechnique(e,r,this._bindParameters);this._render(i)}drawImageryTileData(e,r=1){const t=e.sourceLayerInfo.data;if(!t.source)return;e.tile.surface.layerViewByIndex(e.layerIndex,h.MAP).ensureSymbolizerParameters(t);const i=this._getRasterColorizerTechnique(t),o=this._rctx,s=o.bindTechnique(i);t.bind(o)&&(t.opacity=r,t.scale=e.scale,t.offset=e.offset,i.bindPass(t.getUniforms(),null),this._render(s),o.bindVAO())}_getRasterColorizerTechnique(e){const r=e.symbolizerParameters,i=["stretch","lut","hillshade"].indexOf(r.type);return t(this._rasterColorizerConfig)&&(this._rasterColorizerConfig=new c,this._rctx.gl.getExtension("WEBGL_color_buffer_float"),this._rctx.gl.getExtension("OES_texture_float")),this._rasterColorizerConfig.colorizerType=i,this._rasterColorizerConfig.applyColormap=!!r.colormap,this._rasterColorizerConfig.stretchType=e.hasStretchTypeNone()?s.Noop:s.PerBand,this._rasterColorizerTechnique=this._techniqueRepository.releaseAndAcquire(u,this._rasterColorizerConfig,this._rasterColorizerTechnique),this._rasterColorizerTechnique}drawVectorData(e,r,t,s,a,l,n){const c=this._rctx,u=t.sourceLayerInfo.data,_=t.tile.surface.layerViewByIndex(t.layerIndex,h.MAP);let f;return e.bindPipelineState(c),r.opacity<1?(f=this._fboPool.acquire(l),c.bindFramebuffer(f),c.setClearColor(1,1,1,0),c.clearSafe(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)):n&&c.clearSafe(b.DEPTH_BUFFER_BIT),this._vectorTileHelper.render(c,t.sourceLod,u,_.painter,_.layer.styleRepository,_.schemaHelper,Math.round(1/t.scale),t.offset,a,s),!i(f)||(c.bindFramebuffer(this._currentlyBoundfbo),r.texture=f.colorTexture,r.offset=o,r.scale=1,this.drawRasterData(e,r),this._fboPool.release(f),n)}bindPool(e){this._currentlyBoundfbo=this._fboPool.acquire(e),this._rctx.bindFramebuffer(this._currentlyBoundfbo),this._rctx.setViewport(0,0,e,e),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.clearSafe(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)}releasePool(){this._rctx.bindFramebuffer(null),this._fboPool.release(this._currentlyBoundfbo)}cleanupFBOPool(e,r){e===this._lastPixelRatio&&r===this._lastNumLayers||(this._fboPool.clear(),this._lastPixelRatio=e,this._lastNumLayers=r)}}export{x as TileCompositor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{nextHighestPowerOfTwo as e}from"../../../core/mathUtils.js";import{disposeMaybe as t,releaseMaybe as r,isSome as s,isNone as a}from"../../../core/maybe.js";import{b as o,c as i}from"../../../chunks/vec2.js";import{Z as n}from"../../../chunks/vec2f64.js";import{f as c}from"../../../chunks/vec3f64.js";import{f as u}from"../../../chunks/vec4f64.js";import{isBaseLayer as p}from"../../../layers/support/layerUtils.js";import{ImageWithType as l}from"../support/StreamDataLoader.js";import{BlendLayersPassParameters as m}from"./BlendLayersTechnique.js";import{TextureUpdate as h}from"./interfaces.js";import{LayerClass as _}from"./LayerClass.js";import"../../../core/arrayUtils.js";import"../../../geometry/support/aaBoundingBox.js";import"../../../core/has.js";import"../../../geometry/Extent.js";import"../../../geometry/support/Ellipsoid.js";import"../support/buffer/glUtil.js";import"./TerrainConst.js";import"./GeometryState.js";import"./PatchGeometry.js";import{isVectorTileLayerView as d,isVectorTileRenderInfo as T,isImageryTileRenderInfo as f,isRasterTileRenderInfo as x,isTextureTileRenderInfo as g}from"./terrainUtils.js";import{ActivationTime as y}from"./TextureFader.js";import"./Tile.js";import"../../../core/HeapSort.js";import"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import"../../webgl/BufferObject.js";import"../../webgl/VertexArrayObject.js";import{TextureReference as b}from"./TextureReference.js";import{TileCompositor as I}from"./TileCompositor.js";import j from"./TileTexture.js";import{TileUpdate as k}from"./TileUpdate.js";import{createColorTexture as P,createEmptyTexture as w}from"../webgl-engine/lib/glUtil3D.js";import{TextureSamplingMode as E,TextureType as D,PixelFormat as R,PixelType as A,TextureWrapMode as L}from"../../webgl/enums.js";import{Texture as U}from"../../webgl/Texture.js";class M{constructor(e,t,r){this._rctx=e,this.tileSize=t,this._techniqueRepository=r,this._passParameters=new m,this._backgroundIsGrid=!1,this._backgroundTexture=null,this._backgroundColor=null,this._blackTex=null,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._composition=new I(this._rctx,this._techniqueRepository),this._blackTex=new j(P(this._rctx,[0,0,0,1]))}dispose(){this._composition=t(this._composition),this._backgroundTexture=r(this._backgroundTexture),this._blackTex=r(this._blackTex)}get backgroundIsGrid(){return this._backgroundIsGrid}get backgroundColor(){return this._backgroundColor}updateTileTexture(e,t){const r=e.layerInfo[_.MAP];for(const s of r)s.pendingUpdates&=~(k.TEXTURE_NOFADING&k.TEXTURE_FADING);if(!e.renderData)return;const a=e.surface,o=a.baseOpacity;let i=0,n=0,c=this.tileSize,u=!1;const l=a.view.state.pixelRatio;let m=r.length,h=0;for(;h<r.length&&!u;h++){const t=a.layerViewByIndex(h,_.MAP),s=t.fullOpacity;if(G[h]=s,p(t.layer)&&m>=r.length&&(m=h),0===s)continue;++n;const T=N(e,h,S);T&&(d(t)?c=Math.max(c,this.tileSize*l):1===o&&1===s&&(t.isOpaque||this._dataToTexture(T)&&T.sourceLayerInfo.data.descriptor.isOpaque)&&(u=!0),++i)}this._composition.cleanupFBOPool(l,r.length),c=O(c);const T=c/this.tileSize,f=h-1;0!==i?1===i&&(u||this._backgroundIsGrid||s(this._backgroundColor))&&this._useLayerTexture(e,f,m,G[f])||this._composeMapLayers(e,t,f,m,u,G,c,T):this._useBackgroundTexture(e,n)}_useBackgroundTexture(e,t){let r=y.Immediate;(e.surface.view.layerViewManager.updating||t>0)&&(r=y.Delayed),this._backgroundTexture&&a(e.renderData.textureReference)&&(r=y.Immediate),e.renderData.setTextureReference(s(this._backgroundTexture)?new b(this._backgroundTexture,h.FADING,F,e.surface.baseOpacity,1,1,!1):null,r)}_useLayerTexture(e,t,r,s){const a=t<r,o=a?1:e.surface.baseOpacity,i=a?e.surface.baseOpacity:1,n=N(e,t,S);return!!this._dataToTexture(n)&&(e.renderData.setTextureReference(new b(n.sourceLayerInfo.data,h.FADING,n,o,s,i,!0)),!0)}_composeMapLayers(e,t,r,a,o,i,c,u){const p=this._rctx;this._composition.bindPool(c);let l=!1;!o&&s(this._backgroundTexture)&&(this._passParameters.texture=this._backgroundTexture.texture,this._passParameters.offset=n,this._passParameters.scale=1,this._passParameters.opacity=1,this._composition.drawRasterData(this._composition.blendLayersTechnique,this._passParameters));const m=e.surface.baseOpacity;let h=!1,_=E.LINEAR_MIPMAP_LINEAR;for(let s=r;s>=0;s--){const t=N(e,s,S);t&&(s<a&&m<1&&!h&&(this._passParameters.texture=this._blackTex.texture,this._passParameters.offset=n,this._passParameters.scale=1,this._passParameters.opacity=m,this._composition.drawRasterData(this._composition.applyOpacityTechnique,this._passParameters),h=!0),0!==i[s]&&(T(t)?(this._passParameters.opacity=i[s],l=this._composition.drawVectorData(this._composition.blendLayersTechnique,this._passParameters,t,u,this.tileSize,c,l)):f(t)?(this._composition.drawImageryTileData(t,i[s]),this._hasNearestInterpolation(t)&&(_=E.NEAREST)):this._dataToTexture(t)&&(this._passParameters.texture=t.sourceLayerInfo.data.texture,this._passParameters.offset=t.offset,this._passParameters.scale=t.scale,this._passParameters.opacity=i[s],this._composition.drawRasterData(this._composition.blendLayersTechnique,this._passParameters))))}const d=e.renderData.ensureTexture(c,(()=>this._buildTexture(c,_))),x=p.bindTexture(d.texture,U.TEXTURE_UNIT_FOR_UPDATES),g=d.descriptor;p.gl.copyTexImage2D(D.TEXTURE_2D,0,g.pixelFormat,0,0,g.width,g.height,0),d.generateMipmap(),p.bindTexture(x,U.TEXTURE_UNIT_FOR_UPDATES),this._composition.releasePool();const y=h?1:m;e.renderData.setTextureReference(new b(d,t,F,y,1,1,!1))}_hasNearestInterpolation(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}_dataToTexture(e){return x(e)&&this._rasterDataToTexture(e),g(e)}_rasterDataToTexture(e){const t=e.sourceLayerInfo;t.data=this._buildTexture(t.data),e.tile.setMemoryDirty()}setBackground(e,t){r(this._backgroundTexture),this._backgroundIsGrid=t,e instanceof HTMLImageElement?(this._backgroundTexture=this._buildTexture(e),this._backgroundColor=null):(this._backgroundTexture=new j(P(this._rctx,u(e[0]||0,e[1]||0,e[2]||0,1))),this._backgroundColor=c(e[0]||0,e[1]||0,e[2]||0))}_buildTexture(e,t=E.LINEAR_MIPMAP_LINEAR){if(a(e))return null;const r={target:D.TEXTURE_2D,pixelFormat:R.RGBA,dataType:A.UNSIGNED_BYTE,wrapMode:L.CLAMP_TO_EDGE,samplingMode:t,maxAnisotropy:this._maxAnisotropy,flipped:!0,hasMipmap:!0},s=this._rctx;let o;if("number"==typeof e)r.width=r.height=e,o=new j(new U(s,r));else if(e instanceof l)r.isOpaque=e.isOpaque,o=new j(new U(s,r,e.image)),e.release();else try{o=new j(new U(s,r,e))}catch(n){o=new j(w(s)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const i=s.bindTexture(o.texture,U.TEXTURE_UNIT_FOR_UPDATES);return o.generateMipmap(),s.bindTexture(i,U.TEXTURE_UNIT_FOR_UPDATES),o}get test(){return{backgroundTexture:this._backgroundTexture}}}function O(t){const r=e(t),s=r*r,a=t*t;if(s===a)return t;const o=r/2;return s-a<a-o*o?r:o}function N(e,t,r){r.layerIndex=t;const a=e.layerInfo[_.MAP][t];if(s(a.data))return o(r.offset,0,0),r.tile=e,r.scale=1,r.sourceLod=e.lij,r.sourceLayerInfo=a,r;const n=a.upsampleInfo;if(s(n)){const e=n.tile.layerInfo[_.MAP][t];return r.tile=n.tile,i(r.offset,n.offset),r.scale=n.scale,r.sourceLod=n.tile.lij,r.sourceLayerInfo=e,r}return null}const G=new Array,S={tile:null,sourceLayerInfo:null,sourceLod:null,offset:[0,0],scale:1,layerIndex:0},F={offset:[0,0],scale:1};export{M as TileRenderer};
5
+ import{nextHighestPowerOfTwo as e}from"../../../core/mathUtils.js";import{disposeMaybe as t,releaseMaybe as r,isSome as s,isNone as a}from"../../../core/maybe.js";import{b as o,c as i}from"../../../chunks/vec2.js";import{Z as n}from"../../../chunks/vec2f64.js";import{f as c}from"../../../chunks/vec3f64.js";import{f as u}from"../../../chunks/vec4f64.js";import{isBaseLayer as l}from"../../../layers/support/layerUtils.js";import{ImageWithType as p}from"../support/StreamDataLoader.js";import{BlendLayersPassParameters as h}from"./BlendLayersTechnique.js";import{TextureUpdate as _}from"./interfaces.js";import{LayerClass as m}from"./LayerClass.js";import"./PatchRenderData.js";import{isVectorTileLayerView as d,isVectorTileRenderInfo as T,isImageryTileRenderInfo as f,isRasterTileRenderInfo as x,isTextureTileRenderInfo as y}from"./terrainUtils.js";import{TextureReference as g}from"./TextureReference.js";import{TileCompositor as b}from"./TileCompositor.js";import I from"./TileTexture.js";import{TileUpdate as k}from"./TileUpdate.js";import{createColorTexture as P,createEmptyTexture as D}from"../webgl-engine/lib/glUtil3D.js";import{TextureSamplingMode as w,TextureType as E,PixelFormat as R,PixelType as L,TextureWrapMode as A}from"../../webgl/enums.js";import{Texture as j}from"../../webgl/Texture.js";import{ActivationTime as U}from"./TextureFader.js";class M{constructor(e,t,r){this._rctx=e,this.tileSize=t,this._techniqueRepository=r,this._passParameters=new h,this._backgroundIsGrid=!1,this._backgroundTexture=null,this._backgroundColor=null,this._blackTex=null,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._composition=new b(this._rctx,this._techniqueRepository),this._blackTex=new I(P(this._rctx,[0,0,0,1]))}dispose(){this._composition=t(this._composition),this._backgroundTexture=r(this._backgroundTexture),this._blackTex=r(this._blackTex)}get backgroundIsGrid(){return this._backgroundIsGrid}get backgroundColor(){return this._backgroundColor}updateTileTexture(e,t){const r=e.layerInfo[m.MAP];for(const s of r)s.pendingUpdates&=~(k.TEXTURE_NOFADING&k.TEXTURE_FADING);if(!e.renderData)return;const a=e.surface,o=a.baseOpacity;let i=0,n=0,c=this.tileSize,u=!1;const p=a.view.state.pixelRatio;let h=r.length,_=0;for(;_<r.length&&!u;_++){const t=a.layerViewByIndex(_,m.MAP),s=t.fullOpacity;if(F[_]=s,l(t.layer)&&h>=r.length&&(h=_),0===s)continue;++n;const T=O(e,_,G);T&&(d(t)?c=Math.max(c,this.tileSize*p):1===o&&1===s&&(t.isOpaque||this._dataToTexture(T)&&T.sourceLayerInfo.data.descriptor.isOpaque)&&(u=!0),++i)}this._composition.cleanupFBOPool(p,r.length),c=N(c);const T=c/this.tileSize,f=_-1;0!==i?1===i&&(u||this._backgroundIsGrid||s(this._backgroundColor))&&this._useLayerTexture(e,f,h,F[f])||this._composeMapLayers(e,t,f,h,u,F,c,T):this._useBackgroundTexture(e,n)}_useBackgroundTexture(e,t){let r=U.Immediate;(e.surface.view.layerViewManager.updating||t>0)&&(r=U.Delayed),this._backgroundTexture&&a(e.renderData.textureReference)&&(r=U.Immediate),e.renderData.setTextureReference(s(this._backgroundTexture)?new g(this._backgroundTexture,_.FADING,S,e.surface.baseOpacity,1,1,!1):null,r)}_useLayerTexture(e,t,r,s){const a=t<r,o=a?1:e.surface.baseOpacity,i=a?e.surface.baseOpacity:1,n=O(e,t,G);return!!this._dataToTexture(n)&&(e.renderData.setTextureReference(new g(n.sourceLayerInfo.data,_.FADING,n,o,s,i,!0)),!0)}_composeMapLayers(e,t,r,a,o,i,c,u){const l=this._rctx;this._composition.bindPool(c);let p=!1;!o&&s(this._backgroundTexture)&&(this._passParameters.texture=this._backgroundTexture.texture,this._passParameters.offset=n,this._passParameters.scale=1,this._passParameters.opacity=1,this._composition.drawRasterData(this._composition.blendLayersTechnique,this._passParameters));const h=e.surface.baseOpacity;let _=!1,m=w.LINEAR_MIPMAP_LINEAR;for(let s=r;s>=0;s--){const t=O(e,s,G);t&&(s<a&&h<1&&!_&&(this._passParameters.texture=this._blackTex.texture,this._passParameters.offset=n,this._passParameters.scale=1,this._passParameters.opacity=h,this._composition.drawRasterData(this._composition.applyOpacityTechnique,this._passParameters),_=!0),0!==i[s]&&(T(t)?(this._passParameters.opacity=i[s],p=this._composition.drawVectorData(this._composition.blendLayersTechnique,this._passParameters,t,u,this.tileSize,c,p)):f(t)?(this._composition.drawImageryTileData(t,i[s]),this._hasNearestInterpolation(t)&&(m=w.NEAREST)):this._dataToTexture(t)&&(this._passParameters.texture=t.sourceLayerInfo.data.texture,this._passParameters.offset=t.offset,this._passParameters.scale=t.scale,this._passParameters.opacity=i[s],this._composition.drawRasterData(this._composition.blendLayersTechnique,this._passParameters))))}const d=e.renderData.ensureTexture(c,(()=>this._buildTexture(c,m))),x=l.bindTexture(d.texture,j.TEXTURE_UNIT_FOR_UPDATES),y=d.descriptor;l.gl.copyTexImage2D(E.TEXTURE_2D,0,y.pixelFormat,0,0,y.width,y.height,0),d.generateMipmap(),l.bindTexture(x,j.TEXTURE_UNIT_FOR_UPDATES),this._composition.releasePool();const b=_?1:h;e.renderData.setTextureReference(new g(d,t,S,b,1,1,!1))}_hasNearestInterpolation(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}_dataToTexture(e){return x(e)&&this._rasterDataToTexture(e),y(e)}_rasterDataToTexture(e){const t=e.sourceLayerInfo;t.data=this._buildTexture(t.data),e.tile.setMemoryDirty()}setBackground(e,t){r(this._backgroundTexture),this._backgroundIsGrid=t,e instanceof HTMLImageElement?(this._backgroundTexture=this._buildTexture(e),this._backgroundColor=null):(this._backgroundTexture=new I(P(this._rctx,u(e[0]||0,e[1]||0,e[2]||0,1))),this._backgroundColor=c(e[0]||0,e[1]||0,e[2]||0))}_buildTexture(e,t=w.LINEAR_MIPMAP_LINEAR){if(a(e))return null;const r={target:E.TEXTURE_2D,pixelFormat:R.RGBA,dataType:L.UNSIGNED_BYTE,wrapMode:A.CLAMP_TO_EDGE,samplingMode:t,maxAnisotropy:this._maxAnisotropy,flipped:!0,hasMipmap:!0},s=this._rctx;let o;if("number"==typeof e)r.width=r.height=e,o=new I(new j(s,r));else if(e instanceof p)r.isOpaque=e.isOpaque,o=new I(new j(s,r,e.image)),e.release();else try{o=new I(new j(s,r,e))}catch(n){o=new I(D(s)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const i=s.bindTexture(o.texture,j.TEXTURE_UNIT_FOR_UPDATES);return o.generateMipmap(),s.bindTexture(i,j.TEXTURE_UNIT_FOR_UPDATES),o}get test(){return{backgroundTexture:this._backgroundTexture}}}function N(t){const r=e(t),s=r*r,a=t*t;if(s===a)return t;const o=r/2;return s-a<a-o*o?r:o}function O(e,t,r){r.layerIndex=t;const a=e.layerInfo[m.MAP][t];if(s(a.data))return o(r.offset,0,0),r.tile=e,r.scale=1,r.sourceLod=e.lij,r.sourceLayerInfo=a,r;const n=a.upsampleInfo;if(s(n)){const e=n.tile.layerInfo[m.MAP][t];return r.tile=n.tile,i(r.offset,n.offset),r.scale=n.scale,r.sourceLod=n.tile.lij,r.sourceLayerInfo=e,r}return null}const F=new Array,G={tile:null,sourceLayerInfo:null,sourceLod:null,offset:[0,0],scale:1,layerIndex:0},S={offset:[0,0],scale:1};export{M as TileRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import i from"../../../core/Handles.js";import{destroyMaybe as s,isSome as r}from"../../../core/maybe.js";import{watch as o}from"../../../core/reactiveUtils.js";import{property as n}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{canProjectToWGS84ComparableLonLat as a}from"../../../geometry/projection.js";import{equals as c}from"../../../geometry/support/aaBoundingRect.js";import{isMars as h,isMoon as p}from"../../../geometry/support/spatialReferenceUtils.js";import{isTiledLayer as d}from"../../../layers/support/layerUtils.js";import{ViewingMode as m}from"../../ViewingMode.js";import{getTiledLayerInfo as y,isProjectableRasterLayer as u}from"./terrainUtils.js";import{TilingScheme as S}from"./TilingScheme.js";let g=class extends t{constructor(e){super(e),this._handles=new i}initialize(){this._handles.add(this.layers.on("change",(()=>this._update()))),this._handles.add(o((()=>this.extentHelper.layerViewsExtent),(()=>this._setAdHocTilingScheme()))),this._update(),this.tilingSchemeLocked||this._setAdHocTilingScheme()}destroy(){this._handles=s(this._handles),this._waitTask=null}_update(){if(this._waitTask=null,this.tilingSchemeLocked)return;let e;if(this.layers.some((t=>!(!d(t)||t.isRejected())&&(!(t.isFulfilled()&&!f(t,this.viewSpatialReference,this.viewingMode))&&(e=t,!("vector-tile"===(null==t?void 0:t.type)||u(t)))))),e)if(e.isResolved()){const t=y(e,this.viewSpatialReference,this.viewingMode);if(r(t)){const e=new S(t.tileInfo);this._lockTilingScheme(e)}}else this._updateWhen(e)}_updateWhen(e){const t=e.when().catch((()=>{})).then((()=>{t!==this._waitTask||this.destroyed||this._update()}));this._waitTask=t}_lockTilingScheme(e){if(this.viewingMode===m.Global){const t=e.levels.length-1;e.spatialReference.isWebMercator?e=S.makeWebMercatorAuxiliarySphere(t):a(e.spatialReference)&&(e=S.makeGCSWithTileSize(e.spatialReference,e.pixelSize,t))}this.tilingSchemeLocked=!0,this.tilingScheme=e,this.extentHelper.tilingScheme=this.tilingScheme,this._updateTiledLayerExtent(),this._handles.removeAll(),this._handles.add(o((()=>this.extentHelper.tiledLayersExtent),(()=>this._updateTiledLayerExtent())))}_updateTiledLayerExtent(){this._set("extent",this.extentHelper.tiledLayersExtent)}_setAdHocTilingScheme(){if(this.viewingMode===m.Global){const e=this.extentHelper.viewSpatialReference,t=a(e)||h(e)||p(e);e.isWebMercator?this.tilingScheme=S.WebMercatorAuxiliarySphere:t&&(this.tilingScheme=S.makeGCSWithTileSize(e,256)),this._set("extent",this.extentHelper.layerViewsExtent)}else{const e=this.extentHelper.layerViewsExtent;r(e)&&!c(e,this.extent)&&(this.tilingScheme=S.fromExtent(e,this.extentHelper.viewSpatialReference),this._set("extent",e))}}get test(){return{lockTilingScheme:e=>this._lockTilingScheme(e),done:!this._waitTask}}};function f(e,t,i){return r(y(e,t,i))}e([n()],g.prototype,"tilingScheme",void 0),e([n({readOnly:!0})],g.prototype,"extent",void 0),e([n({value:!1})],g.prototype,"tilingSchemeLocked",void 0),e([n({constructOnly:!0})],g.prototype,"viewSpatialReference",void 0),e([n({constructOnly:!0})],g.prototype,"layers",void 0),e([n({constructOnly:!0})],g.prototype,"extentHelper",void 0),e([n({constructOnly:!0})],g.prototype,"viewingMode",void 0),g=e([l("esri.views.3d.terrain.TilingSchemeLogic")],g);export{g as TilingSchemeLogic};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import i from"../../../core/Handles.js";import{destroyMaybe as s,isSome as r}from"../../../core/maybe.js";import{watch as o}from"../../../core/reactiveUtils.js";import{property as n}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{canProjectToWGS84ComparableLonLat as a}from"../../../geometry/projection.js";import{equals as c}from"../../../geometry/support/aaBoundingRect.js";import{isMars as h,isMoon as p}from"../../../geometry/support/spatialReferenceUtils.js";import{isTiledLayer as d}from"../../../layers/support/layerUtils.js";import{ViewingMode as m}from"../../ViewingMode.js";import{getTiledLayerInfo as y,isProjectableRasterLayer as u}from"./terrainUtils.js";import{TilingScheme as S}from"./TilingScheme.js";let g=class extends t{constructor(e){super(e),this._handles=new i}initialize(){this._handles.add(this.layers.on("change",(()=>this._update()))),this._handles.add(o((()=>this.extentHelper.layerViewsExtent),(()=>this._setAdHocTilingScheme()))),this._update(),this.tilingSchemeLocked||this._setAdHocTilingScheme()}destroy(){this._handles=s(this._handles),this._waitTask=null}_update(){if(this._waitTask=null,this.tilingSchemeLocked)return;let e;if(this.layers.some((t=>!(!d(t)||t.isRejected())&&(!(t.isFulfilled()&&!f(t,this.viewSpatialReference,this.viewingMode))&&(e=t,!("vector-tile"===t?.type||u(t)))))),e)if(e.isResolved()){const t=y(e,this.viewSpatialReference,this.viewingMode);if(r(t)){const e=new S(t.tileInfo);this._lockTilingScheme(e)}}else this._updateWhen(e)}_updateWhen(e){const t=e.when().catch((()=>{})).then((()=>{t!==this._waitTask||this.destroyed||this._update()}));this._waitTask=t}_lockTilingScheme(e){if(this.viewingMode===m.Global){const t=e.levels.length-1;e.spatialReference.isWebMercator?e=S.makeWebMercatorAuxiliarySphere(t):a(e.spatialReference)&&(e=S.makeGCSWithTileSize(e.spatialReference,e.pixelSize,t))}this.tilingSchemeLocked=!0,this.tilingScheme=e,this.extentHelper.tilingScheme=this.tilingScheme,this._updateTiledLayerExtent(),this._handles.removeAll(),this._handles.add(o((()=>this.extentHelper.tiledLayersExtent),(()=>this._updateTiledLayerExtent())))}_updateTiledLayerExtent(){this._set("extent",this.extentHelper.tiledLayersExtent)}_setAdHocTilingScheme(){if(this.viewingMode===m.Global){const e=this.extentHelper.viewSpatialReference,t=a(e)||h(e)||p(e);e.isWebMercator?this.tilingScheme=S.WebMercatorAuxiliarySphere:t&&(this.tilingScheme=S.makeGCSWithTileSize(e,256)),this._set("extent",this.extentHelper.layerViewsExtent)}else{const e=this.extentHelper.layerViewsExtent;r(e)&&!c(e,this.extent)&&(this.tilingScheme=S.fromExtent(e,this.extentHelper.viewSpatialReference),this._set("extent",e))}}get test(){return{lockTilingScheme:e=>this._lockTilingScheme(e),done:!this._waitTask}}};function f(e,t,i){return r(y(e,t,i))}e([n()],g.prototype,"tilingScheme",void 0),e([n({readOnly:!0})],g.prototype,"extent",void 0),e([n({value:!1})],g.prototype,"tilingSchemeLocked",void 0),e([n({constructOnly:!0})],g.prototype,"viewSpatialReference",void 0),e([n({constructOnly:!0})],g.prototype,"layers",void 0),e([n({constructOnly:!0})],g.prototype,"extentHelper",void 0),e([n({constructOnly:!0})],g.prototype,"viewingMode",void 0),g=e([l("esri.views.3d.terrain.TilingSchemeLogic")],g);export{g as TilingSchemeLogic};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/Collection.js";import{isSome as e}from"../../../core/maybe.js";import{isCGCS2000 as n,isEarth as l}from"../../../geometry/support/spatialReferenceUtils.js";import{getTileMaxtrixSetFromActiveLayer as o}from"../../../layers/support/layerUtils.js";import{ViewingMode as r}from"../../ViewingMode.js";import{ImageWithType as i}from"../support/StreamDataLoader.js";import{t as u}from"../../../chunks/terrainUtilsPlanar.js";import{t as f}from"../../../chunks/terrainUtilsSpherical.js";const a={[r.Global]:f,[r.Local]:u};function c(t,e){t||console.warn("Terrain: "+e)}const s=!1;let p=!1;function m(t){p=t}function d(t,e){}function y(t){return I(t)?{fullExtent:t.fullExtent,minScale:t.layer.minScale,maxScale:t.layer.maxScale,tilemapCache:null}:t.layer}function v(t){return"imagery-tile"===(null==t?void 0:t.type)||"wcs"===(null==t?void 0:t.type)}function I(t){return"imagery-tile-3d"===(null==t?void 0:t.type)}function x(t){return"tile-3d"===(null==t?void 0:t.type)}function E(t){return"vector-tile-3d"===(null==t?void 0:t.type)}function L(t){return"wmts-3d"===(null==t?void 0:t.type)}function g(t){return"elevation-3d"===(null==t?void 0:t.type)}function h(t){return t&&(x(t)||I(t)||E(t)||L(t))}function S(t){return h(t)||g(t)}function T(t){var n;const l=null==t||null==(n=t.sourceLayerInfo)?void 0:n.data;return e(l)&&"type"in l&&"raster-tile"===l.type}function j(t){var n;const l=null==t||null==(n=t.sourceLayerInfo)?void 0:n.data;return e(l)&&"type"in l&&"vector-tile"===l.type}function C(t){var n;const l=null==t||null==(n=t.sourceLayerInfo)?void 0:n.data;return e(l)&&"type"in l&&"tile-texture"===l.type}function b(t){var e;const n=null==t||null==(e=t.sourceLayerInfo)?void 0:e.data;return n instanceof HTMLImageElement||n instanceof i||n instanceof HTMLCanvasElement||n instanceof ImageData}function w(t){return e(t)&&"release"in t&&t.release(),null}function M(t){return t.fetchTile&&!1!==t.hasOverriddenFetchTile}function U(t,e,n,l){return a[l].checkIfTileInfoSupportedForViewSR(t,n,e)}function V(t,n,l){let o=null,i=null;if("wmts"===(null==t?void 0:t.type)){const e=k(t,n,l);o=e.tileInfo,i=e.fullExtent}else{i=v(t)?t.getCompatibleFullExtent(n):t.fullExtent;const e=l===r.Local;if(v(t))o=t.getCompatibleTileInfo(n,i,e);else if("vector-tile"===(null==t?void 0:t.type)){const l=e&&!F(n)||G.force512VTL,r=t.tileInfo.spatialReference.isGeographic;o=l?t.tileInfo:t.tileInfo.getOrCreateCompatible(256,r?1:2)}else o=t.tileInfo}return e(o)&&e(i)&&null==U(o,i,n,l)?{tileInfo:o,fullExtent:i}:null}function k(n,l,r){const i=o(n);if(e(i)){if(!t.isCollection(i))return{tileInfo:i.tileInfo,fullExtent:i.fullExtent};{const t=i.find((t=>null==U(t.tileInfo,t.fullExtent,l,r)));if(t)return{tileInfo:t.tileInfo,fullExtent:t.fullExtent}}}return{tileInfo:null,fullExtent:null}}function F(t){return t.isWGS84||t.isWebMercator||n(t)||!l(t)}const G={force512VTL:!1};function R(t){return"["+t[0]+","+t[1]+","+t[2]+"]"}function D(t){return"("+t[0]+","+t[1]+","+t[2]+")"}export{s as ENABLE_TERRAIN_INTERNAL_CHECKS,p as ENABLE_WATERPROOFNESS_TESTS,U as checkIfTileInfoSupportedForView,m as enableWaterproofnessTests,y as getLayerWithExtentRange,k as getTileInfoAndExtentFromWMTSLayer,V as getTiledLayerInfo,d as internalAssert,g as isElevationLayerView,I as isImageryTileLayerView,T as isImageryTileRenderInfo,h as isMapTileLayerView,v as isProjectableRasterLayer,b as isRasterTileRenderInfo,S as isSurfaceLayerView,C as isTextureTileRenderInfo,x as isTileLayerView,E as isVectorTileLayerView,j as isVectorTileRenderInfo,L as isWMTSLayerView,R as lij2s,w as releaseTileData,G as test,M as useFetchTileForLayer,D as v32s,F as vtlAssumes256PixelSizeAsDefault,c as weakAssert};
5
+ import t from"../../../core/Collection.js";import{isSome as e}from"../../../core/maybe.js";import{isCGCS2000 as n,isEarth as r}from"../../../geometry/support/spatialReferenceUtils.js";import{getTileMaxtrixSetFromActiveLayer as o}from"../../../layers/support/layerUtils.js";import{ViewingMode as l}from"../../ViewingMode.js";import{ImageWithType as i}from"../support/StreamDataLoader.js";import{t as u}from"../../../chunks/terrainUtilsPlanar.js";import{t as f}from"../../../chunks/terrainUtilsSpherical.js";const c={[l.Global]:f,[l.Local]:u};function a(t,e){t||console.warn("Terrain: "+e)}const s=!1;let p=!1;function m(t){p=t}function y(t,e){}function I(t){return d(t)?{fullExtent:t.fullExtent,minScale:t.layer.minScale,maxScale:t.layer.maxScale,tilemapCache:null}:t.layer}function x(t){return"imagery-tile"===t?.type||"wcs"===t?.type}function d(t){return"imagery-tile-3d"===t?.type}function E(t){return"tile-3d"===t?.type}function L(t){return"vector-tile-3d"===t?.type}function g(t){return"wmts-3d"===t?.type}function h(t){return"elevation-3d"===t?.type}function S(t){return t&&(E(t)||d(t)||L(t)||g(t))}function T(t){return S(t)||h(t)}function j(t){const n=t?.sourceLayerInfo?.data;return e(n)&&"type"in n&&"raster-tile"===n.type}function C(t){const n=t?.sourceLayerInfo?.data;return e(n)&&"type"in n&&"vector-tile"===n.type}function b(t){const n=t?.sourceLayerInfo?.data;return e(n)&&"type"in n&&"tile-texture"===n.type}function v(t){const e=t?.sourceLayerInfo?.data;return e instanceof HTMLImageElement||e instanceof i||e instanceof HTMLCanvasElement||e instanceof ImageData}function w(t){return e(t)&&"release"in t&&t.release(),null}function M(t){return t.fetchTile&&!1!==t.hasOverriddenFetchTile}function U(t,e,n,r){return c[r].checkIfTileInfoSupportedForViewSR(t,n,e)}function V(t,n,r){let o=null,i=null;if("wmts"===t?.type){const e=k(t,n,r);o=e.tileInfo,i=e.fullExtent}else{i=x(t)?t.getCompatibleFullExtent(n):t.fullExtent;const e=r===l.Local;if(x(t))o=t.getCompatibleTileInfo(n,i,e);else if("vector-tile"===t?.type){const r=e&&!F(n)||G.force512VTL,l=t.tileInfo.spatialReference.isGeographic;o=r?t.tileInfo:t.tileInfo.getOrCreateCompatible(256,l?1:2)}else o=t.tileInfo}return e(o)&&e(i)&&null==U(o,i,n,r)?{tileInfo:o,fullExtent:i}:null}function k(n,r,l){const i=o(n);if(e(i)){if(!t.isCollection(i))return{tileInfo:i.tileInfo,fullExtent:i.fullExtent};{const t=i.find((t=>null==U(t.tileInfo,t.fullExtent,r,l)));if(t)return{tileInfo:t.tileInfo,fullExtent:t.fullExtent}}}return{tileInfo:null,fullExtent:null}}function F(t){return t.isWGS84||t.isWebMercator||n(t)||!r(t)}const G={force512VTL:!1};function R(t){return"["+t[0]+","+t[1]+","+t[2]+"]"}function D(t){return"("+t[0]+","+t[1]+","+t[2]+")"}export{s as ENABLE_TERRAIN_INTERNAL_CHECKS,p as ENABLE_WATERPROOFNESS_TESTS,U as checkIfTileInfoSupportedForView,m as enableWaterproofnessTests,I as getLayerWithExtentRange,k as getTileInfoAndExtentFromWMTSLayer,V as getTiledLayerInfo,y as internalAssert,h as isElevationLayerView,d as isImageryTileLayerView,j as isImageryTileRenderInfo,S as isMapTileLayerView,x as isProjectableRasterLayer,v as isRasterTileRenderInfo,T as isSurfaceLayerView,b as isTextureTileRenderInfo,E as isTileLayerView,L as isVectorTileLayerView,C as isVectorTileRenderInfo,g as isWMTSLayerView,R as lij2s,w as releaseTileData,G as test,M as useFetchTileForLayer,D as v32s,F as vtlAssumes256PixelSizeAsDefault,a as weakAssert};