@arcgis/core 5.2.0-next.27 → 5.2.0-next.28

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 (266) hide show
  1. package/WebLinkChart.js +1 -1
  2. package/arcade/Dictionary.js +1 -1
  3. package/arcade/Feature.js +1 -1
  4. package/arcade/Pixel.js +1 -1
  5. package/arcade/deepClone.js +1 -1
  6. package/arcade/featureset/support/FeatureSet.js +1 -1
  7. package/arcade/functions/geometry.js +1 -1
  8. package/arcade/languageUtils.js +1 -1
  9. package/assets/esri/core/libs/libtess/libtess-f32.wasm +0 -0
  10. package/assets/esri/core/libs/libtess/libtess-f64.wasm +0 -0
  11. package/assets/esri/core/workers/RemoteClient.js +1 -1
  12. package/assets/esri/core/workers/chunks/{5ee887fc6e1e0e70e02f.js → 1664434dc7a67c8ce453.js} +1 -1
  13. package/assets/esri/core/workers/chunks/1837f97f720d255a1694.js +1 -0
  14. package/assets/esri/core/workers/chunks/1893a4b344aa9b57aa8d.js +1 -0
  15. package/assets/esri/core/workers/chunks/209460f8aae3f9f8c9b8.js +1 -0
  16. package/assets/esri/core/workers/chunks/{316a3d5c7842b445e29e.js → 24704e70d1ce01ca4081.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{bf9eca7dd107bdb06614.js → 2665337e1b665e7e2b70.js} +1 -1
  18. package/assets/esri/core/workers/chunks/29a7321fd069253c2521.js +1 -0
  19. package/assets/esri/core/workers/chunks/{31c4128b23968575feca.js → 31d92ba9089617aa59ab.js} +1 -1
  20. package/assets/esri/core/workers/chunks/390f2beee8e3f2a302e4.js +1 -0
  21. package/assets/esri/core/workers/chunks/3eee32db0e9a5086b9a8.js +1 -0
  22. package/assets/esri/core/workers/chunks/{511b9c12a7479d39dac0.js → 409bc7d69b95f7a1634c.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{4e16d7fa2e6f11d082b5.js → 4ba4fd8fa31169760fee.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{268ee59800e64baa9682.js → 4be0c64bbf2449d57ea5.js} +1 -1
  25. package/assets/esri/core/workers/chunks/4fc32e60e63a9c8429b9.js +1 -0
  26. package/assets/esri/core/workers/chunks/{e8e7cd26c43f231cdea2.js → 5189413a83faf3480e29.js} +1 -1
  27. package/assets/esri/core/workers/chunks/5363c622a0571134cadd.js +1 -0
  28. package/assets/esri/core/workers/chunks/{88b08b386926ec889573.js → 548842f8ba9224b15ee4.js} +1 -1
  29. package/assets/esri/core/workers/chunks/5c63b38160c7d063b8af.js +1 -0
  30. package/assets/esri/core/workers/chunks/6183a26837dc087663ad.js +1 -0
  31. package/assets/esri/core/workers/chunks/{a9d477f90e5046400dd5.js → 654a6dc13ff5be88c8b9.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{1f03e34520746e432719.js → 67f44cab103d4411dcc5.js} +1 -1
  33. package/assets/esri/core/workers/chunks/697e0ce10d77b90d4fee.js +1 -0
  34. package/assets/esri/core/workers/chunks/{8f93e6fc11a158d4f1ee.js → 7335a762412bc8c15a2f.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{b2b342b06d502fc61ea5.js → 76789f46b2c65d219cf9.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{fae147d03ed723ab234d.js → 78f68f7534716956f5bc.js} +1 -1
  37. package/assets/esri/core/workers/chunks/7b290ac2e8a567ecae4a.js +1 -0
  38. package/assets/esri/core/workers/chunks/7c344c339743295d11d7.js +1 -0
  39. package/assets/esri/core/workers/chunks/{0098544169e429dd98d2.js → 7f1babbb7ead78201ab3.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{dadf85890961bcc205eb.js → 7fcf4f3b9131c7516524.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{292498a9c7d462d215c6.js → 86e61841df12dbe20a19.js} +1 -1
  42. package/assets/esri/core/workers/chunks/8aba35305368234c94f8.js +1 -0
  43. package/assets/esri/core/workers/chunks/{d670e134348954ce465d.js → 8b452383ba972b638a0c.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{a3ecde3794a7db3cf283.js → 8d90bef1091204fba0f1.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{a18cb809dd56c5537b3b.js → 8dbf9b1d8bb6817b19c1.js} +1 -1
  46. package/assets/esri/core/workers/chunks/8f16a358ed83d2264415.js +1 -0
  47. package/assets/esri/core/workers/chunks/{a454df829a72ab02c860.js → 8fd63cb38036f331a803.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{bbcad2fde838819ffc7b.js → 906f4c0fa8135e6c2f03.js} +1 -1
  49. package/assets/esri/core/workers/chunks/989937c120bdd676ec1e.js +1 -0
  50. package/assets/esri/core/workers/chunks/9ba705a6ddabca0f77b1.js +1 -0
  51. package/assets/esri/core/workers/chunks/a2357aae79bfbb91f125.js +1 -0
  52. package/assets/esri/core/workers/chunks/a3ca0649edb646da0918.js +1 -0
  53. package/assets/esri/core/workers/chunks/a9db775210ebeee41738.js +1 -0
  54. package/assets/esri/core/workers/chunks/acbc14395c31f6da509e.js +1 -0
  55. package/assets/esri/core/workers/chunks/{8bd4c43c34aacf3b07da.js → b10f36658aa77bc3a6cf.js} +1 -1
  56. package/assets/esri/core/workers/chunks/b18b6bb85e52b03b85e3.js +680 -0
  57. package/assets/esri/core/workers/chunks/b7458bd3a2f590f32111.js +1 -0
  58. package/assets/esri/core/workers/chunks/{d374cb2d17a2d11c500f.js → c46500cc95a84e2a5f7a.js} +1 -1
  59. package/assets/esri/core/workers/chunks/cc46261e01a985df5aab.js +1 -0
  60. package/assets/esri/core/workers/chunks/{de0c94defb90e1805081.js → d07261f3fb67b9a99369.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{04070767356c12026369.js → d61294dcc3ba41060d44.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{f3d331da3c61af5c5a2f.js → d8ae5b61b5ae71f4796c.js} +1 -1
  63. package/assets/esri/core/workers/chunks/e181d0f5562878b3dc01.js +1 -0
  64. package/assets/esri/core/workers/chunks/{d07068c44d560e4ce02e.js → e5d2fab228d54b18a8a8.js} +1 -1
  65. package/assets/esri/core/workers/chunks/f1d211904d5a1de93cb3.js +1 -0
  66. package/assets/esri/core/workers/chunks/{928b18e13e015330d44b.js → f68b84df093f2894210b.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{3a35779cae6a11cde51b.js → f74b6952c888d92e479e.js} +1 -1
  68. package/assets/esri/core/workers/chunks/f847a4846c427f671455.js +1 -0
  69. package/assets/esri/core/workers/chunks/{66392ff750c28064040a.js → fe20683f442294eb111b.js} +1 -1
  70. package/assets/esri/images/portal/gaussiansplatlayer16.png +0 -0
  71. package/assets/esri/images/portal/knowledgegraphlayer16.png +0 -0
  72. package/assets/esri/images/portal/propresentation16.png +0 -0
  73. package/assets/esri/images/portal/urbanproject16.png +0 -0
  74. package/assets/esri/images/support/loading-throb.gif +0 -0
  75. package/assets/esri/layers/raster/formats/lerc-wasm.wasm +0 -0
  76. package/assets/esri/libs/basisu/basis_encoder.wasm +0 -0
  77. package/assets/esri/libs/dxtEncoder/dxt_encoder.wasm +0 -0
  78. package/assets/esri/themes/base/icons/style.scss +0 -0
  79. package/assets/esri/themes/base/icons/variables.scss +0 -0
  80. package/assets/esri/themes/base/images/files/archive-32.svg +0 -0
  81. package/assets/esri/themes/base/images/files/cad-32.svg +0 -0
  82. package/assets/esri/themes/base/images/files/code-32.svg +0 -0
  83. package/assets/esri/themes/base/images/files/csv-32.svg +0 -0
  84. package/assets/esri/themes/base/images/files/excel-32.svg +0 -0
  85. package/assets/esri/themes/base/images/files/generic-32.svg +0 -0
  86. package/assets/esri/themes/base/images/files/gpx-32.svg +0 -0
  87. package/assets/esri/themes/base/images/files/image-32.svg +0 -0
  88. package/assets/esri/themes/base/images/files/pdf-32.svg +0 -0
  89. package/assets/esri/themes/base/images/files/report-32.svg +0 -0
  90. package/assets/esri/themes/base/images/files/sound-32.svg +0 -0
  91. package/assets/esri/themes/base/images/files/text-32.svg +0 -0
  92. package/assets/esri/themes/base/images/files/video-32.svg +0 -0
  93. package/assets/esri/themes/base/images/files/word-32.svg +0 -0
  94. package/assets/esri/themes/base/images/files/zip-32.svg +0 -0
  95. package/assets/esri/themes/base/images/loading-throb.gif +0 -0
  96. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +24 -0
  97. package/assets/esri/themes/base/widgets/_Bookmarks.scss +0 -0
  98. package/assets/esri/themes/dark/main.css +1 -1
  99. package/assets/esri/themes/light/main.css +1 -1
  100. package/assets/esri/themes/light/view.css +1 -1
  101. package/chunks/OITBlend.glsl.js +1 -1
  102. package/chunks/languageUtils.js +1 -1
  103. package/config.js +1 -1
  104. package/core/Loadable.js +1 -1
  105. package/core/colorUtils.js +1 -1
  106. package/core/has.js +1 -1
  107. package/core/workers/WorkerHandle.js +1 -1
  108. package/editing/sharedTemplates/SharedTemplateProvider.js +1 -1
  109. package/geometry/Mesh.js +1 -1
  110. package/geometry/support/meshUtils/loadExternal.js +1 -1
  111. package/identity/OAuthCredential.js +1 -1
  112. package/kernel.js +1 -1
  113. package/layers/AnnotationFeatureLayer.d.ts +2 -2
  114. package/layers/AnnotationFeatureLayer.js +1 -1
  115. package/layers/LinkChartLayer.js +1 -1
  116. package/layers/ParquetLayer.js +1 -1
  117. package/layers/PointCloudLayer.js +1 -1
  118. package/layers/SceneLayer.js +1 -1
  119. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  120. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  121. package/layers/graphics/editingSupport.js +1 -1
  122. package/layers/graphics/sources/MemorySource.js +1 -1
  123. package/layers/graphics/sources/ParquetSource.js +1 -1
  124. package/layers/mixins/EditBusLayer.js +1 -1
  125. package/layers/mixins/SceneService.js +1 -1
  126. package/layers/support/KMLSublayer.js +1 -1
  127. package/layers/support/ParquetFilesData.js +1 -1
  128. package/layers/support/TitleCreator.js +1 -1
  129. package/package.json +3 -3
  130. package/rest/knowledgeGraph/ReplicaDefinition.d.ts +62 -6
  131. package/smartMapping/support/adapters/FeatureLayerBinningAdapter.js +1 -1
  132. package/support/ArcadeExpression.js +1 -1
  133. package/support/basemapUtils.js +1 -1
  134. package/support/revision.js +1 -1
  135. package/versionManagement/VersionManagementService.js +1 -1
  136. package/versionManagement/VersionManager.js +1 -1
  137. package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
  138. package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementTool.js +1 -1
  139. package/views/2d/engine/ParentChildStage.js +1 -1
  140. package/views/2d/engine/Stage.js +1 -1
  141. package/views/2d/engine/ThrottledCanvas.js +2 -0
  142. package/views/2d/engine/webgl/Profiler.js +1 -1
  143. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  144. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  145. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  146. package/views/2d/layers/LayerView2D.js +1 -1
  147. package/views/2d/layers/MediaLayerView2D.js +1 -1
  148. package/views/2d/layers/TileLayerView2D.js +1 -1
  149. package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +1 -1
  150. package/views/2d/layers/features/layerAdapters/DimensionLayerAdapter.js +1 -1
  151. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  152. package/views/2d/layers/features/layerAdapters/featureLayerAdapterUtils.js +2 -0
  153. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  154. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  155. package/views/3d/camera/constraintUtils/surfaceCollision.js +1 -1
  156. package/views/3d/camera/constraintUtils.js +1 -1
  157. package/views/3d/glTF/internal/Resource.js +1 -1
  158. package/views/3d/glTF/loader.js +1 -1
  159. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  160. package/views/3d/layers/I3SMeshView3D.js +1 -1
  161. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  162. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  163. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  164. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  165. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  166. package/views/3d/layers/graphics/tessellationUtils.js +1 -1
  167. package/views/3d/state/GoToOperation.js +1 -1
  168. package/views/3d/state/SurfaceCollisionConstraint.js +1 -1
  169. package/views/3d/state/ViewState.js +1 -1
  170. package/views/3d/state/ViewStateManager.js +1 -1
  171. package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
  172. package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
  173. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  174. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  175. package/views/3d/webgl/ManagedFBO.js +1 -1
  176. package/views/3d/webgl/RenderCamera.js +1 -1
  177. package/views/3d/webgl/RenderNode.js +1 -1
  178. package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
  179. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
  180. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
  181. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  182. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  183. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  184. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  185. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  186. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  187. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  188. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  189. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  190. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  191. package/views/3d/webgl-engine/effects/transparency/OITBlendTechniqueConfiguration.js +1 -1
  192. package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
  193. package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
  194. package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
  195. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  196. package/views/3d/webgl.js +1 -1
  197. package/views/VideoView.js +1 -1
  198. package/views/View2D.js +1 -1
  199. package/views/Viewport2DBaseMixin.js +1 -1
  200. package/views/analysis/ElevationProfile/ElevationProfileLineGroundComputation.js +1 -1
  201. package/views/draw/support/editingSessionUtils.js +1 -1
  202. package/views/popupAdapter.js +1 -1
  203. package/views/webgl/BufferObject.js +1 -1
  204. package/widgets/BasemapGallery/support/PortalBasemapsSource.js +1 -1
  205. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  206. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  207. package/widgets/BatchAttributeForm/css.js +1 -1
  208. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  209. package/widgets/BatchAttributeForm/interfaceUtils.js +1 -1
  210. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  211. package/widgets/BatchAttributeForm.js +1 -1
  212. package/widgets/Directions/DirectionsViewModel.js +1 -1
  213. package/widgets/Directions.js +1 -1
  214. package/widgets/Editor/EditorViewModel.d.ts +1 -1
  215. package/widgets/Editor.d.ts +11 -1
  216. package/widgets/Editor.js +1 -1
  217. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  218. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  219. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  220. package/widgets/FeatureTable.js +1 -1
  221. package/widgets/Features/FeaturesViewModel.js +1 -1
  222. package/widgets/LinkChartLayoutSwitcher/LinkChartLayoutSwitcherViewModel.js +1 -1
  223. package/widgets/Locate/LocateViewModel.js +1 -1
  224. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  225. package/widgets/OrientedImageryViewer/adapters/sketch/DataCaptureAdapter.js +1 -1
  226. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  227. package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
  228. package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
  229. package/widgets/OrientedImageryViewer/support/MediaPrefetcher.js +1 -1
  230. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  231. package/widgets/Print/PrintViewModel.js +1 -1
  232. package/widgets/Print.js +1 -1
  233. package/widgets/TableList/ListItem.js +1 -1
  234. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  235. package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
  236. package/widgets/Widget.js +1 -1
  237. package/widgets/support/geolocationUtils.js +1 -1
  238. package/widgets/support/tests.js +1 -1
  239. package/assets/esri/core/workers/chunks/045f178fecc23839bfa8.js +0 -680
  240. package/assets/esri/core/workers/chunks/073ee52705ea326fecfb.js +0 -1
  241. package/assets/esri/core/workers/chunks/0e81b6aa64d5491870b2.js +0 -1
  242. package/assets/esri/core/workers/chunks/126a8c26618425790804.js +0 -1
  243. package/assets/esri/core/workers/chunks/1cb1f125dccbf8c8cac9.js +0 -1
  244. package/assets/esri/core/workers/chunks/2ed81f1e490cb7e73405.js +0 -1
  245. package/assets/esri/core/workers/chunks/32f26757e36704923286.js +0 -1
  246. package/assets/esri/core/workers/chunks/33e86dd1a54e447fa0e3.js +0 -1
  247. package/assets/esri/core/workers/chunks/35c87b0a4d4ee7ce302d.js +0 -1
  248. package/assets/esri/core/workers/chunks/36b904912cea1744d1c6.js +0 -1
  249. package/assets/esri/core/workers/chunks/3df5394b17e9659ecb8f.js +0 -1
  250. package/assets/esri/core/workers/chunks/4adfe7f8a8efe2cd8e80.js +0 -1
  251. package/assets/esri/core/workers/chunks/5396a894e6f8030ca088.js +0 -1
  252. package/assets/esri/core/workers/chunks/6849282c4a5cd733779d.js +0 -1
  253. package/assets/esri/core/workers/chunks/6adc17e6e287a365ad8d.js +0 -1
  254. package/assets/esri/core/workers/chunks/76ed8e455f6bd79e561c.js +0 -1
  255. package/assets/esri/core/workers/chunks/831455798b177678720c.js +0 -1
  256. package/assets/esri/core/workers/chunks/8ca88cfc0b9f84dc5832.js +0 -1
  257. package/assets/esri/core/workers/chunks/93b40245378ced43ca08.js +0 -1
  258. package/assets/esri/core/workers/chunks/98dfe31e8ed9b522eaff.js +0 -1
  259. package/assets/esri/core/workers/chunks/a40ede4d3375184f21fe.js +0 -1
  260. package/assets/esri/core/workers/chunks/af96cbc4fb7bef726635.js +0 -1
  261. package/assets/esri/core/workers/chunks/e73bb7c8de7412d9975c.js +0 -1
  262. package/assets/esri/core/workers/chunks/f23351a04643c464be84.js +0 -1
  263. package/assets/esri/core/workers/chunks/f912c173c58ae4299cbe.js +0 -1
  264. package/assets/esri/core/workers/chunks/f93facf47aba9b128fcc.js +0 -1
  265. package/views/2d/engine/ManagedCanvas.js +0 -2
  266. package/views/3d/state/controllers/SurfaceCollisionCorrectionController.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clone as e}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as t}from"../../../../core/units.js";import{normalFromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as s,invertOrIdentity as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as a,sub as l,cross as c,add as m,normalize as p,transformMat4 as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ONES as u,create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as g,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as f}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as b,fromBuffer as x,intersectsClippingArea as _}from"../../../../geometry/support/aaBoundingBox.js";import{getZeroIndexArray as C}from"../../../../geometry/support/Indices.js";import{a as v}from"../../../../chunks/vec3.js";import{SnappingCandidateVertex as w,SnappingCandidateEdge as S}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as j}from"../../../../renderers/support/renderingInfoUtils.js";import{needsElevationUpdates3D as I,SampleElevationInfo as P}from"./elevationAlignmentUtils.js";import{extrudePolygon as E}from"./extrudeUtils.js";import{Object3DEdgeState as A,Graphics3DObject3DGraphicLayer as U}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as z}from"./Graphics3DSymbolLayer.js";import{computeCentroid as O}from"./graphicUtils.js";import{geometryAsPolygon as D}from"./polygonUtils.js";import{createMaterial as M}from"../support/edgeUtils.js";import{encodeNaNUInt8 as G}from"../support/symbolColorUtils.js";import{debugFlags as L}from"../../support/debugFlags.js";import{SamplePosition as V}from"../../support/ElevationProvider.js";import{loadTessellationUtils as R,preloadedPolygonToRenderInfoElevationAligned as B}from"../../support/renderInfoUtils/polygon.js";import{Attribute as F}from"../../webgl-engine/lib/Attribute.js";import{Geometry as T}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as N}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as H,compressNormal as q}from"../../webgl-engine/lib/Normals.js";import{Object3D as W}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as k}from"../../webgl-engine/materials/DefaultMaterial.js";const Z=["polygon","extent"];class J extends z{constructor(e,t,r,i){super(e,t,r,i,ee(t)),this.ensureDrapedStatus(!1)}async doLoad(){const e=this.symbolLayer,t=e?.material,r=this.symbolLayer.material?.color?.a,i=this._hasDrivenColorOrOpacity,s=this.needsDrivenTransparentPass||i&&null!=r&&r<1,n=t?.emissive,o=("color"===n?.source?n?.strength:void 0)??0,a=!i&&(null==r||0===r),l=i?g:this._materialColor?.toUnitRGBA()??y,c={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,useIndexing:!0,ambient:u,diffuse:u,externalColor:l,opacity:a?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:s,hasSymbolColors:i,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:e.castShadows,emissiveStrengthFromSymbol:o,emissiveSource:1,offsetTransparentBackfaces:!0,normalType:1},m=new k(c,this._context),p=new k({...c,cullFace:2},this._context);this._materials[0]=m,this._materials[1]=p,this._updateTransparentDepedentMaterialParameters(),await R()}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Z,this.symbolLayer.type))return null;const r=this._getDrivenUInt8ColorWithNaNSupport(e.renderingInfo,this._materialColor,!1);G(r,r);const i=this.createElevationContextForGraphic(t);return this._createAs3DShape(t,e.renderingInfo,r,i,t.uid)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._materials[0]?.setParameters({layerOpacity:r}),this._materials[1]?.setParameters({layerOpacity:r}),this._updateTransparentDepedentMaterialParameters(),e?.forEach(e=>t(e)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,I)}slicePlaneEnabledChanged(e,t){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e?.forEach(e=>{const r=t(e);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const e={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[0]?.setParameters(e),this._materials[1]?.setParameters(e),!0}_getExtrusionSize(e){let t;return t=e.size&&this._drivenProperties.size?j(e.size.output,2)??0:this._getSymbolSize(),t/=this._context.renderCoordsHelper.unitInMeters,t}_containsRenderableGeometry(e){return"polygonIndexCount"in e&&"outlineIndexCount"in e?e.polygonIndexCount>0||e.outlineIndexCount>0:super._containsRenderableGeometry(e)}applyRendererDiff(e,t){return this._drivenPropertiesChanged(t)?0:1}async queryForSnapping(r,i,s,n){const o=this._getExtrusionSize(s)*this._context.renderCoordsHelper.unitInMeters/t(i),{objectId:a,target:l}=r,c=e(l);switch(c.z=(c.z??0)+o,r.type){case"edge":{const{start:t,end:i}=r,s=e(t),n=e(i);return s.z=(s.z??0)+o,n.z=(n.z??0)+o,[new S(a,c,1/0,s,n)]}case"vertex":return[new w(a,c,1/0),new S(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,t,n,a,l){const c=D(e.geometry);if(null==c)return null;if(0===c.rings.length||!c.rings.some(e=>e.length>0))return this._logGeometryValidationWarnings(c.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=B(c,this._context.elevationProvider,this._context.renderCoordsHelper,a,{outlineOutput:"tessellated-indices"});if(null==m)return;this._logGeometryCreationWarnings(m,c.rings,"rings","ExtrudeSymbol3DLayer");const p=O(c);if(null==p)return null;const h=new Array,u=new Array,g=b(),y=o(),C=d(),w=1===this._context.renderCoordsHelper.viewingMode;w||this._context.renderCoordsHelper.worldUpAtPosition(null,C),f(c.spatialReference,[p.x,p.y,0],y,this._context.renderCoordsHelper.spatialReference);const S=o();s(S,y);const j=i();r(j,S);const P=new Map,z=this._materials[0];if(this._context.clippingExtent&&(x(m.mapPositions,g),!_(g,this._context.clippingExtent)))return;if(0===m.polygonIndexCount&&0===m.outlineIndexCount)return;const G=this._getExtrusionSize(t),L=E(m,{height:G,worldUp:C,spherical:w,requireElevation:!0,requireNormals:!0,requireSizes:!0});if(null==L)return;v(L.vertices,L.vertices,S);const V=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerViewUid:this._context.layerViewUid}),R=new le(L.vertices,L.elevation,H(L.normals),L.sizes),F=K(z,L.indices,L.indices.length-L.bottomIndices.length,R,n,V),T=m.vertexCount,N=L.polygonVertexCount,q=2*m.outlineSegmentCount,k=m.polygonIndexCount/3,Z=new ce(T,N,q,k);if($(F,Z,y),P.set(F,Z),h.push(F),L.bottomIndices.length>0&&h.push(K(this._materials[1],L.bottomIndices,0,R,n,V)),u.push(R.heights),0===h.length)return null;const J=new W({geometries:h,layerViewUid:this._context.layerViewUid,graphicUid:l,isElevationSource:!0});J.transformation=y;const Q=M(this.symbolLayer,{opacity:this._getLayerOpacity()}),X=Q?new A(this._materials[0],Q,this._context.slicePlaneEnabled):null,ee=new U(this,J,null,(e,t,r,i,s)=>Y(e,t,r,i,s,u,P),a,X);return ee.alignedSampledElevation=m.sampledElevation,ee.needsElevationUpdates=I(a.mode),ee}get _materialColor(){return this.symbolLayer.material?.color}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent?0:2})}}function K(e,t,r,i,s,n){const{attributeIndices:o,drawIndices:a}=Q(t),l=[["position",new F(i.positions,o,3,!0)],["normalCompressed",new F(i.normals,o,2,!0)]];if(e.parameters.hasSymbolColors){const e=C(o.length);l.push(["symbolColor",new F(s,e,4,!0)])}return new T(e,l,i.elevation,0,n,r,null,a)}function Q(e){const t=new Array,r=new Map,i=new Array;for(let s=0;s<e.length;++s){const n=e[s];let o=r.get(n);null==o&&(o=t.length,t.push(n),r.set(n,o)),i.push(o)}return{attributeIndices:t,drawIndices:i}}const X=d();function Y(e,t,r,i,s,l,c){const m=e.stageObject,p=m.geometries,u=p.length,d="absolute-height"!==t.mode;let g=0;const y=m.transformation,f=n(o(),y);for(let n=0,o=0;n<u;++n){const e=p[n],t=c.get(e);if(!t||!N(e))continue;const u=e.getMutableAttribute("position").data,b=l[o++],x=new V(e.mapPositions),_=u.length/3;let C=!1,v=0;{let e=0;for(let t=0;t<_;t++){X[0]=u[e],X[1]=u[e+1],X[2]=u[e+2],i(x,ie),d&&(v+=ie.sampledElevation),L.ENABLE_OPTIMIZATIONS?(a(te,u[e],u[e+1],u[e+2]),h(te,te,y),s.setAltitude(te,ie.z+b[e/3]),h(te,te,f)):(a(te,x.array[x.offset],x.array[x.offset+1],ie.z+b[e/3]),null!=r&&s.toRenderCoords(te,r,te),h(te,te,f)),u[e]=te[0],u[e+1]=te[1],u[e+2]=te[2];const t=se/s.unitInMeters;(Math.abs(X[0]-u[e])>=t||Math.abs(X[1]-u[e+1])>=t||Math.abs(X[2]-u[e+2])>=t)&&(C=!0),x.offset+=3,e+=3}}if(C){$(e,t,y),m.geometryVertexAttributeUpdated(p[n],"normalCompressed"),e.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(p[n],"position");const r=p[n+1],i=!c.has(r);r&&i&&(r.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(r,"position"))}g+=v/_}return g/u}function $(e,t,r){const i=e.getMutableAttribute("position"),s=e.getMutableAttribute("normalCompressed").data,n=i.data,o=e.primitivePositionIndices,{topVertexStart:u,topVertexCount:d,topFaceStart:g,topFaceCount:y}=t,f=g+y,b=u+d,x=ne,_=oe,C=ae,v=re,w=te;a(w,0,0,0);const S=(e,t)=>{const i=3*e;a(t,n[i+0],n[i+1],n[i+2]),h(t,t,r)};for(let a=g;a<f;++a){const e=3*a;S(o[e+0],x[0]),S(o[e+1],x[1]),S(o[e+2],x[2]),l(_,x[1],x[0]),l(C,x[2],x[0]),c(v,_,C),m(w,w,v)}p(w,w);for(let a=u;a<b;++a){const e=w[0],t=w[1],r=w[2];q(s,a,e,t,r)}}function ee(e){return 1===(e.material?.color?.a??0)}const te=d(),re=d(),ie=new P,se=.01,ne=[d(),d(),d()],oe=d(),ae=d();class le{constructor(e,t,r,i){this.positions=e,this.elevation=t,this.normals=r,this.heights=i}}class ce{constructor(e,t,r,i){this.topVertexStart=e,this.topVertexCount=t,this.topFaceStart=r,this.topFaceCount=i}}export{J as Graphics3DExtrudeSymbolLayer};
2
+ import{clone as e}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as t}from"../../../../core/units.js";import{normalFromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as s,invertOrIdentity as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as a,sub as l,cross as c,add as m,normalize as p,transformMat4 as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ONES as u,create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as g,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as f}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as b,fromBuffer as x,intersectsClippingArea as _}from"../../../../geometry/support/aaBoundingBox.js";import{getZeroIndexArray as C}from"../../../../geometry/support/Indices.js";import{a as w}from"../../../../chunks/vec3.js";import{SnappingCandidateVertex as v,SnappingCandidateEdge as S}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as j}from"../../../../renderers/support/renderingInfoUtils.js";import{needsElevationUpdates3D as I,SampleElevationInfo as P}from"./elevationAlignmentUtils.js";import{extrudePolygon as E}from"./extrudeUtils.js";import{Object3DEdgeState as A,Graphics3DObject3DGraphicLayer as U}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as z}from"./Graphics3DSymbolLayer.js";import{computeCentroid as O}from"./graphicUtils.js";import{geometryAsPolygon as D}from"./polygonUtils.js";import{createMaterial as M}from"../support/edgeUtils.js";import{encodeNaNUInt8 as G}from"../support/symbolColorUtils.js";import{debugFlags as L}from"../../support/debugFlags.js";import{SamplePosition as V}from"../../support/ElevationProvider.js";import{loadTessellationUtils as R,preloadedPolygonToRenderInfoElevationAligned as B}from"../../support/renderInfoUtils/polygon.js";import{Attribute as F}from"../../webgl-engine/lib/Attribute.js";import{Geometry as T}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as N}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as H,compressNormal as q}from"../../webgl-engine/lib/Normals.js";import{Object3D as W}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as k}from"../../webgl-engine/materials/DefaultMaterial.js";const Z=["polygon","extent"];class J extends z{constructor(e,t,r,i){super(e,t,r,i,ee(t)),this.ensureDrapedStatus(!1)}async doLoad(){const e=this.symbolLayer,t=e?.material,r=this.symbolLayer.material?.color?.a,i=this._hasDrivenColorOrOpacity,s=this.needsDrivenTransparentPass||i&&null!=r&&r<1,n=t?.emissive,o=("color"===n?.source?n?.strength:void 0)??0,a=!i&&(null==r||0===r),l=i?g:this._materialColor?.toUnitRGBA()??y,c={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,useIndexing:!0,ambient:u,diffuse:u,externalColor:l,opacity:a?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:s,hasSymbolColors:i,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:e.castShadows,emissiveStrengthFromSymbol:o,emissiveSource:1,offsetTransparentBackfaces:!0,normalType:1},m=new k(c,this._context),p=new k({...c,cullFace:2},this._context);this._materials[0]=m,this._materials[1]=p,this._updateTransparentDepedentMaterialParameters(),await R()}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Z,this.symbolLayer.type))return null;const r=this._getDrivenUInt8ColorWithNaNSupport(e.renderingInfo,this._materialColor,!1);G(r,r);const i=this.createElevationContextForGraphic(t);return this._createAs3DShape(t,e.renderingInfo,r,i,t.uid)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._materials[0]?.setParameters({layerOpacity:r}),this._materials[1]?.setParameters({layerOpacity:r}),this._updateTransparentDepedentMaterialParameters(),e?.forEach(e=>t(e)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,I)}slicePlaneEnabledChanged(e,t){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e?.forEach(e=>{const r=t(e);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const e={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[0]?.setParameters(e),this._materials[1]?.setParameters(e),!0}_getExtrusionSize(e){let t;return t=e.size&&this._drivenProperties.size?j(e.size.output,2)??0:this._getSymbolSize(),t/=this._context.renderCoordsHelper.unitInMeters,t}_containsRenderableGeometry(e){return"polygonIndexCount"in e&&"outlineIndexCount"in e?e.polygonIndexCount>0||e.outlineIndexCount>0:super._containsRenderableGeometry(e)}applyRendererDiff(e,t){return this._drivenPropertiesChanged(t)?0:1}async queryForSnapping(r,i,s,n){const o=this._getExtrusionSize(s)*this._context.renderCoordsHelper.unitInMeters/t(i),{objectId:a,target:l}=r,c=e(l);switch(c.z=(c.z??0)+o,r.type){case"edge":{const{start:t,end:i}=r,s=e(t),n=e(i);return s.z=(s.z??0)+o,n.z=(n.z??0)+o,[new S(a,c,1/0,s,n)]}case"vertex":return[new v(a,c,1/0),new S(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,t,n,a,l){const c=D(e.geometry);if(null==c)return null;if(0===c.rings.length||!c.rings.some(e=>e.length>0))return this._logGeometryValidationWarnings(c.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=B(c,this._context.elevationProvider,this._context.renderCoordsHelper,a,{outlineOutput:"tessellated-indices",owner:this._context.layer});if(null==m)return;this._logGeometryCreationWarnings(m,c.rings,"rings","ExtrudeSymbol3DLayer");const p=O(c);if(null==p)return null;const h=new Array,u=new Array,g=b(),y=o(),C=d(),v=1===this._context.renderCoordsHelper.viewingMode;v||this._context.renderCoordsHelper.worldUpAtPosition(null,C),f(c.spatialReference,[p.x,p.y,0],y,this._context.renderCoordsHelper.spatialReference);const S=o();s(S,y);const j=i();r(j,S);const P=new Map,z=this._materials[0];if(this._context.clippingExtent&&(x(m.mapPositions,g),!_(g,this._context.clippingExtent)))return;if(0===m.polygonIndexCount&&0===m.outlineIndexCount)return;const G=this._getExtrusionSize(t),L=E(m,{height:G,worldUp:C,spherical:v,requireElevation:!0,requireNormals:!0,requireSizes:!0});if(null==L)return;w(L.vertices,L.vertices,S);const V=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerViewUid:this._context.layerViewUid}),R=new le(L.vertices,L.elevation,H(L.normals),L.sizes),F=K(z,L.indices,L.indices.length-L.bottomIndices.length,R,n,V),T=m.vertexCount,N=L.polygonVertexCount,q=2*m.outlineSegmentCount,k=m.polygonIndexCount/3,Z=new ce(T,N,q,k);if($(F,Z,y),P.set(F,Z),h.push(F),L.bottomIndices.length>0&&h.push(K(this._materials[1],L.bottomIndices,0,R,n,V)),u.push(R.heights),0===h.length)return null;const J=new W({geometries:h,layerViewUid:this._context.layerViewUid,graphicUid:l,isElevationSource:!0});J.transformation=y;const Q=M(this.symbolLayer,{opacity:this._getLayerOpacity()}),X=Q?new A(this._materials[0],Q,this._context.slicePlaneEnabled):null,ee=new U(this,J,null,(e,t,r,i,s)=>Y(e,t,r,i,s,u,P),a,X);return ee.alignedSampledElevation=m.sampledElevation,ee.needsElevationUpdates=I(a.mode),ee}get _materialColor(){return this.symbolLayer.material?.color}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent?0:2})}}function K(e,t,r,i,s,n){const{attributeIndices:o,drawIndices:a}=Q(t),l=[["position",new F(i.positions,o,3,!0)],["normalCompressed",new F(i.normals,o,2,!0)]];if(e.parameters.hasSymbolColors){const e=C(o.length);l.push(["symbolColor",new F(s,e,4,!0)])}return new T(e,l,i.elevation,0,n,r,null,a)}function Q(e){const t=new Array,r=new Map,i=new Array;for(let s=0;s<e.length;++s){const n=e[s];let o=r.get(n);null==o&&(o=t.length,t.push(n),r.set(n,o)),i.push(o)}return{attributeIndices:t,drawIndices:i}}const X=d();function Y(e,t,r,i,s,l,c){const m=e.stageObject,p=m.geometries,u=p.length,d="absolute-height"!==t.mode;let g=0;const y=m.transformation,f=n(o(),y);for(let n=0,o=0;n<u;++n){const e=p[n],t=c.get(e);if(!t||!N(e))continue;const u=e.getMutableAttribute("position").data,b=l[o++],x=new V(e.mapPositions),_=u.length/3;let C=!1,w=0;{let e=0;for(let t=0;t<_;t++){X[0]=u[e],X[1]=u[e+1],X[2]=u[e+2],i(x,ie),d&&(w+=ie.sampledElevation),L.ENABLE_OPTIMIZATIONS?(a(te,u[e],u[e+1],u[e+2]),h(te,te,y),s.setAltitude(te,ie.z+b[e/3]),h(te,te,f)):(a(te,x.array[x.offset],x.array[x.offset+1],ie.z+b[e/3]),null!=r&&s.toRenderCoords(te,r,te),h(te,te,f)),u[e]=te[0],u[e+1]=te[1],u[e+2]=te[2];const t=se/s.unitInMeters;(Math.abs(X[0]-u[e])>=t||Math.abs(X[1]-u[e+1])>=t||Math.abs(X[2]-u[e+2])>=t)&&(C=!0),x.offset+=3,e+=3}}if(C){$(e,t,y),m.geometryVertexAttributeUpdated(p[n],"normalCompressed"),e.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(p[n],"position");const r=p[n+1],i=!c.has(r);r&&i&&(r.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(r,"position"))}g+=w/_}return g/u}function $(e,t,r){const i=e.getMutableAttribute("position"),s=e.getMutableAttribute("normalCompressed").data,n=i.data,o=e.primitivePositionIndices,{topVertexStart:u,topVertexCount:d,topFaceStart:g,topFaceCount:y}=t,f=g+y,b=u+d,x=ne,_=oe,C=ae,w=re,v=te;a(v,0,0,0);const S=(e,t)=>{const i=3*e;a(t,n[i+0],n[i+1],n[i+2]),h(t,t,r)};for(let a=g;a<f;++a){const e=3*a;S(o[e+0],x[0]),S(o[e+1],x[1]),S(o[e+2],x[2]),l(_,x[1],x[0]),l(C,x[2],x[0]),c(w,_,C),m(v,v,w)}p(v,v);for(let a=u;a<b;++a){const e=v[0],t=v[1],r=v[2];q(s,a,e,t,r)}}function ee(e){return 1===(e.material?.color?.a??0)}const te=d(),re=d(),ie=new P,se=.01,ne=[d(),d(),d()],oe=d(),ae=d();class le{constructor(e,t,r,i){this.positions=e,this.elevation=t,this.normals=r,this.heights=i}}class ce{constructor(e,t,r,i){this.topVertexStart=e,this.topVertexCount=t,this.topFaceStart=r,this.topFaceCount=i}}export{J as Graphics3DExtrudeSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{pt2px as e}from"../../../../core/screenUtils.js";import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as r,intersectsClippingArea as i,empty as n,expandWithAABB as s,create as o}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as a,doubleSubArray as l}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as c}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as p}from"../../../../geometry/support/Indices.js";import{elevationModeChangeUpdateType as u,needsElevationUpdates2D as h}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as d}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as m}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as _}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as g}from"./graphicUtils.js";import{parseCapType as y,computeSymbolLayerIndex as f}from"./lineUtils.js";import{geometryAsPolygon as v,createColorGeometry as x,PolygonCreationDataBase as b}from"./polygonUtils.js";import{initFastSymbolUpdatesState as C,updateFastSymbolUpdatesState as S,getAttributeValue as P,ConvertOptions as D}from"../support/FastSymbolUpdates.js";import{createMaterial as O,uvElevationAligner as U}from"../support/patternUtils.js";import{writeMapSpaceUVCoordsPerConnectedPart as j,writeMapSpaceUVCoordsDraped as w}from"../support/uvUtils.js";import{createGeometry as I}from"../../support/engineContent/line.js";import{loadTessellationUtils as G,preloadedPolygonToRenderInfoElevationAligned as A,preloadedPolygonToRenderInfoDraped as E}from"../../support/renderInfoUtils/polygon.js";import{Object3D as R}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as V}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as L}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as M}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as z}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as B}from"../../webgl-engine/materials/RibbonLineMaterial.js";const F=["polyline","polygon","extent"];class T extends _{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,N(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=C(this._context.renderer,this._vvConvertOptions),await G()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){if(has("enable-feature:emissive-on-none-volumetrics")){const e=this.symbolLayer.material?.emissive;return("color"===e?.source?e?.strength:void 0)??0}return 0}_createMaterials(){if(this._materials.length>0)return;const t=this._materialColor,r=this._getCombinedOpacityAndColor(t);this._materials[0]=O(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof z;const i=this.symbolLayer.outline;if(q(i)){const t=M(i.pattern),r=y(i.pattern?i.patternCap||"butt":"square");this._materials[1]=new B({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:f(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:r,screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&L(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,F,this.symbolLayer.type))return null;const r=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),i=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===i.mode),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,r):this._createAs3DShape(e.renderingInfo,t,r,i)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!S(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,r=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],r],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,n=u(T.elevationModeChangeTypes,r,i);if(1!==n)return n;const s=h(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>s)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_containsRenderableGeometry(e){return e.polygonIndexCount>0||null!=this._materials[1]&&("vertex-data"===e.outline.output?e.outline.outlines.length>0:e.outlineIndexCount>0)}_createAs3DShape(e,t,r,i){const n=v(t.geometry);if(!n)return null;const s=A(n,this._context.elevationProvider,this._context.renderCoordsHelper,i,{projectIfNearlyVertical:!0,outlineOutput:"vertex-data"});if(null==s)return null;const o=new W(s,r,this._context.layerViewUid,t.uid),u=o.renderData.vertexCount;if(this._needsUV){o.uvMapSpace=c(4*u,!0),o.textureElementIndices=new Array(u),o.boundingRect=a(o.renderData.polygonIndices.length/3*9);const e=j(o.uvMapSpace,o.boundingRect,o.textureElementIndices,o.renderData.positions,o.renderData.polygonIndices,this._context.renderCoordsHelper);o.boundingRect=l(o.boundingRect,0,9*e),o.boundingRectIndices=p(e)}if(o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[1]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderData,n.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length)return null;const d=new R({geometries:o.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),_=new m(this,d,null,U,i);return _.alignedSampledElevation=o.renderData.sampledElevation,_.needsElevationUpdates=h(i.mode),_}_createAs3DShapeFill(e,t){const{mapPositions:n,positions:s,polygonIndices:o,polygonIndexCount:a}=t.renderData;if(0===a)return;if(null!=this._context.clippingExtent&&(r(n,H),!i(H,this._context.clippingExtent)))return;const l=this._fastUpdates?.visualVariables.color,c=x({material:this._materials[0],indices:o,mapPositions:n,attributeData:{position:s,color:l?null:t.color,colorFeature:l?P(l,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,boundingRect:this._needsUV?t.boundingRect:null,textureElementIndices:this._needsUV?t.textureElementIndices:null,boundingRectIndices:this._needsUV?t.boundingRectIndices:null,olidColor:t.olidColor}});t.outGeometries.push(c)}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const{outline:t}=e.renderData;if("vertex-data"!==t.output)return;const{outlines:n}=t;if(null!=n&&0!==n.length)for(const{mapPositions:s,position:o}of n){if(null!=this._context.clippingExtent&&(r(s,H),!i(H,this._context.clippingExtent)))continue;const t=I(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:s,attributeData:{position:o}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t,r){const i=v(t.geometry);if(null==i)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const s=E(i,{drapedSpatialReference:this._context.overlaySR,outlineOutput:"vertex-data"});if(null==s)return null;const o=new k(s,r,this._context.layerViewUid,t.uid);return this._needsUV&&(o.uvMapSpace=c(4*o.renderData.vertexCount,!0),w(o.uvMapSpace,o.renderData.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=n(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,"rings","FillSymbol3DLayer"),new d(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const{positions:n,polygonIndices:o,polygonIndexCount:a}=t.renderData;if(0===a)return;const l=r(n,H);if(!i(l,this._context.clippingExtent))return;s(t.outBoundingBox,l);const c=this._fastUpdates?.visualVariables.color,p=x({material:this._materials[0],indices:o,attributeData:{position:n,color:c?null:t.color,colorFeature:c?P(c,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new V(p,t))}_createAsOverlayOutline(e){if(null==this._materials[1])return;const{outline:t}=e.renderData;if("vertex-data"!==t.output)return;const{outlines:n}=t;for(const{position:o}of n){if(r(o,H),!i(H,this._context.clippingExtent))continue;s(e.outBoundingBox,H);const t=I(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:o}},e.olidColor);e.outGeometries.push(new V(t,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return g(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,r)=>this._createAsOverlay(e,t,r),createAs3DShape:(e,t,r,i)=>this._createAs3DShape(e,t,r,i)}}get _vvConvertOptions(){return new D({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??t})}}const H=o();class W extends b{constructor(e,t,r,i){super(e,r,i),this.color=t}}class k extends b{constructor(e,t,r,i){super(e,r,i),this.color=t}}function q(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function N(e){return 1===(e.material?.color?.a??0)}export{T as Graphics3DPolygonFillSymbolLayer};
2
+ import has from"../../../../core/has.js";import{pt2px as e}from"../../../../core/screenUtils.js";import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as r,intersectsClippingArea as i,empty as n,expandWithAABB as s,create as o}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as a,doubleSubArray as l}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as c}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as p}from"../../../../geometry/support/Indices.js";import{elevationModeChangeUpdateType as u,needsElevationUpdates2D as h}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as d}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as m}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as _}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as g}from"./graphicUtils.js";import{parseCapType as y,computeSymbolLayerIndex as f}from"./lineUtils.js";import{geometryAsPolygon as v,createColorGeometry as x,PolygonCreationDataBase as b}from"./polygonUtils.js";import{initFastSymbolUpdatesState as C,updateFastSymbolUpdatesState as S,getAttributeValue as P,ConvertOptions as D}from"../support/FastSymbolUpdates.js";import{createMaterial as O,uvElevationAligner as U}from"../support/patternUtils.js";import{writeMapSpaceUVCoordsPerConnectedPart as w,writeMapSpaceUVCoordsDraped as j}from"../support/uvUtils.js";import{createGeometry as I}from"../../support/engineContent/line.js";import{loadTessellationUtils as G,preloadedPolygonToRenderInfoElevationAligned as A,preloadedPolygonToRenderInfoDraped as E}from"../../support/renderInfoUtils/polygon.js";import{Object3D as R}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as V}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as L}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as M}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as z}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as B}from"../../webgl-engine/materials/RibbonLineMaterial.js";const F=["polyline","polygon","extent"];class T extends _{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,N(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=C(this._context.renderer,this._vvConvertOptions),await G()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){if(has("enable-feature:emissive-on-none-volumetrics")){const e=this.symbolLayer.material?.emissive;return("color"===e?.source?e?.strength:void 0)??0}return 0}_createMaterials(){if(this._materials.length>0)return;const t=this._materialColor,r=this._getCombinedOpacityAndColor(t);this._materials[0]=O(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof z;const i=this.symbolLayer.outline;if(q(i)){const t=M(i.pattern),r=y(i.pattern?i.patternCap||"butt":"square");this._materials[1]=new B({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:f(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:r,screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&L(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,F,this.symbolLayer.type))return null;const r=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),i=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===i.mode),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,r):this._createAs3DShape(e.renderingInfo,t,r,i)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!S(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,r=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],r],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,n=u(T.elevationModeChangeTypes,r,i);if(1!==n)return n;const s=h(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>s)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_containsRenderableGeometry(e){return e.polygonIndexCount>0||null!=this._materials[1]&&("vertex-data"===e.outline.output?e.outline.outlines.length>0:e.outlineIndexCount>0)}_createAs3DShape(e,t,r,i){const n=v(t.geometry);if(!n)return null;const s=A(n,this._context.elevationProvider,this._context.renderCoordsHelper,i,{projectIfNearlyVertical:!0,outlineOutput:"vertex-data",owner:this._context.layer});if(null==s)return null;const o=new W(s,r,this._context.layerViewUid,t.uid),u=o.renderData.vertexCount;if(this._needsUV){o.uvMapSpace=c(4*u,!0),o.textureElementIndices=new Array(u),o.boundingRect=a(o.renderData.polygonIndices.length/3*9);const e=w(o.uvMapSpace,o.boundingRect,o.textureElementIndices,o.renderData.positions,o.renderData.polygonIndices,this._context.renderCoordsHelper);o.boundingRect=l(o.boundingRect,0,9*e),o.boundingRectIndices=p(e)}if(o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[1]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderData,n.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length)return null;const d=new R({geometries:o.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),_=new m(this,d,null,U,i);return _.alignedSampledElevation=o.renderData.sampledElevation,_.needsElevationUpdates=h(i.mode),_}_createAs3DShapeFill(e,t){const{mapPositions:n,positions:s,polygonIndices:o,polygonIndexCount:a}=t.renderData;if(0===a)return;if(null!=this._context.clippingExtent&&(r(n,H),!i(H,this._context.clippingExtent)))return;const l=this._fastUpdates?.visualVariables.color,c=x({material:this._materials[0],indices:o,mapPositions:n,attributeData:{position:s,color:l?null:t.color,colorFeature:l?P(l,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,boundingRect:this._needsUV?t.boundingRect:null,textureElementIndices:this._needsUV?t.textureElementIndices:null,boundingRectIndices:this._needsUV?t.boundingRectIndices:null,olidColor:t.olidColor}});t.outGeometries.push(c)}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const{outline:t}=e.renderData;if("vertex-data"!==t.output)return;const{outlines:n}=t;if(null!=n&&0!==n.length)for(const{mapPositions:s,position:o}of n){if(null!=this._context.clippingExtent&&(r(s,H),!i(H,this._context.clippingExtent)))continue;const t=I(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:s,attributeData:{position:o}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t,r){const i=v(t.geometry);if(null==i)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const s=E(i,{drapedSpatialReference:this._context.overlaySR,outlineOutput:"vertex-data",owner:this._context.layer});if(null==s)return null;const o=new k(s,r,this._context.layerViewUid,t.uid);return this._needsUV&&(o.uvMapSpace=c(4*o.renderData.vertexCount,!0),j(o.uvMapSpace,o.renderData.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=n(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,"rings","FillSymbol3DLayer"),new d(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const{positions:n,polygonIndices:o,polygonIndexCount:a}=t.renderData;if(0===a)return;const l=r(n,H);if(!i(l,this._context.clippingExtent))return;s(t.outBoundingBox,l);const c=this._fastUpdates?.visualVariables.color,p=x({material:this._materials[0],indices:o,attributeData:{position:n,color:c?null:t.color,colorFeature:c?P(c,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new V(p,t))}_createAsOverlayOutline(e){if(null==this._materials[1])return;const{outline:t}=e.renderData;if("vertex-data"!==t.output)return;const{outlines:n}=t;for(const{position:o}of n){if(r(o,H),!i(H,this._context.clippingExtent))continue;s(e.outBoundingBox,H);const t=I(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:o}},e.olidColor);e.outGeometries.push(new V(t,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return g(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,r)=>this._createAsOverlay(e,t,r),createAs3DShape:(e,t,r,i)=>this._createAs3DShape(e,t,r,i)}}get _vvConvertOptions(){return new D({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??t})}}const H=o();class W extends b{constructor(e,t,r,i){super(e,r,i),this.color=t}}class k extends b{constructor(e,t,r,i){super(e,r,i),this.color=t}}function q(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function N(e){return 1===(e.material?.color?.a??0)}export{T as Graphics3DPolygonFillSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{getMetersPerUnitForSR as e}from"../../../../core/units.js";import{set as t}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as r,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scale as o}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{toRadian as n}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as s,intersectsClippingArea as a,empty as l,expandWithAABB as c,create as h}from"../../../../geometry/support/aaBoundingBox.js";import{empty as p,expandPointInPlace as u,create as m}from"../../../../geometry/support/aaBoundingRect.js";import{newFloatArray as d}from"../../../../geometry/support/FloatArray.js";import{perVertexElevationAligner as g}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as y,needsElevationUpdates2D as f}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as x}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as v}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as _}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as w,createWaterGeometry as D,PolygonCreationDataBase as b}from"./polygonUtils.js";import{loadTessellationUtils as S,preloadedPolygonToRenderInfoElevationAligned as C,preloadedPolygonToRenderInfoDraped as G}from"../../support/renderInfoUtils/polygon.js";import{Object3D as j}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as P}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as L,WaterMaterial as O}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as A}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const E=["polyline","polygon","extent"];class T extends _{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i)}async doLoad(){await S()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,E,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const e=new L,t=this.symbolLayer.color.toUnitRGBA();t[3]*=this._getLayerOpacity(),e.color=t,e.transparent=t[3]<1||this.needsDrivenTransparentPass,e.waveDirection=null!=this.symbolLayer.waveDirection?U(this.symbolLayer.waveDirection):r(0,0);const i=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,o=A[i];e.waveStrength=o.waveStrength,e.waveTextureRepeat=o.textureRepeat,e.waveVelocity=o.waveVelocity,e.flowStrength=o.perturbationStrength,e.hasSlicePlane=this._context.slicePlaneEnabled,e.draped=this.draped,e.useIndexing=!0,this._materials[0]=new O(e,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this.symbolLayer.color.a*this._getLayerOpacity(),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,o=y(T.elevationModeChangeTypes,r,i);if(1!==o)return o;const n=f(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>n)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}get needsDrivenTransparentPass(){return!1}_createAs3DShape(e,t,r){const i=w(e.geometry);if(null==i)return null;const o=C(i,this._context.elevationProvider,this._context.renderCoordsHelper,t);if(null==o)return null;const n=o.vertexCount,s=d(2*n);B(s,o.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new z(o,s,this._context.layerViewUid,e.uid);if(a.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,i.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new j({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new v(this,l,null,g,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=f(t.mode),c}_create3DShapeGeometries(e){const{positions:t,mapPositions:r,polygonIndices:i}=e.renderData;if(0===e.renderData.polygonIndexCount)return;const o=e.uvCoords;if(null!=this._context.clippingExtent&&(s(r,V),!a(V,this._context.clippingExtent)))return;const n=D({material:this._materials[0],indices:i,mapPositions:r,attributeData:{position:t,uv0:o}},e.olidColor);e.outGeometries.push(n)}_createAsOverlay(e){const t=w(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=G(t,{drapedSpatialReference:this._context.overlaySR});if(null==r)return null;const i=r.vertexCount,o=d(2*i);B(o,r.positions,i,this._context.overlaySR);const n=new W(r,o,this._context.layerViewUid,e.uid);return n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=l(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new x(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,{positions:r,polygonIndices:i}=e.renderData;if(s(r,V),!a(V,this._context.clippingExtent))return;if(c(e.outBoundingBox,V),0===e.renderData.polygonIndexCount)return;const o=D({material:this._materials[0],indices:i,attributeData:{position:r,uv0:t}},e.olidColor);e.outGeometries.push(new P(o,e))}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function U(e){const t=i(),r=n(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function B(r,i,n,s){const a=e(s);p(I);for(let e=0;e<n;e++)t(M,i[3*e],i[3*e+1]),u(I,M);o(I,I,a);const l=I[0]%T.unitSizeOfTexture,c=I[1]%T.unitSizeOfTexture;R[0]=I[0]-l,R[1]=I[1]-c;for(let e=0;e<n;e++)r[2*e]=(i[3*e]*a-R[0])/T.unitSizeOfTexture,r[2*e+1]=(i[3*e+1]*a-R[1])/T.unitSizeOfTexture}const R=i(),I=m(),M=i(),V=h();class z extends b{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}class W extends b{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}export{T as Graphics3DWaterSymbolLayer,U as headingVectorFromAngle};
2
+ import{getMetersPerUnitForSR as e}from"../../../../core/units.js";import{set as t}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as r,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scale as o}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{toRadian as n}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as s,intersectsClippingArea as a,empty as l,expandWithAABB as c,create as h}from"../../../../geometry/support/aaBoundingBox.js";import{empty as p,expandPointInPlace as u,create as m}from"../../../../geometry/support/aaBoundingRect.js";import{newFloatArray as d}from"../../../../geometry/support/FloatArray.js";import{perVertexElevationAligner as g}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as y,needsElevationUpdates2D as f}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as x}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as v}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as _}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as w,createWaterGeometry as D,PolygonCreationDataBase as b}from"./polygonUtils.js";import{loadTessellationUtils as S,preloadedPolygonToRenderInfoElevationAligned as C,preloadedPolygonToRenderInfoDraped as G}from"../../support/renderInfoUtils/polygon.js";import{Object3D as j}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as P}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as L,WaterMaterial as O}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as A}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const E=["polyline","polygon","extent"];class T extends _{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i)}async doLoad(){await S()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,E,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const e=new L,t=this.symbolLayer.color.toUnitRGBA();t[3]*=this._getLayerOpacity(),e.color=t,e.transparent=t[3]<1||this.needsDrivenTransparentPass,e.waveDirection=null!=this.symbolLayer.waveDirection?U(this.symbolLayer.waveDirection):r(0,0);const i=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,o=A[i];e.waveStrength=o.waveStrength,e.waveTextureRepeat=o.textureRepeat,e.waveVelocity=o.waveVelocity,e.flowStrength=o.perturbationStrength,e.hasSlicePlane=this._context.slicePlaneEnabled,e.draped=this.draped,e.useIndexing=!0,this._materials[0]=new O(e,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this.symbolLayer.color.a*this._getLayerOpacity(),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,o=y(T.elevationModeChangeTypes,r,i);if(1!==o)return o;const n=f(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>n)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}get needsDrivenTransparentPass(){return!1}_createAs3DShape(e,t,r){const i=w(e.geometry);if(null==i)return null;const o=C(i,this._context.elevationProvider,this._context.renderCoordsHelper,t,{owner:this._context.layer});if(null==o)return null;const n=o.vertexCount,s=d(2*n);B(s,o.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new z(o,s,this._context.layerViewUid,e.uid);if(a.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,i.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new j({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new v(this,l,null,g,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=f(t.mode),c}_create3DShapeGeometries(e){const{positions:t,mapPositions:r,polygonIndices:i}=e.renderData;if(0===e.renderData.polygonIndexCount)return;const o=e.uvCoords;if(null!=this._context.clippingExtent&&(s(r,V),!a(V,this._context.clippingExtent)))return;const n=D({material:this._materials[0],indices:i,mapPositions:r,attributeData:{position:t,uv0:o}},e.olidColor);e.outGeometries.push(n)}_createAsOverlay(e){const t=w(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=G(t,{drapedSpatialReference:this._context.overlaySR,owner:this._context.layer});if(null==r)return null;const i=r.vertexCount,o=d(2*i);B(o,r.positions,i,this._context.overlaySR);const n=new W(r,o,this._context.layerViewUid,e.uid);return n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=l(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new x(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,{positions:r,polygonIndices:i}=e.renderData;if(s(r,V),!a(V,this._context.clippingExtent))return;if(c(e.outBoundingBox,V),0===e.renderData.polygonIndexCount)return;const o=D({material:this._materials[0],indices:i,attributeData:{position:r,uv0:t}},e.olidColor);e.outGeometries.push(new P(o,e))}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function U(e){const t=i(),r=n(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function B(r,i,n,s){const a=e(s);p(I);for(let e=0;e<n;e++)t(M,i[3*e],i[3*e+1]),u(I,M);o(I,I,a);const l=I[0]%T.unitSizeOfTexture,c=I[1]%T.unitSizeOfTexture;R[0]=I[0]-l,R[1]=I[1]-c;for(let e=0;e<n;e++)r[2*e]=(i[3*e]*a-R[0])/T.unitSizeOfTexture,r[2*e+1]=(i[3*e+1]*a-R[1])/T.unitSizeOfTexture}const R=i(),I=m(),M=i(),V=h();class z extends b{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}class W extends b{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}export{T as Graphics3DWaterSymbolLayer,U as headingVectorFromAngle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../core/has.js";import"../../../../core/Logger.js";import{trackAccess as n}from"../../../../core/accessorSupport/tracking.js";import{SimpleObservable as t}from"../../../../core/accessorSupport/tracking/SimpleObservable.js";import{e}from"../../../../chunks/earcut.js";import{loadLibtessF64 as o,isLibtessF64Loaded as i,triangulateIndexedF64 as s}from"../../../../geometry/libtess.js";import{isClockwise as r}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as u,doubleSubArray as l,concatDoubleArrays as c}from"../../../../geometry/support/DoubleArray.js";import{compactMeshIndices as g,newIndexArray as h,concatIndexArrays as f}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as p}from"../../../../geometry/support/polygonUtils.js";const d=1e-5,a={method:"auto",projectionAxis:void 0,outlines:void 0};function m(n,t){const{hasZ:e,ccwRingsAsHoles:o,spatialReference:i}=t,s=t.axis??x(n,e,i),r=n.length,c=[],g=[],h=[],f=[],p=n.reduce((n,t)=>n+t.length,0);let d=0;const a=u(3*p);let m=0;const L=o&&n[0]&&y(n[0],e,s);for(let u=r-1;u>=0;u--){const t=n[u],i=S(t,e);if(i<3){i>1&&f.push(t);continue}const r=!!o&&y(t,e,s);if(L?!r:r)c[d++]=t;else{let n=t.length;for(let t=0;t<d;++t)n+=c[t].length;const o={index:m,pathLengths:new Array(d+1),count:n,holeIndices:new Array(d)};o.pathLengths[0]=t.length,t.length>0&&h.push({index:m,count:t.length}),m=k(t,a,m,t.length,e,L);for(let t=0;t<d;++t){const n=c[t];o.holeIndices[t]=m,o.pathLengths[t+1]=n.length,n.length>0&&h.push({index:m,count:n.length}),m=k(n,a,m,n.length,e,L)}d=0,o.count>0&&g.push(o)}}const j=m;for(const u of f)h.push({index:m,count:u.length}),m=k(u,a,m,u.length,e,L);return{positions:3*m===a.length?a:l(a,0,3*m),polygonVertexCount:j,polygons:g,outlines:h}}function x(n,t,e){if(!t)return 2;const o=n.map(n=>{const o=S(n,t);return o<3?2:p(n,o,e)}),i=o[0];return o.every(n=>n===i)?i:2}function y(n,t,e){if(!t)return!r(n);if(n.length<3)return!1;switch(e){case 0:return!r(n,1,2);case 1:return!r(n,0,2);case 2:return!r(n,0,1)}}const L=new t;function j(t,e){const o=v(t,e);if(o.succeeded)return o;return"libtess-not-loaded"===o.message?(n(L),I()):o}async function I(){try{await o(),L.notify()}catch(n){throw n}}function v(n,t){const e={method:t?.method??a.method,projectionAxis:t?.projectionAxis??a.projectionAxis,outlines:t?.outlines??a.outlines},{projectionAxis:o}=e,i=null!=o&&2!==o;i&&b(n.positions,o,2);const s=R(n,e);if(i){const t=s.succeeded?s.positions:null;null!=t&&t!==n.positions&&b(t,2,o),b(n.positions,2,o)}return s}function R(n,t){if("libtess"===t.method)return A(n,t);const o=Array();let i=0;for(const u of n.polygons){const s=O(n.positions,u),r=(u.holeIndices??[]).map(n=>n-u.index),l=r.length>0?r:null,c=e(s,l,3),g=e.deviation(s,r,3,c);if("auto"===t.method&&g>d)return A(n,t);for(let n=0;n<c.length;n++)o.push(c[n]+u.index);i=Math.max(i,g)}const{outlineIndexBuffer:s,outlineRingLengths:r}=null!=t.outlines?w(t.outlines,n.positions):{outlineIndexBuffer:void 0,outlineRingLengths:void 0};return{succeeded:!0,positions:n.positions,indices:g(o),outlineIndexBuffer:s,outlineRingLengths:r,vertexCount:n.positions.length/3,method:"earcut",deviation:i}}function A(n,t){if(!i())return V("libtess-not-loaded");const e=null!=t.outlines,{positions:o,mergedPathLengths:r}=U(n),{vertices:u,indices:l,outlineIndices:c,outlineRingLengths:g}=s(o,r,3,e);if(u.length%3!=0)return V("positions-not-multiple-of-3");const{positions:h,outlineIndexBuffer:f,mergedOutlineRingLengths:p}=e?B(n,t.outlines,u,c,g):{positions:u,outlineIndexBuffer:void 0,mergedOutlineRingLengths:void 0};return{succeeded:!0,positions:h,indices:l,outlineIndexBuffer:f,outlineRingLengths:p,vertexCount:h.length/3,method:"libtess"}}function B(n,t,e,o,i){const s=n.polygonVertexCount,r=t?.filter(n=>n.index>=s)??[];if(0===r.length)return{positions:e,outlineIndexBuffer:o,mergedOutlineRingLengths:i};const u=3*s,g=l(n.positions,u,n.positions.length-u),h=c(e,g),p=e.length/3,d=r.map(n=>({index:p+n.index-s,count:n.count})),{outlineIndexBuffer:a,outlineRingLengths:m}=w(d,h);return{positions:h,outlineIndexBuffer:f(o,a,h.length/3),mergedOutlineRingLengths:f(i,m,i.length+m.length)}}function b(n,t,e){for(let o=0;o<n.length;o+=3){const i=n[o+t];n[o+t]=n[o+e],n[o+e]=i}}function w(n,t){const e=h(n.length);let o=0;for(let r=0;r<n.length;r++){const i=n[r],s=i.count;if(s<=0){e[r]=0;continue}const u=3*i.index,l=3*(i.index+s-1),c=s>1&&t[u]===t[l]&&t[u+1]===t[l+1]&&t[u+2]===t[l+2]?s-1:s,g=c>0?c+1:0;e[r]=g,o+=g}const i=h(o,t.length/3);let s=0;for(let r=0;r<n.length;r++){const t=e[r];if(0===t)continue;const o=n[r].index,u=t-1;for(let n=0;n<u;n++)i[s++]=o+n;i[s++]=o}return{outlineIndexBuffer:i,outlineRingLengths:e}}function C(n){const t=n.reduce((n,t)=>n+t.pathLengths.length,0),e=new Array(t);let o=0;for(let i=0;i<n.length;i++){const t=n[i].pathLengths;for(let n=0;n<t.length;n++)e[o++]=t[n]}return e}function O(n,{index:t,count:e}){return l(n,3*t,3*e)}function k(n,t,e,o,i,s){let r=s?n.length-1:0;const u=s?-1:1;e*=3;for(let l=0;l<o;++l){const o=n[r];t[e++]=o[0],t[e++]=o[1],t[e++]=i&&null!=o[2]?o[2]:0,r+=u}return e/3}function P(n,t){const e=n.length;if(e<2)return!1;const o=n[0],i=n[e-1];return o[0]===i[0]&&o[1]===i[1]&&(!t||o[2]===i[2])}function S(n,t){return P(n,t)?n.length-1:n.length}function V(n){return{succeeded:!1,message:n}}function U(n){const t=C(n.polygons),e=3*n.polygonVertexCount;return e===n.positions.length?{positions:n.positions,mergedPathLengths:t}:{positions:l(n.positions,0,e),mergedPathLengths:t}}export{x as axisFromRings,y as isCounterClockwise,I as load,m as ringsToOutlinedTessellationInfo,v as tessellate,j as tessellateOrLoad};
2
+ import"../../../../core/has.js";import"../../../../core/Logger.js";import{trackAccess as n}from"../../../../core/accessorSupport/tracking.js";import{SimpleObservable as t}from"../../../../core/accessorSupport/tracking/SimpleObservable.js";import{e}from"../../../../chunks/earcut.js";import{loadLibtessF64 as o,isLibtessF64Loaded as i,triangulateIndexedF64 as s}from"../../../../geometry/libtess.js";import{isClockwise as r}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as u,doubleSubArray as l,concatDoubleArrays as c}from"../../../../geometry/support/DoubleArray.js";import{compactMeshIndices as g,newIndexArray as h,concatIndexArrays as f}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as p}from"../../../../geometry/support/polygonUtils.js";const d=1e-5,a={method:"auto",projectionAxis:void 0,outlines:void 0,owner:void 0};function m(n,t){const{hasZ:e,ccwRingsAsHoles:o,spatialReference:i}=t,s=t.axis??x(n,e,i),r=n.length,c=[],g=[],h=[],f=[],p=n.reduce((n,t)=>n+t.length,0);let d=0;const a=u(3*p);let m=0;const L=o&&n[0]&&y(n[0],e,s);for(let u=r-1;u>=0;u--){const t=n[u],i=H(t,e);if(i<3){i>1&&f.push(t);continue}const r=!!o&&y(t,e,s);if(L?!r:r)c[d++]=t;else{let n=t.length;for(let t=0;t<d;++t)n+=c[t].length;const o={index:m,pathLengths:new Array(d+1),count:n,holeIndices:new Array(d)};o.pathLengths[0]=t.length,t.length>0&&h.push({index:m,count:t.length}),m=U(t,a,m,t.length,e,L);for(let t=0;t<d;++t){const n=c[t];o.holeIndices[t]=m,o.pathLengths[t+1]=n.length,n.length>0&&h.push({index:m,count:n.length}),m=U(n,a,m,n.length,e,L)}d=0,o.count>0&&g.push(o)}}const w=m;for(const u of f)h.push({index:m,count:u.length}),m=U(u,a,m,u.length,e,L);return{positions:3*m===a.length?a:l(a,0,3*m),polygonVertexCount:w,polygons:g,outlines:h}}function x(n,t,e){if(!t)return 2;const o=n.map(n=>{const o=H(n,t);return o<3?2:p(n,o,e)}),i=o[0];return o.every(n=>n===i)?i:2}function y(n,t,e){if(!t)return!r(n);if(n.length<3)return!1;switch(e){case 0:return!r(n,1,2);case 1:return!r(n,0,2);case 2:return!r(n,0,1)}}const L=new t;function w(t,e){const o=v(t,e);if(o.succeeded)return o;return"libtess-not-loaded"===o.message?(n(L),j()):o}async function j(){try{await o(),L.notify()}catch(n){throw n}}function v(n,t){const e={method:t?.method??a.method,projectionAxis:t?.projectionAxis??a.projectionAxis,outlines:t?.outlines??a.outlines,owner:t?.owner??a.owner},{projectionAxis:o}=e,i=null!=o&&2!==o;i&&k(n.positions,o,2);const s=I(n,e);if(i){const t=s.succeeded?s.positions:null;null!=t&&t!==n.positions&&k(t,2,o),k(n.positions,2,o)}return s}function I(n,t){if("libtess"===t.method)return C(n,t);const o=b(n,t),i=Array();let s=0;for(const l of n.polygons){const r=P(n.positions,l),u=(l.holeIndices??[]).map(n=>n-l.index),c=u.length>0?u:null,g=e(r,c,3),h=e.deviation(r,u,3,g);if(o&&h>d)return C(n,t);for(let n=0;n<g.length;n++)i.push(g[n]+l.index);s=Math.max(s,h)}const{outlineIndexBuffer:r,outlineRingLengths:u}=null!=t.outlines?S(t.outlines,n.positions):{outlineIndexBuffer:void 0,outlineRingLengths:void 0};return{succeeded:!0,positions:n.positions,indices:g(i),outlineIndexBuffer:r,outlineRingLengths:u,vertexCount:n.positions.length/3,method:"earcut",deviation:s}}const R=250;let A=new WeakSet;const B=1e4;function b(n,t){const e=null!=t.owner&&A.has(t.owner),o=B;return"auto"===t.method&&!(e&&n.polygonVertexCount>=o)}function C(n,t){if(!i())return M("libtess-not-loaded");const e=null!=t.outlines,{positions:o,mergedPathLengths:r}=W(n),u=performance.now(),{vertices:l,indices:c,outlineIndices:g,outlineRingLengths:h}=s(o,r,3,e),f=performance.now()-u,p=R;if(null!=t.owner&&f>p&&A.add(t.owner),l.length%3!=0)return M("positions-not-multiple-of-3");const{positions:d,outlineIndexBuffer:a,mergedOutlineRingLengths:m}=e?O(n,t.outlines,l,g,h):{positions:l,outlineIndexBuffer:void 0,mergedOutlineRingLengths:void 0};return{succeeded:!0,positions:d,indices:c,outlineIndexBuffer:a,outlineRingLengths:m,vertexCount:d.length/3,method:"libtess"}}function O(n,t,e,o,i){const s=n.polygonVertexCount,r=t?.filter(n=>n.index>=s)??[];if(0===r.length)return{positions:e,outlineIndexBuffer:o,mergedOutlineRingLengths:i};const u=3*s,g=l(n.positions,u,n.positions.length-u),h=c(e,g),p=e.length/3,d=r.map(n=>({index:p+n.index-s,count:n.count})),{outlineIndexBuffer:a,outlineRingLengths:m}=S(d,h);return{positions:h,outlineIndexBuffer:f(o,a,h.length/3),mergedOutlineRingLengths:f(i,m,i.length+m.length)}}function k(n,t,e){for(let o=0;o<n.length;o+=3){const i=n[o+t];n[o+t]=n[o+e],n[o+e]=i}}function S(n,t){const e=h(n.length);let o=0;for(let r=0;r<n.length;r++){const i=n[r],s=i.count;if(s<=0){e[r]=0;continue}const u=3*i.index,l=3*(i.index+s-1),c=s>1&&t[u]===t[l]&&t[u+1]===t[l+1]&&t[u+2]===t[l+2]?s-1:s,g=c>0?c+1:0;e[r]=g,o+=g}const i=h(o,t.length/3);let s=0;for(let r=0;r<n.length;r++){const t=e[r];if(0===t)continue;const o=n[r].index,u=t-1;for(let n=0;n<u;n++)i[s++]=o+n;i[s++]=o}return{outlineIndexBuffer:i,outlineRingLengths:e}}function V(n){const t=n.reduce((n,t)=>n+t.pathLengths.length,0),e=new Array(t);let o=0;for(let i=0;i<n.length;i++){const t=n[i].pathLengths;for(let n=0;n<t.length;n++)e[o++]=t[n]}return e}function P(n,{index:t,count:e}){return l(n,3*t,3*e)}function U(n,t,e,o,i,s){let r=s?n.length-1:0;const u=s?-1:1;e*=3;for(let l=0;l<o;++l){const o=n[r];t[e++]=o[0],t[e++]=o[1],t[e++]=i&&null!=o[2]?o[2]:0,r+=u}return e/3}function D(n,t){const e=n.length;if(e<2)return!1;const o=n[0],i=n[e-1];return o[0]===i[0]&&o[1]===i[1]&&(!t||o[2]===i[2])}function H(n,t){return D(n,t)?n.length-1:n.length}function M(n){return{succeeded:!1,message:n}}function W(n){const t=V(n.polygons),e=3*n.polygonVertexCount;return e===n.positions.length?{positions:n.positions,mergedPathLengths:t}:{positions:l(n.positions,0,e),mergedPathLengths:t}}const Z=void 0;export{x as axisFromRings,y as isCounterClockwise,j as load,m as ringsToOutlinedTessellationInfo,v as tessellate,w as tessellateOrLoad,Z as tessellationTestHooks};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import t from"../../../Camera.js";import i from"../../../Viewpoint.js";import e from"../../../core/Error.js";import{onAbort as n,createAbortError as a}from"../../../core/promiseUtils.js";import{whenOnce as r}from"../../../core/reactiveUtils.js";import{toRenderCameraWithScale as o}from"../webgl.js";import{applyAll as s}from"../camera/constraintUtils.js";import{isPointToPointAnimationController as l,PointToPointAnimationController as h}from"./controllers/PointToPointAnimationController.js";import{SurfaceCollisionCorrectionController as c}from"./controllers/SurfaceCollisionCorrectionController.js";import{create as m}from"../support/viewpointUtils.js";class w{constructor(t,i,e){this._target=t,this._options=i,this.view=e,this.state="pending",this._animationController=null,this.promise=new Promise((t,i)=>{this._resolveCallback=t,this._rejectCallback=i;const e=new AbortController;null!=this._options.signal&&n(this._options.signal,()=>this.abort()),this._abortController=e,this._waitForReady()})}_resolve(t){if("finished"!==this.state)return this.state="finished",this._resolveCallback(t)}_reject(t){if("finished"!==this.state)return this.state="finished",this._rejectCallback(t)}abort(t=!1){if(this._abortController.abort(),"wait-for-animation-finish"===this.state)!t&&null!=this._animationController&&this.view.state.cameraController===this._animationController&&this._animationController.running&&this._animationController.stopController();this._reject(a())}async _waitForReady(){if(this.state="wait-for-ready",!this.view.ready)try{await r(()=>this.view.ready,this._abortController.signal)}catch(t){return this._reject(t)}this._createViewPoint()}async _createViewPoint(){if("finished"!==this.state){this.state="wait-for-viewpoint",this._animationController=this._options.animate?this._getAnimationController():null;try{const t=await m(this.view,this._target,this._abortController.signal);if("finished"===this.state)return;const i=t?this._getCameraFromViewpoint(t):null;if(null==i)return;if(this._options.animate){if(null==this._animationController)return;this._startAnimation(i,this._animationController)}else this.view.stateManager.setStateCamera(i.camera,{applyConstraints:!i.isFullySpecified,positionAndOrientationOnly:!0,doNotCancelGoToOperation:!0}),this._resolve()}catch(t){this._reject(t)}}}_getCameraFromViewpoint(n){const a=this._target instanceof i,r=this._target instanceof t,s=!!(a&&this._target.camera||r||"position"in this._target&&void 0!==this._target.position?.z||Array.isArray(this._target)&&void 0!==this._target[2]),l=n.camera;if(null==l)return null;if(!this.view.stateManager.isCompatible(l)){const t=l.position,i=t&&t.spatialReference,n=i?i.wkid:"none",a=this.view.spatialReference?.wkid;return this._reject(new e("GotoAnimation:incompatible-spatialreference",`Resulting camera has an incompatible spatial reference (camera: ${n}, view: ${a})`,{camera:l})),null}const h=o(this.view,l,n.scale);return null==h?(this._reject(new e("GotoAnimation:invalid-camera","Resulting camera is invalid")),null):{viewpoint:n,camera:h,isFullySpecified:s}}_startAnimation(t,i){this.state="wait-for-animation-finish";const n=i.viewAnimation;if(null==n)return void this._reject(new e("GotoAnimation:missing-animation","Unreachable code in view.stateManager"));if(n.update(t.viewpoint,"running"),!i.running||null==i.viewAnimation||i.viewAnimation.target!==t.viewpoint||this.view.state.cameraController!==i)return this.abort();let a;t.isFullySpecified?a=new c({view:this.view,desiredCamera:t.camera}):s(this.view,t.camera),i.begin(t.camera,this._options);const r=()=>{const e=this.view.state.cameraController;a&&(e&&e.running?l(e)&&null!=e.viewAnimation&&e.viewAnimation.target===t.viewpoint&&(this.view.state.cameraController=a):null!=i.viewAnimation&&i.viewAnimation.target===t.viewpoint&&4===i.state&&(this.view.state.cameraController=a))},o=t=>{if(null!=this.view.state)switch(i.state){case 4:switch(this.state){case"pending":case"wait-for-ready":case"wait-for-viewpoint":case"wait-for-animation-finish":this._resolve()}break;case 0:case 1:case 2:case 3:switch(this.state){case"pending":case"wait-for-ready":case"wait-for-viewpoint":case"wait-for-animation-finish":this._reject(t)}}};n.when(r,t=>o(t)),i.asyncResult={resolve:()=>o(),reject:t=>o(t)}}_getAnimationController(){let t=null,i=null;const n=this.view.state.cameraController;return l(n)&&(n.updateStateFromViewAnimation(),n.running&&(t=n,i=t.viewAnimation)),null==t&&(t=new h({view:this.view,mode:"animation"}),i=t.viewAnimation,this.view.state.switchCameraController(t),1===t.state)?(i?.stop(),this._reject(new e("GotoAnimation:goto-cannot-interrupt","Cannot start an animation while interacting")),null):t}}export{w as GoToOperation};
2
+ import t from"../../../Camera.js";import i from"../../../Viewpoint.js";import e from"../../../core/Error.js";import{onAbort as n,createAbortError as a}from"../../../core/promiseUtils.js";import{whenOnce as o}from"../../../core/reactiveUtils.js";import{toRenderCameraWithScale as r}from"../webgl.js";import{applyAll as s}from"../camera/constraintUtils.js";import{isPointToPointAnimationController as l,PointToPointAnimationController as c}from"./controllers/PointToPointAnimationController.js";import{create as h}from"../support/viewpointUtils.js";class m{constructor(t,i,e){this._target=t,this._options=i,this.view=e,this.state="pending",this._animationController=null,this.promise=new Promise((t,i)=>{this._resolveCallback=t,this._rejectCallback=i;const e=new AbortController;null!=this._options.signal&&n(this._options.signal,()=>this.abort()),this._abortController=e,this._waitForReady()})}_resolve(t){if("finished"!==this.state)return this.state="finished",this._resolveCallback(t)}_reject(t){if("finished"!==this.state)return this.state="finished",this._rejectCallback(t)}abort(t=!1){if(this._abortController.abort(),"wait-for-animation-finish"===this.state)!t&&null!=this._animationController&&this.view.state.cameraController===this._animationController&&this._animationController.running&&this._animationController.stopController();this._reject(a())}async _waitForReady(){if(this.state="wait-for-ready",!this.view.ready)try{await o(()=>this.view.ready,this._abortController.signal)}catch(t){return this._reject(t)}this._createViewPoint()}async _createViewPoint(){if("finished"!==this.state){this.state="wait-for-viewpoint",this._animationController=this._options.animate?this._getAnimationController():null;try{const t=await h(this.view,this._target,this._abortController.signal);if("finished"===this.state)return;const i=t?this._getCameraFromViewpoint(t):null;if(null==i)return;if(this._options.animate){if(null==this._animationController)return;this._startAnimation(i,this._animationController)}else this.view.stateManager.setStateCamera(i.camera,{applyConstraints:!i.isFullySpecified,positionAndOrientationOnly:!0,doNotCancelGoToOperation:!0}),this._resolve()}catch(t){this._reject(t)}}}_getCameraFromViewpoint(n){const a=this._target instanceof i,o=this._target instanceof t,s=!!(a&&this._target.camera||o),l=n.camera;if(null==l)return null;if(!this.view.stateManager.isCompatible(l)){const t=l.position,i=t&&t.spatialReference,n=i?i.wkid:"none",a=this.view.spatialReference?.wkid;return this._reject(new e("GotoAnimation:incompatible-spatialreference",`Resulting camera has an incompatible spatial reference (camera: ${n}, view: ${a})`,{camera:l})),null}const c=r(this.view,l,n.scale);return null==c?(this._reject(new e("GotoAnimation:invalid-camera","Resulting camera is invalid")),null):{viewpoint:n,camera:c,isFullySpecified:s}}_startAnimation(t,i){this.state="wait-for-animation-finish";const n=i.viewAnimation;if(null==n)return void this._reject(new e("GotoAnimation:missing-animation","Unreachable code in view.stateManager"));if(n.update(t.viewpoint,"running"),!i.running||null==i.viewAnimation||i.viewAnimation.target!==t.viewpoint||this.view.state.cameraController!==i)return this.abort();t.isFullySpecified||s(this.view,t.camera),i.begin(t.camera,this._options);const a=t=>{if(null!=this.view.state)switch(i.state){case 4:switch(this.state){case"pending":case"wait-for-ready":case"wait-for-viewpoint":case"wait-for-animation-finish":this._resolve()}break;case 0:case 1:case 2:case 3:switch(this.state){case"pending":case"wait-for-ready":case"wait-for-viewpoint":case"wait-for-animation-finish":this._reject(t)}}};i.asyncResult={resolve:()=>a(),reject:t=>a(t)}}_getAnimationController(){let t=null,i=null;const n=this.view.state.cameraController;return l(n)&&(n.updateStateFromViewAnimation(),n.running&&(t=n,i=t.viewAnimation)),null==t&&(t=new c({view:this.view,mode:"animation"}),i=t.viewAnimation,this.view.state.switchCameraController(t),1===t.state)?(i?.stop(),this._reject(new e("GotoAnimation:goto-cannot-interrupt","Cannot start an animation while interacting")),null):t}}export{m as GoToOperation};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{eyeWithinExtent as a}from"../camera/intersectionUtils.js";import{applySurfaceCollisionConstraint as o}from"../camera/constraintUtils/surfaceCollision.js";let s=class extends t{constructor(e){super(e)}initialize(){this.addHandles(this.view.elevationProvider.on("elevation-change",e=>this._handleElevationChangeEvent(e)))}_handleElevationChangeEvent(e){if(this.view.state.cameraController||"ground"!==e.context)return;const t=this.view.state.camera;null!=e.spatialReference&&a(this.view,t,e.extent,e.spatialReference)&&this._applyToCurrentCamera()}_applyToCurrentCamera(){this.view.state.updateCamera(e=>o(this.view,e,1))}};e([r({constructOnly:!0})],s.prototype,"view",void 0),s=e([i("esri.views.3d.state.SurfaceCollisionConstraint")],s);export{s as SurfaceCollisionConstraint};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as a,subclass as r}from"../../../core/accessorSupport/decorators.js";import{eyeWithinExtent as s}from"../camera/intersectionUtils.js";import{applySurfaceCollisionConstraint as i}from"../camera/constraintUtils/surfaceCollision.js";let o=class extends t{constructor(e){super(e),this._sourceCamera=null}initialize(){this.addHandles(this.view.elevationProvider.on("elevation-change",e=>this._handleElevationChangeEvent(e)))}setSourceCamera(e){this._sourceCamera=e.clone()}_handleElevationChangeEvent(e){!this.view.state.cameraController&&"ground"===e.context&&this.view.state.constraints.collision.enabled&&null!=e.spatialReference&&s(this.view,this._sourceCamera||this.view.state.camera,e.extent,e.spatialReference)&&this._applyToCurrentCamera()}_applyToCurrentCamera(){this.view.state.updateCamera(e=>{i(this.view,this._sourceCamera||this.view.state.camera,e,1)})}};e([a({constructOnly:!0})],o.prototype,"view",void 0),o=e([r("esri.views.3d.state.SurfaceCollisionConstraint")],o);export{o as SurfaceCollisionConstraint};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{prefersReducedMotion as t}from"../../../core/a11yUtils.js";import r from"../../../core/Accessor.js";import{EventEmitter as o}from"../../../core/Evented.js";import{destroyMaybe as a}from"../../../core/maybe.js";import{when as i}from"../../../core/reactiveUtils.js";import{property as n,subclass as s}from"../../../core/accessorSupport/decorators.js";import{afterDispatch as l}from"../../../core/accessorSupport/watch.js";import{fromValues as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import m from"../../ViewAnimation.js";import{viewingModeFromString as h}from"../../ViewingMode.js";import{Constraints as d}from"./Constraints.js";import{HUDOccludedFragmentOpacity as u}from"./HUDOccludedFragmentOpacity.js";import{AnimationController as g}from"./controllers/AnimationController.js";import y from"../webgl/RenderCamera.js";import{DepthRange as C}from"../webgl-engine/lib/DepthRange.js";import{maximumHighlights as f}from"../../support/HighlightDefaults.js";import{PropertiesPool as w}from"../../support/PropertiesPool.js";let v=class extends r{constructor(e){super(e),this._propertiesPool=new w({camera:()=>new y},this),this._lastSeenCameraProjectionValues=new y,this.mode=0,this._cssCamera=new y,this._camera=new y,this.rasterPixelRatio=1,this.contentPixelRatio=1,this.constraints=new d({state:this}),this.events=new o,this.fading=!1,this._cameraChanged=!1,this._updateQueue=new Array,this._processingUpdates=!1}reset(){this.cameraController=null,this._propertiesPool.destroy(),this._propertiesPool=new w({camera:()=>new y},this)}destroy(){this.cameraController=null,this._propertiesPool=a(this._propertiesPool)}createInitialCamera(){if(1===this.viewingMode){const e=c(this.spatialReference).radius;this.camera=new y({eye:p(4*e,0,0),center:p(e,0,0),up:p(0,0,1)})}else this.camera=new y({eye:p(0,0,100),center:p(0,0,0),up:p(0,1,0)})}get animation(){return this.cameraController instanceof g&&null!=this.cameraController.viewAnimation?this.cameraController.viewAnimation:null}get cssCamera(){const e=this._cssCamera.copyFrom(this.camera),{height:t,width:r,pixelRatio:o}=this.camera;return e.pixelRatio=1,e.height=Math.round(t/o),e.width=Math.round(r/o),e}get camera(){return this._camera}set camera(e){e!==O&&O.copyFrom(e),O.computeUp(this.viewingMode),this.events.emit("before-camera-change",{camera:O});const t=this._camera;if(j(this._lastSeenCameraProjectionValues,O)&&(this._lastSeenCameraProjectionValues.copyFrom(O),this.events.emit("camera-projection-changed",this._lastSeenCameraProjectionValues)),!t.equals(O)&&(this._camera=this._propertiesPool.get("camera").copyFrom(O),this._cameraChanged=!t.almostEquals(O),this._cameraChanged)){const e=l(()=>{this._cameraChanged=!1,e.remove()})}}get pixelRatio(){return this.camera.pixelRatio}get alignPixelEnabled(){return this.pixelRatio===this.rasterPixelRatio&&2===this.mode}get updating(){return 2!==this.mode}get contentCamera(){return this._contentCamera??this.camera}set contentCamera(e){if(null==e)return void(this._contentCamera=null);const t=e.clone();this.events.emit("before-camera-change",{camera:t,sceneDepthRange:C.Infinite}),this._contentCamera=t}get fixedContentCamera(){return null!=this._contentCamera}get isGlobal(){return 1===this.viewingMode}get isLocal(){return 2===this.viewingMode}get viewingMode(){return h(this.view.viewingMode)}get spatialReference(){return this.view.spatialReference}ensureOccludedFragmentOpacity(){return this.occludedFragmentOpacity??=new u({requestRender:()=>this.view.stage?.renderView.requestRender(2)}),this.occludedFragmentOpacity}get highlights(){const e=this.view.highlights.items.slice(0,f);for(let t=0;t<e.length;){const r=e[t],o=e.findIndex(e=>e.name===r.name);o>=0&&t>o?e.splice(t,1):++t}return e}get highlightOrderMap(){return new Map(this.highlights.map(({name:e},t)=>[e,t]))}get animationsEnabled(){return this.view.animationsEnabled&&!t()}get navigating(){return!!this.cameraController?.isInteractive}get stationary(){return!this._cameraChanged&&!this.navigating}get cameraController(){return this._get("cameraController")}set cameraController(e){this.stopActiveCameraController()?(this.removeHandles(x),this.cameraController?.destroy(),e&&(this.addHandles(i(()=>4===e.state||3===e.state,()=>{this.updateCamera(t=>e.onControllerEnd(t)),this.cameraController===e&&(this._set("cameraController",null),e.destroy())},{sync:!0,once:!0}),x),e.onControllerStart(this.camera)),this._set("cameraController",e)):e&&(e.state=1)}switchCameraController(e){this.cameraController=e}stopActiveCameraController(){return!this.cameraController||this.cameraController.stopController()}updateCamera(e){this._updateQueue.push(e),this._processUpdateQueue()}_processUpdateQueue(){if(0===this._updateQueue.length||this._processingUpdates)return;this._processingUpdates=!0;const e=this._updateQueue.shift();O.copyFrom(this.camera),e(O),this.camera=O,this._processingUpdates=!1,this._processUpdateQueue()}static cleanupViewstate(){O=new y}};e([n({constructOnly:!0})],v.prototype,"view",void 0),e([n()],v.prototype,"mode",void 0),e([n({readOnly:!0,type:m})],v.prototype,"animation",null),e([n({type:y})],v.prototype,"cssCamera",null),e([n()],v.prototype,"_cssCamera",void 0),e([n({type:y})],v.prototype,"camera",null),e([n()],v.prototype,"_camera",void 0),e([n({readOnly:!0})],v.prototype,"pixelRatio",null),e([n()],v.prototype,"rasterPixelRatio",void 0),e([n()],v.prototype,"contentPixelRatio",void 0),e([n({readOnly:!0})],v.prototype,"alignPixelEnabled",null),e([n({readOnly:!0})],v.prototype,"updating",null),e([n({})],v.prototype,"_contentCamera",void 0),e([n({type:y})],v.prototype,"contentCamera",null),e([n({readOnly:!0})],v.prototype,"fixedContentCamera",null),e([n({readOnly:!0})],v.prototype,"events",void 0),e([n({readOnly:!0})],v.prototype,"isGlobal",null),e([n({readOnly:!0})],v.prototype,"isLocal",null),e([n({readOnly:!0})],v.prototype,"viewingMode",null),e([n()],v.prototype,"occludedFragmentOpacity",void 0),e([n({readOnly:!0})],v.prototype,"highlights",null),e([n({readOnly:!0})],v.prototype,"highlightOrderMap",null),e([n({readOnly:!0})],v.prototype,"navigating",null),e([n()],v.prototype,"fading",void 0),e([n({readOnly:!0})],v.prototype,"stationary",null),e([n()],v.prototype,"_cameraChanged",void 0),e([n()],v.prototype,"cameraController",null),v=e([s("esri.views.3d.state.ViewState")],v);const _=v;function j(e,t){return e.fov!==t.fov||(e.fullViewport[0]!==t.fullViewport[0]||e.fullViewport[1]!==t.fullViewport[1]||e.fullViewport[2]!==t.fullViewport[2]||e.fullViewport[3]!==t.fullViewport[3]||(e.padding[0]!==t.padding[0]||e.padding[1]!==t.padding[1]||e.padding[2]!==t.padding[2]||e.padding[3]!==t.padding[3]))}let O=new y;const x="ViewStateHandles";export{_ as default};
2
+ import{__decorate as e}from"tslib";import{prefersReducedMotion as t}from"../../../core/a11yUtils.js";import r from"../../../core/Accessor.js";import{EventEmitter as o}from"../../../core/Evented.js";import{destroyMaybe as a}from"../../../core/maybe.js";import{when as i}from"../../../core/reactiveUtils.js";import{property as n,subclass as s}from"../../../core/accessorSupport/decorators.js";import{afterDispatch as l}from"../../../core/accessorSupport/watch.js";import{fromValues as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import m from"../../ViewAnimation.js";import{viewingModeFromString as h}from"../../ViewingMode.js";import{applySurfaceCollisionConstraint as d}from"../camera/constraintUtils/surfaceCollision.js";import{Constraints as u}from"./Constraints.js";import{HUDOccludedFragmentOpacity as g}from"./HUDOccludedFragmentOpacity.js";import{AnimationController as y}from"./controllers/AnimationController.js";import C from"../webgl/RenderCamera.js";import{DepthRange as w}from"../webgl-engine/lib/DepthRange.js";import{maximumHighlights as f}from"../../support/HighlightDefaults.js";import{PropertiesPool as v}from"../../support/PropertiesPool.js";let _=class extends r{constructor(e){super(e),this._propertiesPool=new v({camera:()=>new C},this),this._lastSeenCameraProjectionValues=new C,this.mode=0,this._cssCamera=new C,this._camera=new C,this.rasterPixelRatio=1,this.contentPixelRatio=1,this.constraints=new u({state:this}),this.events=new o,this.fading=!1,this._cameraChanged=!1,this._updateQueue=new Array,this._processingUpdates=!1}reset(){this.cameraController=null,this._propertiesPool.destroy(),this._propertiesPool=new v({camera:()=>new C},this)}destroy(){this.cameraController=null,this._propertiesPool=a(this._propertiesPool)}createInitialCamera(){if(1===this.viewingMode){const e=c(this.spatialReference).radius;this.camera=new C({eye:p(4*e,0,0),center:p(e,0,0),up:p(0,0,1)})}else this.camera=new C({eye:p(0,0,100),center:p(0,0,0),up:p(0,1,0)})}get animation(){return this.cameraController instanceof y&&null!=this.cameraController.viewAnimation?this.cameraController.viewAnimation:null}get cssCamera(){const e=this._cssCamera.copyFrom(this.camera),{height:t,width:r,pixelRatio:o}=this.camera;return e.pixelRatio=1,e.height=Math.round(t/o),e.width=Math.round(r/o),e}get camera(){return this._camera}set camera(e){e!==x&&x.copyFrom(e),x.computeUp(this.viewingMode),this.events.emit("before-camera-change",{camera:x});const t=this._camera;if(O(this._lastSeenCameraProjectionValues,x)&&(this._lastSeenCameraProjectionValues.copyFrom(x),this.events.emit("camera-projection-changed",this._lastSeenCameraProjectionValues)),!t.equals(x)&&(this._camera=this._propertiesPool.get("camera").copyFrom(x),this._cameraChanged=!t.almostEquals(x),this._cameraChanged)){const e=l(()=>{this._cameraChanged=!1,e.remove()})}}get pixelRatio(){return this.camera.pixelRatio}get alignPixelEnabled(){return this.pixelRatio===this.rasterPixelRatio&&2===this.mode}get updating(){return 2!==this.mode}get contentCamera(){return this._contentCamera??this.camera}set contentCamera(e){if(null==e)return void(this._contentCamera=null);const t=e.clone();this.events.emit("before-camera-change",{camera:t,sceneDepthRange:w.Infinite}),this._contentCamera=t}get fixedContentCamera(){return null!=this._contentCamera}get isGlobal(){return 1===this.viewingMode}get isLocal(){return 2===this.viewingMode}get viewingMode(){return h(this.view.viewingMode)}get spatialReference(){return this.view.spatialReference}ensureOccludedFragmentOpacity(){return this.occludedFragmentOpacity??=new g({requestRender:()=>this.view.stage?.renderView.requestRender(2)}),this.occludedFragmentOpacity}get highlights(){const e=this.view.highlights.items.slice(0,f);for(let t=0;t<e.length;){const r=e[t],o=e.findIndex(e=>e.name===r.name);o>=0&&t>o?e.splice(t,1):++t}return e}get highlightOrderMap(){return new Map(this.highlights.map(({name:e},t)=>[e,t]))}get animationsEnabled(){return this.view.animationsEnabled&&!t()}get navigating(){return!!this.cameraController?.isInteractive}get stationary(){return!this._cameraChanged&&!this.navigating}get cameraController(){return this._get("cameraController")}set cameraController(e){this.stopActiveCameraController()?(this.removeHandles(P),this.cameraController?.destroy(),e&&(this.addHandles(i(()=>4===e.state||3===e.state,()=>{this.updateCamera(t=>{e.onControllerEnd(t),this.view.stateManager?.setCollisionSourceCamera(t),d(this.view,null,t,1)}),this.cameraController===e&&(this._set("cameraController",null),e.destroy())},{sync:!0,once:!0}),P),e.onControllerStart(this.camera),this.view.stateManager?.setCollisionSourceCamera(this.camera)),this._set("cameraController",e)):e&&(e.state=1)}switchCameraController(e){this.cameraController=e}stopActiveCameraController(){return!this.cameraController||this.cameraController.stopController()}updateCamera(e){this._updateQueue.push(e),this._processUpdateQueue()}_processUpdateQueue(){if(0===this._updateQueue.length||this._processingUpdates)return;this._processingUpdates=!0;const e=this._updateQueue.shift();x.copyFrom(this.camera),e(x),this.camera=x,this._processingUpdates=!1,this._processUpdateQueue()}static cleanupViewstate(){x=new C}};e([n({constructOnly:!0})],_.prototype,"view",void 0),e([n()],_.prototype,"mode",void 0),e([n({readOnly:!0,type:m})],_.prototype,"animation",null),e([n({type:C})],_.prototype,"cssCamera",null),e([n()],_.prototype,"_cssCamera",void 0),e([n({type:C})],_.prototype,"camera",null),e([n()],_.prototype,"_camera",void 0),e([n({readOnly:!0})],_.prototype,"pixelRatio",null),e([n()],_.prototype,"rasterPixelRatio",void 0),e([n()],_.prototype,"contentPixelRatio",void 0),e([n({readOnly:!0})],_.prototype,"alignPixelEnabled",null),e([n({readOnly:!0})],_.prototype,"updating",null),e([n({})],_.prototype,"_contentCamera",void 0),e([n({type:C})],_.prototype,"contentCamera",null),e([n({readOnly:!0})],_.prototype,"fixedContentCamera",null),e([n({readOnly:!0})],_.prototype,"events",void 0),e([n({readOnly:!0})],_.prototype,"isGlobal",null),e([n({readOnly:!0})],_.prototype,"isLocal",null),e([n({readOnly:!0})],_.prototype,"viewingMode",null),e([n()],_.prototype,"occludedFragmentOpacity",void 0),e([n({readOnly:!0})],_.prototype,"highlights",null),e([n({readOnly:!0})],_.prototype,"highlightOrderMap",null),e([n({readOnly:!0})],_.prototype,"navigating",null),e([n()],_.prototype,"fading",void 0),e([n({readOnly:!0})],_.prototype,"stationary",null),e([n()],_.prototype,"_cameraChanged",void 0),e([n()],_.prototype,"cameraController",null),_=e([s("esri.views.3d.state.ViewState")],_);const j=_;function O(e,t){return e.fov!==t.fov||(e.fullViewport[0]!==t.fullViewport[0]||e.fullViewport[1]!==t.fullViewport[1]||e.fullViewport[2]!==t.fullViewport[2]||e.fullViewport[3]!==t.fullViewport[3]||(e.padding[0]!==t.padding[0]||e.padding[1]!==t.padding[1]||e.padding[2]!==t.padding[2]||e.padding[3]!==t.padding[3]))}let x=new C;const P="ViewStateHandles";export{j as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Camera.js";import i from"../../../Viewpoint.js";import r from"../../../core/Accessor.js";import a from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{on as n,watch as o,sync as h,when as l}from"../../../core/reactiveUtils.js";import{addFrameTask as c}from"../../../core/scheduling.js";import{createScreenPoint as p}from"../../../core/screenUtils.js";import{Milliseconds as m}from"../../../core/time.js";import{property as d,subclass as v}from"../../../core/accessorSupport/decorators.js";import{runUntracked as u}from"../../../core/accessorSupport/tracking.js";import{squaredDistance as w}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as _}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import y from"../../../geometry/Extent.js";import C from"../../../geometry/Point.js";import x from"../../../geometry/Polygon.js";import{isLoadedOrLoadFor as R,requiresLoad as S}from"../../../geometry/projectionUtils.js";import{fromRenderCamera as P,toRenderCamera as O}from"../webgl.js";import{applyAll as b}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as T,surfaceElevationBelowRenderLocation as j}from"../camera/intersectionUtils.js";import{ConstraintsManager as z}from"./ConstraintsManager.js";import{Frustum as M}from"./Frustum.js";import{GoToOperation as I}from"./GoToOperation.js";import{SurfaceCollisionCorrectionController as H}from"./controllers/SurfaceCollisionCorrectionController.js";import{toArea as V,toExtent as B,applyTiltAdjustToScale as L,scaleToZoom as D,fromExtentSync as E,getObserverForPointAtDistanceSync as U,viewScaleToCameraDistance as k,zoomToScale as A}from"../support/cameraUtils.js";import{fromCamera as F,toCameraSync as N}from"../support/viewpointUtils.js";import G from"../webgl/RenderCamera.js";import{PropertiesPool as q}from"../../support/PropertiesPool.js";import{ensureAttachmentMaxSize as W}from"../../webgl/FramebufferObject.js";let Z=class extends r{constructor(e){super(e),this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._idleTimeout=re,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,getDevicePixelRatioOverride:()=>this._devicePixelRatioOverride,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},get updatingIgnoreRenderState(){return null!=this.renderState},get idleTimeoutEnabled(){return this.viewStateManager._idleTimeout>0},set idleTimeoutEnabled(e){this.viewStateManager._idleTimeout=e?re:0}},this._propertiesPool=new q({frustum:()=>new M(null)},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new J}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([n(()=>this.view.state.events,"before-camera-change",({camera:e})=>e&&this._updateElevation(e)),o(()=>this.view.state?.camera,(e,t)=>this._cameraChangedHandler(e,t),h)]),l(()=>this.view.state?.camera,e=>this._updateElevation(e),{once:!0,sync:!0}),this.addHandles([c({prepare:e=>this._prepareFrame(e.time)}),o(()=>this.view.state.cameraController,()=>{this._cameraSetByUser=!0,this.removeHandles(te)}),n(()=>this.view.state.events,"camera-projection-changed",()=>this.notifyChange("scale"))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}get camera(){const e=this._get("camera");if(!this.ready)return e;const{view:t}=this,i=t.state.camera;return u(()=>{const r=P(t,i,Y);return r&&e&&r.equals(e)?e:r.clone()})}set camera(e){if(this._updatePropertyBeforeReady("camera",e))return;this.view.elevationProvider.enableCache(!0);const t=O(this.view,e);t?this.setStateCamera(t,{applyConstraints:!1})||a.getLogger(this).warnOnce("#camera=","There is a currently active camera controller that has priority."):a.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider.enableCache(!1)}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const{view:t}=this,i=t.state.contentCamera;return u(()=>{const r=P(t,i,Y);return r&&e&&r.equals(e)?e:r.clone()})}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=O(this.view,e);this.view.state.contentCamera=null!=t?t:null}installContentCameraReset(e){if(this.removeHandles(ie),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const t=this.zoom,i=this.view.state.camera.distance**2,r=g(this.view.state.camera.center),a=e.sticky?this.contentCamera.clone():null;return this.addHandles([o(()=>this.contentCamera,()=>{e.sticky||(this.removeHandles(ie),this.test.contentCameraResetState.clear())}),o(()=>this.zoom,e=>{void 0!==e&&void 0!==t&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(e-t)/2),Math.abs(e-t)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a))}),o(()=>this.view.state.camera,e=>{const t=w(r,e.center);this.test.contentCameraResetState.set("camera.center",t/i),t>i?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a)})],ie),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():a.getLogger(this).error("#center=","Invalid center",e):a.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#center=","Center may not be null or undefined"))}get visibleArea(){if(!this.ready){const e=this._get("extent");return e?x.fromExtent(e):null}return V(this.view,this.view.pointsOfInterest.focus.renderLocation)}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=B(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return null!=t?t:this._get("extent")}set extent(e){this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#extent=","Invalid extent",e):a.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get constraintsManager(){return this._constraintsManager}get _initialViewpoint(){const e=this.view.map;return e&&"initialViewProperties"in e?e.initialViewProperties?.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(!this.ready)return this._get("scale");const e=this.view.basemapTerrain.tilingScheme,t=this.view.pointsOfInterest.cameraOnSurface.scale;return e&&t?L(this.view,t,this.view.state.contentCamera,e):this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,t=e.padding,i=e.pixelRatio,r=this._get("padding"),a=Math.round(t[0]/i),s=Math.round(t[1]/i),n=Math.round(t[2]/i),o=Math.round(t[3]/i);return null!=r&&r.top===a&&r.right===s&&r.bottom===n&&r.left===o?r:{top:a,right:s,bottom:n,left:o}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,ee),this.view.state.updateCamera(e=>e.padding=ee))}_paddingToArray(e,t,i){e?_(i,e.top||0,e.right||0,e.bottom||0,e.left||0):_(i,0,0,0,0);for(let r=0;r<4;r++)i[r]=Math.round(i[r]*t)}get screenCenter(){const e=this.padding;return p((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?F(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){if(!this._updatePropertyBeforeReady("viewpoint",e))if(e){if(!this.isCompatible(e)){const t=null!=e.camera?e.camera.position:e.targetGeometry,i=null!=t&&t.spatialReference;return void a.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(i?i.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e)}this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||a.getLogger(this).error("#viewpoint=","Invalid viewpoint",e)}else a.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?D(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||void 0===e||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),t=(this._useDevicePixelResolution()?this._windowDevicePixelRatio:e)*this.view.resolutionScale;this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*t),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*t);const i=this.view.stage.renderView.renderingContext?.parameters.maxTextureSize;return i&&W(this._tmpCanvasSize,i),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5:t,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return null!=this._devicePixelRatioOverride?this._devicePixelRatioOverride:this._useDevicePixelResolution(2)?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}_useDevicePixelResolution(e){return this.view?.stage?.renderer.isFeatureEnabled(8,e)??!1}preinit(e){return!(this._isOverridden("center")&&!R(this.center.spatialReference,e))&&(!(this._isOverridden("camera")&&!R(this.camera.position.spatialReference,e))&&(!(this._isOverridden("extent")&&!R(this.extent.spatialReference,e))&&!!(!this._isOverridden("viewpoint")||R(this.viewpoint.targetGeometry?.spatialReference,e)&&R(this.viewpoint.camera?.position?.spatialReference,e))))}init(){this._constraintsManager=new z({view:this.view}),this._prepareFrame(m(0));const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const t of e)this.set(t.name,t.value);if(!this._cameraSetByUser){const e=this._initialViewpoint||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):2===this.view.state.viewingMode&&this.addHandles(l(()=>this.view.groundView.ready,()=>{this.removeHandles(te),this._setInitialView(this.view.dataExtent)},{once:!0,initial:!0}),te)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(te),this._constraintsManager=s(this._constraintsManager))}async goTo(e,t){return t={animate:this.view.state.animationsEnabled,...t},null!=this._gotoOperation&&this._gotoOperation.abort(t.animate),this._gotoOperation=new I(e,t,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(T(this.view),{applyConstraints:!1})}step(e){const t=this.view.state?.cameraController;t?.stepController&&this.view.state.updateCamera(i=>t.stepController(e,i))}_cancelGoToOperation(){null!=this._gotoOperation&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,t=[];for(const{propertyName:i,overrides:r}of Q){const a=e.has(i),s=this._isOverridden(i);!a&&s&&t.push({name:i,value:this._get(i)}),this._clearOverride(i),(a||s)&&r.forEach(t=>e.add(t))}return t}_setInitialView(e){if(null==e||this._cameraSetByUser)return;if(e instanceof t)return void this.setStateCamera(O(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof y){const t=E(this.view,e.targetGeometry,0,.5,0);return void(null!=t&&this.setStateCamera(O(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const r=E(this.view,e,0,.5,0);null!=r&&this.setStateCamera(O(this.view,r),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&K.has(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return null!=e&&(e instanceof i?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof t?this.isCompatible(e.position):e.spatialReference&&!S(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=X){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=$){const{heading:r,tilt:a}=this._getPreservingHeadingTilt(),s=U(this.view,r,a,e,t,1);return null==s?null:(i.copyFrom(this.view.state.camera),i.eye=s.eye,i.center=s.center,i.up=s.up,i)}_centerToCamera(e){let t;if(e.hasZ)t=this.view.state.camera.distance;else{const{centerOnContent:e}=this.view.pointsOfInterest;e.runTask(),t=e.distance}return this._centerPointAtDistanceToCamera(e,t)}_extentToCamera(e){const{heading:t,tilt:i}=this._getPreservingHeadingTilt(),r=E(this.view,e,t,i,1,Y);return r?O(this.view,r):null}_scaleToCamera(e){if(null==e)return null;const t=this.view,i=t.pointsOfInterest.centerOnContent;i.runTask();const r=i.renderLocation,a=t.pointsOfInterest.cameraOnSurface.renderLocation,s=k(t,e,r,a);return this._centerPointAtDistanceToCamera(r,s)}_zoomToCamera(e){return this._scaleToCamera(A(this.view,e))}_viewpointToCamera(e){return O(this.view,N(this.view,e))}setStateCamera(e,t){return!(null==e||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,t.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera(i=>{t.positionAndOrientationOnly?(i.eye=e.eye,i.center=e.center,i.up=e.up,i.fov=e.fov):i.copyFrom(e),t.applyConstraints&&b(this.view,i)}),t.applyConstraints||(this.view.state.cameraController=new H({view:this.view,desiredCamera:e})),!0)}_prepareFrame(e){const{surface:t,canvas:i,stage:r}=this.view;if(!t||!i||!r||r.destroyed||r.destroying)return;this._windowDevicePixelRatio=window.devicePixelRatio;const a=this._computeCanvasSize();if(0!==a.width&&0!==a.height&&(i.width===a.width&&i.height===a.height||(i.width=a.width,i.height=a.height),this.view.state)){const t=this.view.state.camera;t.fullWidth===a.width&&t.fullHeight===a.height&&t.pixelRatio===a.pixelRatio||($.copyFrom(t),$.pixelRatio!==a.pixelRatio&&(this._paddingToArray(this.padding,a.pixelRatio,ee),$.padding=ee),$.fullWidth=a.width,$.fullHeight=a.height,$.pixelRatio=a.pixelRatio,this.view.state.camera=$),this._updateState(),this.view.state.occludedFragmentOpacity?.update(this.view,this.view.state.mode,e)}}_updateElevation(e){const t=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,i=this.view.basemapTerrain?.spatialReference,r=i?j(this.view,e.eye):0;e.relativeElevation=t-r}_updateState(){null!=this.test.renderState?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=0:this.view.interacting?this.view.state.mode=1:(0===this.view.state.mode&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<this._idleTimeout?this.view.state.mode=1:this.view.state.mode=2),this.view.state.rasterPixelRatio=this._rasterPixelRatio}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=performance.now(),this._updateState())}};e([d({type:t})],Z.prototype,"camera",null),e([d({type:t})],Z.prototype,"contentCamera",null),e([d({type:C})],Z.prototype,"center",null),e([d()],Z.prototype,"visibleArea",null),e([d({type:y})],Z.prototype,"extent",null),e([d({readOnly:!0})],Z.prototype,"frustum",null),e([d()],Z.prototype,"_constraintsManager",void 0),e([d({readOnly:!0})],Z.prototype,"constraintsManager",null),e([d()],Z.prototype,"_initialViewpoint",null),e([d({readOnly:!0})],Z.prototype,"hasInitialView",null),e([d({readOnly:!0,type:Boolean})],Z.prototype,"ready",void 0),e([d({type:Number})],Z.prototype,"scale",null),e([d()],Z.prototype,"padding",null),e([d({readOnly:!0})],Z.prototype,"screenCenter",null),e([d({constructOnly:!0})],Z.prototype,"view",void 0),e([d({type:i})],Z.prototype,"viewpoint",null),e([d({type:Number})],Z.prototype,"zoom",null),e([d({readOnly:!0})],Z.prototype,"_rasterPixelRatio",null),e([d({readOnly:!0})],Z.prototype,"_useDevicePixelResolution",null),e([d()],Z.prototype,"_windowDevicePixelRatio",void 0),e([d()],Z.prototype,"_devicePixelRatioOverride",void 0),Z=e([v("esri.views.3d.state.ViewStateManager")],Z);class J{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const K=new Set(["camera","viewpoint","extent","scale","center","zoom"]),Q=[{propertyName:"camera",overrides:["viewpoint"]},{propertyName:"viewpoint",overrides:["extent"]},{propertyName:"extent",overrides:["center","scale"]},{propertyName:"center",overrides:[]},{propertyName:"scale",overrides:["zoom"]},{propertyName:"zoom",overrides:[]},{propertyName:"padding",overrides:[]}],X={heading:0,tilt:0};let Y=new t,$=new G;const ee=f(),te="pending-initial-view",ie="content-camera-reset",re=300,ae=100;function se(){Y=new t,$=new G}export{Z as ViewStateManager,se as cleanupViewStateManager,ae as interactingTimeout};
2
+ import{__decorate as e}from"tslib";import t from"../../../Camera.js";import i from"../../../Viewpoint.js";import r from"../../../core/Accessor.js";import a from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{on as n,watch as o,sync as h,when as l}from"../../../core/reactiveUtils.js";import{addFrameTask as c}from"../../../core/scheduling.js";import{createScreenPoint as p}from"../../../core/screenUtils.js";import{Milliseconds as m}from"../../../core/time.js";import{property as d,subclass as v}from"../../../core/accessorSupport/decorators.js";import{runUntracked as u}from"../../../core/accessorSupport/tracking.js";import{squaredDistance as w}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as _}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import y from"../../../geometry/Extent.js";import C from"../../../geometry/Point.js";import x from"../../../geometry/Polygon.js";import{isLoadedOrLoadFor as R,requiresLoad as S}from"../../../geometry/projectionUtils.js";import{fromRenderCamera as P,toRenderCamera as O}from"../webgl.js";import{applyAll as b}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as T,surfaceElevationBelowRenderLocation as j}from"../camera/intersectionUtils.js";import{ConstraintsManager as z}from"./ConstraintsManager.js";import{Frustum as M}from"./Frustum.js";import{GoToOperation as I}from"./GoToOperation.js";import{toArea as H,toExtent as V,applyTiltAdjustToScale as B,scaleToZoom as L,fromExtentSync as D,getObserverForPointAtDistanceSync as E,viewScaleToCameraDistance as U,zoomToScale as k}from"../support/cameraUtils.js";import{fromCamera as A,toCameraSync as F}from"../support/viewpointUtils.js";import N from"../webgl/RenderCamera.js";import{PropertiesPool as G}from"../../support/PropertiesPool.js";import{ensureAttachmentMaxSize as q}from"../../webgl/FramebufferObject.js";let W=class extends r{constructor(e){super(e),this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._idleTimeout=ie,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,getDevicePixelRatioOverride:()=>this._devicePixelRatioOverride,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},get updatingIgnoreRenderState(){return null!=this.renderState},get idleTimeoutEnabled(){return this.viewStateManager._idleTimeout>0},set idleTimeoutEnabled(e){this.viewStateManager._idleTimeout=e?ie:0}},this._propertiesPool=new G({frustum:()=>new M(null)},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new Z}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([n(()=>this.view.state.events,"before-camera-change",({camera:e})=>e&&this._updateElevation(e)),o(()=>this.view.state?.camera,(e,t)=>this._cameraChangedHandler(e,t),h)]),l(()=>this.view.state?.camera,e=>this._updateElevation(e),{once:!0,sync:!0}),this.addHandles([c({prepare:e=>this._prepareFrame(e.time)}),o(()=>this.view.state.cameraController,()=>{this._cameraSetByUser=!0,this.removeHandles(ee)}),n(()=>this.view.state.events,"camera-projection-changed",()=>this.notifyChange("scale"))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}get camera(){const e=this._get("camera");if(!this.ready)return e;const{view:t}=this,i=t.state.camera;return u(()=>{const r=P(t,i,X);return r&&e&&r.equals(e)?e:r.clone()})}set camera(e){if(this._updatePropertyBeforeReady("camera",e))return;this.view.elevationProvider.enableCache(!0);const t=O(this.view,e);t?this.setStateCamera(t,{applyConstraints:!1})||a.getLogger(this).warnOnce("#camera=","There is a currently active camera controller that has priority."):a.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider.enableCache(!1)}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const{view:t}=this,i=t.state.contentCamera;return u(()=>{const r=P(t,i,X);return r&&e&&r.equals(e)?e:r.clone()})}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=O(this.view,e);this.view.state.contentCamera=null!=t?t:null}installContentCameraReset(e){if(this.removeHandles(te),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const t=this.zoom,i=this.view.state.camera.distance**2,r=g(this.view.state.camera.center),a=e.sticky?this.contentCamera.clone():null;return this.addHandles([o(()=>this.contentCamera,()=>{e.sticky||(this.removeHandles(te),this.test.contentCameraResetState.clear())}),o(()=>this.zoom,e=>{void 0!==e&&void 0!==t&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(e-t)/2),Math.abs(e-t)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a))}),o(()=>this.view.state.camera,e=>{const t=w(r,e.center);this.test.contentCameraResetState.set("camera.center",t/i),t>i?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a)})],te),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():a.getLogger(this).error("#center=","Invalid center",e):a.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#center=","Center may not be null or undefined"))}get visibleArea(){if(!this.ready){const e=this._get("extent");return e?x.fromExtent(e):null}return H(this.view,this.view.pointsOfInterest.focus.renderLocation)}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=V(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return null!=t?t:this._get("extent")}set extent(e){this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#extent=","Invalid extent",e):a.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get constraintsManager(){return this._constraintsManager}get _initialViewpoint(){const e=this.view.map;return e&&"initialViewProperties"in e?e.initialViewProperties?.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(!this.ready)return this._get("scale");const e=this.view.basemapTerrain.tilingScheme,t=this.view.pointsOfInterest.cameraOnSurface.scale;return e&&t?B(this.view,t,this.view.state.contentCamera,e):this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,t=e.padding,i=e.pixelRatio,r=this._get("padding"),a=Math.round(t[0]/i),s=Math.round(t[1]/i),n=Math.round(t[2]/i),o=Math.round(t[3]/i);return null!=r&&r.top===a&&r.right===s&&r.bottom===n&&r.left===o?r:{top:a,right:s,bottom:n,left:o}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,$),this.view.state.updateCamera(e=>e.padding=$))}_paddingToArray(e,t,i){e?_(i,e.top||0,e.right||0,e.bottom||0,e.left||0):_(i,0,0,0,0);for(let r=0;r<4;r++)i[r]=Math.round(i[r]*t)}get screenCenter(){const e=this.padding;return p((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?A(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){if(!this._updatePropertyBeforeReady("viewpoint",e))if(e){if(!this.isCompatible(e)){const t=null!=e.camera?e.camera.position:e.targetGeometry,i=null!=t&&t.spatialReference;return void a.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(i?i.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e)}this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||a.getLogger(this).error("#viewpoint=","Invalid viewpoint",e)}else a.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?L(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||void 0===e||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),t=(this._useDevicePixelResolution()?this._windowDevicePixelRatio:e)*this.view.resolutionScale;this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*t),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*t);const i=this.view.stage.renderView.renderingContext?.parameters.maxTextureSize;return i&&q(this._tmpCanvasSize,i),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5:t,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return null!=this._devicePixelRatioOverride?this._devicePixelRatioOverride:this._useDevicePixelResolution(2)?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}_useDevicePixelResolution(e){return this.view?.stage?.renderer.isFeatureEnabled(8,e)??!1}preinit(e){return!(this._isOverridden("center")&&!R(this.center.spatialReference,e))&&(!(this._isOverridden("camera")&&!R(this.camera.position.spatialReference,e))&&(!(this._isOverridden("extent")&&!R(this.extent.spatialReference,e))&&!!(!this._isOverridden("viewpoint")||R(this.viewpoint.targetGeometry?.spatialReference,e)&&R(this.viewpoint.camera?.position?.spatialReference,e))))}init(){this._constraintsManager=new z({view:this.view}),this._prepareFrame(m(0));const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const t of e)this.set(t.name,t.value);if(!this._cameraSetByUser){const e=this._initialViewpoint||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):2===this.view.state.viewingMode&&this.addHandles(l(()=>this.view.groundView.ready,()=>{this.removeHandles(ee),this._setInitialView(this.view.dataExtent)},{once:!0,initial:!0}),ee)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(ee),this._constraintsManager=s(this._constraintsManager))}async goTo(e,t){return t={animate:this.view.state.animationsEnabled,...t},null!=this._gotoOperation&&this._gotoOperation.abort(t.animate),this._gotoOperation=new I(e,t,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(T(this.view),{applyConstraints:!1})}step(e){const t=this.view.state?.cameraController;t?.stepController&&this.view.state.updateCamera(i=>t.stepController(e,i))}_cancelGoToOperation(){null!=this._gotoOperation&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,t=[];for(const{propertyName:i,overrides:r}of K){const a=e.has(i),s=this._isOverridden(i);!a&&s&&t.push({name:i,value:this._get(i)}),this._clearOverride(i),(a||s)&&r.forEach(t=>e.add(t))}return t}_setInitialView(e){if(null==e||this._cameraSetByUser)return;if(e instanceof t)return void this.setStateCamera(O(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof y){const t=D(this.view,e.targetGeometry,0,.5,0);return void(null!=t&&this.setStateCamera(O(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const r=D(this.view,e,0,.5,0);null!=r&&this.setStateCamera(O(this.view,r),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&J.has(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return null!=e&&(e instanceof i?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof t?this.isCompatible(e.position):e.spatialReference&&!S(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=Q){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=Y){const{heading:r,tilt:a}=this._getPreservingHeadingTilt(),s=E(this.view,r,a,e,t,1);return null==s?null:(i.copyFrom(this.view.state.camera),i.eye=s.eye,i.center=s.center,i.up=s.up,i)}_centerToCamera(e){let t;if(e.hasZ)t=this.view.state.camera.distance;else{const{centerOnContent:e}=this.view.pointsOfInterest;e.runTask(),t=e.distance}return this._centerPointAtDistanceToCamera(e,t)}_extentToCamera(e){const{heading:t,tilt:i}=this._getPreservingHeadingTilt(),r=D(this.view,e,t,i,1,X);return r?O(this.view,r):null}_scaleToCamera(e){if(null==e)return null;const t=this.view,i=t.pointsOfInterest.centerOnContent;i.runTask();const r=i.renderLocation,a=t.pointsOfInterest.cameraOnSurface.renderLocation,s=U(t,e,r,a);return this._centerPointAtDistanceToCamera(r,s)}_zoomToCamera(e){return this._scaleToCamera(k(this.view,e))}_viewpointToCamera(e){return O(this.view,F(this.view,e))}setStateCamera(e,t){return!(null==e||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,t.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera(i=>{t.positionAndOrientationOnly?(i.eye=e.eye,i.center=e.center,i.up=e.up,i.fov=e.fov):i.copyFrom(e),t.applyConstraints&&b(this.view,i),this.setCollisionSourceCamera(i)}),!0)}setCollisionSourceCamera(e){this._constraintsManager?.surfaceCollisionConstraint.setSourceCamera(e)}_prepareFrame(e){const{surface:t,canvas:i,stage:r}=this.view;if(!t||!i||!r||r.destroyed||r.destroying)return;this._windowDevicePixelRatio=window.devicePixelRatio;const a=this._computeCanvasSize();if(0!==a.width&&0!==a.height&&(i.width===a.width&&i.height===a.height||(i.width=a.width,i.height=a.height),this.view.state)){const t=this.view.state.camera;t.fullWidth===a.width&&t.fullHeight===a.height&&t.pixelRatio===a.pixelRatio||(Y.copyFrom(t),Y.pixelRatio!==a.pixelRatio&&(this._paddingToArray(this.padding,a.pixelRatio,$),Y.padding=$),Y.fullWidth=a.width,Y.fullHeight=a.height,Y.pixelRatio=a.pixelRatio,this.view.state.camera=Y),this._updateState(),this.view.state.occludedFragmentOpacity?.update(this.view,this.view.state.mode,e)}}_updateElevation(e){const t=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,i=this.view.basemapTerrain?.spatialReference,r=i?j(this.view,e.eye):0;e.relativeElevation=t-r}_updateState(){null!=this.test.renderState?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=0:this.view.interacting?this.view.state.mode=1:(0===this.view.state.mode&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<this._idleTimeout?this.view.state.mode=1:this.view.state.mode=2),this.view.state.rasterPixelRatio=this._rasterPixelRatio}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=performance.now(),this._updateState())}};e([d({type:t})],W.prototype,"camera",null),e([d({type:t})],W.prototype,"contentCamera",null),e([d({type:C})],W.prototype,"center",null),e([d()],W.prototype,"visibleArea",null),e([d({type:y})],W.prototype,"extent",null),e([d({readOnly:!0})],W.prototype,"frustum",null),e([d()],W.prototype,"_constraintsManager",void 0),e([d({readOnly:!0})],W.prototype,"constraintsManager",null),e([d()],W.prototype,"_initialViewpoint",null),e([d({readOnly:!0})],W.prototype,"hasInitialView",null),e([d({readOnly:!0,type:Boolean})],W.prototype,"ready",void 0),e([d({type:Number})],W.prototype,"scale",null),e([d()],W.prototype,"padding",null),e([d({readOnly:!0})],W.prototype,"screenCenter",null),e([d({constructOnly:!0})],W.prototype,"view",void 0),e([d({type:i})],W.prototype,"viewpoint",null),e([d({type:Number})],W.prototype,"zoom",null),e([d({readOnly:!0})],W.prototype,"_rasterPixelRatio",null),e([d({readOnly:!0})],W.prototype,"_useDevicePixelResolution",null),e([d()],W.prototype,"_windowDevicePixelRatio",void 0),e([d()],W.prototype,"_devicePixelRatioOverride",void 0),W=e([v("esri.views.3d.state.ViewStateManager")],W);class Z{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const J=new Set(["camera","viewpoint","extent","scale","center","zoom"]),K=[{propertyName:"camera",overrides:["viewpoint"]},{propertyName:"viewpoint",overrides:["extent"]},{propertyName:"extent",overrides:["center","scale"]},{propertyName:"center",overrides:[]},{propertyName:"scale",overrides:["zoom"]},{propertyName:"zoom",overrides:[]},{propertyName:"padding",overrides:[]}],Q={heading:0,tilt:0};let X=new t,Y=new N;const $=f(),ee="pending-initial-view",te="content-camera-reset",ie=300,re=100;function ae(){X=new t,Y=new N}export{W as ViewStateManager,ae as cleanupViewStateManager,re as interactingTimeout};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as i}from"tslib";import{property as t,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import o from"../../../ViewAnimation.js";import{Animation as s}from"../../animation/pointToPoint/Animation.js";import{AnimationController as r}from"./AnimationController.js";import a from"../../webgl/RenderCamera.js";import{Intersector as m}from"../../webgl-engine/lib/Intersector.js";import{EasingFunctions as c}from"../../../animation/easing.js";let l=class extends r{get _intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(i){super(i),this.type="point-to-point",this.mode="interaction"}initialize(){this.animation=new s(this.view.state.viewingMode),this.viewAnimation="interaction"===this.mode?null:new o}get isInteractive(){return"interaction"===this.mode}begin(i,t){this.stepController=(i,t)=>{this.animation.step(i,t),this.animation.finished&&this.finishController()};const n=this.animationSettings(t);p.copyFrom(this.view.state.camera);const e=new m(this.view.state.viewingMode);this._intersectionHelper.intersectRay(p.ray,e,h)&&(p.center=h),this.animation.update(p,i,n),this.animation.finished&&this.finish()}finish(){this.animation.currentTime=this.animation.time,super.finish()}onControllerEnd(i){this.stepController&&(this.animation.cameraAt(this.animation.currentTime/this.animation.time,i),this.animation.currentTime=this.animation.time),super.onControllerEnd(i),this.stepController=void 0}animationSettings(i={}){return{apex:{maximumDistance:this.view.state.constraints.clampAltitude(1/0)/6,ascensionFactor:void 0,descensionFactor:void 0},...i,easing:"string"==typeof i.easing?c[i.easing]:i.easing}}};i([t({constructOnly:!0})],l.prototype,"mode",void 0),i([t({readOnly:!0})],l.prototype,"isInteractive",null),l=i([n("esri.views.3d.state.controllers.PointToPointAnimationController")],l);let p=new a;const h=e();function d(){p=new a}function u(i){return null!=i&&"type"in i&&"point-to-point"===i.type}export{l as PointToPointAnimationController,d as cleanupPointToPointAnimationController,u as isPointToPointAnimationController};
2
+ import{__decorate as t}from"tslib";import{property as i,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import o from"../../../ViewAnimation.js";import{Animation as r}from"../../animation/pointToPoint/Animation.js";import{AnimationController as s}from"./AnimationController.js";import a from"../../webgl/RenderCamera.js";import{Intersector as m}from"../../webgl-engine/lib/Intersector.js";import{EasingFunctions as c}from"../../../animation/easing.js";let l=class extends s{get _intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(t){super(t),this.type="point-to-point",this.mode="interaction",this._target=null}initialize(){this.animation=new r(this.view.state.viewingMode),this.viewAnimation="interaction"===this.mode?null:new o}get isInteractive(){return"interaction"===this.mode}begin(t,i){this._target=t.clone(),this.stepController=(t,i)=>{this.animation.step(t,i),this.animation.finished&&this.finishController()};const n=this.animationSettings(i);h.copyFrom(this.view.state.camera);const e=new m(this.view.state.viewingMode);this._intersectionHelper.intersectRay(h.ray,e,p)&&(h.center=p),this.animation.update(h,t,n),this.animation.finished&&this.finish()}finish(){this.animation.currentTime=this.animation.time,super.finish()}onControllerEnd(t){if(this.stepController){this.animation.currentTime/this.animation.time>=1&&this._target?t.copyFrom(this._target):this.animation.cameraAt(this.animation.currentTime/this.animation.time,t),this.animation.currentTime=this.animation.time}super.onControllerEnd(t),this.stepController=void 0}animationSettings(t={}){return{apex:{maximumDistance:this.view.state.constraints.clampAltitude(1/0)/6,ascensionFactor:void 0,descensionFactor:void 0},...t,easing:"string"==typeof t.easing?c[t.easing]:t.easing}}};t([i({constructOnly:!0})],l.prototype,"mode",void 0),t([i({readOnly:!0})],l.prototype,"isInteractive",null),l=t([n("esri.views.3d.state.controllers.PointToPointAnimationController")],l);let h=new a;const p=e();function u(){h=new a}function d(t){return null!=t&&"type"in t&&"point-to-point"===t.type}export{l as PointToPointAnimationController,u as cleanupPointToPointAnimationController,d as isPointToPointAnimationController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{clamp as i}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.js";import{subclass as e}from"../../../../core/accessorSupport/decorators.js";import{copy as s,distance as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as o,subtract as h,length as c,scale as m,add as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as l}from"../../../../geometry/ellipsoidUtils.js";import{create as u,fromPoints as P}from"../../../../geometry/support/axisAngle.js";import{Sphere as y}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as C,applyAll as g}from"../../camera/constraintUtils.js";import{ConstraintOptions as d}from"../../camera/constraintUtils/ConstraintOptions.js";import{applySurfaceCollisionConstraint as f}from"../../camera/constraintUtils/surfaceCollision.js";import{InteractiveController as v}from"./InteractiveController.js";import{normalizeCoordinate as R,pickPointAndInitSphere as w,excludeTerrain as D,inferNavigationMode as k,zoomPivotDistanceClamp as j,getTiltScaleFactor as A,pivotSearchAreaSize as b,distanceComparisonTolerance as x,sphereOrPlanePointFromScreenPoint as M,applyRotation as O,maxZoomPivotDistanceModifier as U}from"../utils/navigationUtils.js";import{fromScreenAtEye as z}from"../../support/geometryUtils/ray.js";const H=12;let B=class extends v{constructor(){super(...arguments),this._pickPoint=_(),this._tmpP0=a(),this._panAxisAngle=u(),this._tmpRayDir=_(),this._tmpRayDirPick=_(),this._targetOnSphere=_(),this._navigationMode=1,this._tmpRay={origin:_(),direction:_()},this.dragBeginPoint=r(),this._normalizedAnchorPoint=a(),this._constraintOptions=new d(7,1,0,this.startCamera),this._sphere=new y,this._hasPickPoint=!1}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.running)return;s(this.dragBeginPoint,t),R(this.startCamera,t,this._normalizedAnchorPoint);const r=l(this.view.spatialReference),e=w(this._intersectionHelper,this.startCamera,t,r.radius,0,this.view.basemapTerrain.invisible?D:{});if(this._navigationMode=k(this.startCamera,t,this.view.renderCoordsHelper,this.view.viewingMode),1===this._navigationMode)this._hasPickPoint=!!e.scenePickPoint,this._pickPoint=e.scenePickPoint??this._pickPoint,this._sphere=e.sphere;else{let r;z(this.startCamera,t,this._tmpRay),o(this._tmpRay.direction,this._tmpRay.direction),null!=e.scenePickPoint&&(h(this._tmpRayDirPick,this.startCamera.eye,e.scenePickPoint),r=c(this._tmpRayDirPick));const s=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,F);const n=i(A(F,this._tmpRay.direction,U)*s,j[0],j[1]),a=this.view.stage.renderView.getMinimalDepthForArea(null,t[0],t[1],this.view.state.camera,b);let _=null!=a?a:n;null!=r&&(_=Math.min(_,r)),this._hasPickPoint=!0,m(this._tmpRay.direction,this._tmpRay.direction,_),p(this._pickPoint,this._tmpRay.origin,this._tmpRay.direction)}}update(t){if(this.running){if(this.currentCamera.eye=this.startCamera.eye,this.currentCamera.center=this.startCamera.center,this.currentCamera.up=this.startCamera.up,1===this._navigationMode){h(this._tmpRayDir,this.currentCamera.center,this.currentCamera.eye);const i=c(this._tmpRayDir);R(this.currentCamera,t,this._tmpP0);const r=(this._normalizedAnchorPoint[1]-this._tmpP0[1])*H;let e=i*2**r;const s=this.view.state.constraints.minimumPoiDistance;if(r<0&&e<s&&(e=s),Math.abs(i-e)<x)return;if(this._hasPickPoint&&e<i){const t=1-(1-e/i)*(1-this._sphere.radius/c(this.currentCamera.center));this.currentCamera.center=m(S,this.currentCamera.center,t)}m(this._tmpRayDir,this._tmpRayDir,-e/i),this.currentCamera.eye=p(S,this.currentCamera.center,this._tmpRayDir),this._constraintOptions.interactionFactor=C(n(this.dragBeginPoint,t)),g(this.view,this.currentCamera,this._constraintOptions),this._hasPickPoint&&(M(this._sphere,this.currentCamera,this.dragBeginPoint,this._targetOnSphere),P(this._pickPoint,this._targetOnSphere,this._panAxisAngle),O(this.currentCamera,this._sphere.center,this._panAxisAngle))}else{const i=c(this._tmpRay.direction);R(this.currentCamera,t,this._tmpP0);const r=(this._normalizedAnchorPoint[1]-this._tmpP0[1])*H;let e=i*2**r;const s=this.view.state.constraints.minimumPoiDistance;if(r<0&&e<s&&(e=s),Math.abs(i-e)<x)return;m(this._tmpRayDir,this._tmpRay.direction,1-e/i),this.currentCamera.eye=p(S,this.currentCamera.eye,this._tmpRayDir),this.currentCamera.center=p(S,this.currentCamera.center,this._tmpRayDir),o(this._tmpRayDir,this._tmpRayDir),this._constraintOptions.interactionDirection=this._tmpRayDir,g(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}f(this.view,this.currentCamera),this.commitCamera()}}finish(){this.running&&this.finishController()}};B=t([e("esri.views.3d.state.controllers.ZoomControllerGlobal")],B);const S=_(),F=_();export{B as ZoomControllerGlobal};
2
+ import{__decorate as t}from"tslib";import{clamp as i}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.js";import{subclass as e}from"../../../../core/accessorSupport/decorators.js";import{copy as s,distance as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as o,subtract as h,length as c,scale as m,add as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../geometry/ellipsoidUtils.js";import{create as u,fromPoints as P}from"../../../../geometry/support/axisAngle.js";import{Sphere as y}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as C,applyAll as g}from"../../camera/constraintUtils.js";import{ConstraintOptions as d}from"../../camera/constraintUtils/ConstraintOptions.js";import{applySurfaceCollisionConstraint as f}from"../../camera/constraintUtils/surfaceCollision.js";import{InteractiveController as v}from"./InteractiveController.js";import{normalizeCoordinate as R,pickPointAndInitSphere as w,excludeTerrain as D,inferNavigationMode as k,zoomPivotDistanceClamp as j,getTiltScaleFactor as A,pivotSearchAreaSize as b,distanceComparisonTolerance as x,sphereOrPlanePointFromScreenPoint as M,applyRotation as O,maxZoomPivotDistanceModifier as U}from"../utils/navigationUtils.js";import{fromScreenAtEye as z}from"../../support/geometryUtils/ray.js";const H=12;let B=class extends v{constructor(){super(...arguments),this._pickPoint=l(),this._tmpP0=a(),this._panAxisAngle=u(),this._tmpRayDir=l(),this._tmpRayDirPick=l(),this._targetOnSphere=l(),this._navigationMode=1,this._tmpRay={origin:l(),direction:l()},this.dragBeginPoint=r(),this._normalizedAnchorPoint=a(),this._constraintOptions=new d(7,1,0,this.startCamera),this._sphere=new y,this._hasPickPoint=!1}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.running)return;s(this.dragBeginPoint,t),R(this.startCamera,t,this._normalizedAnchorPoint);const r=_(this.view.spatialReference),e=w(this._intersectionHelper,this.startCamera,t,r.radius,0,this.view.basemapTerrain.invisible?D:{});if(this._navigationMode=k(this.startCamera,t,this.view.renderCoordsHelper,this.view.viewingMode),1===this._navigationMode)this._hasPickPoint=!!e.scenePickPoint,this._pickPoint=e.scenePickPoint??this._pickPoint,this._sphere=e.sphere;else{let r;z(this.startCamera,t,this._tmpRay),o(this._tmpRay.direction,this._tmpRay.direction),null!=e.scenePickPoint&&(h(this._tmpRayDirPick,this.startCamera.eye,e.scenePickPoint),r=c(this._tmpRayDirPick));const s=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,F);const n=i(A(F,this._tmpRay.direction,U)*s,j[0],j[1]),a=this.view.stage.renderView.getMinimalDepthForArea(null,t[0],t[1],this.view.state.camera,b);let l=null!=a?a:n;null!=r&&(l=Math.min(l,r)),this._hasPickPoint=!0,m(this._tmpRay.direction,this._tmpRay.direction,l),p(this._pickPoint,this._tmpRay.origin,this._tmpRay.direction)}}update(t){if(this.running){if(this.currentCamera.eye=this.startCamera.eye,this.currentCamera.center=this.startCamera.center,this.currentCamera.up=this.startCamera.up,1===this._navigationMode){h(this._tmpRayDir,this.currentCamera.center,this.currentCamera.eye);const i=c(this._tmpRayDir);R(this.currentCamera,t,this._tmpP0);const r=(this._normalizedAnchorPoint[1]-this._tmpP0[1])*H;let e=i*2**r;const s=this.view.state.constraints.minimumPoiDistance;if(r<0&&e<s&&(e=s),Math.abs(i-e)<x)return;if(this._hasPickPoint&&e<i){const t=1-(1-e/i)*(1-this._sphere.radius/c(this.currentCamera.center));this.currentCamera.center=m(S,this.currentCamera.center,t)}m(this._tmpRayDir,this._tmpRayDir,-e/i),this.currentCamera.eye=p(S,this.currentCamera.center,this._tmpRayDir),this._constraintOptions.interactionFactor=C(n(this.dragBeginPoint,t)),g(this.view,this.currentCamera,this._constraintOptions),this._hasPickPoint&&(M(this._sphere,this.currentCamera,this.dragBeginPoint,this._targetOnSphere),P(this._pickPoint,this._targetOnSphere,this._panAxisAngle),O(this.currentCamera,this._sphere.center,this._panAxisAngle))}else{const i=c(this._tmpRay.direction);R(this.currentCamera,t,this._tmpP0);const r=(this._normalizedAnchorPoint[1]-this._tmpP0[1])*H;let e=i*2**r;const s=this.view.state.constraints.minimumPoiDistance;if(r<0&&e<s&&(e=s),Math.abs(i-e)<x)return;m(this._tmpRayDir,this._tmpRay.direction,1-e/i),this.currentCamera.eye=p(S,this.currentCamera.eye,this._tmpRayDir),this.currentCamera.center=p(S,this.currentCamera.center,this._tmpRayDir),o(this._tmpRayDir,this._tmpRayDir),this._constraintOptions.interactionDirection=this._tmpRayDir,g(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}f(this.view,null,this.currentCamera),this.commitCamera()}}finish(){this.running&&this.finishController()}};B=t([e("esri.views.3d.state.controllers.ZoomControllerGlobal")],B);const S=l(),F=l();export{B as ZoomControllerGlobal};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{clamp as i}from"../../../../core/mathUtils.js";import{Milliseconds as e}from"../../../../core/time.js";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as s,normalize as o,scale as a,length as n,subtract as m,add as h,squaredDistance as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../geometry/ellipsoidUtils.js";import{create as l}from"../../../../geometry/support/ray.js";import{Sphere as y}from"../../../../geometry/support/sphere.js";import{applyAll as d}from"../../camera/constraintUtils.js";import{ConstraintOptions as w}from"../../camera/constraintUtils/ConstraintOptions.js";import{applySurfaceCollisionConstraint as g}from"../../camera/constraintUtils/surfaceCollision.js";import{PointToPointAnimationController as f}from"./PointToPointAnimationController.js";import{excludeTerrain as u,isHitOnSamePlanetSide as D,inferNavigationMode as C,zoomStepDistanceClamp as v,getTiltScaleFactor as R,maxZoomStepDistanceModifier as j,distanceComparisonTolerance as b,panToPosition as M}from"../utils/navigationUtils.js";import{fromScreenAtEye as z}from"../../support/geometryUtils/ray.js";import{intersectScreen as O}from"../../support/geometryUtils/sphere.js";import V from"../../webgl/RenderCamera.js";import{Intersector as U}from"../../webgl-engine/lib/Intersector.js";import{outExpo as L}from"../../../animation/easing.js";const S=.6,x=4,F=60;let H=class extends f{constructor(){super(...arguments),this._zoomLocation=c(),this._tmpCamera=new V,this._tmpViewDir=c(),this._tmpRayDir=l(),this._targetOnSphere=c(),this._tmpCenter=c(),this._beginCamera=new V,this._constraintOptions=new w(7,1,null,this._beginCamera),this._sphere=new y}initialize(){this._intersector=new U(this.view.state.viewingMode)}step(t,i){if(!this.running)return;const e=this.view.state;this.animation.finished?this._beginCamera.copyFrom(e.camera):this.animation.cameraAt(1,this._beginCamera);let r=!1,o=!1;this._intersectionHelper.intersectScreen(i,this._zoomLocation,0===this.view.map.ground.opacity?u:{})&&D(e.camera.eye,this._zoomLocation,_(this.view.spatialReference).radius)&&(r=t>0,o=!0),this._tmpCamera.copyFrom(e.camera),r?this._intersectionHelper.intersectRay(this._tmpCamera.ray,this._intersector,this._tmpCenter)&&(this._tmpCamera.center=this._tmpCenter):this._intersectionHelper.intersectRay(this._tmpCamera.ray,this._intersector,this._zoomLocation)?this._tmpCamera.center=this._zoomLocation:s(this._zoomLocation,this._tmpCamera.center),this._updateCamera(this._tmpCamera,t,i,o),this.begin(this._tmpCamera)}animationSettings(){return{duration:e(600),easing:L}}_updateCamera(t,e,r,s){const c=C(t,r,this.view.renderCoordsHelper,this.view.viewingMode),_=Math.abs(this.view.camera.position.z),l=this._zoomLocation;o(P,t.eye),a(P,P,-1),z(t,r,this._tmpRayDir),o(this._tmpRayDir.direction,this._tmpRayDir.direction);const y=i(R(P,this._tmpRayDir.direction,j)*_,v[0],v[1]);if(1===c){let i=S**e;this._sphere.radius=n(l),m(this._tmpViewDir,t.center,t.eye);const s=Math.min(n(this._tmpViewDir),y);let o=s*i;if(i<=1&&o<x&&(o=x,i=o/s),Math.abs(s-o)<b)return;const c=n(t.center);if(this._sphere.radius!==c){const e=this._sphere.radius+i*(c-this._sphere.radius);t.center=a(A,t.center,e/c)}a(this._tmpViewDir,this._tmpViewDir,-i),t.eye=h(A,t.center,this._tmpViewDir),d(this.view,t,this._constraintOptions),p(l,t.center)>1e-12&&O(this._sphere,t,r,this._targetOnSphere)&&M(this._sphere,t,l,this._targetOnSphere,this.view.camera.heading,this.view.camera.tilt,!0)}else{let i=S**Math.abs(e);const p=e>0?1:-1;m(this._tmpViewDir,l,t.eye);const c=n(this._tmpViewDir),_=this.view.stage.renderView.getMinimalDepthForArea(null,r[0],r[1],this.view.state.camera,F);let w=null!=_?_:y;s&&e>0&&(w=Math.min(w,c)),a(this._tmpRayDir.direction,this._tmpRayDir.direction,w),h(l,this._tmpRayDir.origin,this._tmpRayDir.direction);let g=w*i;const f=Math.max(x,1.01*t.nearFar[0]);if(e>0&&g<f&&(g=f,i=g/w),Math.abs(w-g)<b)return;a(this._tmpRayDir.direction,this._tmpRayDir.direction,p*(1-i)),t.eye=h(A,t.eye,this._tmpRayDir.direction),t.center=h(A,t.center,this._tmpRayDir.direction),o(this._tmpRayDir.direction,this._tmpRayDir.direction),this._constraintOptions.interactionDirection=this._tmpRayDir.direction,d(this.view,t,this._constraintOptions),this._constraintOptions.interactionDirection=null}g(this.view,t)}};H=t([r("esri.views.3d.state.controllers.ZoomStepControllerGlobal")],H);const A=c(),P=c();export{H as ZoomStepControllerGlobal};
2
+ import{__decorate as t}from"tslib";import{clamp as i}from"../../../../core/mathUtils.js";import{Milliseconds as e}from"../../../../core/time.js";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as s,normalize as o,scale as a,length as n,subtract as m,add as h,squaredDistance as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../geometry/ellipsoidUtils.js";import{create as l}from"../../../../geometry/support/ray.js";import{Sphere as y}from"../../../../geometry/support/sphere.js";import{applyAll as d}from"../../camera/constraintUtils.js";import{ConstraintOptions as w}from"../../camera/constraintUtils/ConstraintOptions.js";import{applySurfaceCollisionConstraint as g}from"../../camera/constraintUtils/surfaceCollision.js";import{PointToPointAnimationController as f}from"./PointToPointAnimationController.js";import{excludeTerrain as u,isHitOnSamePlanetSide as D,inferNavigationMode as C,zoomStepDistanceClamp as v,getTiltScaleFactor as R,maxZoomStepDistanceModifier as j,distanceComparisonTolerance as b,panToPosition as M}from"../utils/navigationUtils.js";import{fromScreenAtEye as z}from"../../support/geometryUtils/ray.js";import{intersectScreen as O}from"../../support/geometryUtils/sphere.js";import V from"../../webgl/RenderCamera.js";import{Intersector as U}from"../../webgl-engine/lib/Intersector.js";import{outExpo as L}from"../../../animation/easing.js";const S=.6,x=4,F=60;let H=class extends f{constructor(){super(...arguments),this._zoomLocation=c(),this._tmpCamera=new V,this._tmpViewDir=c(),this._tmpRayDir=l(),this._targetOnSphere=c(),this._tmpCenter=c(),this._beginCamera=new V,this._constraintOptions=new w(7,1,null,this._beginCamera),this._sphere=new y}initialize(){this._intersector=new U(this.view.state.viewingMode)}step(t,i){if(!this.running)return;const e=this.view.state;this.animation.finished?this._beginCamera.copyFrom(e.camera):this.animation.cameraAt(1,this._beginCamera);let r=!1,o=!1;this._intersectionHelper.intersectScreen(i,this._zoomLocation,0===this.view.map.ground.opacity?u:{})&&D(e.camera.eye,this._zoomLocation,_(this.view.spatialReference).radius)&&(r=t>0,o=!0),this._tmpCamera.copyFrom(e.camera),r?this._intersectionHelper.intersectRay(this._tmpCamera.ray,this._intersector,this._tmpCenter)&&(this._tmpCamera.center=this._tmpCenter):this._intersectionHelper.intersectRay(this._tmpCamera.ray,this._intersector,this._zoomLocation)?this._tmpCamera.center=this._zoomLocation:s(this._zoomLocation,this._tmpCamera.center),this._updateCamera(this._tmpCamera,t,i,o),this.begin(this._tmpCamera)}animationSettings(){return{duration:e(600),easing:L}}_updateCamera(t,e,r,s){const c=C(t,r,this.view.renderCoordsHelper,this.view.viewingMode),_=Math.abs(this.view.camera.position.z),l=this._zoomLocation;o(P,t.eye),a(P,P,-1),z(t,r,this._tmpRayDir),o(this._tmpRayDir.direction,this._tmpRayDir.direction);const y=i(R(P,this._tmpRayDir.direction,j)*_,v[0],v[1]);if(1===c){let i=S**e;this._sphere.radius=n(l),m(this._tmpViewDir,t.center,t.eye);const s=Math.min(n(this._tmpViewDir),y);let o=s*i;if(i<=1&&o<x&&(o=x,i=o/s),Math.abs(s-o)<b)return;const c=n(t.center);if(this._sphere.radius!==c){const e=this._sphere.radius+i*(c-this._sphere.radius);t.center=a(A,t.center,e/c)}a(this._tmpViewDir,this._tmpViewDir,-i),t.eye=h(A,t.center,this._tmpViewDir),d(this.view,t,this._constraintOptions),p(l,t.center)>1e-12&&O(this._sphere,t,r,this._targetOnSphere)&&M(this._sphere,t,l,this._targetOnSphere,this.view.camera.heading,this.view.camera.tilt,!0)}else{let i=S**Math.abs(e);const p=e>0?1:-1;m(this._tmpViewDir,l,t.eye);const c=n(this._tmpViewDir),_=this.view.stage.renderView.getMinimalDepthForArea(null,r[0],r[1],this.view.state.camera,F);let w=null!=_?_:y;s&&e>0&&(w=Math.min(w,c)),a(this._tmpRayDir.direction,this._tmpRayDir.direction,w),h(l,this._tmpRayDir.origin,this._tmpRayDir.direction);let g=w*i;const f=Math.max(x,1.01*t.nearFar[0]);if(e>0&&g<f&&(g=f,i=g/w),Math.abs(w-g)<b)return;a(this._tmpRayDir.direction,this._tmpRayDir.direction,p*(1-i)),t.eye=h(A,t.eye,this._tmpRayDir.direction),t.center=h(A,t.center,this._tmpRayDir.direction),o(this._tmpRayDir.direction,this._tmpRayDir.direction),this._constraintOptions.interactionDirection=this._tmpRayDir.direction,d(this.view,t,this._constraintOptions),this._constraintOptions.interactionDirection=null}g(this.view,null,t)}};H=t([r("esri.views.3d.state.controllers.ZoomStepControllerGlobal")],H);const A=c(),P=c();export{H as ZoomStepControllerGlobal};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isPromiseLike as e}from"../../../../core/promiseUtils.js";import{projectBuffer as t}from"../../../../geometry/projection/projectBuffer.js";import{doubleSubArray as n,newDoubleArray as s}from"../../../../geometry/support/DoubleArray.js";import{applyPerVertexElevationAlignment as o}from"../../layers/graphics/elevationAlignmentUtils.js";import{axisFromRings as i,ringsToOutlinedTessellationInfo as r,tessellateOrLoad as l,load as u}from"../../layers/graphics/tessellationUtils.js";import{drapedZ as c}from"../../terrain/OverlayRenderer.js";async function a(){return u()}class p{constructor(e,t,n,s){this.positions=e,this.polygonIndices=t,this.outline=n,this.projectionSuccess=s,this.count=e.length/3}get vertexCount(){return this.positions.length/3}get polygonIndexCount(){return this.polygonIndices.length}get outlineIndexCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++)t+=A(e.outlineIndices[n]);return t}get outlineSegmentCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++){t+=A(e.outlineIndices[n])}return t}}class d extends p{}class f extends p{}class h extends p{constructor(e,t,n,s,o,i){super(e,n,s,o),this.mapPositions=t,this.sampledElevation=i}}function g(t,n){const s=R(t,n);return e(s)?null:s}function m(t,n,s,o,i){const r=j(t,n,s,o,i);return e(r)?null:r}function x(t,n){const s=v(t,n);return e(s)?null:s}function R(t,n){const{projectIfNearlyVertical:s=!1,outlineOutput:o="none",method:u}=n??{},c="tessellated-indices"===o,a=i(t.rings,!!t.hasZ,t.spatialReference),p=r(t.rings,{hasZ:!!t.hasZ,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:a}),d=l(p,{projectionAxis:s?a:void 0,outlines:c?p.outlines:void 0,method:u});if(e(d))return d;if(!d.succeeded)return null;let h={output:"none"};if("vertex-data"===o){const e=d.positions!==p.positions?p.positions:p.positions.slice();h={output:"vertex-data",outlines:y(p.outlines,e)}}else"tessellated-indices"===o&&(h=I(d));return new f(d.positions,d.indices,h,!0)}function v(n,s){const{drapedSpatialReference:o,projectIfNearlyVertical:u=!1,outlineOutput:a="none",method:p}=s,f=i(n.rings,!1,n.spatialReference),h=r(n.rings,{hasZ:!1,ccwRingsAsHoles:!0,spatialReference:n.spatialReference,axis:f}),g="none"!==a,m=t(h.positions,n.spatialReference,0,h.positions,o,0),x=l(h,{projectionAxis:u?f:void 0,outlines:g?h.outlines:void 0,method:p});if(e(x))return x;if(!x.succeeded)return null;const{positions:R,indices:v}=x;for(let e=2;e<R.length;e+=3)R[e]=c;let j={output:"none"};if("vertex-data"===a){if(R!==h.positions)for(let t=2;t<h.positions.length;t+=3)h.positions[t]=c;const e=R!==h.positions?h.positions:h.positions.slice();j={output:"vertex-data",outlines:y(h.outlines,e)}}else"tessellated-indices"===a&&(j=I(x));return new d(R,v,j,m)}function j(t,n,u,c,a){const{projectIfNearlyVertical:p=!1,outlineOutput:d="none",method:f}=a??{},g="none"!==d,m=!!t.hasZ&&"on-the-ground"!==c.mode,x=i(t.rings,m,t.spatialReference),R=r(t.rings,{hasZ:m,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:x}),v=l(R,{projectionAxis:p?x:void 0,outlines:g?R.outlines:void 0,method:f});if(e(v))return v;if(!v.succeeded)return null;const{positions:j,vertexCount:y}=v,A=s(j.length),Z=o(j,t.spatialReference,0,A,0,j,0,y,n,u,c);let C={output:"none"};"vertex-data"===d?C={output:"vertex-data",outlines:w(v,A)}:"tessellated-indices"===d&&(C=I(v));const O=null!=Z;return new h(j,A,v.indices,C,O,Z)}function y(e,t,s=null){return e.filter(({count:e})=>e>1).map(({index:e,count:o})=>{const i=3*e,r=3*o;return null!=s?new C(e,o,n(t,i,r),n(s,i,r)):new Z(e,o,n(t,i,r))})}function I(e){const{outlineIndexBuffer:t,outlineRingLengths:n}=e;if(null==t||null==n)return{output:"none"};const s=new Array(n.length);let o=0;for(let i=0;i<n.length;i++){const e=n[i],r=t.slice(o,o+e);s[i]=r,o+=e}return{output:"tessellated-indices",outlineIndices:s}}function w(e,t){const{outlineIndexBuffer:o,outlineRingLengths:i,positions:r}=e;if(null==o||null==i)return[];let l=0;for(let n=0;n<i.length;n++)l+=i[n]-1;const u=s(3*l),c=s(3*l),a=new Array;let p=0,d=0;for(let s=0;s<i.length;s++){const e=i[s],l=e-1;for(let n=0;n<l;n++){const e=3*o[p+n],s=3*(d+n);u[s]=r[e],u[s+1]=r[e+1],u[s+2]=r[e+2],c[s]=t[e],c[s+1]=t[e+1],c[s+2]=t[e+2]}a.push(new C(d,l,n(u,3*d,3*l),n(c,3*d,3*l))),p+=e,d+=l}return a}function A(e,t=0,n=e.length){return n>1&&e[t]===e[t+n-1]?n-1:n}class Z{constructor(e,t,n){this.index=e,this.count=t,this.position=n}}class C extends Z{constructor(e,t,n,s){super(e,t,n),this.mapPositions=s}}export{C as OutlineVertexData,Z as OutlineVertexDataDraped,p as PolygonRenderInfoBase,d as PolygonRenderInfoDraped,h as PolygonRenderInfoElevationAligned,f as PolygonRenderInfoNotElevationAligned,a as loadTessellationUtils,v as polygonToRenderInfoDraped,j as polygonToRenderInfoElevationAligned,R as polygonToRenderInfoNotElevationAligned,x as preloadedPolygonToRenderInfoDraped,m as preloadedPolygonToRenderInfoElevationAligned,g as preloadedPolygonToRenderInfoNotElevationAligned,I as splitOutlineIndexRings,w as tessellatedOutlineIndicesToVertexData};
2
+ import{isPromiseLike as e}from"../../../../core/promiseUtils.js";import{projectBuffer as t}from"../../../../geometry/projection/projectBuffer.js";import{doubleSubArray as n,newDoubleArray as o}from"../../../../geometry/support/DoubleArray.js";import{applyPerVertexElevationAlignment as s}from"../../layers/graphics/elevationAlignmentUtils.js";import{axisFromRings as i,ringsToOutlinedTessellationInfo as r,tessellateOrLoad as l,load as u}from"../../layers/graphics/tessellationUtils.js";import{drapedZ as c}from"../../terrain/OverlayRenderer.js";async function a(){return u()}class p{constructor(e,t,n,o){this.positions=e,this.polygonIndices=t,this.outline=n,this.projectionSuccess=o,this.count=e.length/3}get vertexCount(){return this.positions.length/3}get polygonIndexCount(){return this.polygonIndices.length}get outlineIndexCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++)t+=A(e.outlineIndices[n]);return t}get outlineSegmentCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++){t+=A(e.outlineIndices[n])}return t}}class d extends p{}class f extends p{}class h extends p{constructor(e,t,n,o,s,i){super(e,n,o,s),this.mapPositions=t,this.sampledElevation=i}}function g(t,n){const o=R(t,n);return e(o)?null:o}function m(t,n,o,s,i){const r=w(t,n,o,s,i);return e(r)?null:r}function x(t,n){const o=v(t,n);return e(o)?null:o}function R(t,n){const{projectIfNearlyVertical:o=!1,outlineOutput:s="none",method:u,owner:c}=n??{},a="tessellated-indices"===s,p=i(t.rings,!!t.hasZ,t.spatialReference),d=r(t.rings,{hasZ:!!t.hasZ,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:p}),h=l(d,{projectionAxis:o?p:void 0,outlines:a?d.outlines:void 0,method:u,owner:c});if(e(h))return h;if(!h.succeeded)return null;let g={output:"none"};if("vertex-data"===s){const e=h.positions!==d.positions?d.positions:d.positions.slice();g={output:"vertex-data",outlines:j(d.outlines,e)}}else"tessellated-indices"===s&&(g=y(h));return new f(h.positions,h.indices,g,!0)}function v(n,o){const{drapedSpatialReference:s,projectIfNearlyVertical:u=!1,outlineOutput:a="none",method:p,owner:f}=o,h=i(n.rings,!1,n.spatialReference),g=r(n.rings,{hasZ:!1,ccwRingsAsHoles:!0,spatialReference:n.spatialReference,axis:h}),m="none"!==a,x=t(g.positions,n.spatialReference,0,g.positions,s,0),R=l(g,{projectionAxis:u?h:void 0,outlines:m?g.outlines:void 0,method:p,owner:f});if(e(R))return R;if(!R.succeeded)return null;const{positions:v,indices:w}=R;for(let e=2;e<v.length;e+=3)v[e]=c;let I={output:"none"};if("vertex-data"===a){if(v!==g.positions)for(let t=2;t<g.positions.length;t+=3)g.positions[t]=c;const e=v!==g.positions?g.positions:g.positions.slice();I={output:"vertex-data",outlines:j(g.outlines,e)}}else"tessellated-indices"===a&&(I=y(R));return new d(v,w,I,x)}function w(t,n,u,c,a){const{projectIfNearlyVertical:p=!1,outlineOutput:d="none",method:f,owner:g}=a??{},m="none"!==d,x=!!t.hasZ&&"on-the-ground"!==c.mode,R=i(t.rings,x,t.spatialReference),v=r(t.rings,{hasZ:x,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:R}),w=l(v,{projectionAxis:p?R:void 0,outlines:m?v.outlines:void 0,method:f,owner:g});if(e(w))return w;if(!w.succeeded)return null;const{positions:j,vertexCount:A}=w,Z=o(j.length),C=s(j,t.spatialReference,0,Z,0,j,0,A,n,u,c);let O={output:"none"};"vertex-data"===d?O={output:"vertex-data",outlines:I(w,Z)}:"tessellated-indices"===d&&(O=y(w));const B=null!=C;return new h(j,Z,w.indices,O,B,C)}function j(e,t,o=null){return e.filter(({count:e})=>e>1).map(({index:e,count:s})=>{const i=3*e,r=3*s;return null!=o?new C(e,s,n(t,i,r),n(o,i,r)):new Z(e,s,n(t,i,r))})}function y(e){const{outlineIndexBuffer:t,outlineRingLengths:n}=e;if(null==t||null==n)return{output:"none"};const o=new Array(n.length);let s=0;for(let i=0;i<n.length;i++){const e=n[i],r=t.slice(s,s+e);o[i]=r,s+=e}return{output:"tessellated-indices",outlineIndices:o}}function I(e,t){const{outlineIndexBuffer:s,outlineRingLengths:i,positions:r}=e;if(null==s||null==i)return[];let l=0;for(let n=0;n<i.length;n++)l+=i[n]-1;const u=o(3*l),c=o(3*l),a=new Array;let p=0,d=0;for(let o=0;o<i.length;o++){const e=i[o],l=e-1;for(let n=0;n<l;n++){const e=3*s[p+n],o=3*(d+n);u[o]=r[e],u[o+1]=r[e+1],u[o+2]=r[e+2],c[o]=t[e],c[o+1]=t[e+1],c[o+2]=t[e+2]}a.push(new C(d,l,n(u,3*d,3*l),n(c,3*d,3*l))),p+=e,d+=l}return a}function A(e,t=0,n=e.length){return n>1&&e[t]===e[t+n-1]?n-1:n}class Z{constructor(e,t,n){this.index=e,this.count=t,this.position=n}}class C extends Z{constructor(e,t,n,o){super(e,t,n),this.mapPositions=o}}export{C as OutlineVertexData,Z as OutlineVertexDataDraped,p as PolygonRenderInfoBase,d as PolygonRenderInfoDraped,h as PolygonRenderInfoElevationAligned,f as PolygonRenderInfoNotElevationAligned,a as loadTessellationUtils,v as polygonToRenderInfoDraped,w as polygonToRenderInfoElevationAligned,R as polygonToRenderInfoNotElevationAligned,x as preloadedPolygonToRenderInfoDraped,m as preloadedPolygonToRenderInfoElevationAligned,g as preloadedPolygonToRenderInfoNotElevationAligned,y as splitOutlineIndexRings,I as tessellatedOutlineIndicesToVertexData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{someMap as e}from"../../../core/MapUtils.js";import{releaseMaybe as o}from"../../../core/maybe.js";import{subclass as s}from"../../../core/accessorSupport/decorators.js";import{RenderNodeOutput as r}from"../webgl.js";import{isManagedDepthTexture as h}from"./ManagedDepthTexture.js";import i from"./ManagedFBOResource.js";import{ColorAttachment0 as a,DepthStencilAttachment as c}from"../../webgl/enums.js";let l=class extends i{constructor(t,e,o,s,h,i){super(t,i),this.fbo=o,this.type=0,this._colors=new Map,this._name=r.COMPOSITE,this.acquireColor=null,this.acquireDepth=null,this._name=e,this.acquireColor=s,this.acquireDepth=h}dispose(){this.fbo?.dispose()}get usedMemory(){return this.fbo?.usedMemory||0}get name(){return this._name}setName(t){this._name=t}getTexture(t=a){return t===c?this.fbo?.depthStencilTexture:this.fbo?.getColorTexture(t)}get depthTexture(){return this.getTexture(c)}getAttachment(t=a){return t===c?this._depth:this._colors.get(t)}obtainAttachment(t){const e=this.getAttachment(t);return e?.retain(),this.detachColor(t),e}hasAttachment(t){return e(this._colors,e=>e.name===t)}attachDepth(t){return t?.retain(),this.detachDepth(),t&&this.fbo?.attachDepthStencil(t.attachment),this._depth=t,this}detachDepth(){this.fbo?.detachDepthStencilTexture(),this.fbo?.detachDepthStencilBuffer(),this._depth=o(this._depth)}obtainDepthTexture(){const t=this._depth;return h(t)?(this.fbo?.detachDepthStencilTexture(),this._depth=null,t):null}attachColor(t,e){return t.retain(),this.detachColor(e),this.fbo?.attachColorTexture(t.attachment,e),this._colors.set(e,t),this}detachColor(t){this.fbo?.detachColorTexture(t),this._colors.get(t)?.release(),this._colors.delete(t)}detachAllColors(){const t=Array.from(this._colors.keys());this._detachColors(t)}detachAll(){this.detachAllColors(),this.detachDepth()}detachAllColorsBut0(){const t=Array.from(this._colors.keys());t.shift(),this._detachColors(t)}_detachColors(t){this.fbo.detachColorTextures(...t),t.forEach(t=>{this._colors.get(t)?.release(),this._colors.delete(t)})}detachAllButColor0(){this.detachAllColorsBut0(),this.detachDepth()}};l=t([s("esri.views.3d.webgl.ManagedFBO")],l);const n=l;export{n as default};
2
+ import{__decorate as t}from"tslib";import{someMap as e}from"../../../core/MapUtils.js";import{releaseMaybe as o}from"../../../core/maybe.js";import{subclass as s}from"../../../core/accessorSupport/decorators.js";import{RenderNodeOutput as h}from"../webgl.js";import{isManagedDepthTexture as r}from"./ManagedDepthTexture.js";import i from"./ManagedFBOResource.js";import{ColorAttachment0 as a,DepthStencilAttachment as c}from"../../webgl/enums.js";let l=class extends i{constructor(t,e,o,s,r,i){super(t,i),this.fbo=o,this.type=0,this._colors=new Map,this._name=h.COMPOSITE,this.acquireColor=null,this.acquireDepth=null,this._name=e,this.acquireColor=s,this.acquireDepth=r}dispose(){this.fbo?.dispose()}get usedMemory(){return this.fbo?.usedMemory||0}get name(){return this._name}setName(t){this._name=t}getTexture(t=a){return t===c?this.fbo?.depthStencilTexture:this.fbo?.getColorTexture(t)}get depthTexture(){return this.getTexture(c)}getAttachment(t=a){return t===c?this._depth:this._colors.get(t)}obtainAttachment(t){const e=this.getAttachment(t);return e?.retain(),this.detachColor(t),e}hasAttachment(t){return e(this._colors,e=>e.name===t)}attachDepth(t){return t?.retain(),this.detachDepth(),t&&this.fbo?.attachDepthStencil(t.attachment),this._depth=t,this}detachDepth(){this.fbo?.detachDepthStencilTexture(),this.fbo?.detachDepthStencilBuffer(),this._depth=o(this._depth)}obtainDepthTexture(){const t=this._depth;return r(t)?(this.fbo?.detachDepthStencilTexture(),this._depth=null,t):null}attachColor(t,e){return t.retain(),this.detachColor(e),this.fbo?.attachColorTexture(t.attachment,e),this._colors.set(e,t),this}detachColor(t){this.fbo?.detachColorTexture(t),this._colors.get(t)?.release(),this._colors.delete(t)}detachAllColors(){const t=Array.from(this._colors.keys());this._detachColors(t)}detachAll(){this.detachAllColors(),this.detachDepth()}detachAllColorsBut0(){const t=Array.from(this._colors.keys());t.shift(),this._detachColors(t)}_detachColors(t){this.fbo.detachColorTextures(...t),t.forEach(t=>{this._colors.get(t)?.release(),this._colors.delete(t)})}detachAllButColor0(){this.detachAllColorsBut0(),this.detachDepth()}moveAttachments(t){t._colors.forEach((t,e)=>{this._colors.has(e)||this.attachColor(t,e)}),this.attachDepth(t.getAttachment(c))}};l=t([s("esri.views.3d.webgl.ManagedFBO")],l);const n=l;export{n as default};