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

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 (418) hide show
  1. package/WebLinkChart.js +1 -1
  2. package/WebMap.js +1 -1
  3. package/applications/KnowledgeStudio/generalSharedKgUtils.d.ts +40 -2
  4. package/applications/KnowledgeStudio/generalSharedKgUtils.js +1 -1
  5. package/arcade/Dictionary.js +1 -1
  6. package/arcade/Feature.js +1 -1
  7. package/arcade/Pixel.js +1 -1
  8. package/arcade/deepClone.js +1 -1
  9. package/arcade/featureset/support/FeatureSet.js +1 -1
  10. package/arcade/functions/geometry.js +1 -1
  11. package/arcade/languageUtils.js +1 -1
  12. package/assets/esri/core/libs/libtess/libtess-f32.wasm +0 -0
  13. package/assets/esri/core/libs/libtess/libtess-f64.wasm +0 -0
  14. package/assets/esri/core/workers/RemoteClient.js +1 -1
  15. package/assets/esri/core/workers/chunks/0197e459fdb04dfb28ef.js +1 -0
  16. package/assets/esri/core/workers/chunks/{f7344d855f1092383abe.js → 15aa9b85976069acf4f3.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{5ee887fc6e1e0e70e02f.js → 1664434dc7a67c8ce453.js} +1 -1
  18. package/assets/esri/core/workers/chunks/17b98787a0698f584882.js +1 -0
  19. package/assets/esri/core/workers/chunks/1837f97f720d255a1694.js +1 -0
  20. package/assets/esri/core/workers/chunks/1b9c68e8431bb4608209.js +1 -0
  21. package/assets/esri/core/workers/chunks/1bbf5f5da5842b93f638.js +1 -0
  22. package/assets/esri/core/workers/chunks/1bd7b7f4ee7ea6cb7ef9.js +1 -0
  23. package/assets/esri/core/workers/chunks/1e386475937e02b3f523.js +1 -0
  24. package/assets/esri/core/workers/chunks/209460f8aae3f9f8c9b8.js +1 -0
  25. package/assets/esri/core/workers/chunks/{316a3d5c7842b445e29e.js → 20ffeb09bb30400de110.js} +1 -1
  26. package/assets/esri/core/workers/chunks/21122f3f3e19a7fd7d33.js +1 -0
  27. package/assets/esri/core/workers/chunks/{25fd4d5d3af887536b3b.js → 2628136bf9f47d238a24.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{bf9eca7dd107bdb06614.js → 2665337e1b665e7e2b70.js} +1 -1
  29. package/assets/esri/core/workers/chunks/2b044c8fab2055a8818d.js +1 -0
  30. package/assets/esri/core/workers/chunks/2b2b042a6d6949b06127.js +1 -0
  31. package/assets/esri/core/workers/chunks/2c15c227d057292d4fa8.js +1 -0
  32. package/assets/esri/core/workers/chunks/2f02880a7f081eb210cd.js +1 -0
  33. package/assets/esri/core/workers/chunks/2fc3e43b64300014dddc.js +1 -0
  34. package/assets/esri/core/workers/chunks/{31c4128b23968575feca.js → 31d92ba9089617aa59ab.js} +1 -1
  35. package/assets/esri/core/workers/chunks/32740b075d7a890d7888.js +1 -0
  36. package/assets/esri/core/workers/chunks/38b69fba9ae4ccbae6b7.js +1 -0
  37. package/assets/esri/core/workers/chunks/390f2beee8e3f2a302e4.js +1 -0
  38. package/assets/esri/core/workers/chunks/3c342e662c13a05f4caf.js +1 -0
  39. package/assets/esri/core/workers/chunks/{d670e134348954ce465d.js → 3d1e5bfd88771d4a0bf6.js} +1 -1
  40. package/assets/esri/core/workers/chunks/3eee32db0e9a5086b9a8.js +1 -0
  41. package/assets/esri/core/workers/chunks/43847d66726fd0bcbbb7.js +1 -0
  42. package/assets/esri/core/workers/chunks/4545cf12ad0824ce6b41.js +1 -0
  43. package/assets/esri/core/workers/chunks/45e4b9069263adeae394.js +1 -0
  44. package/assets/esri/core/workers/chunks/47290f27375c76bcc9c7.js +1 -0
  45. package/assets/esri/core/workers/chunks/{4e16d7fa2e6f11d082b5.js → 4ba4fd8fa31169760fee.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{268ee59800e64baa9682.js → 4be0c64bbf2449d57ea5.js} +1 -1
  47. package/assets/esri/core/workers/chunks/5115059b012ef84407cf.js +1 -0
  48. package/assets/esri/core/workers/chunks/{e8e7cd26c43f231cdea2.js → 5189413a83faf3480e29.js} +1 -1
  49. package/assets/esri/core/workers/chunks/5c63b38160c7d063b8af.js +1 -0
  50. package/assets/esri/core/workers/chunks/5cccb8b06014ccef30f8.js +1 -0
  51. package/assets/esri/core/workers/chunks/{0098544169e429dd98d2.js → 689673173ca1c0e098fe.js} +1 -1
  52. package/assets/esri/core/workers/chunks/697e0ce10d77b90d4fee.js +1 -0
  53. package/assets/esri/core/workers/chunks/6991ba1b204668e7d4da.js +1 -0
  54. package/assets/esri/core/workers/chunks/{ccffaba50674adba7a0f.js → 6b56971783bf4c31a563.js} +1 -1
  55. package/assets/esri/core/workers/chunks/70c94bcfa20453134037.js +1 -0
  56. package/assets/esri/core/workers/chunks/{8f93e6fc11a158d4f1ee.js → 7335a762412bc8c15a2f.js} +1 -1
  57. package/assets/esri/core/workers/chunks/759686b896f51f0fe6a9.js +1 -0
  58. package/assets/esri/core/workers/chunks/7656900713e55036c3c1.js +1 -0
  59. package/assets/esri/core/workers/chunks/{b2b342b06d502fc61ea5.js → 76789f46b2c65d219cf9.js} +1 -1
  60. package/assets/esri/core/workers/chunks/774615303c1cc9a77e20.js +1 -0
  61. package/assets/esri/core/workers/chunks/7b290ac2e8a567ecae4a.js +1 -0
  62. package/assets/esri/core/workers/chunks/7ff37a4f315f7621462b.js +1 -0
  63. package/assets/esri/core/workers/chunks/8ad5e80e911419c1685a.js +1 -0
  64. package/assets/esri/core/workers/chunks/{a3ecde3794a7db3cf283.js → 8d90bef1091204fba0f1.js} +1 -1
  65. package/assets/esri/core/workers/chunks/8f16a358ed83d2264415.js +1 -0
  66. package/assets/esri/core/workers/chunks/{a454df829a72ab02c860.js → 8fd63cb38036f331a803.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{bbcad2fde838819ffc7b.js → 906f4c0fa8135e6c2f03.js} +1 -1
  68. package/assets/esri/core/workers/chunks/989937c120bdd676ec1e.js +1 -0
  69. package/assets/esri/core/workers/chunks/9ba705a6ddabca0f77b1.js +1 -0
  70. package/assets/esri/core/workers/chunks/{87011d2fe14c54e296af.js → 9fe71d49c888fd871312.js} +1 -1
  71. package/assets/esri/core/workers/chunks/a14e5607c5c091c77e3d.js +1 -0
  72. package/assets/esri/core/workers/chunks/a2be8784f2cfdbb42681.js +1 -0
  73. package/assets/esri/core/workers/chunks/a6379a8df8c08b729b9c.js +1 -0
  74. package/assets/esri/core/workers/chunks/a988fd54912969b812ce.js +1 -0
  75. package/assets/esri/core/workers/chunks/a9db775210ebeee41738.js +1 -0
  76. package/assets/esri/core/workers/chunks/acbc14395c31f6da509e.js +1 -0
  77. package/assets/esri/core/workers/chunks/{11d1af758e2140095b10.js → aec82b94787821153d2b.js} +1 -1
  78. package/assets/esri/core/workers/chunks/b18b6bb85e52b03b85e3.js +680 -0
  79. package/assets/esri/core/workers/chunks/b624796ff4a9d4c406bf.js +1 -0
  80. package/assets/esri/core/workers/chunks/b7458bd3a2f590f32111.js +1 -0
  81. package/assets/esri/core/workers/chunks/bb1fad01d9f070e7d795.js +1 -0
  82. package/assets/esri/core/workers/chunks/{a9d477f90e5046400dd5.js → bcb2092c87d8d21c6458.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{3e94ed4d57ee7d870cba.js → c6f5688074ae89c37add.js} +1 -1
  84. package/assets/esri/core/workers/chunks/caf150028aeac91b8d80.js +1 -0
  85. package/assets/esri/core/workers/chunks/cb30e8a66d6dcfebd439.js +1 -0
  86. package/assets/esri/core/workers/chunks/d7c0ab622caf495dbcef.js +1 -0
  87. package/assets/esri/core/workers/chunks/e181d0f5562878b3dc01.js +1 -0
  88. package/assets/esri/core/workers/chunks/{fd629872b5c07853f695.js → e4015870412edd69453c.js} +1 -1
  89. package/assets/esri/core/workers/chunks/{d07068c44d560e4ce02e.js → e5d2fab228d54b18a8a8.js} +1 -1
  90. package/assets/esri/core/workers/chunks/e774303efefee31952d0.js +1 -0
  91. package/assets/esri/core/workers/chunks/e98a8f80023c6023e72c.js +1 -0
  92. package/assets/esri/core/workers/chunks/f10a339b16d84b650012.js +2 -0
  93. package/assets/esri/core/workers/chunks/f1d211904d5a1de93cb3.js +1 -0
  94. package/assets/esri/core/workers/chunks/f847a4846c427f671455.js +1 -0
  95. package/assets/esri/core/workers/chunks/fe42fa2144691b9186fd.js +1 -0
  96. package/assets/esri/images/portal/gaussiansplatlayer16.png +0 -0
  97. package/assets/esri/images/portal/knowledgegraphlayer16.png +0 -0
  98. package/assets/esri/images/portal/propresentation16.png +0 -0
  99. package/assets/esri/images/portal/urbanproject16.png +0 -0
  100. package/assets/esri/images/support/loading-throb.gif +0 -0
  101. package/assets/esri/layers/raster/formats/lerc-wasm.wasm +0 -0
  102. package/assets/esri/libs/basisu/basis_encoder.wasm +0 -0
  103. package/assets/esri/libs/dxtEncoder/dxt_encoder.wasm +0 -0
  104. package/assets/esri/themes/base/icons/style.scss +0 -0
  105. package/assets/esri/themes/base/icons/variables.scss +0 -0
  106. package/assets/esri/themes/base/images/files/archive-32.svg +0 -0
  107. package/assets/esri/themes/base/images/files/cad-32.svg +0 -0
  108. package/assets/esri/themes/base/images/files/code-32.svg +0 -0
  109. package/assets/esri/themes/base/images/files/csv-32.svg +0 -0
  110. package/assets/esri/themes/base/images/files/excel-32.svg +0 -0
  111. package/assets/esri/themes/base/images/files/generic-32.svg +0 -0
  112. package/assets/esri/themes/base/images/files/gpx-32.svg +0 -0
  113. package/assets/esri/themes/base/images/files/image-32.svg +0 -0
  114. package/assets/esri/themes/base/images/files/pdf-32.svg +0 -0
  115. package/assets/esri/themes/base/images/files/report-32.svg +0 -0
  116. package/assets/esri/themes/base/images/files/sound-32.svg +0 -0
  117. package/assets/esri/themes/base/images/files/text-32.svg +0 -0
  118. package/assets/esri/themes/base/images/files/video-32.svg +0 -0
  119. package/assets/esri/themes/base/images/files/word-32.svg +0 -0
  120. package/assets/esri/themes/base/images/files/zip-32.svg +0 -0
  121. package/assets/esri/themes/base/images/loading-throb.gif +0 -0
  122. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +24 -0
  123. package/assets/esri/themes/base/widgets/_Bookmarks.scss +0 -0
  124. package/assets/esri/themes/dark/main.css +1 -1
  125. package/assets/esri/themes/light/main.css +1 -1
  126. package/assets/esri/themes/light/view.css +1 -1
  127. package/chunks/GlowComposition.glsl.js +5 -5
  128. package/chunks/OITBlend.glsl.js +1 -1
  129. package/chunks/languageUtils.js +1 -1
  130. package/config.js +1 -1
  131. package/core/AsyncUpdate.js +1 -1
  132. package/core/Loadable.js +1 -1
  133. package/core/colorUtils.js +1 -1
  134. package/core/date.js +1 -1
  135. package/core/has.js +1 -1
  136. package/core/workers/WorkerHandle.js +1 -1
  137. package/core/workers/workerFactory.js +1 -1
  138. package/editing/sharedTemplates/SharedTemplateProvider.js +1 -1
  139. package/form/elements/AttachmentElement.d.ts +4 -1
  140. package/form/elements/inputs/attachments/AttachmentInput.d.ts +1 -0
  141. package/form/elements/inputs/attachments/AudioInput.d.ts +1 -0
  142. package/form/elements/inputs/attachments/DocumentInput.d.ts +3 -0
  143. package/form/elements/inputs/attachments/ImageInput.d.ts +1 -0
  144. package/form/elements/inputs/attachments/VideoInput.d.ts +1 -0
  145. package/geometry/Mesh.js +1 -1
  146. package/geometry/support/meshUtils/loadExternal.js +1 -1
  147. package/identity/OAuthCredential.js +1 -1
  148. package/kernel.js +1 -1
  149. package/layers/AnnotationFeatureLayer.d.ts +2 -4
  150. package/layers/AnnotationFeatureLayer.js +1 -1
  151. package/layers/DimensionFeatureLayer.d.ts +0 -2
  152. package/layers/DimensionFeatureLayer.js +1 -1
  153. package/layers/LinkChartLayer.js +1 -1
  154. package/layers/ParquetLayer.js +1 -1
  155. package/layers/PointCloudLayer.js +1 -1
  156. package/layers/SceneLayer.js +1 -1
  157. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  158. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  159. package/layers/graphics/editingSupport.js +1 -1
  160. package/layers/graphics/sources/MemorySource.js +1 -1
  161. package/layers/graphics/sources/ParquetSource.js +1 -1
  162. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  163. package/layers/mixins/EditBusLayer.js +1 -1
  164. package/layers/mixins/SceneService.js +1 -1
  165. package/layers/support/KMLSublayer.js +1 -1
  166. package/layers/support/ParquetFilesData.js +1 -1
  167. package/layers/support/TitleCreator.js +1 -1
  168. package/layers/support/featureLayerUtils.js +1 -1
  169. package/layers/support/parquetUtils.js +1 -1
  170. package/linkChart/guards.js +2 -0
  171. package/linkChart/utils.js +1 -1
  172. package/networks/CircuitManager.d.ts +44 -0
  173. package/networks/support/CircuitExportJobInfo.d.ts +1 -1
  174. package/networks/support/CircuitVerifyJobInfo.d.ts +1 -1
  175. package/networks/support/jsonTypes.d.ts +2 -0
  176. package/package.json +5 -5
  177. package/rest/featureService/types.d.ts +4 -7
  178. package/rest/knowledgeGraph/ReplicaDefinition.d.ts +62 -6
  179. package/rest/networks/circuits/support/CircuitVerifyResult.d.ts +1 -1
  180. package/rest/networks/circuits/support/ExportCircuitsParameters.d.ts +1 -1
  181. package/rest/networks/circuits/support/VerifyCircuitsParameters.d.ts +17 -3
  182. package/rest/networks/unitIdentifiers/support/UnitQueryResult.d.ts +1 -1
  183. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  184. package/smartMapping/support/adapters/FeatureLayerBinningAdapter.js +1 -1
  185. package/support/ArcadeExpression.js +1 -1
  186. package/support/basemapUtils.js +1 -1
  187. package/support/revision.js +1 -1
  188. package/symbols/cim/CIMOperators.js +1 -1
  189. package/symbols/cim/utils.js +1 -1
  190. package/symbols/support/cimSymbolUtils.js +1 -1
  191. package/versionManagement/VersionManagementService.js +1 -1
  192. package/versionManagement/VersionManager.js +1 -1
  193. package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
  194. package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementTool.js +1 -1
  195. package/views/2d/engine/ParentChildStage.js +1 -1
  196. package/views/2d/engine/Stage.js +1 -1
  197. package/views/2d/engine/ThrottledCanvas.js +2 -0
  198. package/views/2d/engine/webgl/Profiler.js +1 -1
  199. package/views/2d/engine/webgl/mesh/factories/FeatureMeshFactory.js +1 -1
  200. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  201. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  202. package/views/2d/engine/webgl/util/AnnotationMatcher.js +1 -1
  203. package/views/2d/engine/webgl/util/DictionaryMatcher.js +1 -1
  204. package/views/2d/engine/webgl/util/DimensionMatcher.js +1 -1
  205. package/views/2d/engine/webgl/util/IntervalMatcher.js +1 -1
  206. package/views/2d/engine/webgl/util/LabelMatcher.js +1 -1
  207. package/views/2d/engine/webgl/util/MapMatcher.js +1 -1
  208. package/views/2d/engine/webgl/util/Matcher.js +1 -1
  209. package/views/2d/engine/webgl/util/createMatcher.js +1 -1
  210. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  211. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  212. package/views/2d/layers/LayerView2D.js +1 -1
  213. package/views/2d/layers/MediaLayerView2D.js +1 -1
  214. package/views/2d/layers/TileLayerView2D.js +1 -1
  215. package/views/2d/layers/features/Processor.js +1 -1
  216. package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +1 -1
  217. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  218. package/views/2d/layers/features/layerAdapters/DimensionLayerAdapter.js +1 -1
  219. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  220. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  221. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  222. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  223. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  224. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  225. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  226. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  227. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  228. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  229. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  230. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  231. package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
  232. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  233. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  234. package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
  235. package/views/2d/layers/support/annodime/MatcherGeometryOverride.js +2 -0
  236. package/views/2d/layers/support/annodime/PrivateDimensionEffect.js +1 -1
  237. package/views/2d/layers/support/annodime/PrivateMatcherGeometryOverrideEffect.js +2 -0
  238. package/views/2d/layers/support/annodime/TileObjectId.js +2 -0
  239. package/views/2d/layers/support/annodime/annotationGraphic.js +1 -1
  240. package/views/2d/layers/support/annodime/debugUtils.js +2 -0
  241. package/views/2d/layers/support/annodime/dimensionStyleDefaults.js +2 -0
  242. package/views/2d/layers/support/annodime/dimensionSymbols.js +1 -1
  243. package/views/2d/layers/support/annodime/dimensionUtils.js +1 -1
  244. package/views/2d/layers/support/annodime/utils.js +1 -1
  245. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  246. package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +1 -1
  247. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  248. package/views/3d/camera/constraintUtils/surfaceCollision.js +1 -1
  249. package/views/3d/camera/constraintUtils.js +1 -1
  250. package/views/3d/glTF/internal/Resource.js +1 -1
  251. package/views/3d/glTF/loader.js +1 -1
  252. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  253. package/views/3d/layers/I3SMeshView3D.js +1 -1
  254. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  255. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  256. package/views/3d/layers/SceneLayerWorkerHandle.js +1 -1
  257. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  258. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  259. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  260. package/views/3d/layers/graphics/tessellationUtils.js +1 -1
  261. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  262. package/views/3d/state/GoToOperation.js +1 -1
  263. package/views/3d/state/SurfaceCollisionConstraint.js +1 -1
  264. package/views/3d/state/ViewState.js +1 -1
  265. package/views/3d/state/ViewStateManager.js +1 -1
  266. package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
  267. package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
  268. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  269. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  270. package/views/3d/webgl/ManagedFBO.js +1 -1
  271. package/views/3d/webgl/RenderCamera.js +1 -1
  272. package/views/3d/webgl/RenderNode.js +1 -1
  273. package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
  274. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
  275. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
  276. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  277. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  278. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  279. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  280. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  281. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  282. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  283. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  284. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  285. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  286. package/views/3d/webgl-engine/effects/transparency/OITBlendTechniqueConfiguration.js +1 -1
  287. package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
  288. package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
  289. package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
  290. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  291. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  292. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  293. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  294. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  295. package/views/3d/webgl.js +1 -1
  296. package/views/VideoView.js +1 -1
  297. package/views/View2D.js +1 -1
  298. package/views/Viewport2DBaseMixin.js +1 -1
  299. package/views/analysis/ElevationProfile/ElevationProfileLineGroundComputation.js +1 -1
  300. package/views/draw/DrawTool.js +1 -1
  301. package/views/draw/support/editingSessionUtils.js +1 -1
  302. package/views/interactive/sketch/SketchLabelOptions.d.ts +0 -6
  303. package/views/layers/AnnotationFeatureLayerView.d.ts +0 -7
  304. package/views/layers/DimensionFeatureLayerView.d.ts +0 -7
  305. package/views/popupAdapter.js +1 -1
  306. package/views/support/LayerViewManager.js +1 -1
  307. package/views/webgl/BufferObject.js +1 -1
  308. package/webdoc/support/webdocSaveUtils.js +1 -1
  309. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  310. package/widgets/BasemapGallery/support/PortalBasemapsSource.js +1 -1
  311. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  312. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  313. package/widgets/BatchAttributeForm/css.js +1 -1
  314. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  315. package/widgets/BatchAttributeForm/interfaceUtils.js +1 -1
  316. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  317. package/widgets/BatchAttributeForm.js +1 -1
  318. package/widgets/Directions/DirectionsViewModel.js +1 -1
  319. package/widgets/Directions.js +1 -1
  320. package/widgets/Editor/EditorViewModel.d.ts +1 -13
  321. package/widgets/Editor.d.ts +11 -13
  322. package/widgets/Editor.js +1 -1
  323. package/widgets/Feature/FeatureViewModel.js +1 -1
  324. package/widgets/Feature.js +1 -1
  325. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  326. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  327. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  328. package/widgets/FeatureTable.js +1 -1
  329. package/widgets/Features/FeaturesViewModel.js +1 -1
  330. package/widgets/Features.js +1 -1
  331. package/widgets/LayerList/LayerListViewModel.js +1 -1
  332. package/widgets/LinkChartLayoutSwitcher/LinkChartLayoutSwitcherViewModel.js +1 -1
  333. package/widgets/Locate/LocateViewModel.js +1 -1
  334. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  335. package/widgets/OrientedImageryViewer/adapters/sketch/DataCaptureAdapter.js +1 -1
  336. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  337. package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
  338. package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
  339. package/widgets/OrientedImageryViewer/support/MediaPrefetcher.js +1 -1
  340. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  341. package/widgets/Popup/PopupViewModel.d.ts +0 -1
  342. package/widgets/Popup/PopupViewModel.js +1 -1
  343. package/widgets/Popup.js +1 -1
  344. package/widgets/Print/PrintViewModel.js +1 -1
  345. package/widgets/Print.js +1 -1
  346. package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
  347. package/widgets/Sketch/SketchViewModel.d.ts +0 -12
  348. package/widgets/Sketch.d.ts +0 -12
  349. package/widgets/TableList/ListItem.js +1 -1
  350. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  351. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  352. package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
  353. package/widgets/Widget.js +1 -1
  354. package/widgets/support/geolocationUtils.js +1 -1
  355. package/widgets/support/tests.js +1 -1
  356. package/assets/esri/core/workers/chunks/04070767356c12026369.js +0 -1
  357. package/assets/esri/core/workers/chunks/045f178fecc23839bfa8.js +0 -680
  358. package/assets/esri/core/workers/chunks/073ee52705ea326fecfb.js +0 -1
  359. package/assets/esri/core/workers/chunks/0e81b6aa64d5491870b2.js +0 -1
  360. package/assets/esri/core/workers/chunks/126a8c26618425790804.js +0 -1
  361. package/assets/esri/core/workers/chunks/1a7c0a1dc6ecc93ea03a.js +0 -1
  362. package/assets/esri/core/workers/chunks/1cb1f125dccbf8c8cac9.js +0 -1
  363. package/assets/esri/core/workers/chunks/1f03e34520746e432719.js +0 -1
  364. package/assets/esri/core/workers/chunks/292498a9c7d462d215c6.js +0 -1
  365. package/assets/esri/core/workers/chunks/2ed81f1e490cb7e73405.js +0 -1
  366. package/assets/esri/core/workers/chunks/32f26757e36704923286.js +0 -1
  367. package/assets/esri/core/workers/chunks/33e86dd1a54e447fa0e3.js +0 -1
  368. package/assets/esri/core/workers/chunks/35c87b0a4d4ee7ce302d.js +0 -1
  369. package/assets/esri/core/workers/chunks/36b904912cea1744d1c6.js +0 -1
  370. package/assets/esri/core/workers/chunks/3a35779cae6a11cde51b.js +0 -1
  371. package/assets/esri/core/workers/chunks/3b7060d264888bf298b1.js +0 -1
  372. package/assets/esri/core/workers/chunks/3df5394b17e9659ecb8f.js +0 -1
  373. package/assets/esri/core/workers/chunks/4adfe7f8a8efe2cd8e80.js +0 -1
  374. package/assets/esri/core/workers/chunks/511b9c12a7479d39dac0.js +0 -1
  375. package/assets/esri/core/workers/chunks/5396a894e6f8030ca088.js +0 -1
  376. package/assets/esri/core/workers/chunks/5728d8440aca205e4f53.js +0 -1
  377. package/assets/esri/core/workers/chunks/66392ff750c28064040a.js +0 -1
  378. package/assets/esri/core/workers/chunks/668d84dc512b3085a960.js +0 -1
  379. package/assets/esri/core/workers/chunks/6849282c4a5cd733779d.js +0 -1
  380. package/assets/esri/core/workers/chunks/6adc17e6e287a365ad8d.js +0 -1
  381. package/assets/esri/core/workers/chunks/6db5ee9c589265b23b60.js +0 -1
  382. package/assets/esri/core/workers/chunks/76ed8e455f6bd79e561c.js +0 -1
  383. package/assets/esri/core/workers/chunks/7c34eb94e2c74602aeab.js +0 -1
  384. package/assets/esri/core/workers/chunks/831455798b177678720c.js +0 -1
  385. package/assets/esri/core/workers/chunks/88b08b386926ec889573.js +0 -1
  386. package/assets/esri/core/workers/chunks/8bd4c43c34aacf3b07da.js +0 -1
  387. package/assets/esri/core/workers/chunks/8ca88cfc0b9f84dc5832.js +0 -1
  388. package/assets/esri/core/workers/chunks/928b18e13e015330d44b.js +0 -1
  389. package/assets/esri/core/workers/chunks/937e347d130d469518ce.js +0 -1
  390. package/assets/esri/core/workers/chunks/93b40245378ced43ca08.js +0 -1
  391. package/assets/esri/core/workers/chunks/98dfe31e8ed9b522eaff.js +0 -1
  392. package/assets/esri/core/workers/chunks/a18cb809dd56c5537b3b.js +0 -1
  393. package/assets/esri/core/workers/chunks/a195f569eada3a8736be.js +0 -1
  394. package/assets/esri/core/workers/chunks/a40ede4d3375184f21fe.js +0 -1
  395. package/assets/esri/core/workers/chunks/a8167ab9fd846d699be5.js +0 -1
  396. package/assets/esri/core/workers/chunks/af96cbc4fb7bef726635.js +0 -1
  397. package/assets/esri/core/workers/chunks/b87aca8ad281870ae970.js +0 -1
  398. package/assets/esri/core/workers/chunks/ceb5bd9f2afaa2ea0808.js +0 -1
  399. package/assets/esri/core/workers/chunks/d25c37f169577a33db46.js +0 -1
  400. package/assets/esri/core/workers/chunks/d374cb2d17a2d11c500f.js +0 -1
  401. package/assets/esri/core/workers/chunks/dadf85890961bcc205eb.js +0 -1
  402. package/assets/esri/core/workers/chunks/db279d5d9c7deec554bb.js +0 -1
  403. package/assets/esri/core/workers/chunks/de0c94defb90e1805081.js +0 -1
  404. package/assets/esri/core/workers/chunks/e1340232962cf576d37e.js +0 -1
  405. package/assets/esri/core/workers/chunks/e38d1ba15babc238b151.js +0 -1
  406. package/assets/esri/core/workers/chunks/e73bb7c8de7412d9975c.js +0 -1
  407. package/assets/esri/core/workers/chunks/f23351a04643c464be84.js +0 -1
  408. package/assets/esri/core/workers/chunks/f3d331da3c61af5c5a2f.js +0 -1
  409. package/assets/esri/core/workers/chunks/f5125925f83c979edde7.js +0 -2
  410. package/assets/esri/core/workers/chunks/f912c173c58ae4299cbe.js +0 -1
  411. package/assets/esri/core/workers/chunks/f93facf47aba9b128fcc.js +0 -1
  412. package/assets/esri/core/workers/chunks/fae147d03ed723ab234d.js +0 -1
  413. package/views/2d/engine/ManagedCanvas.js +0 -2
  414. package/views/2d/layers/features/support/FeatureSetReaderAnnotationJSON.js +0 -2
  415. package/views/2d/layers/features/support/FeatureSetReaderDimensionJSON.js +0 -2
  416. package/views/2d/layers/support/annodime/annotationUtils.js +0 -2
  417. package/views/3d/state/controllers/SurfaceCollisionCorrectionController.js +0 -2
  418. /package/assets/esri/core/workers/chunks/{f5125925f83c979edde7.js.LICENSE.txt → f10a339b16d84b650012.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import s from"../../../core/Logger.js";import t from"../../../core/PooledArray.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{WorkerHandle as o}from"../../../core/workers/WorkerHandle.js";import{canProjectWithoutEngine as i}from"../../../geometry/projectionUtils.js";import{projectVectorToVector as n}from"../../../geometry/projection/projectVectorToVector.js";class r{constructor(s,t,e,o,i,n){this.layout=s,this.interleavedVertexData=t,this.indices=e,this.hasColors=o,this.hasModifications=i,this.positionData=n}}class h{constructor(s,t,e,o,i,n,r){this.componentOffsets=s,this.featureIds=t,this.anchorIds=e,this.anchors=o,this.transformedGeometry=i,this.globalTrafo=n,this.obb=r}}class a extends o{constructor(s){super("SceneLayerWorker","process",{process:s=>[s.geometryBuffer],project:s=>[s.positions.buffer],transformNormals:s=>[s.normals.buffer]},s,{hasInitialize:!0}),this._schemasByContext=new Map,this._modificationsByContext=new Map}_onClientConnected(s){for(const[t,e]of this._schemasByContext)s.invoke("setLegacySchema",{context:t,jsonSchema:e});for(const t of this._modificationsByContext.values())s.invoke("setModifications",t)}setModifications(s,t,e){const o={context:s,modifications:t,isGeodetic:e};return this._modificationsByContext.set(s,o),this.broadcast(o,"setModifications")}setLegacySchema(s,t){const e=JSON.stringify(t);return this._schemasByContext.set(s,e),this.broadcast({context:s,jsonSchema:e},"setLegacySchema")}destroyContext(s){return this._schemasByContext.delete(s),this._modificationsByContext.delete(s),this.broadcast(s,"destroyContext")}async destroyContextAndSelf(s){await this.destroyContext(s),this.destroy()}project(s,t){return this.invokeMethod("project",s,t)}transformNormals(s,t){return this.invokeMethod("transformNormals",s,t)}}const c=new t({deallocator:null}),p=e();function u(t,e,o){c.clear();let r=1/0,h=1/0,a=-1/0,u=-1/0,l=!1;for(const m of e){const t="clip"===m.type?2:"mask"===m.type?1:0,e=m.geometry;let f=s=>s;if(e.spatialReference){if(!i(e.spatialReference,o)){s.getLogger("esri.views.3d.layers.SceneLayerWorkerHandle").warn("im-modification-projection-failed","Can't project modification polygon into layer spatial reference, ignoring modification",{polygon:e});continue}f=s=>(n(s,e.spatialReference,p,o),p)}l=l||1===t;const g=e.rings.length,d=e.rings.some(s=>s.length<3);if(0===g||d)s.getLogger("esri.views.3d.layers.SceneLayerWorkerHandle").warn("im-modification-invalid-polygon","Ignoring invalid modification polygon (no rings or rings with less than 3 vertices).",{polygon:e});else{c.push(t),c.push(g);for(const s of e.rings){c.push(s.length);for(const t of s){const s=f(t);c.push(s[0]),c.push(s[1]),c.push(s[2]??0),r=Math.min(r,s[0]),h=Math.min(h,s[1]),a=Math.max(a,s[0]),u=Math.max(u,s[1])}}}}if(null!=t)if(l){const s=1e-4;c.push(2),c.push(2),c.push(4),c.push(r-s),c.push(h-s),c.push(0),c.push(a+s),c.push(h-s),c.push(0),c.push(a+s),c.push(u+s),c.push(0),c.push(r-s),c.push(u+s),c.push(0),c.push(4),c.push(t[0]),c.push(t[1]),c.push(0),c.push(t[2]),c.push(t[1]),c.push(0),c.push(t[2]),c.push(t[3]),c.push(0),c.push(t[0]),c.push(t[3]),c.push(0)}else c.push(1),c.push(1),c.push(4),c.push(t[0]),c.push(t[1]),c.push(0),c.push(t[2]),c.push(t[1]),c.push(0),c.push(t[2]),c.push(t[3]),c.push(0),c.push(t[0]),c.push(t[3]),c.push(0);c.push(3);const f=new Float64Array(c.length);for(let s=0;s<c.length;++s)f[s]=c.at(s);return f}function l(s,t){let e=0;for(const o of t){const t=o.geometry,i=t.rings.length,n=t.rings.some(s=>s.length<3);if(0!==i&&!n){e+=1,e+=1;for(let o=0;o<t.rings.length;++o){const i=t.rings[o];e+=1;for(let n=0;n<i.length;++n){const i=[s[e+0],s[e+1],s[e+2]];e+=3,t.setPoint(o,n,i)}}}}}export{a as SceneLayerWorkerHandle,h as TransformedData,r as TransformedGeometry,l as fromWasmModification,u as toWasmModification};
2
+ import t from"../../../core/Logger.js";import s from"../../../core/PooledArray.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{WorkerHandle as o}from"../../../core/workers/WorkerHandle.js";import{canProjectWithoutEngine as i}from"../../../geometry/projectionUtils.js";import{projectVectorToVector as n}from"../../../geometry/projection/projectVectorToVector.js";class r{constructor(t,s,e,o,i,n){this.layout=t,this.interleavedVertexData=s,this.indices=e,this.hasColors=o,this.hasModifications=i,this.positionData=n}}class h{constructor(t,s,e,o,i,n,r){this.componentOffsets=t,this.featureIds=s,this.anchorIds=e,this.anchors=o,this.transformedGeometry=i,this.globalTrafo=n,this.obb=r}}class a extends o{constructor(t){super("SceneLayerWorker","process",{process:t=>[t.geometryBuffer],project:t=>[t.positions.buffer],transformNormals:t=>[t.normals.buffer]},t,{hasInitialize:!0}),this._schemasByContext=new Map,this._modificationsByContext=new Map}_onClientConnected(t){for(const[s,e]of this._schemasByContext)t.invoke("setLegacySchema",{context:s,jsonSchema:e}).catch(()=>{});for(const s of this._modificationsByContext.values())t.invoke("setModifications",s).catch(()=>{})}setModifications(t,s,e){const o={context:t,modifications:s,isGeodetic:e};return this._modificationsByContext.set(t,o),this.broadcast(o,"setModifications")}setLegacySchema(t,s){const e=JSON.stringify(s);return this._schemasByContext.set(t,e),this.broadcast({context:t,jsonSchema:e},"setLegacySchema")}destroyContext(t){return this._schemasByContext.delete(t),this._modificationsByContext.delete(t),this.broadcast(t,"destroyContext")}async destroyContextAndSelf(t){await this.destroyContext(t),this.destroy()}project(t,s){return this.invokeMethod("project",t,s)}transformNormals(t,s){return this.invokeMethod("transformNormals",t,s)}}const c=new s({deallocator:null}),p=e();function u(s,e,o){c.clear();let r=1/0,h=1/0,a=-1/0,u=-1/0,l=!1;for(const m of e){const s="clip"===m.type?2:"mask"===m.type?1:0,e=m.geometry;let f=t=>t;if(e.spatialReference){if(!i(e.spatialReference,o)){t.getLogger("esri.views.3d.layers.SceneLayerWorkerHandle").warn("im-modification-projection-failed","Can't project modification polygon into layer spatial reference, ignoring modification",{polygon:e});continue}f=t=>(n(t,e.spatialReference,p,o),p)}l=l||1===s;const g=e.rings.length,d=e.rings.some(t=>t.length<3);if(0===g||d)t.getLogger("esri.views.3d.layers.SceneLayerWorkerHandle").warn("im-modification-invalid-polygon","Ignoring invalid modification polygon (no rings or rings with less than 3 vertices).",{polygon:e});else{c.push(s),c.push(g);for(const t of e.rings){c.push(t.length);for(const s of t){const t=f(s);c.push(t[0]),c.push(t[1]),c.push(t[2]??0),r=Math.min(r,t[0]),h=Math.min(h,t[1]),a=Math.max(a,t[0]),u=Math.max(u,t[1])}}}}if(null!=s)if(l){const t=1e-4;c.push(2),c.push(2),c.push(4),c.push(r-t),c.push(h-t),c.push(0),c.push(a+t),c.push(h-t),c.push(0),c.push(a+t),c.push(u+t),c.push(0),c.push(r-t),c.push(u+t),c.push(0),c.push(4),c.push(s[0]),c.push(s[1]),c.push(0),c.push(s[2]),c.push(s[1]),c.push(0),c.push(s[2]),c.push(s[3]),c.push(0),c.push(s[0]),c.push(s[3]),c.push(0)}else c.push(1),c.push(1),c.push(4),c.push(s[0]),c.push(s[1]),c.push(0),c.push(s[2]),c.push(s[1]),c.push(0),c.push(s[2]),c.push(s[3]),c.push(0),c.push(s[0]),c.push(s[3]),c.push(0);c.push(3);const f=new Float64Array(c.length);for(let t=0;t<c.length;++t)f[t]=c.at(t);return f}function l(t,s){let e=0;for(const o of s){const s=o.geometry,i=s.rings.length,n=s.rings.some(t=>t.length<3);if(0!==i&&!n){e+=1,e+=1;for(let o=0;o<s.rings.length;++o){const i=s.rings[o];e+=1;for(let n=0;n<i.length;++n){const i=[t[e+0],t[e+1],t[e+2]];e+=3,s.setPoint(o,n,i)}}}}}export{a as SceneLayerWorkerHandle,h as TransformedData,r as TransformedGeometry,l as fromWasmModification,u as toWasmModification};
@@ -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{__decorate as e}from"tslib";import t from"../../../../request.js";import r from"../../../../core/Accessor.js";import{splitIntoChunks as s}from"../../../../core/arrayUtils.js";import{createTask as i,resultOrAbort as n,result as o}from"../../../../core/asyncUtils.js";import a from"../../../../core/Collection.js";import{makeHandle as d}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import c from"../../../../core/Logger.js";import{abortMaybe as h,destroyMaybe as l}from"../../../../core/maybe.js";import{estimateNumberMemory as u,estimateStringMemory as m}from"../../../../core/memoryEstimations.js";import{whenOrAbort as g}from"../../../../core/promiseUtils.js";import p from"../../../../core/ReactiveSet.js";import{watch as y,sync as f}from"../../../../core/reactiveUtils.js";import{property as _,subclass as b}from"../../../../core/accessorSupport/decorators.js";import{equals as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{formatNumber as O}from"../../../../intl/number.js";import{getMaximumQuerySize as j,queryAllJSON as C}from"../../../../layers/support/featureQueryAll.js";let w=class extends r{constructor(e){super(e),this._warnMaximumChangedObjectsExceeded=!1,this._maximumNumberOfEditOVerrides=G,this._definitionExpressionDirty=!0,this._interactiveEditingSessions=new a,this.geometryOverrides=new a,this._clientGeometryCache=new Map,this._attributeChangedObjectIds=new p,this._geometryChangedObjectIds=new p,this._pendingFetchChangedObjectIds=null,this._pendingFetchAbortController=new AbortController,this._applyGeometryOverridesTask=null,this._featureIdLocks=new Map}initialize(){this._memCache=new F(this.memoryController.newCache(`i3s-attribute-overrides-${this.layer.uid}`)),this.addHandles(y(()=>this.layer.definitionExpression,async()=>{this._definitionExpressionDirty=!0,this._pendingFetchChangedObjectIds||(this._applyGeometryOverridesTask=h(this._applyGeometryOverridesTask),this._applyGeometryOverridesTask=i(e=>this._queryAndAddGeometryOverrides(e)),await this._applyGeometryOverridesTask.promise)},f)),this._pendingFetchChangedObjectIds=this._fetchChangedObjectIds(this._pendingFetchAbortController?.signal),this._pendingFetchChangedObjectIds.finally(()=>{this._pendingFetchAbortController=null,this._pendingFetchChangedObjectIds=null})}destroy(){this._set("layer",null),this._memCache=l(this._memCache),this._pendingFetchAbortController=h(this._pendingFetchAbortController),this._pendingFetchChangedObjectIds=null,this._featureIdLocks.clear()}get is3DOFL(){return null!=this._associatedLayer?.infoFor3D}get sortedGeometryChangedObjectIds(){return this.is3DOFL?[...this._geometryChangedObjectIds].sort((e,t)=>e-t):[]}get _associatedLayer(){return null==this.layer?null:this.layer.associatedLayer}get hasGeometryChanges(){return this._geometryChangedObjectIds.size>0}get updating(){return!!this.is3DOFL&&!!(this._pendingFetchChangedObjectIds||this._applyGeometryOverridesTask&&!this._applyGeometryOverridesTask.finished)}get isEmpty(){return null==this._pendingFetchChangedObjectIds&&0===this._attributeChangedObjectIds.size&&0===this._geometryChangedObjectIds.size}featureHasGeometryChanges(e){return this._geometryChangedObjectIds.has(e)}featureHasAttributeChanges(e){return this._attributeChangedObjectIds.has(e)}createInteractiveEditSession(e){this._attributeChangedObjectIds.add(e);const t=this._interactiveEditingSessions,r=new I(e,()=>{t.remove(r)});return t.unshift(r),r}async applyAttributeOverrides(e,t,r,s=[]){if(this._pendingFetchChangedObjectIds&&await g(this._pendingFetchChangedObjectIds,r),null==t)return;const{attributeData:i,loadedAttributes:n}=t;if(null==n||null==i||0===this._attributeChangedObjectIds.size)return;const o=new Set;for(const d of n)o.add(d.index);for(const d of s)o.has(d.index)||(n.push(d),i[d.name]=new Array(e.length));const a=await this._lockFeatureIds(e);try{const t={attributeData:i,loadedAttributes:n},s=this._getOverridesFromCache(e,t,this._attributeChangedObjectIds),{objectIds:o,fieldNames:a}=s;if(0===o.length||0===a.length)return;const d=await this._queryAttributeOverridesFromAssociatedLayer(o,a,r);if(null==d)return;this._processOverridesFromAssociatedLayer(e,d,a,t)}finally{a.remove()}}updateGeometry(e,t){this._geometryChangedObjectIds.add(e);const r=this._clientGeometryCache.get(e);if(null!=r&&(this.geometryOverrides.remove(r),this._clientGeometryCache.delete(e)),null!=t){const r={oid:e,mesh:t};this.geometryOverrides.add(r),this._clientGeometryCache.set(e,r)}}updateAttributeValue(e,t,r){this._attributeChangedObjectIds.add(e),this._cacheAttributeValue(e,t,r)}featureAdded(e){this.is3DOFL&&this._geometryChangedObjectIds.add(e),this._attributeChangedObjectIds.add(e)}_cacheAttributeValue(e,t,r){this._memCache.put(e,t,r)}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:r},s){const i=new Array;for(const a of t)i[a.index]=r[a.name];const n=new Set,o=new Set;for(let a=0;a<e.length;a++){const r=e[a];if(s.has(r))for(const e of t){const t=this._attributeFromCache(r,e.index);void 0===t?(n.add(r),o.add(e.name)):i[e.index][a]=t}}return{objectIds:Array.from(n),fieldNames:Array.from(o)}}_attributeFromCache(e,t){const r=this._fromInteractiveEditingSession(e,t);return void 0!==r?r:this._memCache.get(e,t)}_fromInteractiveEditingSession(e,t){if(null!=this._interactiveEditingSessions)for(const r of this._interactiveEditingSessions){if(r.objectId!==e)continue;const s=r.getAttribute(t);if(void 0!==s)return s}}async _queryAttributeOverridesFromAssociatedLayer(e,t,r){if(0===e.length)return null;this._logWarningIfMaximumObjectsExceeded();const{associatedLayer:s}=this.layer;if(null==s)return null;const i=s.createQuery(),{objectIdField:n}=s,o=[n,...t];i.where=this.layer.definitionExpression||"1=1",i.returnGeometry=!1,i.outFields=o,i.cacheHint=!0;const a=await this._executeBatchQuery(s,e,i,r),d=[];for(const c of a)if(c.ok)for(const e of c.value.features)d.push(e);return d}async _queryGeometryOverridesFromAssociatedLayer(e,t){if(0===e.length||!this.is3DOFL)return null;const r=this.layer.associatedLayer,s=r.infoFor3D,{spatialReference:i}=r,{state:{viewingMode:n},spatialReference:o}=this.view,a=1===n,d=i.isGeographic;if(a&&!d)return c.getLogger(this).warn("unsupported-pcs-edits-in-global-view",this.layer.title,L(i,o,this.view.viewingMode,0)),null;if(!a&&d)return c.getLogger(this).warn("unsupported-gcs-edits-in-local-view",this.layer.title,L(i,o,this.view.viewingMode,0)),null;if(!(v(i,o)||a&&o.isWebMercator&&i.isWGS84))return c.getLogger(this).warn("unsupported-mismatched-spatial-reference-edits",this.layer.title,L(i,o,this.view.viewingMode,1)),null;this._logWarningIfMaximumObjectsExceeded();const{objectIdField:h,globalIdField:l}=r,u=[h,...null!=l?[l]:[]],m=r.createQuery();m.where=this.layer.definitionExpression||"1=1",m.returnGeometry=!0,m.outFields=u,m.cacheHint=!0,m.returnZ=r.hasZ,m.returnM=r.hasM;const{assetMapFromAssetMapsJSON:g,extractMesh:p}=await import("../../../../rest/support/meshFeatureSet.js"),y=await this._executeBatchQuery(r,e,m,t),f=[];for(const c of y){if(!c.ok)continue;const e=c.value,{assetMaps:t,features:r,globalIdFieldName:n}=e;if(null==t)continue;const o=g(s,t);for(const a of r){const e=p(a,n,i,s,o),t=a;null!=e?(t.geometry=e,f.push(t)):t.geometry=null}}return f}_logWarningIfMaximumObjectsExceeded(){if(!this._warnMaximumChangedObjectsExceeded)return;this._warnMaximumChangedObjectsExceeded=!1;let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${O(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;e+=t?.loaded?` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:` (${this.layer.parsedUrl.path})`,c.getLogger(this).warn("#queryOverrides()",this.layer.title,`${e}.`)}async _executeBatchQuery(e,t,r,i){if(0===t.length)return[];const o=j(e);t=[...t].sort((e,t)=>e-t);const a=s(t,o).map(t=>{const s=r.clone();return s.objectIds=t,n(C(e,s,{signal:i}))});return Promise.all(a)}_processOverridesFromAssociatedLayer(e,t,r,{loadedAttributes:s,attributeData:i}){const n=this._associatedLayer;if(null==n)return;const o=n.objectIdField,a=r.map(t=>(t in i||(i[t]=new Array(e.length)),i[t])),d=new Map(s.map(e=>[e.name,e.index])),c=r.map(e=>d.get(e)),h=new Map(Array.from(e,(e,t)=>[e,t]));for(const l of t){const e=l.attributes[o];for(let t=0;t<r.length;t++){const s=c[t],i=h.get(e),n=l.attributes[r[t]];a[t][i]=n,this._cacheAttributeValue(e,s,n)}}}async _fetchChangedObjectIds(e){const r=this.layer;await r.load({signal:e}),this._geometryChangedObjectIds.clear(),this._attributeChangedObjectIds.clear();const{associatedLayer:s}=r;if(null==s||!s.capabilities?.operations?.supportsChangeTracking)return;const i=this._getFetchChangedObjectIdsServerGen();if(null==i)return;const n=s.layerId,a=this.is3DOFL,d={...s.customParameters,f:"json",returnIdsOnly:!0,layers:`[${n}]`,returnUpdates:!0,returnDeletes:a,returnInserts:a,layerServerGens:JSON.stringify([{id:n,serverGen:i}])};if(null!=s.apiKey&&(d.token=s.apiKey),a){const e=s.infoFor3D;d.fieldsToCompare=JSON.stringify({fields:[...Object.values(e.transformFieldRoles),e.sourceHashField]})}const h=await o(t(`${s.url}/extractChanges`,{method:"post",query:d,timeout:x,signal:e}));if(!h.ok){const e=this.layer.title;c.getLogger(this).warn("extractChanges:unavailable",e,": could not obtain edited features that are not cached in the scene service. Display of features may not be up to date with the latest edits. Consider re-caching the scene service.")}if(h.ok&&1===h.value.data?.edits?.length){const t=h.value.data.edits[0],r=t?.objectIds,s=t?.fieldUpdates,i=r?.adds??[],n=r?.updates??[],o=r?.deletes??[],d=[...i,...n,...o],c=a?[...i,...s??n,...o]:[],l=Math.min(this._maximumNumberOfEditOVerrides,d.length);l<d.length&&(this._warnMaximumChangedObjectsExceeded=!0);const u=d.sort((e,t)=>e-t);for(let e=0;e<l;++e){const t=u[e];this._attributeChangedObjectIds.add(t)}for(const e of c)this._geometryChangedObjectIds.add(e);for(;this._definitionExpressionDirty;)await this._queryAndAddGeometryOverrides(e)}}async _queryAndAddGeometryOverrides(e){this._definitionExpressionDirty=!1;const t=this.layer,{associatedLayer:r}=t;if(null!=r&&r.capabilities?.operations?.supportsChangeTracking&&this.is3DOFL&&this._geometryChangedObjectIds.size>0){const t=await this._queryGeometryOverridesFromAssociatedLayer(Array.from(this._geometryChangedObjectIds),e);if(null!=t)for(const e of t)null!=e.geometry&&this.updateGeometry(e.attributes[r.objectIdField],e.geometry)}}_getFetchChangedObjectIdsServerGen(){const e=this.layer;if(null!=e.serviceUpdateTimeStamp?.lastUpdate)return e.serviceUpdateTimeStamp.lastUpdate;const t=e.associatedLayer;return null!=t?.serverGens?.minServerGen?t.serverGens.minServerGen:null}async _lockFeatureIds(e){const t=this._featureIdLocks;let r=!0;for(;r;){const s=new Array;for(const r of e){const e=t.get(r);e&&s.push(e)}0===s.length?r=!1:await Promise.all(s)}const s=Promise.withResolvers(),i=s.promise;for(const n of e)t.set(n,i);return d(()=>{for(const r of e)t.delete(r);s.resolve()})}get test(){}};e([_({constructOnly:!0})],w.prototype,"view",void 0),e([_({constructOnly:!0})],w.prototype,"layer",void 0),e([_({readOnly:!0})],w.prototype,"is3DOFL",null),e([_()],w.prototype,"_interactiveEditingSessions",void 0),e([_({readOnly:!0})],w.prototype,"sortedGeometryChangedObjectIds",null),e([_({readOnly:!0})],w.prototype,"geometryOverrides",void 0),e([_()],w.prototype,"_clientGeometryCache",void 0),e([_()],w.prototype,"_associatedLayer",null),e([_({constructOnly:!0})],w.prototype,"memoryController",void 0),e([_()],w.prototype,"_attributeChangedObjectIds",void 0),e([_()],w.prototype,"_geometryChangedObjectIds",void 0),e([_()],w.prototype,"hasGeometryChanges",null),e([_()],w.prototype,"_pendingFetchChangedObjectIds",void 0),e([_()],w.prototype,"_pendingFetchAbortController",void 0),e([_()],w.prototype,"_applyGeometryOverridesTask",void 0),e([_()],w.prototype,"updating",null),e([_()],w.prototype,"isEmpty",null),w=e([b("esri.views.3d.layers.i3s.I3SOverrides")],w);class I{constructor(e,t){this.objectId=e,this._remove=t,this._updates=new Map,this._isActive=!0}getAttribute(e){return this._updates.get(e)}setAttribute(e,t){this.isActive&&this._updates.set(e,t)}remove(){this.isActive&&(this._isActive=!1,this._remove())}get isActive(){return this._isActive}}class F{constructor(e){this._cache=e}destroy(){this._cache.destroy()}put(e,t,r){this._cache.put(this._getKey(e,t),new A(r))}get(e,t){return this._cache.get(this._getKey(e,t))?.value}_getKey(e,t){return`${e}-${t}`}}class A{constructor(e){this.value=e,this.usedMemory="string"==typeof e?m(e):u}}const x=1e4,G=5e4;function L(e,t,r,s){return`Displaying the edits of a SceneLayer with a${0===s?e.isGeographic?" geographic ":" projected ":" "}spatial reference (wkid:${e.wkid}) in ${r} viewing mode${1===s?` with spatial reference (wkid:${t.wkid}) `:" "}is not supported. No geometry edits will be displayed for this layer.\nPlease consider re-caching the scene service or changing the ${0===s?"viewing mode":"view spatial reference"} to display edits.`}export{w as I3SOverrides};
2
+ import{__decorate as e}from"tslib";import t from"../../../../request.js";import r from"../../../../core/Accessor.js";import{splitIntoChunks as s}from"../../../../core/arrayUtils.js";import{createTask as i,resultOrAbort as n,result as o}from"../../../../core/asyncUtils.js";import a from"../../../../core/Collection.js";import{makeHandle as d}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import c from"../../../../core/Logger.js";import{abortMaybe as h,destroyMaybe as l}from"../../../../core/maybe.js";import{estimateNumberMemory as u,estimateStringMemory as m}from"../../../../core/memoryEstimations.js";import{whenOrAbort as g}from"../../../../core/promiseUtils.js";import p from"../../../../core/ReactiveSet.js";import{watch as y,sync as f}from"../../../../core/reactiveUtils.js";import{property as _,subclass as b}from"../../../../core/accessorSupport/decorators.js";import{equals as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{formatNumber as O}from"../../../../intl/number.js";import{getMaximumQuerySize as j,queryAllJSON as C}from"../../../../layers/support/featureQueryAll.js";let w=class extends r{constructor(e){super(e),this._warnMaximumChangedObjectsExceeded=!1,this._maximumNumberOfEditOVerrides=G,this._definitionExpressionDirty=!0,this._interactiveEditingSessions=new a,this.geometryOverrides=new a,this._clientGeometryCache=new Map,this._attributeChangedObjectIds=new p,this._geometryChangedObjectIds=new p,this._pendingFetchChangedObjectIds=null,this._pendingFetchAbortController=new AbortController,this._applyGeometryOverridesTask=null,this._featureIdLocks=new Map}initialize(){this._memCache=new F(this.memoryController.newCache(`i3s-attribute-overrides-${this.layer.uid}`)),this.addHandles(y(()=>this.layer.definitionExpression,async()=>{this._definitionExpressionDirty=!0,this._pendingFetchChangedObjectIds||(this._applyGeometryOverridesTask=h(this._applyGeometryOverridesTask),this._applyGeometryOverridesTask=i(e=>this._queryAndAddGeometryOverrides(e)),await this._applyGeometryOverridesTask.promise.catch(()=>{}))},f)),this._pendingFetchChangedObjectIds=this._fetchChangedObjectIds(this._pendingFetchAbortController?.signal),this._pendingFetchChangedObjectIds.finally(()=>{this._pendingFetchAbortController=null,this._pendingFetchChangedObjectIds=null}).catch(()=>{})}destroy(){this._set("layer",null),this._memCache=l(this._memCache),this._pendingFetchAbortController=h(this._pendingFetchAbortController),this._pendingFetchChangedObjectIds=null,this._featureIdLocks.clear()}get is3DOFL(){return null!=this._associatedLayer?.infoFor3D}get sortedGeometryChangedObjectIds(){return this.is3DOFL?[...this._geometryChangedObjectIds].sort((e,t)=>e-t):[]}get _associatedLayer(){return null==this.layer?null:this.layer.associatedLayer}get hasGeometryChanges(){return this._geometryChangedObjectIds.size>0}get updating(){return!!this.is3DOFL&&!!(this._pendingFetchChangedObjectIds||this._applyGeometryOverridesTask&&!this._applyGeometryOverridesTask.finished)}get isEmpty(){return null==this._pendingFetchChangedObjectIds&&0===this._attributeChangedObjectIds.size&&0===this._geometryChangedObjectIds.size}featureHasGeometryChanges(e){return this._geometryChangedObjectIds.has(e)}featureHasAttributeChanges(e){return this._attributeChangedObjectIds.has(e)}createInteractiveEditSession(e){this._attributeChangedObjectIds.add(e);const t=this._interactiveEditingSessions,r=new I(e,()=>{t.remove(r)});return t.unshift(r),r}async applyAttributeOverrides(e,t,r,s=[]){if(this._pendingFetchChangedObjectIds&&await g(this._pendingFetchChangedObjectIds,r),null==t)return;const{attributeData:i,loadedAttributes:n}=t;if(null==n||null==i||0===this._attributeChangedObjectIds.size)return;const o=new Set;for(const d of n)o.add(d.index);for(const d of s)o.has(d.index)||(n.push(d),i[d.name]=new Array(e.length));const a=await this._lockFeatureIds(e);try{const t={attributeData:i,loadedAttributes:n},s=this._getOverridesFromCache(e,t,this._attributeChangedObjectIds),{objectIds:o,fieldNames:a}=s;if(0===o.length||0===a.length)return;const d=await this._queryAttributeOverridesFromAssociatedLayer(o,a,r);if(null==d)return;this._processOverridesFromAssociatedLayer(e,d,a,t)}finally{a.remove()}}updateGeometry(e,t){this._geometryChangedObjectIds.add(e);const r=this._clientGeometryCache.get(e);if(null!=r&&(this.geometryOverrides.remove(r),this._clientGeometryCache.delete(e)),null!=t){const r={oid:e,mesh:t};this.geometryOverrides.add(r),this._clientGeometryCache.set(e,r)}}updateAttributeValue(e,t,r){this._attributeChangedObjectIds.add(e),this._cacheAttributeValue(e,t,r)}featureAdded(e){this.is3DOFL&&this._geometryChangedObjectIds.add(e),this._attributeChangedObjectIds.add(e)}_cacheAttributeValue(e,t,r){this._memCache.put(e,t,r)}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:r},s){const i=new Array;for(const a of t)i[a.index]=r[a.name];const n=new Set,o=new Set;for(let a=0;a<e.length;a++){const r=e[a];if(s.has(r))for(const e of t){const t=this._attributeFromCache(r,e.index);void 0===t?(n.add(r),o.add(e.name)):i[e.index][a]=t}}return{objectIds:Array.from(n),fieldNames:Array.from(o)}}_attributeFromCache(e,t){const r=this._fromInteractiveEditingSession(e,t);return void 0!==r?r:this._memCache.get(e,t)}_fromInteractiveEditingSession(e,t){if(null!=this._interactiveEditingSessions)for(const r of this._interactiveEditingSessions){if(r.objectId!==e)continue;const s=r.getAttribute(t);if(void 0!==s)return s}}async _queryAttributeOverridesFromAssociatedLayer(e,t,r){if(0===e.length)return null;this._logWarningIfMaximumObjectsExceeded();const{associatedLayer:s}=this.layer;if(null==s)return null;const i=s.createQuery(),{objectIdField:n}=s,o=[n,...t];i.where=this.layer.definitionExpression||"1=1",i.returnGeometry=!1,i.outFields=o,i.cacheHint=!0;const a=await this._executeBatchQuery(s,e,i,r),d=[];for(const c of a)if(c.ok)for(const e of c.value.features)d.push(e);return d}async _queryGeometryOverridesFromAssociatedLayer(e,t){if(0===e.length||!this.is3DOFL)return null;const r=this.layer.associatedLayer,s=r.infoFor3D,{spatialReference:i}=r,{state:{viewingMode:n},spatialReference:o}=this.view,a=1===n,d=i.isGeographic;if(a&&!d)return c.getLogger(this).warn("unsupported-pcs-edits-in-global-view",this.layer.title,L(i,o,this.view.viewingMode,0)),null;if(!a&&d)return c.getLogger(this).warn("unsupported-gcs-edits-in-local-view",this.layer.title,L(i,o,this.view.viewingMode,0)),null;if(!(v(i,o)||a&&o.isWebMercator&&i.isWGS84))return c.getLogger(this).warn("unsupported-mismatched-spatial-reference-edits",this.layer.title,L(i,o,this.view.viewingMode,1)),null;this._logWarningIfMaximumObjectsExceeded();const{objectIdField:h,globalIdField:l}=r,u=[h,...null!=l?[l]:[]],m=r.createQuery();m.where=this.layer.definitionExpression||"1=1",m.returnGeometry=!0,m.outFields=u,m.cacheHint=!0,m.returnZ=r.hasZ,m.returnM=r.hasM;const{assetMapFromAssetMapsJSON:g,extractMesh:p}=await import("../../../../rest/support/meshFeatureSet.js"),y=await this._executeBatchQuery(r,e,m,t),f=[];for(const c of y){if(!c.ok)continue;const e=c.value,{assetMaps:t,features:r,globalIdFieldName:n}=e;if(null==t)continue;const o=g(s,t);for(const a of r){const e=p(a,n,i,s,o),t=a;null!=e?(t.geometry=e,f.push(t)):t.geometry=null}}return f}_logWarningIfMaximumObjectsExceeded(){if(!this._warnMaximumChangedObjectsExceeded)return;this._warnMaximumChangedObjectsExceeded=!1;let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${O(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;e+=t?.loaded?` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:` (${this.layer.parsedUrl.path})`,c.getLogger(this).warn("#queryOverrides()",this.layer.title,`${e}.`)}async _executeBatchQuery(e,t,r,i){if(0===t.length)return[];const o=j(e);t=[...t].sort((e,t)=>e-t);const a=s(t,o).map(t=>{const s=r.clone();return s.objectIds=t,n(C(e,s,{signal:i}))});return Promise.all(a)}_processOverridesFromAssociatedLayer(e,t,r,{loadedAttributes:s,attributeData:i}){const n=this._associatedLayer;if(null==n)return;const o=n.objectIdField,a=r.map(t=>(t in i||(i[t]=new Array(e.length)),i[t])),d=new Map(s.map(e=>[e.name,e.index])),c=r.map(e=>d.get(e)),h=new Map(Array.from(e,(e,t)=>[e,t]));for(const l of t){const e=l.attributes[o];for(let t=0;t<r.length;t++){const s=c[t],i=h.get(e),n=l.attributes[r[t]];a[t][i]=n,this._cacheAttributeValue(e,s,n)}}}async _fetchChangedObjectIds(e){const r=this.layer;await r.load({signal:e}),this._geometryChangedObjectIds.clear(),this._attributeChangedObjectIds.clear();const{associatedLayer:s}=r;if(null==s||!s.capabilities?.operations?.supportsChangeTracking)return;const i=this._getFetchChangedObjectIdsServerGen();if(null==i)return;const n=s.layerId,a=this.is3DOFL,d={...s.customParameters,f:"json",returnIdsOnly:!0,layers:`[${n}]`,returnUpdates:!0,returnDeletes:a,returnInserts:a,layerServerGens:JSON.stringify([{id:n,serverGen:i}])};if(null!=s.apiKey&&(d.token=s.apiKey),a){const e=s.infoFor3D;d.fieldsToCompare=JSON.stringify({fields:[...Object.values(e.transformFieldRoles),e.sourceHashField]})}const h=await o(t(`${s.url}/extractChanges`,{method:"post",query:d,timeout:x,signal:e}));if(!h.ok){const e=this.layer.title;c.getLogger(this).warn("extractChanges:unavailable",e,": could not obtain edited features that are not cached in the scene service. Display of features may not be up to date with the latest edits. Consider re-caching the scene service.")}if(h.ok&&1===h.value.data?.edits?.length){const t=h.value.data.edits[0],r=t?.objectIds,s=t?.fieldUpdates,i=r?.adds??[],n=r?.updates??[],o=r?.deletes??[],d=[...i,...n,...o],c=a?[...i,...s??n,...o]:[],l=Math.min(this._maximumNumberOfEditOVerrides,d.length);l<d.length&&(this._warnMaximumChangedObjectsExceeded=!0);const u=d.sort((e,t)=>e-t);for(let e=0;e<l;++e){const t=u[e];this._attributeChangedObjectIds.add(t)}for(const e of c)this._geometryChangedObjectIds.add(e);for(;this._definitionExpressionDirty;)await this._queryAndAddGeometryOverrides(e)}}async _queryAndAddGeometryOverrides(e){this._definitionExpressionDirty=!1;const t=this.layer,{associatedLayer:r}=t;if(null!=r&&r.capabilities?.operations?.supportsChangeTracking&&this.is3DOFL&&this._geometryChangedObjectIds.size>0){const t=await this._queryGeometryOverridesFromAssociatedLayer(Array.from(this._geometryChangedObjectIds),e);if(null!=t)for(const e of t)null!=e.geometry&&this.updateGeometry(e.attributes[r.objectIdField],e.geometry)}}_getFetchChangedObjectIdsServerGen(){const e=this.layer;if(null!=e.serviceUpdateTimeStamp?.lastUpdate)return e.serviceUpdateTimeStamp.lastUpdate;const t=e.associatedLayer;return null!=t?.serverGens?.minServerGen?t.serverGens.minServerGen:null}async _lockFeatureIds(e){const t=this._featureIdLocks;let r=!0;for(;r;){const s=new Array;for(const r of e){const e=t.get(r);e&&s.push(e)}0===s.length?r=!1:await Promise.all(s)}const s=Promise.withResolvers(),i=s.promise;for(const n of e)t.set(n,i);return d(()=>{for(const r of e)t.delete(r);s.resolve()})}get test(){}};e([_({constructOnly:!0})],w.prototype,"view",void 0),e([_({constructOnly:!0})],w.prototype,"layer",void 0),e([_({readOnly:!0})],w.prototype,"is3DOFL",null),e([_()],w.prototype,"_interactiveEditingSessions",void 0),e([_({readOnly:!0})],w.prototype,"sortedGeometryChangedObjectIds",null),e([_({readOnly:!0})],w.prototype,"geometryOverrides",void 0),e([_()],w.prototype,"_clientGeometryCache",void 0),e([_()],w.prototype,"_associatedLayer",null),e([_({constructOnly:!0})],w.prototype,"memoryController",void 0),e([_()],w.prototype,"_attributeChangedObjectIds",void 0),e([_()],w.prototype,"_geometryChangedObjectIds",void 0),e([_()],w.prototype,"hasGeometryChanges",null),e([_()],w.prototype,"_pendingFetchChangedObjectIds",void 0),e([_()],w.prototype,"_pendingFetchAbortController",void 0),e([_()],w.prototype,"_applyGeometryOverridesTask",void 0),e([_()],w.prototype,"updating",null),e([_()],w.prototype,"isEmpty",null),w=e([b("esri.views.3d.layers.i3s.I3SOverrides")],w);class I{constructor(e,t){this.objectId=e,this._remove=t,this._updates=new Map,this._isActive=!0}getAttribute(e){return this._updates.get(e)}setAttribute(e,t){this.isActive&&this._updates.set(e,t)}remove(){this.isActive&&(this._isActive=!1,this._remove())}get isActive(){return this._isActive}}class F{constructor(e){this._cache=e}destroy(){this._cache.destroy()}put(e,t,r){this._cache.put(this._getKey(e,t),new A(r))}get(e,t){return this._cache.get(this._getKey(e,t))?.value}_getKey(e,t){return`${e}-${t}`}}class A{constructor(e){this.value=e,this.usedMemory="string"==typeof e?m(e):u}}const x=1e4,G=5e4;function L(e,t,r,s){return`Displaying the edits of a SceneLayer with a${0===s?e.isGeographic?" geographic ":" projected ":" "}spatial reference (wkid:${e.wkid}) in ${r} viewing mode${1===s?` with spatial reference (wkid:${t.wkid}) `:" "}is not supported. No geometry edits will be displayed for this layer.\nPlease consider re-caching the scene service or changing the ${0===s?"viewing mode":"view spatial reference"} to display edits.`}export{w as I3SOverrides};
@@ -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};