@arcgis/core 5.0.0-next.14 → 5.0.0-next.16

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 (366) hide show
  1. package/PopupTemplate.js +1 -1
  2. package/applications/Components/QuantityFormatter.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{5299ec59c86022ca37e2.js → 080268f78436a2f0d996.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{a6ee40dfc471d6612f3c.js → 1585298168c200d65c2f.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{34bb4852ebef0f529c96.js → 1a98e35837c6279fd8ee.js} +1 -1
  7. package/assets/esri/core/workers/chunks/5608e1eeec887295dc7c.js +1 -0
  8. package/assets/esri/core/workers/chunks/57262321c51096ef885f.js +1 -0
  9. package/assets/esri/core/workers/chunks/58d891779f04b6d12fc0.js +1 -0
  10. package/assets/esri/core/workers/chunks/{7c14f99e6cfff2a8ef4a.js → 5a7bb13ccb9188f90dfd.js} +1 -1
  11. package/assets/esri/core/workers/chunks/607beb12592f99871bf9.js +1 -0
  12. package/assets/esri/core/workers/chunks/71d9e9b0a7f8c0edd32d.js +1 -0
  13. package/assets/esri/core/workers/chunks/{8be16b03caa947ac7631.js → 79326e3ebd5081046f79.js} +1 -1
  14. package/assets/esri/core/workers/chunks/7c08c0824ad354177787.js +1 -0
  15. package/assets/esri/core/workers/chunks/{54c49a768147720c3c56.js → 8208dfa8f7fae7e616b9.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{d7755c4c8d1d3059efca.js → 847f4fc39100fac1df01.js} +1 -1
  17. package/assets/esri/core/workers/chunks/8b73db0f4d6714396eb0.js +1 -0
  18. package/assets/esri/core/workers/chunks/{9cdd087c43a601ec331d.js → 9a7f7de06dbc37661ffb.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{55adbd7481f8dfb1067e.js → a174c9f6bc687349e563.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{38fa50336983265c73a4.js → bc318b6fef192cee2a72.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{57806a01f33074b601e7.js → cdb4664fd59860ddeb5a.js} +1 -1
  22. package/assets/esri/core/workers/chunks/d98203c932a60f9f809d.js +1 -0
  23. package/assets/esri/core/workers/chunks/{5e08b19e6d7202ea38d7.js → db900e8949cc75e72b18.js} +1 -1
  24. package/assets/esri/core/workers/chunks/de831a9cb542a09db5c3.js +1 -0
  25. package/assets/esri/core/workers/chunks/{2166238a7ad63a2d43c7.js → e05ce6f91ca59e34da7c.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{f28ffda9a95c6568503d.js → e07dda45281439e6582e.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{d888ae5ac1810a486919.js → ff8752dbcb014ea66806.js} +1 -1
  28. package/chunks/GaussianSplat.glsl.js +2 -2
  29. package/config.js +1 -1
  30. package/copyright.txt +0 -60
  31. package/core/SetUtils.js +1 -1
  32. package/core/accessorSupport/ensureType.js +1 -1
  33. package/core/accessorSupport/extensions/serializableProperty/reader.js +1 -1
  34. package/core/workers/workerFactory.js +1 -1
  35. package/identity/IdentityModal.js +1 -1
  36. package/interfaces.d.ts +107 -11
  37. package/intl.js +1 -1
  38. package/kernel.js +1 -1
  39. package/layers/ImageryTileLayer.js +1 -1
  40. package/layers/ParquetLayer.js +1 -1
  41. package/layers/graphics/sources/ParquetSource.js +1 -1
  42. package/layers/graphics/sources/support/QueryTask.js +1 -1
  43. package/layers/mixins/ArcGISImageService.js +1 -1
  44. package/layers/mixins/ImageryTileMixin.js +1 -1
  45. package/layers/support/NumberFieldFormat.js +1 -1
  46. package/layers/support/Sublayer.js +1 -1
  47. package/layers/support/SubtypeSublayer.js +1 -1
  48. package/layers/support/featureLayerUtils.js +1 -1
  49. package/layers/support/fieldUtils.js +1 -1
  50. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  51. package/layers/support/rasterFunctionUtils.js +1 -1
  52. package/package.json +1 -1
  53. package/popup/content.js +1 -1
  54. package/portal/schemas/definitions.js +1 -1
  55. package/renderers/support/numberUtils.js +1 -1
  56. package/rest/geometryService.js +1 -1
  57. package/rest/geoprocessor.js +1 -1
  58. package/rest/imageService.js +1 -1
  59. package/rest/locator.js +1 -1
  60. package/rest/query.js +1 -1
  61. package/smartMapping/labels/bins.js +1 -1
  62. package/smartMapping/popup/support/clusterUtils.js +1 -1
  63. package/smartMapping/popup/support/utils.js +1 -1
  64. package/smartMapping/renderers/support/utils.js +1 -1
  65. package/support/BasemapStyle.js +1 -1
  66. package/support/actions/actionUtils.js +1 -1
  67. package/support/revision.js +1 -1
  68. package/symbols/support/svgUtils.js +1 -1
  69. package/tables/elements.js +1 -1
  70. package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
  71. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  72. package/views/2d/layers/graphics/GraphicStore.js +1 -1
  73. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
  74. package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
  75. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
  76. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  77. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  78. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  79. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  80. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  81. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  82. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  83. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  84. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +14 -32
  85. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +17 -0
  86. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +10 -0
  87. package/views/3d/webgl-engine/core/shaderLibrary/shading/PiUtils.glsl.js +1 -1
  88. package/views/3d/webgl-engine/core/shaderLibrary/util/FastApproximateTrigonometry.glsl.js +26 -0
  89. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  90. package/views/3d/webgl-engine/lib/TextureBackedBuffer/BufferManager.js +1 -1
  91. package/views/3d/webgl-engine/lib/TextureBackedBuffer/ManagedTextureBackedBuffer.js +1 -1
  92. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
  93. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFields.js +5 -0
  94. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +5 -0
  95. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  96. package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
  97. package/views/draw/support/Reshape.js +1 -1
  98. package/views/input/gamepad/GamepadInputDevice.js +1 -1
  99. package/views/input/gamepad/GamepadSource.js +1 -1
  100. package/views/interactive/SegmentLabels.js +1 -1
  101. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  102. package/views/interactive/tooltip/components/DrawHeaderActions.js +1 -1
  103. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  104. package/views/interactive/tooltip/components/TooltipField.js +1 -1
  105. package/views/interactive/tooltip/components/ValueByValue.js +1 -1
  106. package/views/interactive/tooltip/content/Fields.js +1 -1
  107. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  108. package/views/interactive/tooltip/content/TooltipContentDrawCircle.js +1 -1
  109. package/views/interactive/tooltip/content/TooltipContentDrawMesh.js +1 -1
  110. package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
  111. package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
  112. package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
  113. package/views/interactive/tooltip/content/TooltipContentDrawRectangle.js +1 -1
  114. package/views/interactive/tooltip/content/TooltipContentElevation.js +1 -1
  115. package/views/interactive/tooltip/content/TooltipContentExtentRotate.js +1 -1
  116. package/views/interactive/tooltip/content/TooltipContentExtentScale.js +1 -1
  117. package/views/interactive/tooltip/content/TooltipContentMovePoint.js +1 -1
  118. package/views/interactive/tooltip/content/TooltipContentReshapeEdgeOffset.js +1 -1
  119. package/views/interactive/tooltip/content/TooltipContentSelectedVertex.js +1 -1
  120. package/views/interactive/tooltip/content/TooltipContentTransformMesh.js +1 -1
  121. package/views/interactive/tooltip/content/TooltipContentTransformPoint.js +1 -1
  122. package/views/interactive/tooltip/content/TooltipContentTranslate.js +1 -1
  123. package/views/interactive/tooltip/content/TooltipContentTranslateVertex.js +1 -1
  124. package/views/interactive/tooltip/content/TooltipContentTranslateXY.js +1 -1
  125. package/views/interactive/tooltip/content/TooltipContentTranslateZ.js +1 -1
  126. package/views/overlay/BoxOverlayItem.js +1 -1
  127. package/views/overlay/CrosshairOverlayItem.js +1 -1
  128. package/views/overlay/OutlineOverlayItem.js +1 -1
  129. package/views/ui/UI.js +1 -1
  130. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  131. package/widgets/AreaMeasurement2D.js +1 -1
  132. package/widgets/AreaMeasurement3D.js +1 -1
  133. package/widgets/Attachments.js +1 -1
  134. package/widgets/Attribution.js +1 -1
  135. package/widgets/BasemapGallery.js +1 -1
  136. package/widgets/BasemapLayerList.js +1 -1
  137. package/widgets/BasemapToggle.js +1 -1
  138. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  139. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  140. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  141. package/widgets/BatchAttributeForm/inputs/InputBase.js +1 -1
  142. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  143. package/widgets/BatchAttributeForm.js +1 -1
  144. package/widgets/Bookmarks.js +1 -1
  145. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
  146. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
  147. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  148. package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
  149. package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
  150. package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
  151. package/widgets/BuildingExplorer.js +1 -1
  152. package/widgets/CatalogLayerList.js +1 -1
  153. package/widgets/Compass.js +1 -1
  154. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  155. package/widgets/CoordinateConversion.js +1 -1
  156. package/widgets/Daylight/support/SliderWithDropdown.js +1 -1
  157. package/widgets/Daylight.js +1 -1
  158. package/widgets/DirectLineMeasurement3D.js +1 -1
  159. package/widgets/DirectionalPad.js +1 -1
  160. package/widgets/Directions.js +1 -1
  161. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  162. package/widgets/DistanceMeasurement2D.js +1 -1
  163. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  164. package/widgets/Editor/EditorViewModel.js +1 -1
  165. package/widgets/Editor/MergeFeaturesWorkflow.js +1 -1
  166. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  167. package/widgets/Editor/SplitFeatureWorkflowData.js +1 -1
  168. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  169. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  170. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  171. package/widgets/Editor/UpdateWorkflow.js +1 -1
  172. package/widgets/Editor/Workflow.js +1 -1
  173. package/widgets/Editor/components/CreateFeaturesPanelContent.js +1 -1
  174. package/widgets/Editor/components/FeatureList.js +1 -1
  175. package/widgets/Editor/components/FooterActions.js +1 -1
  176. package/widgets/Editor/components/MergeFeaturesList.js +1 -1
  177. package/widgets/Editor/components/Notices.js +1 -1
  178. package/widgets/Editor/components/PanelContent.js +1 -1
  179. package/widgets/Editor/components/PanelToolbar.js +1 -1
  180. package/widgets/Editor/components/PendingFeatureList.js +1 -1
  181. package/widgets/Editor/components/Prompt.js +1 -1
  182. package/widgets/Editor/components/Settings.js +1 -1
  183. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  184. package/widgets/Editor/components/UploadDetails.js +1 -1
  185. package/widgets/Editor/components/workflowAdapters/pendingFeatureList/SplitFeatureWorkflowPendingFeatureListAdapter.js +1 -1
  186. package/widgets/Editor/support/errors.js +1 -1
  187. package/widgets/Editor.js +1 -1
  188. package/widgets/ElevationProfile/components/Legend.js +1 -1
  189. package/widgets/ElevationProfile/components/LegendItem.js +1 -1
  190. package/widgets/ElevationProfile/components/SettingsButton.js +1 -1
  191. package/widgets/ElevationProfile/components/Statistics.js +1 -1
  192. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  193. package/widgets/ElevationProfile.js +1 -1
  194. package/widgets/Expand.js +1 -1
  195. package/widgets/Feature/FeatureAttachments.js +1 -1
  196. package/widgets/Feature/FeatureContent.js +1 -1
  197. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  198. package/widgets/Feature/FeatureExpression.js +1 -1
  199. package/widgets/Feature/FeatureFields.js +1 -1
  200. package/widgets/Feature/FeatureMedia.js +1 -1
  201. package/widgets/Feature/FeatureRelationship.js +1 -1
  202. package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
  203. package/widgets/Feature/FeatureUtilityNetworkAssociations.js +1 -1
  204. package/widgets/Feature/support/FeatureContentMixin.js +1 -1
  205. package/widgets/Feature/support/FeatureElementInfo.js +1 -1
  206. package/widgets/Feature.js +1 -1
  207. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/AssociationDetails.js +1 -1
  208. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  209. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  210. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +1 -1
  211. package/widgets/FeatureForm/featureFormUtils.js +1 -1
  212. package/widgets/FeatureForm.js +1 -1
  213. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  214. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  215. package/widgets/FeatureTable.js +1 -1
  216. package/widgets/FeatureTemplates.js +1 -1
  217. package/widgets/Features/FeaturesDrillIn.js +1 -1
  218. package/widgets/Features.js +1 -1
  219. package/widgets/FloorFilter.js +1 -1
  220. package/widgets/FovOverlay.js +1 -1
  221. package/widgets/Fullscreen.js +1 -1
  222. package/widgets/Histogram.js +1 -1
  223. package/widgets/HistogramRangeSlider.js +1 -1
  224. package/widgets/Home.js +1 -1
  225. package/widgets/LayerList/LayerListItem.js +1 -1
  226. package/widgets/LayerList/ListItemPanel.js +1 -1
  227. package/widgets/LayerList.js +1 -1
  228. package/widgets/Legend/LegendViewModel.js +1 -1
  229. package/widgets/Legend/styles/card/CardView.js +1 -1
  230. package/widgets/Legend/styles/card/ColorRamp.js +1 -1
  231. package/widgets/Legend/styles/card/LegendElement.js +1 -1
  232. package/widgets/Legend/styles/card/SizeRamp.js +1 -1
  233. package/widgets/Legend/styles/card/UnivariateAboveAndBelowRamp.js +1 -1
  234. package/widgets/Legend/styles/card/UnivariateColorSizeRamp.js +1 -1
  235. package/widgets/Legend/styles/classic/ClassicView.js +1 -1
  236. package/widgets/Legend/styles/classic/ColorRamp.js +1 -1
  237. package/widgets/Legend/styles/classic/LegendElement.js +1 -1
  238. package/widgets/Legend/styles/classic/SizeRamp.js +1 -1
  239. package/widgets/Legend/styles/classic/UnivariateAboveAndBelowRamp.js +1 -1
  240. package/widgets/Legend/styles/classic/UnivariateColorSizeRamp.js +1 -1
  241. package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
  242. package/widgets/Legend/styles/support/sizeRampUtils.js +1 -1
  243. package/widgets/Legend/styles/support/univariateUtils.js +1 -1
  244. package/widgets/Legend/styles/support/utils.js +1 -1
  245. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  246. package/widgets/Legend/support/styleUtils.js +1 -1
  247. package/widgets/Legend/support/utils.js +1 -1
  248. package/widgets/Legend.js +1 -1
  249. package/widgets/LineOfSight.js +1 -1
  250. package/widgets/Locate/LocateViewModel.js +1 -1
  251. package/widgets/Locate.js +1 -1
  252. package/widgets/Measurement.js +1 -1
  253. package/widgets/NavigationToggle.js +1 -1
  254. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  255. package/widgets/OrientedImageryViewer/components/Alert.js +1 -1
  256. package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
  257. package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
  258. package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
  259. package/widgets/OrientedImageryViewer/components/ImageViewer.js +1 -1
  260. package/widgets/OrientedImageryViewer/components/NavigationActions.js +1 -1
  261. package/widgets/OrientedImageryViewer/components/NavigationSettings.js +1 -1
  262. package/widgets/OrientedImageryViewer/components/NavigationUI360.js +1 -1
  263. package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
  264. package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
  265. package/widgets/OrientedImageryViewer/components/VideoEnhancementTools.js +1 -1
  266. package/widgets/OrientedImageryViewer/mixins/ImageMeasurementMixin.js +1 -1
  267. package/widgets/OrientedImageryViewer/mixins/TriangulatedImageMeasurementMixin.js +1 -1
  268. package/widgets/OrientedImageryViewer.js +1 -1
  269. package/widgets/PanoramicVideoViewer.js +1 -1
  270. package/widgets/PanoramicViewer.js +1 -1
  271. package/widgets/Popup.js +1 -1
  272. package/widgets/Print/FileLink.js +1 -1
  273. package/widgets/Print.js +1 -1
  274. package/widgets/ScaleBar.js +1 -1
  275. package/widgets/ScaleRangeSlider.js +1 -1
  276. package/widgets/Search/SearchResultRenderer.js +1 -1
  277. package/widgets/Search/support/layerSearchUtils.js +1 -1
  278. package/widgets/Search.js +1 -1
  279. package/widgets/ShadowCast/components/DiscreteConfigurator.js +1 -1
  280. package/widgets/ShadowCast/components/DurationConfigurator.js +1 -1
  281. package/widgets/ShadowCast/components/ShadowTooltipContent.js +1 -1
  282. package/widgets/ShadowCast/components/ThresholdConfigurator.js +1 -1
  283. package/widgets/ShadowCast.js +1 -1
  284. package/widgets/Sketch/SketchViewModel.js +1 -1
  285. package/widgets/Sketch/support/ResponsiveToolbar/MeasuredContentGroup.js +1 -1
  286. package/widgets/Sketch/support/ResponsiveToolbar/OverflowGroup.js +1 -1
  287. package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
  288. package/widgets/Sketch/support/ResponsiveToolbar/SplitButton.js +1 -1
  289. package/widgets/Sketch.js +1 -1
  290. package/widgets/Slice.js +1 -1
  291. package/widgets/Slider.js +1 -1
  292. package/widgets/Spinner.js +1 -1
  293. package/widgets/Swipe.js +1 -1
  294. package/widgets/TableList/ListItemPanel.js +1 -1
  295. package/widgets/TableList.js +1 -1
  296. package/widgets/TimeSlider.js +1 -1
  297. package/widgets/TimeZoneLabel.js +1 -1
  298. package/widgets/Track.js +1 -1
  299. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js +1 -1
  300. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
  301. package/widgets/UtilityNetworkAssociations.js +1 -1
  302. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  303. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
  304. package/widgets/UtilityNetworkTrace.js +1 -1
  305. package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.js +1 -1
  306. package/widgets/UtilityNetworkValidateTopology.js +1 -1
  307. package/widgets/ValuePicker/ValuePickerCollection.js +1 -1
  308. package/widgets/ValuePicker/ValuePickerCombobox.js +1 -1
  309. package/widgets/ValuePicker/ValuePickerLabel.js +1 -1
  310. package/widgets/ValuePicker/ValuePickerSlider.js +1 -1
  311. package/widgets/ValuePicker.js +1 -1
  312. package/widgets/VideoPlayer/components/MetadataSection.js +1 -1
  313. package/widgets/VideoPlayer/components/PlayerActionsGroup.js +1 -1
  314. package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
  315. package/widgets/VideoPlayer/components/SettingsButton.js +1 -1
  316. package/widgets/VideoPlayer.js +1 -1
  317. package/widgets/Weather/LabeledSlider.js +1 -1
  318. package/widgets/Weather.js +1 -1
  319. package/widgets/Widget.js +1 -1
  320. package/widgets/Zoom.js +1 -1
  321. package/widgets/smartMapping/BinaryColorSizeSlider.js +1 -1
  322. package/widgets/smartMapping/ClassedColorSlider.js +1 -1
  323. package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
  324. package/widgets/smartMapping/ColorSizeSlider.js +1 -1
  325. package/widgets/smartMapping/ColorSlider.js +1 -1
  326. package/widgets/smartMapping/HeatmapSlider/HeatmapSliderViewModel.js +1 -1
  327. package/widgets/smartMapping/HeatmapSlider.js +1 -1
  328. package/widgets/smartMapping/OpacitySlider.js +1 -1
  329. package/widgets/smartMapping/SizeSlider.js +1 -1
  330. package/widgets/smartMapping/SmartMappingSliderBase.js +1 -1
  331. package/widgets/support/ColorPicker.js +1 -1
  332. package/widgets/support/FilterBuilder.js +1 -1
  333. package/widgets/support/FilterCondition.js +1 -1
  334. package/widgets/support/GridControls.js +1 -1
  335. package/widgets/support/Heading.js +1 -1
  336. package/widgets/support/ItemList.js +1 -1
  337. package/widgets/support/LabeledSwitch.js +1 -1
  338. package/widgets/support/MeasurementWidgetContent.js +1 -1
  339. package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
  340. package/widgets/support/SelectionList/LayerItem.js +1 -1
  341. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  342. package/widgets/support/SelectionList/selectionListUtils.js +1 -1
  343. package/widgets/support/SelectionList.js +1 -1
  344. package/widgets/support/SelectionToolbar.js +1 -1
  345. package/widgets/support/SketchTooltipControls.js +1 -1
  346. package/widgets/support/SnappingControls.js +1 -1
  347. package/widgets/support/TimezonePicker.js +1 -1
  348. package/widgets/support/UnitSelect.js +1 -1
  349. package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationList.js +1 -1
  350. package/widgets/support/UtilityNetworkAssociations/utils/formatPercentAlong.js +1 -1
  351. package/widgets/support/chartUtilsAm5.js +1 -1
  352. package/widgets/support/dateUtils.js +1 -1
  353. package/widgets/support/iconUtils.js +1 -1
  354. package/widgets/support/widget.js +1 -1
  355. package/assets/esri/core/workers/chunks/097e5deb51ee7e25e654.js +0 -1
  356. package/assets/esri/core/workers/chunks/3edffdb0e282ed562ac7.js +0 -1
  357. package/assets/esri/core/workers/chunks/8fc82fe1fcbcedf35400.js +0 -1
  358. package/assets/esri/core/workers/chunks/af5fc5d6c1d072a27df1.js +0 -1
  359. package/assets/esri/core/workers/chunks/bc29c29bfa5be3ebafb1.js +0 -1
  360. package/assets/esri/core/workers/chunks/c4dfd897bcab20dee43b.js +0 -1
  361. package/assets/esri/core/workers/chunks/c68935ed44eb0702a6ba.js +0 -1
  362. package/assets/esri/core/workers/chunks/db54552def7bc6cef9bd.js +0 -1
  363. package/assets/esri/core/workers/chunks/fd88e07cba5964f80e9e.js +0 -1
  364. package/views/interactive/editGeometry/CheckpointingEditGeometryOperations.js +0 -5
  365. package/views/interactive/editGeometry/operations/ReplayableAppendVertex.js +0 -5
  366. package/widgets/support/jsxFactory.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as i}from"tslib";import e from"../../../../Color.js";import"../../../../intl.js";import s from"../../../../core/Accessor.js";import{destroyHandle as t}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{mapCollection as a}from"../../../../core/mapCollectionUtils.js";import{watch as o,syncAndInitial as r,when as n,sync as l}from"../../../../core/reactiveUtils.js";import{pt2px as m}from"../../../../core/screenUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as d}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{LengthDimensionVisualization as p}from"./LengthDimensionVisualization.js";import{markerLineSizeFraction as f,offsetLineSizeFraction as u}from"./settings.js";import{LineMarkerMaterial as g}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{createStipplePatternSimple as M}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as _}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{onLocaleChange as y}from"../../../../intl/locale.js";import{fetchMessageBundle as w}from"../../../../intl/messages.js";let v=class extends s{get analysis(){return this.analysisViewData.analysis}get visible(){return this.analysisViewData.visible}constructor(i){super(i),this.loadingMessages=!1,this._messages=null}initialize(){const i=this.isDecoration;this._markerMaterial=new g({width:1,anchor:1,color:d,placement:"begin-end",worldSpace:!0,hideOnShortSegments:!0,hasTip:!0,renderOccluded:4,markerPrimitive:"triangle",isDecoration:i},this.view.state.isGlobal),this._dimensionLineMaterial=new _({width:1,color:d,renderOccluded:4,markerParameters:this._markerMaterial.parameters,isDecoration:i},this.view.state.isGlobal),this._offsetLineMaterial=new _({width:1,color:d,renderOccluded:4,stipplePattern:M(5),isDecoration:i},this.view.state.isGlobal),this._smallDimensionLineMaterial=new _({width:1,color:d,renderOccluded:4,isDecoration:i},this.view.state.isGlobal),this._smallOffsetLineMaterial=new _({width:1,color:d,renderOccluded:4,stipplePattern:M(5),isDecoration:i},this.view.state.isGlobal);const s=a(()=>this.analysisViewData.computations,({computation:i})=>this._createVisualization(i));this._dimensionVisualizations=s,this.addHandles([t(s),o(()=>e.toUnitRGBA(this.analysis.style.color),i=>{for(const e of this._lineMaterials())e.setParameters({color:i})},r),o(()=>this.analysis.style.lineSize,i=>{const e=m(i);this._markerMaterial.setParameters({width:e*f}),this._dimensionLineMaterial.setParameters({width:e,markerParameters:this._markerMaterial.parameters});const s=Math.max(e*u,1);this._offsetLineMaterial.setParameters({width:s})},r),o(()=>({camera:this.view.state.camera,style:L(this.analysis)}),({camera:i,style:e})=>{for(const{visualization:s}of this._dimensionVisualizations)s.updateCameraDependentElements(i,s.computation.geometry,e),s.updateLabelStyle(e)}),o(()=>this.visible,i=>{for(const{visualization:e}of this._dimensionVisualizations)e.visible=i})]),this.addHandles([y(()=>this._updateMessageBundle()),n(()=>!this.loadingMessages,()=>{for(const{visualization:i}of this._dimensionVisualizations)i.updateUnitsMessages(this._messages)},l)]),this._updateMessageBundle()}get testInfo(){}_createVisualization(i){const e=new p({analysis:this.analysis,computation:i,view:this.view,visible:this.visible,markerMaterial:this._markerMaterial,dimensionLineMaterial:this._dimensionLineMaterial,offsetLineMaterial:this._offsetLineMaterial,smallDimensionLineMaterial:this._smallDimensionLineMaterial,smallOffsetLineMaterial:this._smallOffsetLineMaterial,messages:this._messages,isDecoration:this.isDecoration});return{visualization:e,remove:()=>e.destroy()}}_lineMaterials(){return[this._markerMaterial,this._dimensionLineMaterial,this._offsetLineMaterial,this._smallDimensionLineMaterial,this._smallOffsetLineMaterial]}async _updateMessageBundle(){this.loadingMessages=!0;try{this._messages=await w("esri/core/t9n/Units")}finally{this.loadingMessages=!1}}};function L(i){const{fontSize:e,lineSize:s,textColor:t,textBackgroundColor:a}=i.style;return{fontSize:e,lineSize:s,textBackgroundColor:a.clone(),textColor:t.clone()}}i([c({constructOnly:!0})],v.prototype,"analysisViewData",void 0),i([c({constructOnly:!0,nonNullable:!0})],v.prototype,"view",void 0),i([c({constructOnly:!0})],v.prototype,"isDecoration",void 0),i([c()],v.prototype,"analysis",null),i([c()],v.prototype,"visible",null),i([c()],v.prototype,"loadingMessages",void 0),v=i([h("esri.views.3d.analysis.Dimension.DimensionVisualization")],v);export{v as DimensionVisualization};
5
+ import{__decorate as i}from"tslib";import e from"../../../../Color.js";import{onLocaleChange as s,fetchMessageBundle as t}from"../../../../intl.js";import a from"../../../../core/Accessor.js";import{destroyHandle as o}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{mapCollection as r}from"../../../../core/mapCollectionUtils.js";import{watch as n,syncAndInitial as l,when as m,sync as c}from"../../../../core/reactiveUtils.js";import{pt2px as h}from"../../../../core/screenUtils.js";import{property as d}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as u}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{LengthDimensionVisualization as f}from"./LengthDimensionVisualization.js";import{markerLineSizeFraction as M,offsetLineSizeFraction as g}from"./settings.js";import{LineMarkerMaterial as _}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{createStipplePatternSimple as y}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as w}from"../../webgl-engine/materials/RibbonLineMaterial.js";let v=class extends a{get analysis(){return this.analysisViewData.analysis}get visible(){return this.analysisViewData.visible}constructor(i){super(i),this.loadingMessages=!1,this._messages=null}initialize(){const i=this.isDecoration;this._markerMaterial=new _({width:1,anchor:1,color:u,placement:"begin-end",worldSpace:!0,hideOnShortSegments:!0,hasTip:!0,renderOccluded:4,markerPrimitive:"triangle",isDecoration:i},this.view.state.isGlobal),this._dimensionLineMaterial=new w({width:1,color:u,renderOccluded:4,markerParameters:this._markerMaterial.parameters,isDecoration:i},this.view.state.isGlobal),this._offsetLineMaterial=new w({width:1,color:u,renderOccluded:4,stipplePattern:y(5),isDecoration:i},this.view.state.isGlobal),this._smallDimensionLineMaterial=new w({width:1,color:u,renderOccluded:4,isDecoration:i},this.view.state.isGlobal),this._smallOffsetLineMaterial=new w({width:1,color:u,renderOccluded:4,stipplePattern:y(5),isDecoration:i},this.view.state.isGlobal);const t=r(()=>this.analysisViewData.computations,({computation:i})=>this._createVisualization(i));this._dimensionVisualizations=t,this.addHandles([o(t),n(()=>e.toUnitRGBA(this.analysis.style.color),i=>{for(const e of this._lineMaterials())e.setParameters({color:i})},l),n(()=>this.analysis.style.lineSize,i=>{const e=h(i);this._markerMaterial.setParameters({width:e*M}),this._dimensionLineMaterial.setParameters({width:e,markerParameters:this._markerMaterial.parameters});const s=Math.max(e*g,1);this._offsetLineMaterial.setParameters({width:s})},l),n(()=>({camera:this.view.state.camera,style:L(this.analysis)}),({camera:i,style:e})=>{for(const{visualization:s}of this._dimensionVisualizations)s.updateCameraDependentElements(i,s.computation.geometry,e),s.updateLabelStyle(e)}),n(()=>this.visible,i=>{for(const{visualization:e}of this._dimensionVisualizations)e.visible=i})]),this.addHandles([s(()=>this._updateMessageBundle()),m(()=>!this.loadingMessages,()=>{for(const{visualization:i}of this._dimensionVisualizations)i.updateUnitsMessages(this._messages)},c)]),this._updateMessageBundle()}get testInfo(){}_createVisualization(i){const e=new f({analysis:this.analysis,computation:i,view:this.view,visible:this.visible,markerMaterial:this._markerMaterial,dimensionLineMaterial:this._dimensionLineMaterial,offsetLineMaterial:this._offsetLineMaterial,smallDimensionLineMaterial:this._smallDimensionLineMaterial,smallOffsetLineMaterial:this._smallOffsetLineMaterial,messages:this._messages,isDecoration:this.isDecoration});return{visualization:e,remove:()=>e.destroy()}}_lineMaterials(){return[this._markerMaterial,this._dimensionLineMaterial,this._offsetLineMaterial,this._smallDimensionLineMaterial,this._smallOffsetLineMaterial]}async _updateMessageBundle(){this.loadingMessages=!0;try{this._messages=await t("esri/core/t9n/Units")}finally{this.loadingMessages=!1}}};function L(i){const{fontSize:e,lineSize:s,textColor:t,textBackgroundColor:a}=i.style;return{fontSize:e,lineSize:s,textBackgroundColor:a.clone(),textColor:t.clone()}}i([d({constructOnly:!0})],v.prototype,"analysisViewData",void 0),i([d({constructOnly:!0,nonNullable:!0})],v.prototype,"view",void 0),i([d({constructOnly:!0})],v.prototype,"isDecoration",void 0),i([d()],v.prototype,"analysis",null),i([d()],v.prototype,"visible",null),i([d()],v.prototype,"loadingMessages",void 0),v=i([p("esri.views.3d.analysis.Dimension.DimensionVisualization")],v);export{v as DimensionVisualization};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import"../../../../intl.js";import t from"../../../../core/Accessor.js";import{unitRGBAFromColor as i,multiplyOpacityToUnitRGBA as s,getContrast as n,multiplyOpacity as l}from"../../../../core/colorUtils.js";import"../../../../core/has.js";import{nextHighestPowerOfTen as o,deg2rad as r}from"../../../../core/mathUtils.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import{formatDecimal as c,formatImperialVerticalLength as h,formatImperialLength as u,formatMetricVerticalLength as d,formatMetricLength as m}from"../../../../core/quantityFormatUtils.js";import{toUnit as g}from"../../../../core/quantityUtils.js";import{watch as p,syncAndInitial as _,initial as v}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as b,createRenderScreenPointArray as L}from"../../../../core/screenUtils.js";import{adaptiveImperialLengthUnit as w,convertUnit as y}from"../../../../core/unitUtils.js";import{property as S}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{dot as E}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{h as V,g as z}from"../../../../chunks/vec32.js";import{create as A}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{renderScreenSpaceTangent as P}from"../../interactive/support/viewUtils.js";import{LabelVisualElement as j,mirrorPosition as M}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as C}from"../../interactive/visualElements/LineVisualElement.js";import{MeasurementArrowVisualElement as O}from"../../interactive/visualElements/MeasurementArrowVisualElement.js";import{RightAngleQuadVisualElement as x}from"../../interactive/visualElements/RightAngleQuadVisualElement.js";import{GeodesicSegment as D,EuclideanSegment as G}from"../../interactive/visualElements/support/Segment.js";import{createStipplePatternSimple as H}from"../../webgl-engine/materials/lineStippleUtils.js";import{geodesicDistanceThreshold as k}from"../../../support/geodesicMeasurementUtils.js";import{onLocaleChange as T}from"../../../../intl/locale.js";import{fetchMessageBundle as U}from"../../../../intl/messages.js";let R=class extends t{get _parameters(){const e=this.view.effectiveTheme,{accentColor:t,textColor:o}=e,r=i(t),a=s(t,.75),c=i(n(t)),h=n(o,160);return{accentColor:r,contrastColor:c,translucentAccentColor:a,triangleLineWidth:3,geodesicProjectionLineWidth:2,guideLineWidth:2,guideStippleLengthPixels:3,directLabelFontSize:16,horizontalLabelFontSize:12,verticalLabelFontSize:12,textColor:o,textBackgroundColor:l(h,.6),textCalloutColor:l(h,.5)}}get visible(){return this.analysisView.visible}get viewMode(){const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}=this.analysisView;if(null==e||null==t||e.equals(t))return 0;const i=this.analysisView.result;if(null==i)return 1;if("geodesic"===this.actualVisualizedMeasurement)return this._requiresGeodesicGuideAt(this._startPosition)||this._requiresGeodesicGuideAt(this._endPosition)?3:1;const{verticalDistance:s,horizontalDistance:n}=i,l=g(s,"meters").value,o=g(n,"meters").value;return Math.min(l/o,o/l)<this.triangleCollapseRatioThreshold?1:2}get actualVisualizedMeasurement(){const{measurementMode:e,result:t}=this.analysisView;switch(e){case 0:return null!=t&&g(t.horizontalDistance,"meters").value>k?"geodesic":"euclidean";case 1:return"euclidean";case 2:return"geodesic"}}get allowVisualElementsOrientationChange(){return null==this._triangleOrientationOverride}set allowVisualElementsOrientationChange(e){null==this._triangleOrientationOverride!==e&&(null==this._triangleOrientationOverride?this._triangleOrientationOverride=this._actualVisualElementsOrientation:this._triangleOrientationOverride=null)}get labels(){return"geodesic"===this.actualVisualizedMeasurement?{direct:null,horizontal:this._segmentLabel,vertical:this._verticalLabel}:{direct:this._segmentLabel,horizontal:this._horizontalLabel,vertical:this._verticalLabel}}constructor(e){super(e),this._segmentVisualElement=null,this._triangleVisualElement=null,this._rightAngleQuad=null,this._projectedGeodesicLine=null,this._geodesicStartHint=null,this._geodesicEndHint=null,this._segmentLabel=null,this._verticalLabel=null,this._horizontalLabel=null,this._startPosition=A(),this._endPosition=A(),this._cornerPosition=A(),this._startPositionAtSeaLevel=A(),this._endPositionAtSeaLevel=A(),this._triangleOrientationOverride=null,this.messages=null,this.loadingMessages=!0,this.visualElementOrientation=0,this.triangleCollapseRatioThreshold=.03}initialize(){const e={attached:!0,view:this.view,isDecoration:!0},{guideLineWidth:t,guideStippleLengthPixels:i,triangleLineWidth:s,geodesicProjectionLineWidth:n,directLabelFontSize:l,verticalLabelFontSize:o,horizontalLabelFontSize:r}=this._parameters;this._segmentVisualElement=new O({...e,geometry:null,renderOccluded:4}),this._triangleVisualElement=new C({...e,width:s,renderOccluded:4}),this._rightAngleQuad=new x({...e,renderOccluded:4});const a={...e,polygonOffset:!0,renderOccluded:4};this._projectedGeodesicLine=new C({...a,width:n,stipplePattern:H(i)}),this._geodesicStartHint=new C({...a,width:t,stipplePattern:H(i)}),this._geodesicEndHint=new C({...a,width:t,stipplePattern:H(i)}),this._segmentLabel=new j({...e,fontSize:l}),this._verticalLabel=new j({...e,fontSize:o}),this._horizontalLabel=new j({...e,fontSize:r}),this.addHandles([p(()=>{const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}=this.analysisView,i=this.view;return{view:i,camera:i.state.camera,viewMode:this.viewMode,elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,orientation:this._actualVisualElementsOrientation,visualizedMeasurement:this.actualVisualizedMeasurement,stripeLength:this._measurementArrowStripeLength}},e=>this._updateGeometryAndViewMode(e),_),p(()=>({visible:this.visible,viewMode:this.viewMode}),e=>this._updateVisualElementVisibility(e),_),p(()=>({text:this._labelsText,visualizedMeasurement:this.actualVisualizedMeasurement}),e=>this._updateLabelText(e),_),p(()=>({visible:this.visible,viewMode:this.viewMode}),e=>this._updateLabelVisibility(e),_),p(()=>this._measurementArrowStripeLength,e=>this._updateSegmentStripeLength(e),_),T(()=>this._updateMessageBundle()),p(()=>this._parameters,({textBackgroundColor:e,textCalloutColor:t,textColor:i,translucentAccentColor:s,accentColor:n,contrastColor:l})=>{const{_segmentLabel:o,_verticalLabel:r,_horizontalLabel:a,_triangleVisualElement:c,_rightAngleQuad:h,_projectedGeodesicLine:u,_geodesicStartHint:d,_geodesicEndHint:m,_segmentVisualElement:g}=this;o.backgroundColor=e,o.calloutColor=t,o.textColor=i,r.backgroundColor=e,r.calloutColor=t,r.textColor=i,a.backgroundColor=e,a.calloutColor=t,a.textColor=i,c.color=s,h.color=s,u.color=s,d.color=s,m.color=s,g.color=n,g.contrastColor=l},v)]),this._updateMessageBundle()}destroy(){this._segmentVisualElement=a(this._segmentVisualElement),this._triangleVisualElement=a(this._triangleVisualElement),this._rightAngleQuad=a(this._rightAngleQuad),this._projectedGeodesicLine=a(this._projectedGeodesicLine),this._geodesicStartHint=a(this._geodesicStartHint),this._geodesicEndHint=a(this._geodesicEndHint),this._segmentLabel=a(this._segmentLabel),this._verticalLabel=a(this._verticalLabel),this._horizontalLabel=a(this._horizontalLabel),this.set("view",null)}_updateVisualElementVisibility({visible:e,viewMode:t}){if(this._segmentVisualElement.visible=!1,this._triangleVisualElement.visible=!1,this._rightAngleQuad.visible=!1,this._projectedGeodesicLine.visible=!1,this._geodesicStartHint.visible=!1,this._geodesicEndHint.visible=!1,e)switch(t){case 0:break;case 1:this._segmentVisualElement.visible=!0;break;case 2:this._segmentVisualElement.visible=!0,this._triangleVisualElement.visible=!0,this._rightAngleQuad.visible=!0;break;case 3:this._segmentVisualElement.visible=!0,this._projectedGeodesicLine.visible=!0,this._geodesicStartHint.visible=!0,this._geodesicEndHint.visible=!0}}_updateGeometryAndViewMode({view:e,camera:t,viewMode:i,elevationAlignedStartPoint:s,elevationAlignedEndPoint:n,orientation:l,visualizedMeasurement:o,stripeLength:r}){const a=e.renderCoordsHelper;if(null==a||null==s||null==n||s.equals(n))return;let c=this._startPosition,h=this._endPosition;a.toRenderCoords(s,c),a.toRenderCoords(n,h);const u=1===l?1:-1,d=u*(a.getAltitude(h)-a.getAltitude(c));d<0&&(c=this._endPosition,h=this._startPosition);const m="geodesic"===o?new D(this._startPosition,this._endPosition,a.spatialReference):new G(this._startPosition,this._endPosition);switch(this._segmentVisualElement.geometry=m,this._updateSegmentStripeLength(r),i){case 1:this._updateSegment(m,l);break;case 2:this._updateSegmentAndTriangle({view:e,camera:t,segment:m,orientation:l,startPosition:c,endPosition:h,deltaSign:u,altitudeDelta:d});break;case 3:this._updateSegmentAndProjection({view:e,orientation:l,startPosition:c,endPosition:h})}}_updateSegment(e,t){this._segmentLabel.anchor=1===t?"top":"bottom",this._segmentLabel.geometry={type:"segment",segment:e,sampleLocation:"center"}}_updateSegmentAndTriangle({view:{renderCoordsHelper:e},camera:t,segment:i,orientation:s,startPosition:n,endPosition:l,deltaSign:o,altitudeDelta:r}){const a=this._cornerPosition;e.worldUpAtPosition(n,a),V(a,a,o*Math.abs(r)),z(a,a,n),this._triangleVisualElement.geometry=[[[n[0],n[1],n[2]],[a[0],a[1],a[2]],[l[0],l[1],l[2]]]],this._rightAngleQuad.geometry={previous:n,center:a,next:l};const c=new G(n,a),h=new G(a,l),u=F(n,l,a,s,t);u&&(this._segmentLabel.anchor=u.segment,this._segmentLabel.geometry={type:"segment",segment:i,sampleLocation:"center"},this._verticalLabel.geometry={type:"segment",segment:c,sampleLocation:"center"},this._verticalLabel.anchor=u.vertical,this._horizontalLabel.geometry={type:"segment",segment:h,sampleLocation:"center"},this._horizontalLabel.anchor=u.horizontal)}_updateSegmentAndProjection({view:{renderCoordsHelper:e},orientation:t,startPosition:i,endPosition:s}){e.setAltitude(this._startPositionAtSeaLevel,0,i),e.setAltitude(this._endPositionAtSeaLevel,0,s);const n=new D(this._startPositionAtSeaLevel,this._endPositionAtSeaLevel,e.spatialReference);this._projectedGeodesicLine.setGeometryFromSegment(n),this._geodesicStartHint.setGeometryFromSegment(new G(this._startPositionAtSeaLevel,i)),this._geodesicEndHint.setGeometryFromSegment(new G(this._endPositionAtSeaLevel,s)),this._segmentLabel.geometry={type:"segment",segment:n,sampleLocation:"center"},this._segmentLabel.anchor=1===t?"top":"bottom"}_updateLabelText({text:e,visualizedMeasurement:t}){null!=e?(this._segmentLabel.text="euclidean"===t?e.directDistance:e.horizontalDistance,this._horizontalLabel.text=e.horizontalDistance,this._verticalLabel.text=e.verticalDistance):(this._segmentLabel.text=null,this._horizontalLabel.text=null,this._verticalLabel.text=null),this.notifyChange("labels")}_updateLabelVisibility({visible:e,viewMode:t}){const i=this._segmentLabel,s=this._horizontalLabel,n=this._verticalLabel;if(i.visible=!1,s.visible=!1,n.visible=!1,e)switch(t){case 1:case 3:i.visible=!0;break;case 2:i.visible=!0,s.visible=!0,n.visible=!0}}get _labelsText(){if(this.destroyed)return null;const e=this.messages,t=this.analysisView.result;if(null==t||null==e)return null;const{directDistance:i,horizontalDistance:s,verticalDistance:n}=t,l=this.analysisView.unit,o=e=>({directDistance:"",horizontalDistance:"",verticalDistance:"",...e});switch(l){case"metric":return o({directDistance:i&&m(e,i),horizontalDistance:s&&m(e,s),verticalDistance:n&&d(e,n)});case"imperial":return o({directDistance:i&&u(e,i),horizontalDistance:s&&u(e,s),verticalDistance:n&&h(e,n)});default:return o({directDistance:i&&c(e,i,l),horizontalDistance:s&&c(e,s,l),verticalDistance:n&&c(e,n,l)})}}_updateSegmentStripeLength(e){const t=this._segmentVisualElement;null!=e?(t.stripeLength=e,t.stripesEnabled=!0):t.stripesEnabled=!1}get _actualVisualElementsOrientation(){if(null!=this._triangleOrientationOverride)return this._triangleOrientationOverride;const e=this.visualElementOrientation;return 0===e?this.view.state.camera.aboveGround?1:2:e}_requiresGeodesicGuideAt(e){const t=this.view;if(!t?.state)return!1;const i=t.state.camera,s=t.renderCoordsHelper;if(!s)return!1;const n=i.computeScreenPixelSizeAt(e);return s.getAltitude(e)/n>=10}get _measurementArrowStripeLength(){const{result:e,unit:t}=this.analysisView;if(null==e)return null;let i=null;const s=e.directDistance;switch(t){case"metric":i=s&&g(s,"meters");break;case"imperial":i=s&&g(s,w(s.value,s.unit));break;default:i=s&&g(s,t)}if(null==i)return null;return o(i.value/30)*y(1,i.unit,"meters")}_updateMessageBundle(){this.loadingMessages=!0,U("esri/core/t9n/Units").then(e=>{this.messages=e}).finally(()=>{this.loadingMessages=!1})}get testData(){}};function F(e,t,i,s,n){const l=P(e,i,n,B),o=P(e,t,n,I);if(null==l||null==o)return null;const r=n.projectToRenderScreen(i,q),a=n.projectToRenderScreen(t,W),c={segment:"bottom",horizontal:"top",vertical:null==r||null==a||r[0]<a[0]?"left":"right"};if(E(l,o)>=Q){const e=Math.sign(l[1])===Math.sign(o[1]);c.segment=e?M(c.vertical):c.vertical}else{const e=J;P(i,t,n,e),E(e,o)>=Q&&(c.segment=Math.sign(e[0])===Math.sign(o[0])?M(c.horizontal):c.horizontal)}if(2===s){const e=e=>"top"===e?"bottom":"top";c.segment=e(c.segment),c.horizontal=e(c.horizontal),c.vertical=e(c.vertical)}return c}e([S()],R.prototype,"_parameters",null),e([S()],R.prototype,"_triangleOrientationOverride",void 0),e([S()],R.prototype,"messages",void 0),e([S()],R.prototype,"view",void 0),e([S()],R.prototype,"analysis",void 0),e([S()],R.prototype,"analysisView",void 0),e([S()],R.prototype,"loadingMessages",void 0),e([S()],R.prototype,"visible",null),e([S()],R.prototype,"viewMode",null),e([S()],R.prototype,"actualVisualizedMeasurement",null),e([S()],R.prototype,"visualElementOrientation",void 0),e([S()],R.prototype,"triangleCollapseRatioThreshold",void 0),e([S()],R.prototype,"allowVisualElementsOrientationChange",null),e([S()],R.prototype,"labels",null),e([S()],R.prototype,"_labelsText",null),e([S()],R.prototype,"_actualVisualElementsOrientation",null),e([S()],R.prototype,"_measurementArrowStripeLength",null),R=e([f("esri.views.3d.analysis.DirectLineMeasurement.DirectLineMeasurementVisualization")],R);const Q=Math.cos(r(12)),q=b(),W=b(),B=L(),I=L(),J=L();export{R as DirectLineMeasurementVisualization};
5
+ import{__decorate as e}from"tslib";import{onLocaleChange as t,fetchMessageBundle as i}from"../../../../intl.js";import s from"../../../../core/Accessor.js";import{unitRGBAFromColor as n,multiplyOpacityToUnitRGBA as l,getContrast as o,multiplyOpacity as r}from"../../../../core/colorUtils.js";import"../../../../core/has.js";import{nextHighestPowerOfTen as a,deg2rad as c}from"../../../../core/mathUtils.js";import{destroyMaybe as h}from"../../../../core/maybe.js";import{formatDecimal as u,formatImperialVerticalLength as d,formatImperialLength as m,formatMetricVerticalLength as g,formatMetricLength as p}from"../../../../core/quantityFormatUtils.js";import{toUnit as _}from"../../../../core/quantityUtils.js";import{watch as v,syncAndInitial as b,initial as L}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as w,createRenderScreenPointArray as y}from"../../../../core/screenUtils.js";import{adaptiveImperialLengthUnit as S,convertUnit as f}from"../../../../core/unitUtils.js";import{property as E}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as V}from"../../../../core/accessorSupport/decorators/subclass.js";import{dot as z}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{h as A,g as P}from"../../../../chunks/vec32.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{renderScreenSpaceTangent as j}from"../../interactive/support/viewUtils.js";import{LabelVisualElement as C,mirrorPosition as O}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as x}from"../../interactive/visualElements/LineVisualElement.js";import{MeasurementArrowVisualElement as D}from"../../interactive/visualElements/MeasurementArrowVisualElement.js";import{RightAngleQuadVisualElement as G}from"../../interactive/visualElements/RightAngleQuadVisualElement.js";import{GeodesicSegment as H,EuclideanSegment as k}from"../../interactive/visualElements/support/Segment.js";import{createStipplePatternSimple as T}from"../../webgl-engine/materials/lineStippleUtils.js";import{geodesicDistanceThreshold as U}from"../../../support/geodesicMeasurementUtils.js";let R=class extends s{get _parameters(){const e=this.view.effectiveTheme,{accentColor:t,textColor:i}=e,s=n(t),a=l(t,.75),c=n(o(t)),h=o(i,160);return{accentColor:s,contrastColor:c,translucentAccentColor:a,triangleLineWidth:3,geodesicProjectionLineWidth:2,guideLineWidth:2,guideStippleLengthPixels:3,directLabelFontSize:16,horizontalLabelFontSize:12,verticalLabelFontSize:12,textColor:i,textBackgroundColor:r(h,.6),textCalloutColor:r(h,.5)}}get visible(){return this.analysisView.visible}get viewMode(){const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}=this.analysisView;if(null==e||null==t||e.equals(t))return 0;const i=this.analysisView.result;if(null==i)return 1;if("geodesic"===this.actualVisualizedMeasurement)return this._requiresGeodesicGuideAt(this._startPosition)||this._requiresGeodesicGuideAt(this._endPosition)?3:1;const{verticalDistance:s,horizontalDistance:n}=i,l=_(s,"meters").value,o=_(n,"meters").value;return Math.min(l/o,o/l)<this.triangleCollapseRatioThreshold?1:2}get actualVisualizedMeasurement(){const{measurementMode:e,result:t}=this.analysisView;switch(e){case 0:return null!=t&&_(t.horizontalDistance,"meters").value>U?"geodesic":"euclidean";case 1:return"euclidean";case 2:return"geodesic"}}get allowVisualElementsOrientationChange(){return null==this._triangleOrientationOverride}set allowVisualElementsOrientationChange(e){null==this._triangleOrientationOverride!==e&&(null==this._triangleOrientationOverride?this._triangleOrientationOverride=this._actualVisualElementsOrientation:this._triangleOrientationOverride=null)}get labels(){return"geodesic"===this.actualVisualizedMeasurement?{direct:null,horizontal:this._segmentLabel,vertical:this._verticalLabel}:{direct:this._segmentLabel,horizontal:this._horizontalLabel,vertical:this._verticalLabel}}constructor(e){super(e),this._segmentVisualElement=null,this._triangleVisualElement=null,this._rightAngleQuad=null,this._projectedGeodesicLine=null,this._geodesicStartHint=null,this._geodesicEndHint=null,this._segmentLabel=null,this._verticalLabel=null,this._horizontalLabel=null,this._startPosition=M(),this._endPosition=M(),this._cornerPosition=M(),this._startPositionAtSeaLevel=M(),this._endPositionAtSeaLevel=M(),this._triangleOrientationOverride=null,this.messages=null,this.loadingMessages=!0,this.visualElementOrientation=0,this.triangleCollapseRatioThreshold=.03}initialize(){const e={attached:!0,view:this.view,isDecoration:!0},{guideLineWidth:i,guideStippleLengthPixels:s,triangleLineWidth:n,geodesicProjectionLineWidth:l,directLabelFontSize:o,verticalLabelFontSize:r,horizontalLabelFontSize:a}=this._parameters;this._segmentVisualElement=new D({...e,geometry:null,renderOccluded:4}),this._triangleVisualElement=new x({...e,width:n,renderOccluded:4}),this._rightAngleQuad=new G({...e,renderOccluded:4});const c={...e,polygonOffset:!0,renderOccluded:4};this._projectedGeodesicLine=new x({...c,width:l,stipplePattern:T(s)}),this._geodesicStartHint=new x({...c,width:i,stipplePattern:T(s)}),this._geodesicEndHint=new x({...c,width:i,stipplePattern:T(s)}),this._segmentLabel=new C({...e,fontSize:o}),this._verticalLabel=new C({...e,fontSize:r}),this._horizontalLabel=new C({...e,fontSize:a}),this.addHandles([v(()=>{const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}=this.analysisView,i=this.view;return{view:i,camera:i.state.camera,viewMode:this.viewMode,elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,orientation:this._actualVisualElementsOrientation,visualizedMeasurement:this.actualVisualizedMeasurement,stripeLength:this._measurementArrowStripeLength}},e=>this._updateGeometryAndViewMode(e),b),v(()=>({visible:this.visible,viewMode:this.viewMode}),e=>this._updateVisualElementVisibility(e),b),v(()=>({text:this._labelsText,visualizedMeasurement:this.actualVisualizedMeasurement}),e=>this._updateLabelText(e),b),v(()=>({visible:this.visible,viewMode:this.viewMode}),e=>this._updateLabelVisibility(e),b),v(()=>this._measurementArrowStripeLength,e=>this._updateSegmentStripeLength(e),b),t(()=>this._updateMessageBundle()),v(()=>this._parameters,({textBackgroundColor:e,textCalloutColor:t,textColor:i,translucentAccentColor:s,accentColor:n,contrastColor:l})=>{const{_segmentLabel:o,_verticalLabel:r,_horizontalLabel:a,_triangleVisualElement:c,_rightAngleQuad:h,_projectedGeodesicLine:u,_geodesicStartHint:d,_geodesicEndHint:m,_segmentVisualElement:g}=this;o.backgroundColor=e,o.calloutColor=t,o.textColor=i,r.backgroundColor=e,r.calloutColor=t,r.textColor=i,a.backgroundColor=e,a.calloutColor=t,a.textColor=i,c.color=s,h.color=s,u.color=s,d.color=s,m.color=s,g.color=n,g.contrastColor=l},L)]),this._updateMessageBundle()}destroy(){this._segmentVisualElement=h(this._segmentVisualElement),this._triangleVisualElement=h(this._triangleVisualElement),this._rightAngleQuad=h(this._rightAngleQuad),this._projectedGeodesicLine=h(this._projectedGeodesicLine),this._geodesicStartHint=h(this._geodesicStartHint),this._geodesicEndHint=h(this._geodesicEndHint),this._segmentLabel=h(this._segmentLabel),this._verticalLabel=h(this._verticalLabel),this._horizontalLabel=h(this._horizontalLabel),this.set("view",null)}_updateVisualElementVisibility({visible:e,viewMode:t}){if(this._segmentVisualElement.visible=!1,this._triangleVisualElement.visible=!1,this._rightAngleQuad.visible=!1,this._projectedGeodesicLine.visible=!1,this._geodesicStartHint.visible=!1,this._geodesicEndHint.visible=!1,e)switch(t){case 0:break;case 1:this._segmentVisualElement.visible=!0;break;case 2:this._segmentVisualElement.visible=!0,this._triangleVisualElement.visible=!0,this._rightAngleQuad.visible=!0;break;case 3:this._segmentVisualElement.visible=!0,this._projectedGeodesicLine.visible=!0,this._geodesicStartHint.visible=!0,this._geodesicEndHint.visible=!0}}_updateGeometryAndViewMode({view:e,camera:t,viewMode:i,elevationAlignedStartPoint:s,elevationAlignedEndPoint:n,orientation:l,visualizedMeasurement:o,stripeLength:r}){const a=e.renderCoordsHelper;if(null==a||null==s||null==n||s.equals(n))return;let c=this._startPosition,h=this._endPosition;a.toRenderCoords(s,c),a.toRenderCoords(n,h);const u=1===l?1:-1,d=u*(a.getAltitude(h)-a.getAltitude(c));d<0&&(c=this._endPosition,h=this._startPosition);const m="geodesic"===o?new H(this._startPosition,this._endPosition,a.spatialReference):new k(this._startPosition,this._endPosition);switch(this._segmentVisualElement.geometry=m,this._updateSegmentStripeLength(r),i){case 1:this._updateSegment(m,l);break;case 2:this._updateSegmentAndTriangle({view:e,camera:t,segment:m,orientation:l,startPosition:c,endPosition:h,deltaSign:u,altitudeDelta:d});break;case 3:this._updateSegmentAndProjection({view:e,orientation:l,startPosition:c,endPosition:h})}}_updateSegment(e,t){this._segmentLabel.anchor=1===t?"top":"bottom",this._segmentLabel.geometry={type:"segment",segment:e,sampleLocation:"center"}}_updateSegmentAndTriangle({view:{renderCoordsHelper:e},camera:t,segment:i,orientation:s,startPosition:n,endPosition:l,deltaSign:o,altitudeDelta:r}){const a=this._cornerPosition;e.worldUpAtPosition(n,a),A(a,a,o*Math.abs(r)),P(a,a,n),this._triangleVisualElement.geometry=[[[n[0],n[1],n[2]],[a[0],a[1],a[2]],[l[0],l[1],l[2]]]],this._rightAngleQuad.geometry={previous:n,center:a,next:l};const c=new k(n,a),h=new k(a,l),u=F(n,l,a,s,t);u&&(this._segmentLabel.anchor=u.segment,this._segmentLabel.geometry={type:"segment",segment:i,sampleLocation:"center"},this._verticalLabel.geometry={type:"segment",segment:c,sampleLocation:"center"},this._verticalLabel.anchor=u.vertical,this._horizontalLabel.geometry={type:"segment",segment:h,sampleLocation:"center"},this._horizontalLabel.anchor=u.horizontal)}_updateSegmentAndProjection({view:{renderCoordsHelper:e},orientation:t,startPosition:i,endPosition:s}){e.setAltitude(this._startPositionAtSeaLevel,0,i),e.setAltitude(this._endPositionAtSeaLevel,0,s);const n=new H(this._startPositionAtSeaLevel,this._endPositionAtSeaLevel,e.spatialReference);this._projectedGeodesicLine.setGeometryFromSegment(n),this._geodesicStartHint.setGeometryFromSegment(new k(this._startPositionAtSeaLevel,i)),this._geodesicEndHint.setGeometryFromSegment(new k(this._endPositionAtSeaLevel,s)),this._segmentLabel.geometry={type:"segment",segment:n,sampleLocation:"center"},this._segmentLabel.anchor=1===t?"top":"bottom"}_updateLabelText({text:e,visualizedMeasurement:t}){null!=e?(this._segmentLabel.text="euclidean"===t?e.directDistance:e.horizontalDistance,this._horizontalLabel.text=e.horizontalDistance,this._verticalLabel.text=e.verticalDistance):(this._segmentLabel.text=null,this._horizontalLabel.text=null,this._verticalLabel.text=null),this.notifyChange("labels")}_updateLabelVisibility({visible:e,viewMode:t}){const i=this._segmentLabel,s=this._horizontalLabel,n=this._verticalLabel;if(i.visible=!1,s.visible=!1,n.visible=!1,e)switch(t){case 1:case 3:i.visible=!0;break;case 2:i.visible=!0,s.visible=!0,n.visible=!0}}get _labelsText(){if(this.destroyed)return null;const e=this.messages,t=this.analysisView.result;if(null==t||null==e)return null;const{directDistance:i,horizontalDistance:s,verticalDistance:n}=t,l=this.analysisView.unit,o=e=>({directDistance:"",horizontalDistance:"",verticalDistance:"",...e});switch(l){case"metric":return o({directDistance:i&&p(e,i),horizontalDistance:s&&p(e,s),verticalDistance:n&&g(e,n)});case"imperial":return o({directDistance:i&&m(e,i),horizontalDistance:s&&m(e,s),verticalDistance:n&&d(e,n)});default:return o({directDistance:i&&u(e,i,l),horizontalDistance:s&&u(e,s,l),verticalDistance:n&&u(e,n,l)})}}_updateSegmentStripeLength(e){const t=this._segmentVisualElement;null!=e?(t.stripeLength=e,t.stripesEnabled=!0):t.stripesEnabled=!1}get _actualVisualElementsOrientation(){if(null!=this._triangleOrientationOverride)return this._triangleOrientationOverride;const e=this.visualElementOrientation;return 0===e?this.view.state.camera.aboveGround?1:2:e}_requiresGeodesicGuideAt(e){const t=this.view;if(!t?.state)return!1;const i=t.state.camera,s=t.renderCoordsHelper;if(!s)return!1;const n=i.computeScreenPixelSizeAt(e);return s.getAltitude(e)/n>=10}get _measurementArrowStripeLength(){const{result:e,unit:t}=this.analysisView;if(null==e)return null;let i=null;const s=e.directDistance;switch(t){case"metric":i=s&&_(s,"meters");break;case"imperial":i=s&&_(s,S(s.value,s.unit));break;default:i=s&&_(s,t)}if(null==i)return null;return a(i.value/30)*f(1,i.unit,"meters")}_updateMessageBundle(){this.loadingMessages=!0,i("esri/core/t9n/Units").then(e=>{this.messages=e}).finally(()=>{this.loadingMessages=!1})}get testData(){}};function F(e,t,i,s,n){const l=j(e,i,n,B),o=j(e,t,n,I);if(null==l||null==o)return null;const r=n.projectToRenderScreen(i,q),a=n.projectToRenderScreen(t,W),c={segment:"bottom",horizontal:"top",vertical:null==r||null==a||r[0]<a[0]?"left":"right"};if(z(l,o)>=Q){const e=Math.sign(l[1])===Math.sign(o[1]);c.segment=e?O(c.vertical):c.vertical}else{const e=J;j(i,t,n,e),z(e,o)>=Q&&(c.segment=Math.sign(e[0])===Math.sign(o[0])?O(c.horizontal):c.horizontal)}if(2===s){const e=e=>"top"===e?"bottom":"top";c.segment=e(c.segment),c.horizontal=e(c.horizontal),c.vertical=e(c.vertical)}return c}e([E()],R.prototype,"_parameters",null),e([E()],R.prototype,"_triangleOrientationOverride",void 0),e([E()],R.prototype,"messages",void 0),e([E()],R.prototype,"view",void 0),e([E()],R.prototype,"analysis",void 0),e([E()],R.prototype,"analysisView",void 0),e([E()],R.prototype,"loadingMessages",void 0),e([E()],R.prototype,"visible",null),e([E()],R.prototype,"viewMode",null),e([E()],R.prototype,"actualVisualizedMeasurement",null),e([E()],R.prototype,"visualElementOrientation",void 0),e([E()],R.prototype,"triangleCollapseRatioThreshold",void 0),e([E()],R.prototype,"allowVisualElementsOrientationChange",null),e([E()],R.prototype,"labels",null),e([E()],R.prototype,"_labelsText",null),e([E()],R.prototype,"_actualVisualElementsOrientation",null),e([E()],R.prototype,"_measurementArrowStripeLength",null),R=e([V("esri.views.3d.analysis.DirectLineMeasurement.DirectLineMeasurementVisualization")],R);const Q=Math.cos(c(12)),q=w(),W=w(),B=y(),I=y(),J=y();export{R as DirectLineMeasurementVisualization};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../Color.js";import"../../../../intl.js";import{volumeMeasurementConfiguration as i}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import s from"../../../../core/Accessor.js";import{equals as o}from"../../../../core/arrayUtils.js";import{cyclicalPI as r}from"../../../../core/Cyclical.js";import{destroyMaybe as l}from"../../../../core/maybe.js";import{formatDecimal as n}from"../../../../core/quantityFormatUtils.js";import{watch as a,initial as c}from"../../../../core/reactiveUtils.js";import{adaptiveVolumeUnit as u}from"../../../../core/unitUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as h}from"../../../../chunks/earcut.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{j as g,n as y,e as _,i as f,f as v}from"../../../../chunks/vec32.js";import{create as j,fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as L}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as C}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as w}from"../../../../geometry/support/Indices.js";import{angleAroundAxis as G}from"../../../../geometry/support/vector.js";import{t as P}from"../../../../chunks/vec3.js";import V from"../../../../symbols/support/ElevationInfo.js";import{LabelVisualElement as R}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as F}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as A}from"../../interactive/visualElements/OutlineVisualElement.js";import{EuclideanSegment as O}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as x}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as D}from"../../layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{polygonToRenderInfo as M}from"../../support/renderInfoUtils/polygon.js";import{CutFillColor as S,VolumeGeometry as U}from"../../webgl-engine/lib/CutFillColor.js";import{createStipplePatternSimple as E}from"../../webgl-engine/materials/lineStippleUtils.js";import{onLocaleChange as B}from"../../../../intl/locale.js";import{fetchMessageBundle as N}from"../../../../intl/messages.js";import{substitute as H}from"../../../../intl/substitute.js";let T=class extends s{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}get updating(){return this.loadingMessages}get hasUnsupportedError(){const{error:e}=this.analysisViewData;return!!e&&["unsupported-coordinate-system","unsupported-layer-transparency"].includes(e.name)}constructor(e){super(e),this.unitsMessages=null,this.messages=null,this.loadingMessages=!0,this._elevationContext=x.fromElevationInfo(new V({mode:"absolute-height"})),this._extrusionHeight=i.targetElevationRange,this._projectionLines=[]}initialize(){const{view:e}=this,s={view:e,isDecoration:!0},o=i,r={...s,width:o.geometryOutlineWidth};this._elevationAlignedGeometry=new A({...r,isDraped:!0,color:t.toUnitRGBA(o.geometryOutlineColor)}),this._targetGeometry=new A(r);const l={...s,attached:!0,width:o.projectionLineWidth,renderOccluded:4,polygonOffset:!0},n={...l,stipplePattern:E(o.projectionLineStippleSize)},u=t.toUnitRGBA(o.cutProjectionLineColor),m=t.toUnitRGBA(o.fillProjectionLineColor);this._cutProjectionLines=new F({...l,color:u}),this._occludedCutProjectionLines=new F({...n,color:u}),this._fillProjectionLines=new F({...l,color:m}),this._occludedFillProjectionLines=new F({...n,color:m});const d={...s,attached:!0};this._cutVolumeLabel=new R(d),this._fillVolumeLabel=new R(d),this._cutFillRenderNode=new S({view:e,cutColor:o.cutColor,fillColor:o.fillColor,borderColor:o.geometryOutlineColor}),this.addHandles([a(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry}),({elevationAlignedGeometry:e,targetGeometry:t})=>{this._elevationAlignedGeometry.geometry=e,this._targetGeometry.geometry=t},c),a(()=>({interactive:this.analysisViewData.interactive,measureType:this.analysis.measureType,visible:this.visible}),({visible:e,interactive:t,measureType:i})=>{this._elevationAlignedGeometry.visible=e&&!t,this._targetGeometry.visible=e&&"cut-fill"===i},c),a(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry,visible:this.visible}),({elevationAlignedGeometry:e,targetGeometry:t,visible:i})=>this._updateProjectionLines(e,t,i),c),a(()=>({interactive:this.analysisViewData.interactive,accentColor:this.view.effectiveTheme.accentColor,hasResult:!!this.analysisViewData.result}),({interactive:e,accentColor:t,hasResult:i})=>{this._updateColors(e,t,i)},c),a(()=>this.analysisViewData.targetGeometry,()=>this._updateCutFillGeometry(),c),a(()=>this.visible&&!this.hasUnsupportedError,e=>this._updateCutFillVisibility(e),c),a(()=>{const{messages:e,unitsMessages:t,visible:i,analysisViewData:s}=this;return{labelAnchors:s.labelAnchors,effectiveDisplayUnits:s.effectiveDisplayUnits,messages:e,unitsMessages:t,result:s.result,visible:i&&!!s.result}},e=>this._updateLabels(e)),a(()=>this.view.state.camera,e=>this._updateProjectionLineOcclusion(e),c),B(()=>this._updateMessageBundle())]),this._updateMessageBundle()}destroy(){this._elevationAlignedGeometry=l(this._elevationAlignedGeometry),this._targetGeometry=l(this._targetGeometry),this._cutProjectionLines=l(this._cutProjectionLines),this._occludedCutProjectionLines=l(this._occludedCutProjectionLines),this._fillProjectionLines=l(this._fillProjectionLines),this._occludedFillProjectionLines=l(this._occludedFillProjectionLines),this._cutVolumeLabel=l(this._cutVolumeLabel),this._fillVolumeLabel=l(this._fillVolumeLabel),this._cutFillRenderNode.destroy()}_updateProjectionLines(e,t,i){if(this._cutProjectionLines.visible=i,this._occludedCutProjectionLines.visible=i,this._fillProjectionLines.visible=i,this._occludedFillProjectionLines.visible=i,!e||!t)return;const{renderCoordsHelper:s}=this.view,r=[],l=e.spatialReference,n=e.rings[0],a=n.length>1&&o(n[0],n[n.length-1]),c=n.length-(a?1:0);for(let o=0;o<c;++o){const e=n[o],i=g(j(),e[0],e[1],e[2]);s.toRenderCoords(i,l,i);const a=t.rings[0][o],c=g(j(),a[0],a[1],a[2]);s.toRenderCoords(c,l,c);const u=new O(i,c);r.push(u)}e.isClockwise(n)||r.reverse();const u=[],m=[],d=[],h=[],p=[],y=this.view.state.camera;for(let o=0;o<r.length;++o){const i=r[o],s=r[0===o?r.length-1:o-1],l=r[o===r.length-1?0:o+1],n=e.rings[0][o],a=t.rings[0][o],c=n[2]>a[2],g=new k(i,s,l,c);u.push(g),g.updateOccluded(y);const _=g.isOccluded;c?(_?d:m).push(i):(_?p:h).push(i)}this._projectionLines=u,this._cutProjectionLines.setGeometryFromSegments(m),this._occludedCutProjectionLines.setGeometryFromSegments(d),this._fillProjectionLines.setGeometryFromSegments(h),this._occludedFillProjectionLines.setGeometryFromSegments(p)}_updateProjectionLineOcclusion(e){const t=[],i=[],s=[],o=[];let r=!1,l=!1;for(const n of this._projectionLines){n.updateOccluded(e)&&(r||=n.isCut,l||=!n.isCut);const a=n.isOccluded;(n.isCut?a?i:t:a?o:s).push(n.segment)}l&&(this._fillProjectionLines.setGeometryFromSegments(s),this._occludedFillProjectionLines.setGeometryFromSegments(o)),r&&(this._cutProjectionLines.setGeometryFromSegments(t),this._occludedCutProjectionLines.setGeometryFromSegments(i))}_updateColors(e,s,o){const{geometryOutlineColor:r,cutColor:l,fillColor:n,cutColorMuted:a,fillColorMuted:c,cutProjectionLineColor:u,fillProjectionLineColor:m}=i;if(this._cutFillRenderNode.cutColor=o?l:a,this._cutFillRenderNode.fillColor=o?n:c,e){const e=t.toUnitRGBA(s);this._targetGeometry.color=e,this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e,this._fillProjectionLines.color=e,this._occludedFillProjectionLines.color=e,this._cutFillRenderNode.borderColor=s}else{this._targetGeometry.color=t.toUnitRGBA(r);const e=t.toUnitRGBA(o?u:a);this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e;const i=t.toUnitRGBA(o?m:c);this._fillProjectionLines.color=i,this._occludedFillProjectionLines.color=i,this._cutFillRenderNode.borderColor=r}}_updateLabels(e){const{labelDistance:t}=i,{effectiveDisplayUnits:s,labelAnchors:o,messages:r,unitsMessages:l,result:n,visible:a}=e;if(this._cutVolumeLabel.visible=a,this._fillVolumeLabel.visible=a,this._cutVolumeLabel.geometry=o.cut?{type:"point",point:o.cut,callout:{distance:t,offset:0}}:null,this._fillVolumeLabel.geometry=o.fill?{type:"point",point:o.fill,callout:{distance:-t,offset:0}}:null,null==n||null==r||null==l)return this._cutVolumeLabel.text="-",void(this._fillVolumeLabel.text="-");const c=s.volume,u=H(r.labels.cut,{volume:I(l,n.cutVolume,c)}),m=H(r.labels.fill,{volume:I(l,n.fillVolume,c)});this._cutVolumeLabel.text=u,this._fillVolumeLabel.text=m}_updateCutFillVisibility(e){e?this._cutFillRenderNode.enable():this._cutFillRenderNode.disable()}_updateCutFillGeometry(){const{renderCoordsHelper:e}=this.view,{targetGeometry:t}=this.analysisViewData;if(!t?.extent)return;const{center:i}=t.extent,s=b(i.x,i.y,0),o=j();e.toRenderCoords(s,t.spatialReference,o);const r=this._getExtrudedVolumes(t,this._extrusionHeight,s),l=this._getExtrudedVolumes(t,-this._extrusionHeight,s);this._cutFillRenderNode.updateGeometries(r,l,o)}_getExtrudedVolumes(e,t,i){const{renderCoordsHelper:s,spatialReference:o,elevationProvider:r}=this.view,l=j(),n=1===s.viewingMode;n||s.worldUpAtPosition([0,0,0],l);const a=M(e,r,s,this._elevationContext),{polygons:c,mapPositions:u,position:m}=a,d=c[0],g=d.count,y=h(d.mapPositions,d.holeIndices,3),_=y.length,f=6*g,v=w(f+_),b=w(_),G=C(3*f),V=C(3*f);D(m,u,y,d,G,null,V,null,v,b,t,l,n);const R=p(),F=p();return L(o,i,R,s.spatialReference),F[12]=-R[12],F[13]=-R[13],F[14]=-R[14],P(G,G,F),new U(G,b,v,V)}async _updateMessageBundle(){this.loadingMessages=!0;try{this.unitsMessages=await N("esri/core/t9n/Units"),this.messages=await N("esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis")}finally{this.loadingMessages=!1}}};function I(e,t,s){if(!t||!e)return null;const o=u(t.value,t.unit,s),r=i.labelPrecisions[o];return n(e,t,o,r)}e([m({constructOnly:!0})],T.prototype,"view",void 0),e([m({constructOnly:!0})],T.prototype,"analysis",void 0),e([m({constructOnly:!0})],T.prototype,"analysisViewData",void 0),e([m()],T.prototype,"unitsMessages",void 0),e([m()],T.prototype,"messages",void 0),e([m()],T.prototype,"loadingMessages",void 0),e([m({readOnly:!0})],T.prototype,"visible",null),e([m()],T.prototype,"updating",null),e([m()],T.prototype,"hasUnsupportedError",null),T=e([d("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillVisualization")],T);class k{constructor(e,t,i,s){this.segment=e,this.previous=t,this.next=i,this.isCut=s,this._isOccluded=!1,this._n1=j(),this._n2=j();const o=y(z,_(z,e.endRenderSpace,e.startRenderSpace));y(this._n1,f(this._n1,o,y(W,_(W,t.startRenderSpace,e.startRenderSpace)))),y(this._n2,f(this._n2,o,y(W,_(W,e.startRenderSpace,i.startRenderSpace)))),this._isConvex=r.normalize(G(this._n1,this._n2,o))<0}get isOccluded(){return this._isOccluded}updateOccluded(e){_(z,this.segment.startRenderSpace,e.eye);const t=v(this._n1,z)<0,i=v(this._n2,z)<0,s=this._isOccluded;return this._isOccluded=this._isConvex?t&&i:t||i,this._isOccluded!==s}}const z=j(),W=j();export{T as VolumeMeasurementCutFillVisualization};
5
+ import{__decorate as e}from"tslib";import t from"../../../../Color.js";import{onLocaleChange as i,substitute as s,fetchMessageBundle as o}from"../../../../intl.js";import{volumeMeasurementConfiguration as r}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import l from"../../../../core/Accessor.js";import{equals as n}from"../../../../core/arrayUtils.js";import{cyclicalPI as a}from"../../../../core/Cyclical.js";import{destroyMaybe as c}from"../../../../core/maybe.js";import{formatDecimal as u}from"../../../../core/quantityFormatUtils.js";import{watch as m,initial as d}from"../../../../core/reactiveUtils.js";import{adaptiveVolumeUnit as h}from"../../../../core/unitUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as g}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as y}from"../../../../chunks/earcut.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{j as f,n as v,e as j,i as L,f as b}from"../../../../chunks/vec32.js";import{create as C,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as G}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as P}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as V}from"../../../../geometry/support/Indices.js";import{angleAroundAxis as R}from"../../../../geometry/support/vector.js";import{t as F}from"../../../../chunks/vec3.js";import A from"../../../../symbols/support/ElevationInfo.js";import{LabelVisualElement as O}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as x}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as D}from"../../interactive/visualElements/OutlineVisualElement.js";import{EuclideanSegment as M}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as S}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as U}from"../../layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{polygonToRenderInfo as E}from"../../support/renderInfoUtils/polygon.js";import{CutFillColor as B,VolumeGeometry as N}from"../../webgl-engine/lib/CutFillColor.js";import{createStipplePatternSimple as H}from"../../webgl-engine/materials/lineStippleUtils.js";let T=class extends l{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}get updating(){return this.loadingMessages}get hasUnsupportedError(){const{error:e}=this.analysisViewData;return!!e&&["unsupported-coordinate-system","unsupported-layer-transparency"].includes(e.name)}constructor(e){super(e),this.unitsMessages=null,this.messages=null,this.loadingMessages=!0,this._elevationContext=S.fromElevationInfo(new A({mode:"absolute-height"})),this._extrusionHeight=r.targetElevationRange,this._projectionLines=[]}initialize(){const{view:e}=this,s={view:e,isDecoration:!0},o=r,l={...s,width:o.geometryOutlineWidth};this._elevationAlignedGeometry=new D({...l,isDraped:!0,color:t.toUnitRGBA(o.geometryOutlineColor)}),this._targetGeometry=new D(l);const n={...s,attached:!0,width:o.projectionLineWidth,renderOccluded:4,polygonOffset:!0},a={...n,stipplePattern:H(o.projectionLineStippleSize)},c=t.toUnitRGBA(o.cutProjectionLineColor),u=t.toUnitRGBA(o.fillProjectionLineColor);this._cutProjectionLines=new x({...n,color:c}),this._occludedCutProjectionLines=new x({...a,color:c}),this._fillProjectionLines=new x({...n,color:u}),this._occludedFillProjectionLines=new x({...a,color:u});const h={...s,attached:!0};this._cutVolumeLabel=new O(h),this._fillVolumeLabel=new O(h),this._cutFillRenderNode=new B({view:e,cutColor:o.cutColor,fillColor:o.fillColor,borderColor:o.geometryOutlineColor}),this.addHandles([m(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry}),({elevationAlignedGeometry:e,targetGeometry:t})=>{this._elevationAlignedGeometry.geometry=e,this._targetGeometry.geometry=t},d),m(()=>({interactive:this.analysisViewData.interactive,measureType:this.analysis.measureType,visible:this.visible}),({visible:e,interactive:t,measureType:i})=>{this._elevationAlignedGeometry.visible=e&&!t,this._targetGeometry.visible=e&&"cut-fill"===i},d),m(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry,visible:this.visible}),({elevationAlignedGeometry:e,targetGeometry:t,visible:i})=>this._updateProjectionLines(e,t,i),d),m(()=>({interactive:this.analysisViewData.interactive,accentColor:this.view.effectiveTheme.accentColor,hasResult:!!this.analysisViewData.result}),({interactive:e,accentColor:t,hasResult:i})=>{this._updateColors(e,t,i)},d),m(()=>this.analysisViewData.targetGeometry,()=>this._updateCutFillGeometry(),d),m(()=>this.visible&&!this.hasUnsupportedError,e=>this._updateCutFillVisibility(e),d),m(()=>{const{messages:e,unitsMessages:t,visible:i,analysisViewData:s}=this;return{labelAnchors:s.labelAnchors,effectiveDisplayUnits:s.effectiveDisplayUnits,messages:e,unitsMessages:t,result:s.result,visible:i&&!!s.result}},e=>this._updateLabels(e)),m(()=>this.view.state.camera,e=>this._updateProjectionLineOcclusion(e),d),i(()=>this._updateMessageBundle())]),this._updateMessageBundle()}destroy(){this._elevationAlignedGeometry=c(this._elevationAlignedGeometry),this._targetGeometry=c(this._targetGeometry),this._cutProjectionLines=c(this._cutProjectionLines),this._occludedCutProjectionLines=c(this._occludedCutProjectionLines),this._fillProjectionLines=c(this._fillProjectionLines),this._occludedFillProjectionLines=c(this._occludedFillProjectionLines),this._cutVolumeLabel=c(this._cutVolumeLabel),this._fillVolumeLabel=c(this._fillVolumeLabel),this._cutFillRenderNode.destroy()}_updateProjectionLines(e,t,i){if(this._cutProjectionLines.visible=i,this._occludedCutProjectionLines.visible=i,this._fillProjectionLines.visible=i,this._occludedFillProjectionLines.visible=i,!e||!t)return;const{renderCoordsHelper:s}=this.view,o=[],r=e.spatialReference,l=e.rings[0],a=l.length>1&&n(l[0],l[l.length-1]),c=l.length-(a?1:0);for(let n=0;n<c;++n){const e=l[n],i=f(C(),e[0],e[1],e[2]);s.toRenderCoords(i,r,i);const a=t.rings[0][n],c=f(C(),a[0],a[1],a[2]);s.toRenderCoords(c,r,c);const u=new M(i,c);o.push(u)}e.isClockwise(l)||o.reverse();const u=[],m=[],d=[],h=[],p=[],g=this.view.state.camera;for(let n=0;n<o.length;++n){const i=o[n],s=o[0===n?o.length-1:n-1],r=o[n===o.length-1?0:n+1],l=e.rings[0][n],a=t.rings[0][n],c=l[2]>a[2],y=new k(i,s,r,c);u.push(y),y.updateOccluded(g);const _=y.isOccluded;c?(_?d:m).push(i):(_?p:h).push(i)}this._projectionLines=u,this._cutProjectionLines.setGeometryFromSegments(m),this._occludedCutProjectionLines.setGeometryFromSegments(d),this._fillProjectionLines.setGeometryFromSegments(h),this._occludedFillProjectionLines.setGeometryFromSegments(p)}_updateProjectionLineOcclusion(e){const t=[],i=[],s=[],o=[];let r=!1,l=!1;for(const n of this._projectionLines){n.updateOccluded(e)&&(r||=n.isCut,l||=!n.isCut);const a=n.isOccluded;(n.isCut?a?i:t:a?o:s).push(n.segment)}l&&(this._fillProjectionLines.setGeometryFromSegments(s),this._occludedFillProjectionLines.setGeometryFromSegments(o)),r&&(this._cutProjectionLines.setGeometryFromSegments(t),this._occludedCutProjectionLines.setGeometryFromSegments(i))}_updateColors(e,i,s){const{geometryOutlineColor:o,cutColor:l,fillColor:n,cutColorMuted:a,fillColorMuted:c,cutProjectionLineColor:u,fillProjectionLineColor:m}=r;if(this._cutFillRenderNode.cutColor=s?l:a,this._cutFillRenderNode.fillColor=s?n:c,e){const e=t.toUnitRGBA(i);this._targetGeometry.color=e,this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e,this._fillProjectionLines.color=e,this._occludedFillProjectionLines.color=e,this._cutFillRenderNode.borderColor=i}else{this._targetGeometry.color=t.toUnitRGBA(o);const e=t.toUnitRGBA(s?u:a);this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e;const i=t.toUnitRGBA(s?m:c);this._fillProjectionLines.color=i,this._occludedFillProjectionLines.color=i,this._cutFillRenderNode.borderColor=o}}_updateLabels(e){const{labelDistance:t}=r,{effectiveDisplayUnits:i,labelAnchors:o,messages:l,unitsMessages:n,result:a,visible:c}=e;if(this._cutVolumeLabel.visible=c,this._fillVolumeLabel.visible=c,this._cutVolumeLabel.geometry=o.cut?{type:"point",point:o.cut,callout:{distance:t,offset:0}}:null,this._fillVolumeLabel.geometry=o.fill?{type:"point",point:o.fill,callout:{distance:-t,offset:0}}:null,null==a||null==l||null==n)return this._cutVolumeLabel.text="-",void(this._fillVolumeLabel.text="-");const u=i.volume,m=s(l.labels.cut,{volume:I(n,a.cutVolume,u)}),d=s(l.labels.fill,{volume:I(n,a.fillVolume,u)});this._cutVolumeLabel.text=m,this._fillVolumeLabel.text=d}_updateCutFillVisibility(e){e?this._cutFillRenderNode.enable():this._cutFillRenderNode.disable()}_updateCutFillGeometry(){const{renderCoordsHelper:e}=this.view,{targetGeometry:t}=this.analysisViewData;if(!t?.extent)return;const{center:i}=t.extent,s=w(i.x,i.y,0),o=C();e.toRenderCoords(s,t.spatialReference,o);const r=this._getExtrudedVolumes(t,this._extrusionHeight,s),l=this._getExtrudedVolumes(t,-this._extrusionHeight,s);this._cutFillRenderNode.updateGeometries(r,l,o)}_getExtrudedVolumes(e,t,i){const{renderCoordsHelper:s,spatialReference:o,elevationProvider:r}=this.view,l=C(),n=1===s.viewingMode;n||s.worldUpAtPosition([0,0,0],l);const a=E(e,r,s,this._elevationContext),{polygons:c,mapPositions:u,position:m}=a,d=c[0],h=d.count,p=y(d.mapPositions,d.holeIndices,3),g=p.length,f=6*h,v=V(f+g),j=V(g),L=P(3*f),b=P(3*f);U(m,u,p,d,L,null,b,null,v,j,t,l,n);const w=_(),R=_();return G(o,i,w,s.spatialReference),R[12]=-w[12],R[13]=-w[13],R[14]=-w[14],F(L,L,R),new N(L,j,v,b)}async _updateMessageBundle(){this.loadingMessages=!0;try{this.unitsMessages=await o("esri/core/t9n/Units"),this.messages=await o("esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis")}finally{this.loadingMessages=!1}}};function I(e,t,i){if(!t||!e)return null;const s=h(t.value,t.unit,i),o=r.labelPrecisions[s];return u(e,t,s,o)}e([p({constructOnly:!0})],T.prototype,"view",void 0),e([p({constructOnly:!0})],T.prototype,"analysis",void 0),e([p({constructOnly:!0})],T.prototype,"analysisViewData",void 0),e([p()],T.prototype,"unitsMessages",void 0),e([p()],T.prototype,"messages",void 0),e([p()],T.prototype,"loadingMessages",void 0),e([p({readOnly:!0})],T.prototype,"visible",null),e([p()],T.prototype,"updating",null),e([p()],T.prototype,"hasUnsupportedError",null),T=e([g("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillVisualization")],T);class k{constructor(e,t,i,s){this.segment=e,this.previous=t,this.next=i,this.isCut=s,this._isOccluded=!1,this._n1=C(),this._n2=C();const o=v(z,j(z,e.endRenderSpace,e.startRenderSpace));v(this._n1,L(this._n1,o,v(W,j(W,t.startRenderSpace,e.startRenderSpace)))),v(this._n2,L(this._n2,o,v(W,j(W,e.startRenderSpace,i.startRenderSpace)))),this._isConvex=a.normalize(R(this._n1,this._n2,o))<0}get isOccluded(){return this._isOccluded}updateOccluded(e){j(z,this.segment.startRenderSpace,e.eye);const t=b(this._n1,z)<0,i=b(this._n2,z)<0,s=this._isOccluded;return this._isOccluded=this._isConvex?t&&i:t||i,this._isOccluded!==s}}const z=C(),W=C();export{T as VolumeMeasurementCutFillVisualization};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{initial as r,watch as o,when as n}from"../../../core/reactiveUtils.js";import{schedule as a}from"../../../core/scheduling.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as d,invert as h}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m,IDENTITY as u}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as f}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{o as g,g as b,a as y,f as _}from"../../../chunks/vec32.js";import{fromArray as w,clone as v,create as j}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as x}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as M}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as C}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as O}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as T}from"../../../geometry/projection/projectVectorToVector.js";import{create as U}from"../../../geometry/support/aaBoundingRect.js";import{BufferViewVec2f as P,BufferViewVec4f as H,BufferViewVec4u8 as S,BufferViewVec4u16 as E,BufferViewVec3f as R,BufferViewVec3u8 as V,BufferViewVec3u16 as A,BufferViewInt16 as k,BufferViewUint32 as F,BufferViewUint16 as I}from"../../../geometry/support/buffer/BufferView.js";import D from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as L}from"../../../support/elevationInfoUtils.js";import{toWasmModification as B}from"./I3SMeshWorkerHandle.js";import{LayerView3D as G}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as z}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as N,removeLayerViewFromWasm as W,getLyr3DWasm as $}from"./Lyr3DWasm.js";import{LayerElevationProvider as q}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as J,wrapModeConversion as K,lyr3DTypeToByteSize as Q,alphaModeConversion as X,faceCullingConversion as Y}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as Z}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as ee}from"../support/ElevationRange.js";import{toBoundingRect as te}from"../support/extentUtils.js";import{Obb as ie,compute as se}from"../support/orientedBoundingBox.js";import{ObjectParameters as re}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as oe,createVertexBufferLayout as ne,SourceGeometry as ae}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as le}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as ce}from"../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as de}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as he}from"../webgl-engine/lib/Attribute.js";import{compressAndTransformNormals as me}from"../webgl-engine/lib/Normals.js";import{Texture as ue}from"../webgl-engine/lib/Texture.js";import{writeAttribute as pe,writeBufferVec2 as fe}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import ge from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as be,isInEffectiveScaleRange as ye}from"../../support/layerViewUtils.js";import{TextureCompressionTracker as _e}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as we}from"../../../webscene/support/AlphaCutoff.js";class ve{constructor(e,t,i,s,r,o,n){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=n,this.isVisible=!1,this.usedMemory=this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage;const a=j();n?.getCenter(a),this._obbCenter=a,this._obbRadiusSquared=n?n?.radius**2:0}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const i=y(je,this._obbCenter,e),s=_(i,t);return _(i,i)-s*s<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}}const je=j();function xe(e){return Math.round(e/1048.576)/1e3}let Me=class extends(G(ge)){get hasModifications(){return this._modifications&&this._modifications.length>0}constructor(e){super(e),this.type="integrated-mesh-3dtiles",this._compressionTracker=new _e,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._suspendedHandle=null,this._dbgFlags=new Set,this._memCache=e.view.resourceController.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e))}initialize(){this._dbgFlags.add(3),this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),r),!this._canProjectWithoutEngine())throw be("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=N(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new Z(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),r),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),r),this._elevationProvider=new q({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),e.elevationProvider.register(1,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([o(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=o(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),r)});this.addResolvingPromise(t),this._replacesTerrain&&this.addHandles(n(()=>this.view.map.ground.opacity,()=>{this._opacityChange()}))}get _replacesTerrain(){return this.layer.replacesTerrain&&!!this.view.map.basemap?.groundLayers.includes(this.layer)}get opacity(){return this.fullOpacity*(this._replacesTerrain?this.view.map.ground.opacity:1)}_opacityChange(){const{opacity:e}=this;this.forEachComponentObject(t=>{this._collection.getMaterial(t).objectOpacity=e})}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!0}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),W(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._usedMemory=this._cacheMemory=0,this._memCache.destroy(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}_modificationsChanged(){const e=this.layer.spatialReference,t=B(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t,e.wkid)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=U();this._layerClippingArea=te(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=a(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.forEachComponentObject(t=>this._collection.getMaterial(t).commonMaterialParameters.hasSlicePlane=e)}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,L(e))}get _wasm(){return $(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return ye(this.layer.effectiveScaleRange,this.view.scale)}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isVisible?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new z(this.usedMemory,r,o,xe(t),xe(e),xe(s),xe(i))}_canProjectWithoutEngine(){if(2===this.view.state.viewingMode){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return L(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new ee(e.zmin,e.zmax):null}getElevationRange(e){return null}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const i of e)for(const e of i.componentObjects)t(e)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=w(t.desc.origin),s=new Array,r=this.view.basemapTerrain.spatialReference;let o,n;if("global"===this.view.viewingMode){const e=p();C(M,i,e,r),o=d(m(),e),n=h(m(),o)}else o=u,n=u;const a=v(i),l=j(),c=Ue(t.desc.obb);let f=0,b=0;const y={textureMemoryUsage:0},_=new Array,U=new Map,H=t.desc.prims.length;for(let d=0;d<H;d++){const e=t.desc.prims[d];this._dbg(2,JSON.stringify(e));if(null==J[e.ptype]||null==t.data){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const h=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,m=null!=h?h.lightingModel:"Unlit",{positionView:p,positionAttr:w,normalsView:v,normalsAttr:M,colorAttr:C,texCoord0Attr:H,indicesView:S}=this.getBufferViews(e,t.data.buffer,o);if(null==w||null==p||null==S)continue;const E=new oe(null!=C,H?1:0,null!=v,this._shadeNormals||this._replacesTerrain,this._applySSAO),R=w.data.length/w.size,V=(e,t)=>!e||e.data.length/e.size===R||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!V(H,"numTexcoord")||!V(C,"numColors")||!V(M,"normals"))continue;const A=ne(E),k=c?.clone()??Te(w,i);if(o!==u)for(let t=0;t<p.count;t++)p.getVec(t,l),g(l,l,o),p.setVec(t,l);const F=A.createBuffer(w.data.length);if(pe("position",w,null,null,F,0),null!=H){const e=F.getField("uv0",P);fe(H,e,0)}null!=C&&pe("color",C,null,null,F,0),null!=M&&pe("normalCompressed",M,null,null,F,0);const I=new Uint32Array([0,S.typedBuffer.length]),D=new ae({data:F.buffer,count:F.byteLength/A.stride,layoutParameters:E},{positions:p.typedBuffer,indices:S.typedBuffer},S.typedBuffer,I);f+=p.count+S.count;const L=this.view.renderSpatialReference,B=j(),G=[1,1,1];O(a,L,G,r)||this._dbg(3,"Unsupported coordinate system for IM overlay"),T(a,L,B,r);const z=this._collection.createObject(new re(x(B[0],B[1],G[0],G[1]),new le(a,n),k,D,!1));if(h){const e=e=>{e.baseColor=h.baseColorFactor,e.usePBR="Pbr"===m,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(h.baseColorTex,t,U,y),e.usePBR&&(e.mrrFactors=[h.metallicFactor,h.roughnessFactor,0],e.emissiveBaseColor=h.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(h.metalTex,t,U,y),e.emissionTexture=this._getTexture(h.emissiveTex,t,U,y),e.occlusionTexture=this._getTexture(h.occlusionTex,t,U,y),e.normalTexture=this._getTexture(h.normalTex,t,U,y)),e.objectOpacity=0,e.alphaDiscardMode=2;const i=[];e.baseColorTexture&&i.push(e.baseColorTexture.loadPromise),e.usePBR&&(e.metallicRoughnessTexture&&i.push(e.metallicRoughnessTexture.loadPromise),e.emissionTexture&&i.push(e.emissionTexture.loadPromise),e.occlusionTexture&&i.push(e.occlusionTexture.loadPromise),e.normalTexture&&i.push(e.normalTexture.loadPromise));const r=Promise.all(i);s.push(r),r.then(()=>{e.alphaDiscardMode=X[h.alphaMode],e.objectOpacity=this.opacity,y.textureMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory??0,e.usePBR&&(y.textureMemoryUsage+=(e.metallicRoughnessTexture?.glTexture?.usedMemory??0)+(e.emissionTexture?.glTexture?.usedMemory??0)+(e.occlusionTexture?.glTexture?.usedMemory??0)+(e.normalTexture?.glTexture?.usedMemory??0))}),e.commonMaterialParameters.doubleSided=h.isDoubleSided,e.commonMaterialParameters.cullFace=Y[h.faceCulling??"NotSet"],e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=0,e.textureAlphaCutoff=h.alphaCutoff??we,e.alphaDiscardMode=X[h.alphaMode],e.isIntegratedMesh=!0,e.sphereDepthInterpolate=this.layer.hasGoogleUrl,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=de(this.view.spatialReference)};this._collection.updateMaterial(z,e)}_.push(z),b+=this._collection.getObjectGPUMemoryUsage(z)}await Promise.all(s);const S=new Array;U.forEach(e=>{S.push(e)});const E=new ve(e.handle,_,S,f,b,y.textureMemoryUsage,c);return this._memCache.put(`${E.handle}`,E),this._lyrHandleToObjects.set(e.handle,E),this._cacheMemory+=E.usedMemory,{memUsageBytes:E.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(t.isVisible?(this._visibleObjects.delete(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache.pop(`${e.handle}`),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){for(let s=0;s<i;++s){const i=t[s];if(!i)continue;const r=e[s],o=this._lyrHandleToObjects.get(r);if(o){if(o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!0,this._visibleObjects.add(o),this._usedMemory+=o.usedMemory,this._cacheMemory-=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.pop(`${r}`)}}for(let s=0;s<i;++s){const i=e[s],r=t[s];if(r)continue;const o=this._lyrHandleToObjects.get(i);if(o){if(!o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!1,this._visibleObjects.delete(o),this._usedMemory-=o.usedMemory,this._cacheMemory+=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,r),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.put(`${i}`,o)}}}_getTexture(e,t,i,s){let r=null;if(e&&t.desc?.images&&t.data?.buffer){const o=t.desc.images[e?.imageId];if(r=i.get(o),!r&&o){const n=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=!!o.mipCount||n>1,l=K[e.wrapMode??"None"];let c=o.alpha?6408:6407;const d=new Uint8Array(t.data.buffer,o.data.byteOffset,o.data.byteCount);let h=null,m=null,u=null;switch(o.format){case"Raw":"R8"===o.pixelFormat?(h=d,c=6403,m=""):"Rgb8"===o.pixelFormat?(h=d,c=6407,m=""):"Rgba8"===o.pixelFormat&&(h=d,c=6408,m="");break;case"Dxt1":h=d,c=6407,m="image/vnd-ms.dds";break;case"Dxt5":h=d,c=6408,m="image/vnd-ms.dds";break;case"Basis":h=d,c=6407,m="image/ktx2";break;case"Png":m="image/png",u=document.createElement("img");break;case"Jpeg":m="image/jpeg",u=document.createElement("img");break;case"Etc2":m="image/ktx",u=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(u&&m){const e=new Blob([d],{type:m});u.src=URL.createObjectURL(e),h=u}if(h&&null!=m){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(s.textureMemoryUsage-=e)}}:void 0;r=new ue(h,{mipmap:a,maxAnisotropy:n,encoding:m,wrap:l,pixelFormat:c,compressionOptions:e,noUnpackFlip:!0,width:o.mip0Width,height:o.mip0Height}),this._stage.addTexture(r),i.set(o,r)}}}return r?new ce(this.view.stage.renderView.textures,r.id):null}getBufferViews(e,t,i){let s,r,o,n,a,l,c,d=null;for(let m=0;m<e.atrbs.length;m++){const c=e.atrbs[m],u=c.view,p=void 0,f=u.byteOffset+u.byteCount,g=u.byteCount/Q[u.type],b=[...Array(g).keys()].map(e=>e);try{switch(c.sem){case"Position":3!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new R(t,u.byteOffset,p,f),r=new he(s.typedBuffer,b,3));break;case"Normal":if(3!==u.ncomp||"F32"!==u.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new R(t,u.byteOffset,p,f),s=me(e.typedBuffer,i);a=new k(s.buffer),l=new he(a.typedBuffer,b,2)}break;case"TexCoord":2!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===n&&(n=new he(new P(t,u.byteOffset,p,f).typedBuffer,b,2));break;case"Color":4===u.ncomp?("F32"===u.type&&(d=new H(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new S(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new E(t,u.byteOffset,p,f))):3===u.ncomp&&("F32"===u.type&&(d=new R(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new V(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new A(t,u.byteOffset,p,f))),null==d?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new he(d.typedBuffer,b,u.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(h){this._dbg(2,"Error Creating buffer ("+h+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":c=new I(t,i.byteOffset,s,r);break;case"U32":c=new F(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==c&&null!=s){const e=s.count;if(e<65535){const t=new Uint16Array(e);c=new I(t.buffer)}else{const t=new Uint32Array(e);c=new F(t.buffer)}for(let t=0;t<e;t++)c.set(t,t)}return{positionView:s,positionAttr:r,colorAttr:o,texCoord0Attr:n,indicesView:c,normalsView:a,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),r),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([l({type:[D]})],Me.prototype,"_modifications",void 0),e([l()],Me.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([l()],Me.prototype,"layer",void 0),e([l({readOnly:!0})],Me.prototype,"visibleAtCurrentScale",null),e([l()],Me.prototype,"elevationOffset",null),Me=e([c("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Me);const Ce=Me,Oe=j();function Te(e,t){const i=se(e);return b(Oe,i.center,t),i.center=Oe,i}function Ue(e){return e?new ie(e.center,e.halfSize,f(...e.quaternion)):null}export{Ce as default};
5
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{initial as r,watch as o,when as n}from"../../../core/reactiveUtils.js";import{schedule as a}from"../../../core/scheduling.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as d,invert as h}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m,IDENTITY as u}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as f}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{o as g,g as b,a as y,f as _}from"../../../chunks/vec32.js";import{fromArray as w,clone as v,create as j}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as x}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as M}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as C}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as O}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as T}from"../../../geometry/projection/projectVectorToVector.js";import{create as U}from"../../../geometry/support/aaBoundingRect.js";import{BufferViewVec2f as P,BufferViewVec4f as H,BufferViewVec4u8 as S,BufferViewVec4u16 as E,BufferViewVec3f as R,BufferViewVec3u8 as V,BufferViewVec3u16 as A,BufferViewInt16 as k,BufferViewUint32 as F,BufferViewUint16 as I}from"../../../geometry/support/buffer/BufferView.js";import D from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as L}from"../../../support/elevationInfoUtils.js";import{toWasmModification as B}from"./I3SMeshWorkerHandle.js";import{LayerView3D as G}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as z}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as N,removeLayerViewFromWasm as W,getLyr3DWasm as $}from"./Lyr3DWasm.js";import{LayerElevationProvider as q}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as J,wrapModeConversion as K,lyr3DTypeToByteSize as Q,alphaModeConversion as X,faceCullingConversion as Y}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as Z}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as ee}from"../support/ElevationRange.js";import{toBoundingRect as te}from"../support/extentUtils.js";import{Obb as ie,compute as se}from"../support/orientedBoundingBox.js";import{ObjectParameters as re}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as oe,createVertexBufferLayout as ne,SourceGeometry as ae}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as le}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as ce}from"../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as de}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as he}from"../webgl-engine/lib/Attribute.js";import{compressAndTransformNormals as me}from"../webgl-engine/lib/Normals.js";import{Texture as ue}from"../webgl-engine/lib/Texture.js";import{writeAttribute as pe,writeBufferVec2 as fe}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import ge from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as be,isInEffectiveScaleRange as ye}from"../../support/layerViewUtils.js";import{TextureCompressionTracker as _e}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as we}from"../../../webscene/support/AlphaCutoff.js";class ve{constructor(e,t,i,s,r,o,n){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=n,this.isVisible=!1,this.usedMemory=this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage;const a=j();n?.getCenter(a),this._obbCenter=a,this._obbRadiusSquared=n?n?.radius**2:0}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const i=y(je,this._obbCenter,e),s=_(i,t);return _(i,i)-s*s<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}}const je=j();function xe(e){return Math.round(e/1048.576)/1e3}let Me=class extends(G(ge)){get hasModifications(){return this._modifications&&this._modifications.length>0}constructor(e){super(e),this.type="integrated-mesh-3dtiles",this._compressionTracker=new _e,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._suspendedHandle=null,this._dbgFlags=new Set,this._memCache=e.view.resourceController.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e))}initialize(){this._dbgFlags.add(3),this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),r),!this._canProjectWithoutEngine())throw be("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=N(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new Z(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),r),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),r),this._elevationProvider=new q({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),e.elevationProvider.register(1,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([o(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=o(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),r)});this.addResolvingPromise(t),this._replacesTerrain&&this.addHandles(n(()=>this.view.map.ground.opacity,()=>{this._opacityChange()}))}get _replacesTerrain(){return this.layer.replacesTerrain&&!!this.view.map.basemap?.groundLayers.includes(this.layer)}get fullOpacity(){return this._replacesTerrain?this.view.map.ground.opacity:1}get opacity(){return 1}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>{this._collection.getMaterial(t).objectOpacity=e})}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!0}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),W(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._usedMemory=this._cacheMemory=0,this._memCache.destroy(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}_modificationsChanged(){const e=this.layer.spatialReference,t=B(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t,e.wkid)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=U();this._layerClippingArea=te(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=a(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.forEachComponentObject(t=>this._collection.getMaterial(t).commonMaterialParameters.hasSlicePlane=e)}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,L(e))}get _wasm(){return $(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return ye(this.layer.effectiveScaleRange,this.view.scale)}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isVisible?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new z(this.usedMemory,r,o,xe(t),xe(e),xe(s),xe(i))}_canProjectWithoutEngine(){if(2===this.view.state.viewingMode){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return L(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new ee(e.zmin,e.zmax):null}getElevationRange(e){return null}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const i of e)for(const e of i.componentObjects)t(e)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=w(t.desc.origin),s=new Array,r=this.view.basemapTerrain.spatialReference;let o,n;if("global"===this.view.viewingMode){const e=p();C(M,i,e,r),o=d(m(),e),n=h(m(),o)}else o=u,n=u;const a=v(i),l=j(),c=Ue(t.desc.obb);let f=0,b=0;const y={textureMemoryUsage:0},_=new Array,U=new Map,H=t.desc.prims.length;for(let d=0;d<H;d++){const e=t.desc.prims[d];this._dbg(2,JSON.stringify(e));if(null==J[e.ptype]||null==t.data){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const h=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,m=null!=h?h.lightingModel:"Unlit",{positionView:p,positionAttr:w,normalsView:v,normalsAttr:M,colorAttr:C,texCoord0Attr:H,indicesView:S}=this.getBufferViews(e,t.data.buffer,o);if(null==w||null==p||null==S)continue;const E=new oe(null!=C,H?1:0,null!=v,this._shadeNormals||this._replacesTerrain,this._applySSAO),R=w.data.length/w.size,V=(e,t)=>!e||e.data.length/e.size===R||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!V(H,"numTexcoord")||!V(C,"numColors")||!V(M,"normals"))continue;const A=ne(E),k=c?.clone()??Te(w,i);if(o!==u)for(let t=0;t<p.count;t++)p.getVec(t,l),g(l,l,o),p.setVec(t,l);const F=A.createBuffer(w.data.length);if(pe("position",w,null,null,F,0),null!=H){const e=F.getField("uv0",P);fe(H,e,0)}null!=C&&pe("color",C,null,null,F,0),null!=M&&pe("normalCompressed",M,null,null,F,0);const I=new Uint32Array([0,S.typedBuffer.length]),D=new ae({data:F.buffer,count:F.byteLength/A.stride,layoutParameters:E},{positions:p.typedBuffer,indices:S.typedBuffer},S.typedBuffer,I);f+=p.count+S.count;const L=this.view.renderSpatialReference,B=j(),G=[1,1,1];O(a,L,G,r)||this._dbg(3,"Unsupported coordinate system for IM overlay"),T(a,L,B,r);const z=this._collection.createObject(new re(x(B[0],B[1],G[0],G[1]),new le(a,n),k,D,!1));if(h){const e=e=>{e.baseColor=h.baseColorFactor,e.usePBR="Pbr"===m,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(h.baseColorTex,t,U,y),e.usePBR&&(e.mrrFactors=[h.metallicFactor,h.roughnessFactor,0],e.emissiveBaseColor=h.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(h.metalTex,t,U,y),e.emissionTexture=this._getTexture(h.emissiveTex,t,U,y),e.occlusionTexture=this._getTexture(h.occlusionTex,t,U,y),e.normalTexture=this._getTexture(h.normalTex,t,U,y)),e.objectOpacity=0,e.alphaDiscardMode=2;const i=[];e.baseColorTexture&&i.push(e.baseColorTexture.loadPromise),e.usePBR&&(e.metallicRoughnessTexture&&i.push(e.metallicRoughnessTexture.loadPromise),e.emissionTexture&&i.push(e.emissionTexture.loadPromise),e.occlusionTexture&&i.push(e.occlusionTexture.loadPromise),e.normalTexture&&i.push(e.normalTexture.loadPromise));const r=Promise.all(i);s.push(r),r.then(()=>{e.alphaDiscardMode=X[h.alphaMode],e.objectOpacity=this.fullOpacity,y.textureMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory??0,e.usePBR&&(y.textureMemoryUsage+=(e.metallicRoughnessTexture?.glTexture?.usedMemory??0)+(e.emissionTexture?.glTexture?.usedMemory??0)+(e.occlusionTexture?.glTexture?.usedMemory??0)+(e.normalTexture?.glTexture?.usedMemory??0))}),e.commonMaterialParameters.doubleSided=h.isDoubleSided,e.commonMaterialParameters.cullFace=Y[h.faceCulling??"NotSet"],e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=0,e.textureAlphaCutoff=h.alphaCutoff??we,e.alphaDiscardMode=X[h.alphaMode],e.isIntegratedMesh=!0,e.sphereDepthInterpolate=this.layer.hasGoogleUrl,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=de(this.view.spatialReference)};this._collection.updateMaterial(z,e)}_.push(z),b+=this._collection.getObjectGPUMemoryUsage(z)}await Promise.all(s);const S=new Array;U.forEach(e=>{S.push(e)});const E=new ve(e.handle,_,S,f,b,y.textureMemoryUsage,c);return this._memCache.put(`${E.handle}`,E),this._lyrHandleToObjects.set(e.handle,E),this._cacheMemory+=E.usedMemory,{memUsageBytes:E.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(t.isVisible?(this._visibleObjects.delete(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache.pop(`${e.handle}`),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){for(let s=0;s<i;++s){const i=t[s];if(!i)continue;const r=e[s],o=this._lyrHandleToObjects.get(r);if(o){if(o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!0,this._visibleObjects.add(o),this._usedMemory+=o.usedMemory,this._cacheMemory-=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.pop(`${r}`)}}for(let s=0;s<i;++s){const i=e[s],r=t[s];if(r)continue;const o=this._lyrHandleToObjects.get(i);if(o){if(!o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!1,this._visibleObjects.delete(o),this._usedMemory-=o.usedMemory,this._cacheMemory+=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,r),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.put(`${i}`,o)}}}_getTexture(e,t,i,s){let r=null;if(e&&t.desc?.images&&t.data?.buffer){const o=t.desc.images[e?.imageId];if(r=i.get(o),!r&&o){const n=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=!!o.mipCount||n>1,l=K[e.wrapMode??"None"];let c=o.alpha?6408:6407;const d=new Uint8Array(t.data.buffer,o.data.byteOffset,o.data.byteCount);let h=null,m=null,u=null;switch(o.format){case"Raw":"R8"===o.pixelFormat?(h=d,c=6403,m=""):"Rgb8"===o.pixelFormat?(h=d,c=6407,m=""):"Rgba8"===o.pixelFormat&&(h=d,c=6408,m="");break;case"Dxt1":h=d,c=6407,m="image/vnd-ms.dds";break;case"Dxt5":h=d,c=6408,m="image/vnd-ms.dds";break;case"Basis":h=d,c=6407,m="image/ktx2";break;case"Png":m="image/png",u=document.createElement("img");break;case"Jpeg":m="image/jpeg",u=document.createElement("img");break;case"Etc2":m="image/ktx",u=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(u&&m){const e=new Blob([d],{type:m});u.src=URL.createObjectURL(e),h=u}if(h&&null!=m){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(s.textureMemoryUsage-=e)}}:void 0;r=new ue(h,{mipmap:a,maxAnisotropy:n,encoding:m,wrap:l,pixelFormat:c,compressionOptions:e,noUnpackFlip:!0,width:o.mip0Width,height:o.mip0Height}),this._stage.addTexture(r),i.set(o,r)}}}return r?new ce(this.view.stage.renderView.textures,r.id):null}getBufferViews(e,t,i){let s,r,o,n,a,l,c,d=null;for(let m=0;m<e.atrbs.length;m++){const c=e.atrbs[m],u=c.view,p=void 0,f=u.byteOffset+u.byteCount,g=u.byteCount/Q[u.type],b=[...Array(g).keys()].map(e=>e);try{switch(c.sem){case"Position":3!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new R(t,u.byteOffset,p,f),r=new he(s.typedBuffer,b,3));break;case"Normal":if(3!==u.ncomp||"F32"!==u.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new R(t,u.byteOffset,p,f),s=me(e.typedBuffer,i);a=new k(s.buffer),l=new he(a.typedBuffer,b,2)}break;case"TexCoord":2!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===n&&(n=new he(new P(t,u.byteOffset,p,f).typedBuffer,b,2));break;case"Color":4===u.ncomp?("F32"===u.type&&(d=new H(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new S(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new E(t,u.byteOffset,p,f))):3===u.ncomp&&("F32"===u.type&&(d=new R(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new V(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new A(t,u.byteOffset,p,f))),null==d?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new he(d.typedBuffer,b,u.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(h){this._dbg(2,"Error Creating buffer ("+h+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":c=new I(t,i.byteOffset,s,r);break;case"U32":c=new F(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==c&&null!=s){const e=s.count;if(e<65535){const t=new Uint16Array(e);c=new I(t.buffer)}else{const t=new Uint32Array(e);c=new F(t.buffer)}for(let t=0;t<e;t++)c.set(t,t)}return{positionView:s,positionAttr:r,colorAttr:o,texCoord0Attr:n,indicesView:c,normalsView:a,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),r),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([l()],Me.prototype,"fullOpacity",null),e([l({type:[D]})],Me.prototype,"_modifications",void 0),e([l()],Me.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([l()],Me.prototype,"layer",void 0),e([l({readOnly:!0})],Me.prototype,"visibleAtCurrentScale",null),e([l()],Me.prototype,"elevationOffset",null),Me=e([c("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Me);const Ce=Me,Oe=j();function Te(e,t){const i=se(e);return b(Oe,i.center,t),i.center=Oe,i}function Ue(e){return e?new ie(e.center,e.halfSize,f(...e.quaternion)):null}export{Ce as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{initial as r}from"../../../core/reactiveUtils.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{I3SMeshView3D as o}from"./I3SMeshView3D.js";import{LayerView3D as s}from"./LayerView3D.js";import{updatingProgress as a}from"../support/updatingProperties.js";import l from"../../layers/LayerView.js";import{isInEffectiveScaleRange as n}from"../../support/layerViewUtils.js";const p=.2;let d=class extends(o(s(l))){constructor(){super(...arguments),this.type="integrated-mesh-3d",this._elevationContext=1,this._supportsLabeling=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this.drapeTargetType=1}get i3slayer(){return this.layer}get updatingProgressValue(){return this._controller?.updatingProgress??0}get lodFactor(){return this.view?.qualitySettings?.sceneService?.integratedMesh?.lodFactor??1}get progressiveLoadFactor(){return this.lodFactor>=1?p:1}get visibleAtCurrentScale(){return n(this.i3slayer.effectiveScaleRange,this.view.scale)}get layerPopupEnabledAndHasTemplate(){return!1}initialize(){this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),r),this.view.overlayManager.registerDrapeTarget(this)}destroy(){this.view.overlayManager.unregisterDrapeTarget(this)}get ready(){return this.layer.loaded}_createLayerGraphic(){}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),r),"modifications")}};e([t()],d.prototype,"layer",void 0),e([t()],d.prototype,"i3slayer",null),e([t(a)],d.prototype,"updatingProgress",void 0),e([t()],d.prototype,"updatingProgressValue",null),e([t()],d.prototype,"lodFactor",null),e([t({readOnly:!0})],d.prototype,"progressiveLoadFactor",null),e([t({readOnly:!0})],d.prototype,"visibleAtCurrentScale",null),d=e([i("esri.views.3d.layers.IntegratedMeshLayerView3D")],d);const c=d;export{c as default};
5
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{initial as t}from"../../../core/reactiveUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{I3SMeshView3D as o}from"./I3SMeshView3D.js";import{LayerView3D as s}from"./LayerView3D.js";import{updatingProgress as a}from"../support/updatingProperties.js";import l from"../../layers/LayerView.js";import{isInEffectiveScaleRange as n}from"../../support/layerViewUtils.js";const p=.2;let d=class extends(o(s(l))){constructor(){super(...arguments),this.type="integrated-mesh-3d",this._elevationContext=1,this._supportsLabeling=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this.drapeTargetType=1}get i3slayer(){return this.layer}get updatingProgressValue(){return this._controller?.updatingProgress??0}get lodFactor(){return this.view?.qualitySettings?.sceneService?.integratedMesh?.lodFactor??1}get progressiveLoadFactor(){return this.lodFactor>=1?p:1}get visibleAtCurrentScale(){return n(this.i3slayer.effectiveScaleRange,this.view.scale)}get fullOpacity(){return 1}get layerPopupEnabledAndHasTemplate(){return!1}initialize(){this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),t),this.view.overlayManager.registerDrapeTarget(this)}destroy(){this.view.overlayManager.unregisterDrapeTarget(this)}get ready(){return this.layer.loaded}_createLayerGraphic(){}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),t),"modifications")}};e([r()],d.prototype,"layer",void 0),e([r()],d.prototype,"i3slayer",null),e([r(a)],d.prototype,"updatingProgress",void 0),e([r()],d.prototype,"updatingProgressValue",null),e([r()],d.prototype,"lodFactor",null),e([r({readOnly:!0})],d.prototype,"progressiveLoadFactor",null),e([r({readOnly:!0})],d.prototype,"visibleAtCurrentScale",null),e([r()],d.prototype,"fullOpacity",null),d=e([i("esri.views.3d.layers.IntegratedMeshLayerView3D")],d);const c=d;export{c as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import e from"../../../../core/PooledArray.js";import{isAbortError as t}from"../../../../core/promiseUtils.js";import{projectBoundingSphere as i}from"../../../../geometry/projection/projectBoundingSphere.js";import{j as s,m as n,c as o,z as r}from"../../../../chunks/sphere.js";import{NodeBoundingData as a,Node as d,NodeTraversalState as l}from"./I3SNode.js";import{invalidateMbs as h,addWraparound as u}from"./I3SUtil.js";import{ValidatedNode as c}from"./ValidatedNode.js";import{ElevationRange as g}from"../../support/ElevationRange.js";import{Obb as _}from"../../support/orientedBoundingBox.js";class f{constructor(e,t,i,s,n){this.childOffset=e,this.childCount=t,this.visibilityCache=i,this._boundingData=s,this.node=n,this.parentIndex=-1,this.useAsHole=0,this.filterImpact=2,this.traversalState=null}get nodeBoundingData(){return this._boundingData}destroy(){this._boundingData=null,this.node=null,this.traversalState=null}invalidateBounds(){this.node?.invalidateServiceBVsInRenderSR(),this.nodeBoundingData?.invalidateServiceBVsInRenderSR()}}class m{constructor(e=new Array,t=new Array){this._nodeDescriptors=e,this._children=t,this.lastTraversed=0,this.numNodesWithLoadedChildren=0}destroy(){for(const e of this._nodeDescriptors)e.destroy();this._nodeDescriptors.length=0,this._children.length=0}get nodes(){return this._nodeDescriptors}addNode(e){return this._nodeDescriptors.push(e),this._nodeDescriptors.length-1}setNodes(e,t){this._nodeDescriptors=e,this._children=t}get children(){return this._children}}class v{get _useNodePages(){return this._pageSize>0}constructor(t,i,s,n,o,r,d,l,h,u,c,g,_,f,v){if(this.viewingMode=t,this._layer=i,this._requester=n,this._clientNodeLoader=o,this._viewportQueries=r,this._logger=d,this.holeFilling=l,this._isLoaded=h,this._isReloading=u,this._shouldLoadNode=c,this._enable=g,this._needsUpdate=_,this._computeVisibilityObb=f,this._computeNodeFiltering=v,this._dirty=!0,this._nodePages=new Map,this._clientNodePage=null,this._pageSize=0,this._rootIndex=0,this._lodMetric=0,this._lodConversion=e=>e,this._isEditable=!1,this.urlPrefix="",this._loadingNodes=new Set,this._loadingPages=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._version=P(0),this._visibilityCacheVersion=P(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._missingPagesAndNodes=new e({deallocator:null}),this._prefetchNodes=new e({deallocator:null}),this._updates=new N(this._missingPagesAndNodes),this._imModificationUncategorized=new e({deallocator:null}),this.ignoreServiceObb=!1,this._pageQueue=new Array,this._newPages=new Array,this.needNodeElevationRange=!1,this.layerHasModifications=!1,this._layerHasFilter=!1,this._frameNumber=0,this._traverseDescendantsQueue=[0],this._traverseDescendantsNestingLevel=0,this._isEditable=null!=i.associatedLayer?.infoFor3D,i.serviceUpdateTimeStamp?.lastUpdate&&(this._lastUpdate=`${i.serviceUpdateTimeStamp.lastUpdate}`),this._maxLodLevel=this._viewportQueries?this._viewportQueries.maxLodLevel:1,"page"===s.type){const e=s.rootPage;switch(this.urlPrefix=s.urlPrefix,this._pageSize=s.pageSize,s.lodMetric){case"maxScreenThreshold":this._lodMetric=1;break;case"maxScreenThresholdSQ":this._lodMetric=1,this._lodConversion=A}if(this._isEditable){this._rootIndex=-1;const t=S(s.rootIndex,s.pageSize),i=e.nodes[t],n={nodes:[{index:this._rootIndex,children:[s.rootIndex],mesh:void 0,obb:i.obb,lodThreshold:i.lodThreshold}]};this._addPage(R(this._rootIndex,this._pageSize),n),this.getNode(-1).serviceObbInIndexSR=void 0}else this._rootIndex=s.rootIndex;this._addPage(R(s.rootIndex,this._pageSize),e),this._updateParentsAndLevel()}else if("node"===s.type){this.urlPrefix=s.urlPrefix;const e=new m;if(this._nodePages.set(0,e),this._isEditable){this._clientNodePage=new m;const e={id:"-1",version:null,mbs:s.rootNode.mbs,obb:s.rootNode.obb,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:[{id:"root",href:"../root",mbs:s.rootNode.mbs,obb:s.rootNode.obb}]};this._rootIndex=this._makeClientRefNode(new a(e.id,null),-1);const t=this._validateNode(e.id,e);t&&this._addNode(t,this._rootIndex)}else this._rootIndex=this._makeRefNode(new a(s.rootNode.id,null),-1);const t=this._validateNode(s.rootNode.id,s.rootNode);t&&this._addNode(t,0)}}addClientNodeToIndex(e,t){const i=-1,s=new a(e,t),n=this._makeClientRefNode(s,i);return this._linkChildToParentNode(i,n),this.requestUpdate(),n}removeClientNodeFromIndex(e,t,i){this._destroyClientRefNode(e,t,i),this.requestUpdate()}_canRequest(e){return!this._requester.isFull(e)}_loadPage(e){this._loadingPages.add(e);const i=this.urlPrefix+e;this._requester.request(i,"json").then(t=>this._pageQueue.push({pageIndex:e,page:t})).catch(i=>{this._loadingPages.delete(e),t(i)||(this._failedPages.add(e),this._logger.error("#loadPage()",this._layer,`Error when loading page ${e}`,i))})}_addQueuedPages(e){for(;this._pageQueue.length>0&&!e.done;){const{pageIndex:t,page:i}=this._pageQueue.shift();this._addPage(t,i),this._loadingPages.delete(t),e.madeProgress(),this.needNodeElevationRange&&this._newPages.push(t)}this._updateParentsAndLevel()}_invalidateElevationRangeForNewPages(e){if(this.needNodeElevationRange)for(;this._newPages.length>0&&!e.done;){const e=this._nodePages.get(this._newPages.shift());e?.nodes.forEach(e=>{let t=e.parentIndex;for(;null!=t&&t!==this._rootIndex;){const e=this.getNode(t);e&&!Number.isNaN(e?.elevationRangeMin)&&(e.invalidateElevationRange(),this.invalidateBoundingVolumeCache(t)),t=this._getParentIndex(t)}})}}_addPage(e,t){const i=[],n=[],o=t.nodes.map((t,o)=>{const r=i.length,a=t.children?t.children.length:0;n.push(this._rootIndex);for(let e=0;e<a;e++)i.push(t.children[e]);const l=`${t.index}`,h=_.fromJSON(t.obb),u=s(h.center,h.radius),c=t.mesh?.attribute,g=t.mesh?.geometry,m=t.mesh?.material,v={hasSharedResource:!1,isEmpty:null==g,attributes:null!=c?.resource?`${c.resource}`:void 0,geometry:null!=g?.resource?`${g.resource}`:void 0,texture:null!=m?.resource?`${m.resource}`:void 0,geometryDefinition:g?g.definition:-1,materialDefinition:m?m.definition:-1},p=new d(l,C(o,e,this._pageSize),u,a,0,v,this._lastUpdate,this._lodMetric,this._lodConversion(t.lodThreshold),g?.featureCount??null);return p.serviceObbInIndexSR=h,p.visibilityObbInRenderSR=this._computeVisibilityObb(p),p.vertexCount=g?g.vertexCount:0,new f(r,a,b(this._visibilityCacheVersion),null,p)}),r=new m(o,i);-1===e?this._clientNodePage=r:this._nodePages.set(e,r)}_updateParentsAndLevel(){const e=new Array,t=(t,i,s)=>{const n=this._getPage(t);if(null!=n){const o=S(t,this._pageSize),r=n.nodes[o];r.parentIndex=null!=i?i:-1;const a=r.node;null!=a&&(a.level=s,e.push(t))}};for(t(this._rootIndex,null,0);e.length;){const i=e.pop(),s=this.getNode(i);if(null!=s)for(let e=0;e<s.childCount;e++){t(this.getChildIndex(s.index,e),i,s.level+1),this._maxLevel=Math.max(this._maxLevel,s.level+1)}}}_getPage(e){const t=R(e,this._pageSize);return this._getPageFromPageIndex(t)}_getPageFromPageIndex(e){return e<0?this._clientNodePage:this._nodePages.get(e)}_getNodeDescriptor(e){const t=this._getPage(e);return null==t?null:(t.lastTraversed=this._frameNumber,t.nodes[S(e,this._pageSize)])}_addNode(e,t){e.children&&this.populateChildren(t,e.children);const i=this.getParent(t),s=null!=i?i.level+1:0;this._maxLevel=Math.max(this._maxLevel,e.children?s+1:s);const{lodMetric:n,maxError:o}=E(e.lodSelection),r=this._getNodeDescriptor(t),a=new d(e.id,t,e.mbs,r.childCount,s,e.resources,e.version,n,o,e.numFeatures);r.node=a,e.obb&&(a.serviceObbInIndexSR=_.fromJSON(e.obb)),a.visibilityObbInRenderSR=this._computeVisibilityObb(a);const l=r.nodeBoundingData;return null!=l&&(null==l.serviceMbsInIndexSR&&(l.serviceMbsInIndexSR=e.mbs),a.shareServiceBVsInRenderSRWith(l),l.visibilityObbInRenderSR=a.visibilityObbInRenderSR),a}_makeRefNode(e,t){const i=this._nodePages.get(0);if(t<-1)return this._makeClientRefNode(e,t);if(null==i)return-1;const s=i.nodes.length,n=new f(0,0,b(this._visibilityCacheVersion),e,null);return i.addNode(n),n.parentIndex=t,e.invalidateServiceBVsInRenderSR(),s}_makeClientRefNode(e,t){const i=this._clientNodePage;if(null==i)return-1;if(t>=0)throw new Error("I3SIndex::client side nodes can not be made children of service side nodes.");const s=-(i.nodes.length+1),n=new f(0,0,b(this._visibilityCacheVersion),e,null);return i.addNode(n),n.parentIndex=t,e.invalidateServiceBVsInRenderSR(),s}_linkChildToParentNode(e,t){const i=this._clientNodePage;if(null==i||e>=0)return;const s=S(e,this._pageSize),n=S(t,this._pageSize),o=i.nodes[s],r=o.childOffset;i.children.splice(o.childOffset+o.childCount,0,t);const a=1;o.childCount+=a,null!=o.node&&(o.node.childCount+=a);for(const d of i.nodes)d.childOffset>r&&(d.childOffset+=a);i.nodes[n].parentIndex=e,this._updateParentBoundingInformation(e)}_destroyClientRefNode(e,t,i){const s=this._clientNodePage;if(null==s)return;const n=this._getParentIndex(e);if(null==n)return;const o=new Set,r=new Map,a=e=>{const i=S(e,this._pageSize),n=s.nodes[i];if(n.childCount>0)for(let t=n.childOffset;t<n.childOffset+n.childCount;++t)a(s.children[t]);const r=n.node?.id??n.nodeBoundingData?.id;if(null==r)throw new Error("Node has no id");t(r,e),o.add(n)};a(e);const d=s.nodes,l=s.children,h=s.nodes.map(()=>-1),u=[],c=[];for(let g=0;g<d.length;++g){const e=d[g];if(o.has(e))continue;const t=u.length,s=C(g,-1,this._pageSize),n=C(t,-1,this._pageSize);if(e.node&&(e.node.index=n),h[g]=n,u.push(e),s!==n){const t=e.node?.id??e.nodeBoundingData?.id;if(null==t)throw new Error("Node has no id");i(t,s,n),r.set(s,n)}}for(let g=0;g<u.length;++g){const e=C(g,-1,this._pageSize),t=u[g],i=c.length;for(let s=t.childOffset;s<t.childOffset+t.childCount;++s){const t=l[s];if(t>=0)c.push(t);else{const i=S(t,this._pageSize),s=d[i];if(o.has(s))continue;const n=h[i];c.push(n),s.parentIndex=e}}t.childOffset=i,t.childCount=c.length-i,t.node&&(t.node.childCount=t.childCount)}s.setNodes(u,c),this._updateParentBoundingInformation(h[S(n,this._pageSize)])}_updateParentBoundingInformation(e){let t=e;do{let e=null;const s=this._clientNodeLoader.indexSR,a=this._clientNodeLoader.renderSR,d=this._getNodeDescriptor(t);if(null==d)return;for(let o=0;o<d.childCount;o++){const d=this.getChildIndex(t,o),l=this._getNodeDescriptor(d),h=null!=l?l.nodeBoundingData||l.node:null;if(null!=h&&h.serviceMbsInIndexSR[3]>0)if(null==e)e=n(h.serviceMbsInIndexSR,V);else{const t=O,n=L,o=B;i(h.serviceMbsInIndexSR,s,t,a),i(e,s,n,a),r(t,n,o),i(o,a,e,s)}}const l=t=>{null!=t&&(t.serviceObbInIndexSR=null,null!=e?(t.serviceMbsInIndexSR??=o(),n(e,t.serviceMbsInIndexSR)):h(t.serviceMbsInIndexSR),t.invalidateServiceBVsInRenderSR(),t.geometryObbInRenderSR=null)};l(d.nodeBoundingData),l(d.node),this.invalidateNodeVisibilityCacheInternal(d),t=this._getParentIndex(t)}while(null!=t)}populateChildren(e,t){const i=this._getNodeDescriptor(e),s=this._getPage(e);i.childOffset=s.children.length,i.childCount=t.length;for(let n=0;n<t.length;n++){const i=this._makeRefNode(t[n],e);s.children.push(i)}}getNode(e){const t=this._getNodeDescriptor(e);return null!=t?t.node:null}getIndexById(e){let t;return this._forAllNodes((i,s)=>{(null!=i.node&&i.node.id===e||null!=i.nodeBoundingData&&i.nodeBoundingData.id===e)&&(t=s)}),t}getNodeById(e){const t=this.getIndexById(e);return null!=t&&t>=0?this.getNode(t):null}getChildIndex(e,t){const i=this._getPage(e);if(null==i)return-1;const s=i.nodes[S(e,this._pageSize)];return i.children[s.childOffset+t]}_getParentIndex(e){const t=this._getPage(e);return null!=t&&e!==this._rootIndex?t.nodes[S(e,this._pageSize)]?.parentIndex:null}getParent(e){const t=this._getParentIndex(e);return null!=t?this.getNode(t):null}isLeaf(e){const t=this._getNodeDescriptor(e);return null!=t&&0===t.childCount}get rootNode(){return this.getNode(this._rootIndex)}get isEditable(){return this._isEditable}removeAllGeometryObbs(){this._forAllNodes(e=>{null!=e.node&&(e.node.geometryObbInRenderSR=null)})}invalidateVisibilityCache(){this._visibilityCacheVersion=P(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(e){const t=this._getNodeDescriptor(e);null!=t&&this.invalidateNodeVisibilityCacheInternal(t)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=b(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(e){const t=this._getNodeDescriptor(e);null!=t&&(t?.invalidateBounds(),this.invalidateNodeVisibilityCacheInternal(t))}updateElevationChanged(e){const t=this._getNodeDescriptor(e);if(null==t)return;if(!this.needNodeElevationRange)return void this.invalidateBoundingVolumeCache(e);const i=null!=t.node?t.node:t.nodeBoundingData;null!=i&&i.invalidateElevationRange()}invalidateGeometryVisibility(e){const t=this._getNodeDescriptor(e),i=t?.node;i&&(i.geometryObbInRenderSR=null,i.invalidateServiceBVsInRenderSR())}invalidateVisibilityObbs(){null!=this.rootNode&&this.traverse(this.rootNode,e=>(e.visibilityObbInRenderSR=this._computeVisibilityObb(e),e.geometryObbInRenderSR=null,!0))}_isElevationRangeUpToDate(e){if(!this.needNodeElevationRange)return!0;const t=e?.node??e?.nodeBoundingData;return!t||t.elevationRangeValid}_updateElevationRange(e,t){const i=this._getNodeDescriptor(e);if(!i)return!1;const s=i?.node??i?.nodeBoundingData;if(!s)return!1;if(s.elevationRangeValid)return t?.expandElevationRange(s),!0;const n=new g;let o=!1;for(let d=0;d<i.childCount;d++){const t=this.getChildIndex(e,d),i=this._updateElevationRange(t,n);o=o||!i}if(0===i.childCount||o){const e=!i.node?.resources.isEmpty;this._viewportQueries.expandElevationRange(s,e,n)}n.elevationRangeMin!==1/0&&n.elevationRangeMax!==-1/0||n.expandElevationRangeValues(0,0);const{elevationRangeMin:r,elevationRangeMax:a}=s;return r===n.elevationRangeMin&&a===n.elevationRangeMax?(t?.expandElevationRange(s),!0):(i.node?.setElevationRange(n),i.nodeBoundingData?.setElevationRange(n),this.invalidateBoundingVolumeCache(e),t?.expandElevationRange(s),!0)}isNodeVisible(e){const t=this._getNodeDescriptor(e);if(null==t)return!0;const i=t.nodeBoundingData;if(null!=i&&!i.serviceMbsInIndexSR)return!0;if(this._isElevationRangeUpToDate(t)&&I(t.visibilityCache,this._visibilityCacheVersion))return x(t.visibilityCache);const s=t.node,n=this._viewportQueries;if(s){const e=n.ensureElevationAgnosticBoundingVolume(s),i=n.isElevationAgnosticBoundingVolumeVisible(e);let o=i;if(this.needNodeElevationRange&&i){const t=n.getNodeObbInRenderSRIndependentOfElevationOffset(s);null!=t&&(o=n.isObbVisibleIndependentOfElevation(e,t))}if(!o)return t.visibilityCache=y(!1,this._visibilityCacheVersion),!1}if(this._layerHasFilter&&this._computeNodeFiltering&&(null!=s||null!=i)&&2===t.filterImpact){const e=null!=s?s.serviceMbsInIndexSR:null!=i?i.serviceMbsInIndexSR:null;t.filterImpact=null!=e?this._computeNodeFiltering(e):0}const o=null!=s&&1===t.filterImpact;let r=!(null!=s&&2===s.imModificationImpact)&&!o;if(r){const t=!s||i&&!s.visibilityObbInRenderSR?i??null:s;if(null!=t){this.needNodeElevationRange&&this._updateElevationRange(e);r=n.isNodeVisible(t)}}return t.visibilityCache=y(r,this._visibilityCacheVersion),r}isGeometryVisible(e){if(!this.isNodeVisible(e))return!1;const t=this._getNodeDescriptor(e);return!!(null==t?.node?.geometryObbInRenderSR||this.layerHasModifications&&4===t.node.imModificationImpact)||this._viewportQueries.isGeometryVisible(t.node)}_traverseCoverage(e,t,i,s,n){const o=this._getPage(e);if(null==o||0===t.childCount)return;const r=t.childOffset+t.childCount,a=new Array;for(let d=t.childOffset;d<r;++d){const e=o.children[d],t=this._getNodeDescriptor(e);null!=t?.node&&this.isGeometryVisible(e)&&a.push(t)}s/=a.length;for(const d of a){const e=d.node.index;this._isLoaded(e)||this._isReloading(e)?(n.delta=Math.max(n.delta,i),n.coverage+=s):this._traverseCoverage(e,d,i+1,s,n)}}useNodeAsHole(e){if("off"===this.holeFilling)return!1;const t=this._getNodeDescriptor(e);if(null==t)return!1;if("always"===this.holeFilling)return!0;if(I(t.useAsHole,this._version))return x(t.useAsHole);const i={delta:0,coverage:0};this._traverseCoverage(e,t,0,1,i);const s=i.delta*i.coverage<=.5;return t.useAsHole=y(s,this._version),s}get maxLevel(){return this._maxLevel}get dirty(){return this._dirty}destroy(){this._updates.destroy(),this._nodePages.clear(),this._clientNodePage=null,this._layer=null,this._missingPagesAndNodes.prune(),this._prefetchNodes.prune(),this._imModificationUncategorized.prune()}requestUpdate(){this._dirty=!0,this._indexMissing=1,this._version=P(this._version)}imModificationsChanged(e){this.layerHasModifications=e,this._forAllNodes(({node:e})=>{null!=e&&(e.imModificationImpact=4,e.visibilityObbInRenderSR=this._computeVisibilityObb(e),e.hasModifications&&this.invalidateGeometryVisibility(e.index))}),this.invalidateVisibilityCache()}layerFilterChanged(e){this._layerHasFilter=e,this._forAllNodes(e=>{if(null!=e){e.filterImpact=2;const t=e.node;null!=t&&this.invalidateNodeVisibilityCache(t.index)}}),this.invalidateVisibilityCache()}update(e,t,i){if(!this._dirty)return;this._pageQueue.length>0&&this._addQueuedPages(t),this._invalidateElevationRangeForNewPages(t),this.resetUpdateState(e);let s=!0;const n=new M,o=new D,r=this._imModificationUncategorized;r.clear();const a=new Set;let d=0;const l=(a,l,h)=>{const u=e=>{this._shouldLoadNode(e)&&e.childCount&&(s=!1)};if(!l){const e=R(a,this._pageSize);let t=this._getNodeLoadPriority(a);return t===1/0&&(t=this._getNodeLoadPriority(h)),p.set(e,Math.max(t,p.get(e)||0)),this._loadingPages.has(e)||this._failedPages.has(e)||(this._missingPagesAndNodes.push(e),++d),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,t))}const{node:c,childCount:g}=l;if(this._updateNodeFeatureEstimate(c,o),!c){const e=this._getNodeLoadPriority(a);return this._loadingNodes.has(a)||this._failedNodes.has(a)||(this._missingPagesAndNodes.push(a),p.set(a,e)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const _=this._getPage(a);if(!this._useNodePages&&0===this._missingPagesAndNodes.length)for(let e=0;e<g;e++){const t=_.children[l.childOffset+e],i=this._getNodeDescriptor(t);null!=i&&!i.node&&!this._loadingNodes.has(t)&&!this._failedNodes.has(t)&&t>=0&&(p.set(t,this._getNodeLoadPriority(t)),this._prefetchNodes.push(t))}if(c.failed||c.resources.isEmpty)return void u(c);if(this._isLoaded(a)){if(n.known+=c.memory,++n.knownNodes,u(c),this._shouldLoadNode(c)||(n.unremoved+=c.memory),this._needsUpdate(c)){const e=this._getNodeLoadPriority(a);p.set(a,e),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e),this._updates.update.push(a)}return}if(c.memory&&(n.known+=c.memory,++n.knownNodes),!this._shouldLoadNode(c))return void(this._isReloading(a)&&this._updates.remove.push(a));if(u(c),c.memory?(n.missing+=c.memory,n.known+=c.memory,++n.knownNodes):++n.missingNodes,e.includes(c.index))return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._getNodeLoadPriority(a)),void(this._updates.cancel=this._updates.cancel.filter(e=>e!==c.index));if(!t.done&&this._enable(c))return void t.madeProgress();const f=this._getNodeLoadPriority(a);p.set(a,f),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,f),this._updates.add.push(a),this.layerHasModifications&&i&&null!=c&&4===c.imModificationImpact&&r.push(a)};this.traverseVisible(l,a),this._frameNumber++,this._finalizeMissingNodesAndPages(),this._removeUnusedNodePages(a,d),this._handleModifications(i,r),this._updateUnloadedMemoryEstimate(n),this._featureEstimate.estimate=this._computeFeatureEstimate(o),this._featureEstimate.leavesReached=s,this._updates.add.filterInPlace(e=>p.get(e)>=this._maxUnloadedPrio).sort((e,t)=>p.get(e)-p.get(t)),this._updates.update.sort((e,t)=>p.get(e)-p.get(t)),this._indexMissing=this._loadingPages.size+this._loadingNodes.size+this._missingPagesAndNodes.length,this._dirty=this._indexMissing>0,p.clear()}_updateUnloadedMemoryEstimate(e){this._unloadedMemoryEstimate=e.missing-e.unremoved,e.knownNodes>3&&e.missingNodes>0&&(this._unloadedMemoryEstimate+=e.known/e.knownNodes*e.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate)}resetUpdateState(e){this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missingPagesAndNodes.clear(),this._prefetchNodes.clear(),this._updates.reset(e),p.clear()}_finalizeMissingNodesAndPages(){this._missingPagesAndNodes.sort((e,t)=>e-t),this._missingPagesAndNodes.filterInPlace((e,t)=>t<1||this._missingPagesAndNodes.data[t-1]!==e),this._missingPagesAndNodes.sort((e,t)=>p.get(e)-p.get(t)),this._missingPagesAndNodes.length>0&&(this._maxUnloadedPrio=p.get(this._missingPagesAndNodes.back()),this._prefetchNodes.clear())}_handleModifications(e,t){this.layerHasModifications&&0!==this._updates.add.length&&(t.length>0&&e?.(t),this._updates.add.filterInPlace(e=>{const t=this._getNodeDescriptor(e),i=null==t?.node||2!==t.node.imModificationImpact;return i||this.invalidateNodeVisibilityCache(e),i}))}checkFeatureTarget(e,t){const i=this._viewportQueries.updateScreenSpaceErrorBias(t);let s=t,n=t,o=i,r=10;for(;r--;){const i=new D;this._updateFeatureEstimate(s,i);if(this._computeFeatureEstimate(i)<=e){if(s>=t||i.missingNodes>0||0===r)break;o=s,s=.5*(s+n)}else n=s,s=.5*(s+o)}return this._version=P(this._version),this._viewportQueries.updateScreenSpaceErrorBias(i),Math.min(t,s)}_removeUnusedNodePages(e,t){if(!this._useNodePages)return;const i=e.size,s=this._nodePages,n=s.size+this._loadingPages.size+t;if(n>z&&n>i){const t=new Array;for(const[i,n]of s)0!==n.numNodesWithLoadedChildren||e.has(i)||t.push([n.lastTraversed,i]);t.sort((e,t)=>e[0]-t[0]).some(e=>{const t=e[1];return this._deleteNodePage(t),s.size<=z})}}_updateFeatureEstimate(e,t){this._version=P(this._version),this._viewportQueries.updateScreenSpaceErrorBias(e),this.traverseVisible((e,i)=>this._updateNodeFeatureEstimate(i?.node,t))}_updateNodeFeatureEstimate(e,t){null!=e&&!e.failed&&this._shouldLoadNode(e)&&(null!=e.numFeatures?(t.numFeatures+=e.numFeatures,++t.knownNodes):++t.missingNodes)}_computeFeatureEstimate(e){let t=e.numFeatures;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.numFeatures/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._missingPagesAndNodes)}prefetch(){return this._prefetchNodes.sort((e,t)=>p.get(e)-p.get(t)),this._load(this._prefetchNodes)}_load(e){if(0===e.length||!this._canRequest(this.urlPrefix))return!1;for(;e.length>0&&this._canRequest(this.urlPrefix);){const t=e.pop();this._useNodePages&&t>=0?this._loadPage(t):this._loadNode(t)}return!0}get isLoading(){return this._indexMissing>0}get isPrefetching(){return this._prefetchNodes.length>0}get indexLoading(){return this._loadingPages.size+this._loadingNodes.size}get indexMissing(){return this._indexMissing}get unloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}get maxPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}nodeTraversalState(e){if(null==e)return null;const t=e.index,i=this._getNodeDescriptor(t);if(!i)return null;let s=i?.traversalState;if(s&&I(s.version,this._version))return s;const n=this._viewportQueries.getLodLevel(e),o=this._viewportQueries.hasLOD(e);let r=!0;if(o){const e=this._getParentIndex(t);if(null!=e){const t=this._getNodeDescriptor(e),i=t?.traversalState;r=!!i&&n>i.lodLevel}else r=n>0}else r=0===e.childCount;return s?(s.lodLevel=n,s.isChosen=r,s.version=y(!0,this._version),s):(s=new l(o,r,n,y(!0,this._version)),i.traversalState=s,s)}_loadNode(e){this._loadingNodes.add(e);const i=this._getNodeDescriptor(e).nodeBoundingData;if(null==i)return void this._failedNodes.add(e);const s=i.id,n=this.urlPrefix+s,o=()=>{this._loadingNodes.delete(e),0===this._missingPagesAndNodes.length&&0===this._loadingNodes.size&&this.requestUpdate()};(e>=0?this._requester.request(n,"json"):this._clientNodeLoader.loadNodeJSON(s)).catch(i=>{o(),t(i)||(this._logger.error("#loadNode()",this._layer,"Error loading node: "+n),this._failedNodes.add(e))}).then(t=>{o();const i=this._validateNode(s,t);if(null==i)return;i.obb&&this.invalidateNodeVisibilityCache(e);const n=this._addNode(i,e);this.nodeTraversalState(n)})}_validateNode(e,t){if(null==t||"object"!=typeof t||t.id!==e)return this._logger.error("#validateNode()",this._layer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this._logger.error("#validateNode()",this._layer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&"./shared"!==t.sharedResource.href&&"./shared/"!==t.sharedResource.href&&this._logger.warn("#validateNode()",this._layer,`Invalid shared resource href on node "${e}"`);const i=t.geometryData;null==i||Array.isArray(i)&&0===i.length||Array.isArray(i)&&1===i.length&&"./geometries/0"===i[0].href||this._logger.warn("#validateNode()",this._layer,`Invalid geometry data on node "${e}"`);const s=t.attributeData,n=this._layer.attributeStorageInfo;null==s||Array.isArray(s)&&!s.some((e,t)=>e.href!==`./attributes/${n?.[t]?.key??`f_${t}`}/0`)||this._logger.warn("#validateNode()",this._layer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this._logger.warn("#validateNode()",this._layer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const o=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:void 0,r=t.featureData&&1===t.featureData.length&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:void 0,d=t=>{if(null==t)return null;const i=t=>this._logger.error("#validateNode()",this._layer,`Invalid node reference on node ${e}: ${t}`);if("number"==typeof t.id)i(`id ${t.id} is a number instead of a string.`);else if("string"!=typeof t.id||!Array.isArray(t.mbs))return i("Missing or invalid id."),null;if(!Array.isArray(t.mbs))return i(`Invalid bounding volume on reference ${t.id}.`),null;t.href&&t.href!=="../"+t.id&&this._logger.error("#validateNode()",this._layer,`Invalid node href on node "${e}"`);const s=new a(`${t.id}`,t.mbs);return s.serviceObbInIndexSR=!this.ignoreServiceObb&&t.hasOwnProperty("obb")&&t.obb?_.fromJSON(t.obb):null,s.visibilityObbInRenderSR=this._computeVisibilityObb(s),s},l=Array.isArray(t.children)?t.children.map(d).filter(e=>null!=e):null,h=t.featureData?.length??!1,u=!0===t.isEmpty;return new c(e,t.mbs,o,"string"==typeof t.version?t.version:null,{isEmpty:!h&&u,hasSharedResource:null!=t.sharedResource,attributes:t.attributeData?e:void 0,texture:t.textureData&&t.textureData.length>0?e:void 0,geometry:null!=t.geometryData?e:void 0},l,Array.isArray(t.lodSelection)?t.lodSelection:null,r)}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes(e=>{null!=e.node&&(e.node.failed=!1)})}_getNodeLoadPriority(e){const t=this._getNodeDescriptor(e),i=this._getParentIndex(e);if(null==t||null==i&&null==t.node)return null==i?1/0:this._getNodeLoadPriority(i);let s=0;if(t.node&&null!=i){const e=this._getNodeDescriptor(i);s=e.traversalState?.lodLevel??0}const n=10,o=this._hasLoadedAncestor(e)?0:n*this._viewportQueries.distCameraToPOI();return-(this._viewportQueries.distToPOI(t.nodeBoundingData??t.node)*(1+s)+s*n*this._viewportQueries.distCameraToPOI())+o}_hasLoadedAncestor(e){let t=this._getParentIndex(e);for(;null!=t;){if(this._isLoaded(t))return!0;t=this._getParentIndex(t)}return!1}traverseVisible(e,t){const i=this._getNodeDescriptor(this._rootIndex);null!=i?this._traverseVisible(this._rootIndex,null,i,e,t):e(this._rootIndex,null,null)}_traverseVisible(e,t,i,s,n){const o=R(e,this._pageSize);if(n&&n.add(o),i.node&&0===i.childCount)return void(this.isGeometryVisible(e)&&s(e,i,t));if(!this.isNodeVisible(e))return;if(s(e,i,t),null==i.node)return;const r=this.nodeTraversalState(i.node);if(r?.nodeHasLOD&&r.lodLevel===this._maxLodLevel)return;const a=this._getPageFromPageIndex(o);for(let d=0;d<i.childCount;d++){const t=a.children[i.childOffset+d],o=this._getNodeDescriptor(t);if(o)this._traverseVisible(t,e,o,s,n);else{if(n){const e=R(t,this._pageSize);n.add(e)}s(t,null,e)}}}traverse(e,t){t(e)&&this.traverseDescendants(e,t)}traverseDescendants(e,t){++this._traverseDescendantsNestingLevel;const i=e.index,s=this._pageSize,n=R(i,s),o=this._getPageFromPageIndex(n);if(null==o)return;const r=this._frameNumber,a=this._nodePages,d=S(i,s),l=o.nodes[d],h=l.childCount;if(o.lastTraversed=r,0===h)return;const u=new Array,c=1===this._traverseDescendantsNestingLevel?this._traverseDescendantsQueue:[0];let g=0;{const{childOffset:e,childCount:t}=l,{children:i}=o;c.length=2**Math.ceil(Math.log2(g+t));for(let s=e;s<e+t;++s){const e=i[s];e>=0?(c[g]=e,++g):u.push(e)}}if(u.length>0){const e=this._clientNodePage;if(e){const i=e.children;let s=0;for(;s<u.length;){const n=u[s];++s;const o=-n-1,r=e.nodes[o],a=r.node;if(!a||!t(a))continue;const{childCount:d}=r;if(0===d)continue;const{childOffset:l}=r,h=l+d;for(let e=l;e<h;++e)u.push(i[e])}}}if(g>0){let e=0;if(s>0){let i=n*s,d=o,l=d.nodes;for(;e<g;){const n=c[e];let o;if(++e,i<=n&&n<i+s)o=d;else{const e=n/s|0,t=a.get(e);if(void 0===t)continue;o=t,o.lastTraversed=r,d=o,l=d.nodes,i=s*e}const h=l[n-i],u=h.node;if(null==u||!1===t(u))continue;const{childCount:_}=h;if(0===_)continue;const f=g+_;for(c.length<f&&(c.length=2**Math.ceil(Math.log2(g+_)));c.length<g+_;)c.length+=c.length;const m=o.children,{childOffset:v}=h,p=v+_;for(let e=v;e<p;++e)c[g]=m[e],++g}}else{const i=a.get(0);if(i)for(;e<g;){const s=c[e++],n=i.nodes[s],o=n.node;if(!o||!t(o))continue;const{childCount:r}=n;if(0===r)continue;c.length=Math.max(c.length,2**Math.ceil(Math.log2(g+r)));const a=i.children,{childOffset:d}=n,l=d+r;for(let e=d;e<l;++e)c[g]=a[e],++g}}}--this._traverseDescendantsNestingLevel}updateChildrenLoaded(e,t){let i=this.getNode(e);for(;null!=i;){const e=i.childrenLoaded,s=e+t;i.childrenLoaded=s;const n=0===e?1:0===s?-1:0,o=i.index;if(0!==n){this._getPage(o).numNodesWithLoadedChildren+=n}i=this.getParent(o)}}checkChildrenLoadedInvariant(){return!0}updateElevationInfo(e,t){this.needNodeElevationRange=t&&!!e&&("relative-to-ground"===e.mode||"relative-to-scene"===e.mode||"on-the-ground"===e.mode),this._viewportQueries.updateElevationInfo(e),this.invalidateAllElevationRanges()}invalidateAllElevationRanges(){this._forAllNodes(e=>{e?.invalidateBounds(),e.node?.invalidateElevationRange(),e.nodeBoundingData?.invalidateElevationRange()})}_forAllNodes(e){if(null!=this._clientNodePage){const t=this._clientNodePage;for(let i=0;i<t.nodes.length;i++)e(t.nodes[i],-(i+1))}for(const[t,i]of this._nodePages){const s=t*this._pageSize;for(let t=0;t<i.nodes.length;t++)e(i.nodes[t],s+t)}}clearCaches(){if(this._useNodePages){const e=this._nodePages,t=new Set;this.traverseVisible(e=>t.add(R(e,this._pageSize)));for(const[i,s]of e)if(0!==s.numNodesWithLoadedChildren||t.has(i))for(const e of s.nodes)e.traversalState=null;else this._deleteNodePage(i)}}_deleteNodePage(e){const t=this._nodePages.get(e);this._nodePages.delete(e),t?.destroy()}get test(){}}const p=new Map;class N{constructor(t){this.missing=t,this.update=new e({deallocator:null}),this.add=new e({deallocator:null}),this.remove=new e({deallocator:null}),this.cancel=[]}destroy(){this.update.prune(),this.add.prune(),this.remove.prune(),this.cancel.length=0}reset(e){this.add.clear(),this.update.clear(),this.cancel=e}}function b(e){return u(e,-2)}function P(e){return u(e,2)}function y(e,t){return t+(e?1:0)}function I(e,t){return(-2&e)===t}function x(e){return!(1&~e)}function R(e,t){return e<0?-1:t>0?e/t|0:0}function S(e,t){return e<0?-e-1:0===t?e:e%t}function C(e,t,i){return-1===t?-(e+1):0===i?e:t*i+e}const w=[["maxScreenThreshold",1],["screenSpaceRelative",2],["removedFeatureDiameter",3],["distanceRangeFromDefaultCamera",4]];function E(e){if(e)for(let t=0;t<e.length;t++)for(const i of w)if(i[0]===e[t].metricType)return{lodMetric:i[1],maxError:e[t].maxError};return{lodMetric:0,maxError:0}}class M{constructor(){this.known=0,this.knownNodes=0,this.missing=0,this.missingNodes=0,this.unremoved=0}}class D{constructor(){this.numFeatures=0,this.knownNodes=0,this.missingNodes=0}}function A(e){return Math.sqrt(e*(4/Math.PI))}const V=o(),O=o(),L=o(),B=o(),z=has("esri-mobile")?100:300;export{v as I3SIndex,E as selectErrorMetric};
5
+ import has from"../../../../core/has.js";import e from"../../../../core/PooledArray.js";import{isAbortError as t}from"../../../../core/promiseUtils.js";import{projectBoundingSphere as i}from"../../../../geometry/projection/projectBoundingSphere.js";import{j as s,m as n,c as o,z as r}from"../../../../chunks/sphere.js";import{NodeBoundingData as a,Node as d,NodeTraversalState as l}from"./I3SNode.js";import{invalidateMbs as h,addWraparound as u}from"./I3SUtil.js";import{ValidatedNode as c}from"./ValidatedNode.js";import{ElevationRange as g}from"../../support/ElevationRange.js";import{Obb as _}from"../../support/orientedBoundingBox.js";class f{constructor(e,t,i,s,n){this.childOffset=e,this.childCount=t,this.visibilityCache=i,this._boundingData=s,this.node=n,this.parentIndex=-1,this.useAsHole=0,this.filterImpact=2,this.traversalState=null}get nodeBoundingData(){return this._boundingData}destroy(){this._boundingData=null,this.node=null,this.traversalState=null}invalidateBounds(){this.node?.invalidateServiceBVsInRenderSR(),this.nodeBoundingData?.invalidateServiceBVsInRenderSR()}}class m{constructor(e=new Array,t=new Array){this._nodeDescriptors=e,this._children=t,this.lastTraversed=0,this.numNodesWithLoadedChildren=0}destroy(){for(const e of this._nodeDescriptors)e.destroy();this._nodeDescriptors.length=0,this._children.length=0}get nodes(){return this._nodeDescriptors}addNode(e){return this._nodeDescriptors.push(e),this._nodeDescriptors.length-1}setNodes(e,t){this._nodeDescriptors=e,this._children=t}get children(){return this._children}}class v{get _useNodePages(){return this._pageSize>0}constructor(t,i,s,n,o,r,d,l,h,u,c,g,_,f,v){if(this.viewingMode=t,this._layer=i,this._requester=n,this._clientNodeLoader=o,this._viewportQueries=r,this._logger=d,this.holeFilling=l,this._isLoaded=h,this._isReloading=u,this._shouldLoadNode=c,this._enable=g,this._needsUpdate=_,this._computeVisibilityObb=f,this._computeNodeFiltering=v,this._dirty=!0,this._nodePages=new Map,this._clientNodePage=null,this._pageSize=0,this._rootIndex=0,this._lodMetric=0,this._lodConversion=e=>e,this._isEditable=!1,this.urlPrefix="",this._loadingNodes=new Set,this._loadingPages=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._version=P(0),this._visibilityCacheVersion=P(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._progressiveLoadPenaltyWeight=10,this._missingPagesAndNodes=new e({deallocator:null}),this._prefetchNodes=new e({deallocator:null}),this._updates=new N(this._missingPagesAndNodes),this._imModificationUncategorized=new e({deallocator:null}),this.ignoreServiceObb=!1,this._pageQueue=new Array,this._newPages=new Array,this.needNodeElevationRange=!1,this.layerHasModifications=!1,this._layerHasFilter=!1,this._frameNumber=0,this._traverseDescendantsQueue=[0],this._traverseDescendantsNestingLevel=0,this._isEditable=null!=i.associatedLayer?.infoFor3D,i.serviceUpdateTimeStamp?.lastUpdate&&(this._lastUpdate=`${i.serviceUpdateTimeStamp.lastUpdate}`),this._maxLodLevel=this._viewportQueries?this._viewportQueries.maxLodLevel:1,"page"===s.type){const e=s.rootPage;switch(this.urlPrefix=s.urlPrefix,this._pageSize=s.pageSize,s.lodMetric){case"maxScreenThreshold":this._lodMetric=1;break;case"maxScreenThresholdSQ":this._lodMetric=1,this._lodConversion=A}if(this._isEditable){this._rootIndex=-1;const t=S(s.rootIndex,s.pageSize),i=e.nodes[t],n={nodes:[{index:this._rootIndex,children:[s.rootIndex],mesh:void 0,obb:i.obb,lodThreshold:i.lodThreshold}]};this._addPage(R(this._rootIndex,this._pageSize),n),this.getNode(-1).serviceObbInIndexSR=void 0}else this._rootIndex=s.rootIndex;this._addPage(R(s.rootIndex,this._pageSize),e),this._updateParentsAndLevel()}else if("node"===s.type){this.urlPrefix=s.urlPrefix;const e=new m;if(this._nodePages.set(0,e),this._isEditable){this._clientNodePage=new m;const e={id:"-1",version:null,mbs:s.rootNode.mbs,obb:s.rootNode.obb,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:[{id:"root",href:"../root",mbs:s.rootNode.mbs,obb:s.rootNode.obb}]};this._rootIndex=this._makeClientRefNode(new a(e.id,null),-1);const t=this._validateNode(e.id,e);t&&this._addNode(t,this._rootIndex)}else this._rootIndex=this._makeRefNode(new a(s.rootNode.id,null),-1);const t=this._validateNode(s.rootNode.id,s.rootNode);t&&this._addNode(t,0)}}addClientNodeToIndex(e,t){const i=-1,s=new a(e,t),n=this._makeClientRefNode(s,i);return this._linkChildToParentNode(i,n),this.requestUpdate(),n}removeClientNodeFromIndex(e,t,i){this._destroyClientRefNode(e,t,i),this.requestUpdate()}_canRequest(e){return!this._requester.isFull(e)}_loadPage(e){this._loadingPages.add(e);const i=this.urlPrefix+e;this._requester.request(i,"json").then(t=>this._pageQueue.push({pageIndex:e,page:t})).catch(i=>{this._loadingPages.delete(e),t(i)||(this._failedPages.add(e),this._logger.error("#loadPage()",this._layer,`Error when loading page ${e}`,i))})}_addQueuedPages(e){for(;this._pageQueue.length>0&&!e.done;){const{pageIndex:t,page:i}=this._pageQueue.shift();this._addPage(t,i),this._loadingPages.delete(t),e.madeProgress(),this.needNodeElevationRange&&this._newPages.push(t)}this._updateParentsAndLevel()}_invalidateElevationRangeForNewPages(e){if(this.needNodeElevationRange)for(;this._newPages.length>0&&!e.done;){const e=this._nodePages.get(this._newPages.shift());e?.nodes.forEach(e=>{let t=e.parentIndex;for(;null!=t&&t!==this._rootIndex;){const e=this.getNode(t);e&&!Number.isNaN(e?.elevationRangeMin)&&(e.invalidateElevationRange(),this.invalidateBoundingVolumeCache(t)),t=this._getParentIndex(t)}})}}_addPage(e,t){const i=[],n=[],o=t.nodes.map((t,o)=>{const r=i.length,a=t.children?t.children.length:0;n.push(this._rootIndex);for(let e=0;e<a;e++)i.push(t.children[e]);const l=`${t.index}`,h=_.fromJSON(t.obb),u=s(h.center,h.radius),c=t.mesh?.attribute,g=t.mesh?.geometry,m=t.mesh?.material,v={hasSharedResource:!1,isEmpty:null==g,attributes:null!=c?.resource?`${c.resource}`:void 0,geometry:null!=g?.resource?`${g.resource}`:void 0,texture:null!=m?.resource?`${m.resource}`:void 0,geometryDefinition:g?g.definition:-1,materialDefinition:m?m.definition:-1},p=new d(l,C(o,e,this._pageSize),u,a,0,v,this._lastUpdate,this._lodMetric,this._lodConversion(t.lodThreshold),g?.featureCount??null);return p.serviceObbInIndexSR=h,p.visibilityObbInRenderSR=this._computeVisibilityObb(p),p.vertexCount=g?g.vertexCount:0,new f(r,a,b(this._visibilityCacheVersion),null,p)}),r=new m(o,i);-1===e?this._clientNodePage=r:this._nodePages.set(e,r)}_updateParentsAndLevel(){const e=new Array,t=(t,i,s)=>{const n=this._getPage(t);if(null!=n){const o=S(t,this._pageSize),r=n.nodes[o];r.parentIndex=null!=i?i:-1;const a=r.node;null!=a&&(a.level=s,e.push(t))}};for(t(this._rootIndex,null,0);e.length;){const i=e.pop(),s=this.getNode(i);if(null!=s)for(let e=0;e<s.childCount;e++){t(this.getChildIndex(s.index,e),i,s.level+1),this._maxLevel=Math.max(this._maxLevel,s.level+1)}}}_getPage(e){const t=R(e,this._pageSize);return this._getPageFromPageIndex(t)}_getPageFromPageIndex(e){return e<0?this._clientNodePage:this._nodePages.get(e)}_getNodeDescriptor(e){const t=this._getPage(e);return null==t?null:(t.lastTraversed=this._frameNumber,t.nodes[S(e,this._pageSize)])}_addNode(e,t){e.children&&this.populateChildren(t,e.children);const i=this.getParent(t),s=null!=i?i.level+1:0;this._maxLevel=Math.max(this._maxLevel,e.children?s+1:s);const{lodMetric:n,maxError:o}=E(e.lodSelection),r=this._getNodeDescriptor(t),a=new d(e.id,t,e.mbs,r.childCount,s,e.resources,e.version,n,o,e.numFeatures);r.node=a,e.obb&&(a.serviceObbInIndexSR=_.fromJSON(e.obb)),a.visibilityObbInRenderSR=this._computeVisibilityObb(a);const l=r.nodeBoundingData;return null!=l&&(null==l.serviceMbsInIndexSR&&(l.serviceMbsInIndexSR=e.mbs),a.shareServiceBVsInRenderSRWith(l),l.visibilityObbInRenderSR=a.visibilityObbInRenderSR),a}_makeRefNode(e,t){const i=this._nodePages.get(0);if(t<-1)return this._makeClientRefNode(e,t);if(null==i)return-1;const s=i.nodes.length,n=new f(0,0,b(this._visibilityCacheVersion),e,null);return i.addNode(n),n.parentIndex=t,e.invalidateServiceBVsInRenderSR(),s}_makeClientRefNode(e,t){const i=this._clientNodePage;if(null==i)return-1;if(t>=0)throw new Error("I3SIndex::client side nodes can not be made children of service side nodes.");const s=-(i.nodes.length+1),n=new f(0,0,b(this._visibilityCacheVersion),e,null);return i.addNode(n),n.parentIndex=t,e.invalidateServiceBVsInRenderSR(),s}_linkChildToParentNode(e,t){const i=this._clientNodePage;if(null==i||e>=0)return;const s=S(e,this._pageSize),n=S(t,this._pageSize),o=i.nodes[s],r=o.childOffset;i.children.splice(o.childOffset+o.childCount,0,t);const a=1;o.childCount+=a,null!=o.node&&(o.node.childCount+=a);for(const d of i.nodes)d.childOffset>r&&(d.childOffset+=a);i.nodes[n].parentIndex=e,this._updateParentBoundingInformation(e)}_destroyClientRefNode(e,t,i){const s=this._clientNodePage;if(null==s)return;const n=this._getParentIndex(e);if(null==n)return;const o=new Set,r=new Map,a=e=>{const i=S(e,this._pageSize),n=s.nodes[i];if(n.childCount>0)for(let t=n.childOffset;t<n.childOffset+n.childCount;++t)a(s.children[t]);const r=n.node?.id??n.nodeBoundingData?.id;if(null==r)throw new Error("Node has no id");t(r,e),o.add(n)};a(e);const d=s.nodes,l=s.children,h=s.nodes.map(()=>-1),u=[],c=[];for(let g=0;g<d.length;++g){const e=d[g];if(o.has(e))continue;const t=u.length,s=C(g,-1,this._pageSize),n=C(t,-1,this._pageSize);if(e.node&&(e.node.index=n),h[g]=n,u.push(e),s!==n){const t=e.node?.id??e.nodeBoundingData?.id;if(null==t)throw new Error("Node has no id");i(t,s,n),r.set(s,n)}}for(let g=0;g<u.length;++g){const e=C(g,-1,this._pageSize),t=u[g],i=c.length;for(let s=t.childOffset;s<t.childOffset+t.childCount;++s){const t=l[s];if(t>=0)c.push(t);else{const i=S(t,this._pageSize),s=d[i];if(o.has(s))continue;const n=h[i];c.push(n),s.parentIndex=e}}t.childOffset=i,t.childCount=c.length-i,t.node&&(t.node.childCount=t.childCount)}s.setNodes(u,c),this._updateParentBoundingInformation(h[S(n,this._pageSize)])}_updateParentBoundingInformation(e){let t=e;do{let e=null;const s=this._clientNodeLoader.indexSR,a=this._clientNodeLoader.renderSR,d=this._getNodeDescriptor(t);if(null==d)return;for(let o=0;o<d.childCount;o++){const d=this.getChildIndex(t,o),l=this._getNodeDescriptor(d),h=null!=l?l.nodeBoundingData||l.node:null;if(null!=h&&h.serviceMbsInIndexSR[3]>0)if(null==e)e=n(h.serviceMbsInIndexSR,V);else{const t=L,n=O,o=B;i(h.serviceMbsInIndexSR,s,t,a),i(e,s,n,a),r(t,n,o),i(o,a,e,s)}}const l=t=>{null!=t&&(t.serviceObbInIndexSR=null,null!=e?(t.serviceMbsInIndexSR??=o(),n(e,t.serviceMbsInIndexSR)):h(t.serviceMbsInIndexSR),t.invalidateServiceBVsInRenderSR(),t.geometryObbInRenderSR=null)};l(d.nodeBoundingData),l(d.node),this.invalidateNodeVisibilityCacheInternal(d),t=this._getParentIndex(t)}while(null!=t)}populateChildren(e,t){const i=this._getNodeDescriptor(e),s=this._getPage(e);i.childOffset=s.children.length,i.childCount=t.length;for(let n=0;n<t.length;n++){const i=this._makeRefNode(t[n],e);s.children.push(i)}}getNode(e){const t=this._getNodeDescriptor(e);return null!=t?t.node:null}getIndexById(e){let t;return this._forAllNodes((i,s)=>{(null!=i.node&&i.node.id===e||null!=i.nodeBoundingData&&i.nodeBoundingData.id===e)&&(t=s)}),t}getNodeById(e){const t=this.getIndexById(e);return null!=t&&t>=0?this.getNode(t):null}getChildIndex(e,t){const i=this._getPage(e);if(null==i)return-1;const s=i.nodes[S(e,this._pageSize)];return i.children[s.childOffset+t]}_getParentIndex(e){const t=this._getPage(e);return null!=t&&e!==this._rootIndex?t.nodes[S(e,this._pageSize)]?.parentIndex:null}getParent(e){const t=this._getParentIndex(e);return null!=t?this.getNode(t):null}isLeaf(e){const t=this._getNodeDescriptor(e);return null!=t&&0===t.childCount}get rootNode(){return this.getNode(this._rootIndex)}get isEditable(){return this._isEditable}removeAllGeometryObbs(){this._forAllNodes(e=>{null!=e.node&&(e.node.geometryObbInRenderSR=null)})}invalidateVisibilityCache(){this._visibilityCacheVersion=P(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(e){const t=this._getNodeDescriptor(e);null!=t&&this.invalidateNodeVisibilityCacheInternal(t)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=b(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(e){const t=this._getNodeDescriptor(e);null!=t&&(t?.invalidateBounds(),this.invalidateNodeVisibilityCacheInternal(t))}updateElevationChanged(e){const t=this._getNodeDescriptor(e);if(null==t)return;if(!this.needNodeElevationRange)return void this.invalidateBoundingVolumeCache(e);const i=null!=t.node?t.node:t.nodeBoundingData;null!=i&&i.invalidateElevationRange()}invalidateGeometryVisibility(e){const t=this._getNodeDescriptor(e),i=t?.node;i&&(i.geometryObbInRenderSR=null,i.invalidateServiceBVsInRenderSR())}invalidateVisibilityObbs(){null!=this.rootNode&&this.traverse(this.rootNode,e=>(e.visibilityObbInRenderSR=this._computeVisibilityObb(e),e.geometryObbInRenderSR=null,!0))}_isElevationRangeUpToDate(e){if(!this.needNodeElevationRange)return!0;const t=e?.node??e?.nodeBoundingData;return!t||t.elevationRangeValid}_updateElevationRange(e,t){const i=this._getNodeDescriptor(e);if(!i)return!1;const s=i?.node??i?.nodeBoundingData;if(!s)return!1;if(s.elevationRangeValid)return t?.expandElevationRange(s),!0;const n=new g;let o=!1;for(let d=0;d<i.childCount;d++){const t=this.getChildIndex(e,d),i=this._updateElevationRange(t,n);o=o||!i}if(0===i.childCount||o){const e=!i.node?.resources.isEmpty;this._viewportQueries.expandElevationRange(s,e,n)}n.elevationRangeMin!==1/0&&n.elevationRangeMax!==-1/0||n.expandElevationRangeValues(0,0);const{elevationRangeMin:r,elevationRangeMax:a}=s;return r===n.elevationRangeMin&&a===n.elevationRangeMax?(t?.expandElevationRange(s),!0):(i.node?.setElevationRange(n),i.nodeBoundingData?.setElevationRange(n),this.invalidateBoundingVolumeCache(e),t?.expandElevationRange(s),!0)}isNodeVisible(e){const t=this._getNodeDescriptor(e);if(null==t)return!0;const i=t.nodeBoundingData;if(null!=i&&!i.serviceMbsInIndexSR)return!0;if(this._isElevationRangeUpToDate(t)&&I(t.visibilityCache,this._visibilityCacheVersion))return x(t.visibilityCache);const s=t.node,n=this._viewportQueries;if(s){const e=n.ensureElevationAgnosticBoundingVolume(s),i=n.isElevationAgnosticBoundingVolumeVisible(e);let o=i;if(this.needNodeElevationRange&&i){const t=n.getNodeObbInRenderSRIndependentOfElevationOffset(s);null!=t&&(o=n.isObbVisibleIndependentOfElevation(e,t))}if(!o)return t.visibilityCache=y(!1,this._visibilityCacheVersion),!1}if(this._layerHasFilter&&this._computeNodeFiltering&&(null!=s||null!=i)&&2===t.filterImpact){const e=null!=s?s.serviceMbsInIndexSR:null!=i?i.serviceMbsInIndexSR:null;t.filterImpact=null!=e?this._computeNodeFiltering(e):0}const o=null!=s&&1===t.filterImpact;let r=!(null!=s&&2===s.imModificationImpact)&&!o;if(r){const t=!s||i&&!s.visibilityObbInRenderSR?i??null:s;if(null!=t){this.needNodeElevationRange&&this._updateElevationRange(e);r=n.isNodeVisible(t)}}return t.visibilityCache=y(r,this._visibilityCacheVersion),r}isGeometryVisible(e){if(!this.isNodeVisible(e))return!1;const t=this._getNodeDescriptor(e);return!!(null==t?.node?.geometryObbInRenderSR||this.layerHasModifications&&4===t.node.imModificationImpact)||this._viewportQueries.isGeometryVisible(t.node)}_traverseCoverage(e,t,i,s,n){const o=this._getPage(e);if(null==o||0===t.childCount)return;const r=t.childOffset+t.childCount,a=new Array;for(let d=t.childOffset;d<r;++d){const e=o.children[d],t=this._getNodeDescriptor(e);null!=t?.node&&this.isGeometryVisible(e)&&a.push(t)}s/=a.length;for(const d of a){const e=d.node.index;this._isLoaded(e)||this._isReloading(e)?(n.delta=Math.max(n.delta,i),n.coverage+=s):this._traverseCoverage(e,d,i+1,s,n)}}useNodeAsHole(e){if("off"===this.holeFilling)return!1;const t=this._getNodeDescriptor(e);if(null==t)return!1;if("always"===this.holeFilling)return!0;if(I(t.useAsHole,this._version))return x(t.useAsHole);const i={delta:0,coverage:0};this._traverseCoverage(e,t,0,1,i);const s=i.delta*i.coverage<=.5;return t.useAsHole=y(s,this._version),s}get maxLevel(){return this._maxLevel}get dirty(){return this._dirty}destroy(){this._updates.destroy(),this._nodePages.clear(),this._clientNodePage=null,this._layer=null,this._missingPagesAndNodes.prune(),this._prefetchNodes.prune(),this._imModificationUncategorized.prune()}requestUpdate(){this._dirty=!0,this._indexMissing=1,this._version=P(this._version)}imModificationsChanged(e){this.layerHasModifications=e,this._forAllNodes(({node:e})=>{null!=e&&(e.imModificationImpact=4,e.visibilityObbInRenderSR=this._computeVisibilityObb(e),e.hasModifications&&this.invalidateGeometryVisibility(e.index))}),this.invalidateVisibilityCache()}layerFilterChanged(e){this._layerHasFilter=e,this._forAllNodes(e=>{if(null!=e){e.filterImpact=2;const t=e.node;null!=t&&this.invalidateNodeVisibilityCache(t.index)}}),this.invalidateVisibilityCache()}update(e,t,i){if(!this._dirty)return;this._pageQueue.length>0&&this._addQueuedPages(t),this._invalidateElevationRangeForNewPages(t),this.resetUpdateState(e);let s=!0;const n=new M,o=new D,r=this._imModificationUncategorized;r.clear();const a=new Set;let d=0;const l=(a,l,h)=>{const u=e=>{this._shouldLoadNode(e)&&e.childCount&&(s=!1)};if(!l){const e=R(a,this._pageSize);let t=this._getNodeLoadPriority(a);return t===1/0&&(t=this._getNodeLoadPriority(h)),p.set(e,Math.max(t,p.get(e)||0)),this._loadingPages.has(e)||this._failedPages.has(e)||(this._missingPagesAndNodes.push(e),++d),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,t))}const{node:c,childCount:g}=l;if(this._updateNodeFeatureEstimate(c,o),!c){const e=this._getNodeLoadPriority(a);return this._loadingNodes.has(a)||this._failedNodes.has(a)||(this._missingPagesAndNodes.push(a),p.set(a,e)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const _=this._getPage(a);if(!this._useNodePages&&0===this._missingPagesAndNodes.length)for(let e=0;e<g;e++){const t=_.children[l.childOffset+e],i=this._getNodeDescriptor(t);null!=i&&!i.node&&!this._loadingNodes.has(t)&&!this._failedNodes.has(t)&&t>=0&&(p.set(t,this._getNodeLoadPriority(t)),this._prefetchNodes.push(t))}if(c.failed||c.resources.isEmpty)return void u(c);if(this._isLoaded(a)){if(n.known+=c.memory,++n.knownNodes,u(c),this._shouldLoadNode(c)||(n.unremoved+=c.memory),this._needsUpdate(c)){const e=this._getNodeLoadPriority(a);p.set(a,e),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e),this._updates.update.push(a)}return}if(c.memory&&(n.known+=c.memory,++n.knownNodes),!this._shouldLoadNode(c))return void(this._isReloading(a)&&this._updates.remove.push(a));if(u(c),c.memory?(n.missing+=c.memory,n.known+=c.memory,++n.knownNodes):++n.missingNodes,e.includes(c.index))return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._getNodeLoadPriority(a)),void(this._updates.cancel=this._updates.cancel.filter(e=>e!==c.index));if(!t.done&&this._enable(c))return void t.madeProgress();const f=this._getNodeLoadPriority(a);p.set(a,f),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,f),this._updates.add.push(a),this.layerHasModifications&&i&&null!=c&&4===c.imModificationImpact&&r.push(a)};this.traverseVisible(l,a),this._frameNumber++,this._finalizeMissingNodesAndPages(),this._removeUnusedNodePages(a,d),this._handleModifications(i,r),this._updateUnloadedMemoryEstimate(n),this._featureEstimate.estimate=this._computeFeatureEstimate(o),this._featureEstimate.leavesReached=s,this._updates.add.filterInPlace(e=>p.get(e)>=this._maxUnloadedPrio).sort((e,t)=>p.get(e)-p.get(t)),this._updates.update.sort((e,t)=>p.get(e)-p.get(t)),this._indexMissing=this._loadingPages.size+this._loadingNodes.size+this._missingPagesAndNodes.length,this._dirty=this._indexMissing>0,p.clear()}_updateUnloadedMemoryEstimate(e){this._unloadedMemoryEstimate=e.missing-e.unremoved,e.knownNodes>3&&e.missingNodes>0&&(this._unloadedMemoryEstimate+=e.known/e.knownNodes*e.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate)}resetUpdateState(e){this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missingPagesAndNodes.clear(),this._prefetchNodes.clear(),this._updates.reset(e),p.clear()}_finalizeMissingNodesAndPages(){this._missingPagesAndNodes.sort((e,t)=>e-t),this._missingPagesAndNodes.filterInPlace((e,t)=>t<1||this._missingPagesAndNodes.data[t-1]!==e),this._missingPagesAndNodes.sort((e,t)=>p.get(e)-p.get(t)),this._missingPagesAndNodes.length>0&&(this._maxUnloadedPrio=p.get(this._missingPagesAndNodes.back()),this._prefetchNodes.clear())}_handleModifications(e,t){this.layerHasModifications&&0!==this._updates.add.length&&(t.length>0&&e?.(t),this._updates.add.filterInPlace(e=>{const t=this._getNodeDescriptor(e),i=null==t?.node||2!==t.node.imModificationImpact;return i||this.invalidateNodeVisibilityCache(e),i}))}checkFeatureTarget(e,t){const i=this._viewportQueries.updateScreenSpaceErrorBias(t);let s=t,n=t,o=i,r=10;for(;r--;){const i=new D;this._updateFeatureEstimate(s,i);if(this._computeFeatureEstimate(i)<=e){if(s>=t||i.missingNodes>0||0===r)break;o=s,s=.5*(s+n)}else n=s,s=.5*(s+o)}return this._version=P(this._version),this._viewportQueries.updateScreenSpaceErrorBias(i),Math.min(t,s)}_removeUnusedNodePages(e,t){if(!this._useNodePages)return;const i=e.size,s=this._nodePages,n=s.size+this._loadingPages.size+t;if(n>z&&n>i){const t=new Array;for(const[i,n]of s)0!==n.numNodesWithLoadedChildren||e.has(i)||t.push([n.lastTraversed,i]);t.sort((e,t)=>e[0]-t[0]).some(e=>{const t=e[1];return this._deleteNodePage(t),s.size<=z})}}_updateFeatureEstimate(e,t){this._version=P(this._version),this._viewportQueries.updateScreenSpaceErrorBias(e),this.traverseVisible((e,i)=>this._updateNodeFeatureEstimate(i?.node,t))}_updateNodeFeatureEstimate(e,t){null!=e&&!e.failed&&this._shouldLoadNode(e)&&(null!=e.numFeatures?(t.numFeatures+=e.numFeatures,++t.knownNodes):++t.missingNodes)}_computeFeatureEstimate(e){let t=e.numFeatures;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.numFeatures/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._missingPagesAndNodes)}prefetch(){return this._prefetchNodes.sort((e,t)=>p.get(e)-p.get(t)),this._load(this._prefetchNodes)}_load(e){if(0===e.length||!this._canRequest(this.urlPrefix))return!1;for(;e.length>0&&this._canRequest(this.urlPrefix);){const t=e.pop();this._useNodePages&&t>=0?this._loadPage(t):this._loadNode(t)}return!0}get isLoading(){return this._indexMissing>0}get isPrefetching(){return this._prefetchNodes.length>0}get indexLoading(){return this._loadingPages.size+this._loadingNodes.size}get indexMissing(){return this._indexMissing}get unloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}get maxPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}nodeTraversalState(e){if(null==e)return null;const t=e.index,i=this._getNodeDescriptor(t);if(!i)return null;let s=i?.traversalState;if(s&&I(s.version,this._version))return s;const n=this._viewportQueries.getLodLevel(e),o=this._viewportQueries.hasLOD(e);let r=!0;if(o){const e=this._getParentIndex(t);if(null!=e){const t=this._getNodeDescriptor(e),i=t?.traversalState;r=!!i&&n>i.lodLevel}else r=n>0}else r=0===e.childCount;return s?(s.lodLevel=n,s.isChosen=r,s.version=y(!0,this._version),s):(s=new l(o,r,n,y(!0,this._version)),i.traversalState=s,s)}_loadNode(e){this._loadingNodes.add(e);const i=this._getNodeDescriptor(e).nodeBoundingData;if(null==i)return void this._failedNodes.add(e);const s=i.id,n=this.urlPrefix+s,o=()=>{this._loadingNodes.delete(e),0===this._missingPagesAndNodes.length&&0===this._loadingNodes.size&&this.requestUpdate()};(e>=0?this._requester.request(n,"json"):this._clientNodeLoader.loadNodeJSON(s)).catch(i=>{o(),t(i)||(this._logger.error("#loadNode()",this._layer,"Error loading node: "+n),this._failedNodes.add(e))}).then(t=>{o();const i=this._validateNode(s,t);if(null==i)return;i.obb&&this.invalidateNodeVisibilityCache(e);const n=this._addNode(i,e);this.nodeTraversalState(n)})}_validateNode(e,t){if(null==t||"object"!=typeof t||t.id!==e)return this._logger.error("#validateNode()",this._layer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this._logger.error("#validateNode()",this._layer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&"./shared"!==t.sharedResource.href&&"./shared/"!==t.sharedResource.href&&this._logger.warn("#validateNode()",this._layer,`Invalid shared resource href on node "${e}"`);const i=t.geometryData;null==i||Array.isArray(i)&&0===i.length||Array.isArray(i)&&1===i.length&&"./geometries/0"===i[0].href||this._logger.warn("#validateNode()",this._layer,`Invalid geometry data on node "${e}"`);const s=t.attributeData,n=this._layer.attributeStorageInfo;null==s||Array.isArray(s)&&!s.some((e,t)=>e.href!==`./attributes/${n?.[t]?.key??`f_${t}`}/0`)||this._logger.warn("#validateNode()",this._layer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this._logger.warn("#validateNode()",this._layer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const o=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:void 0,r=t.featureData&&1===t.featureData.length&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:void 0,d=t=>{if(null==t)return null;const i=t=>this._logger.error("#validateNode()",this._layer,`Invalid node reference on node ${e}: ${t}`);if("number"==typeof t.id)i(`id ${t.id} is a number instead of a string.`);else if("string"!=typeof t.id||!Array.isArray(t.mbs))return i("Missing or invalid id."),null;if(!Array.isArray(t.mbs))return i(`Invalid bounding volume on reference ${t.id}.`),null;t.href&&t.href!=="../"+t.id&&this._logger.error("#validateNode()",this._layer,`Invalid node href on node "${e}"`);const s=new a(`${t.id}`,t.mbs);return s.serviceObbInIndexSR=!this.ignoreServiceObb&&t.hasOwnProperty("obb")&&t.obb?_.fromJSON(t.obb):null,s.visibilityObbInRenderSR=this._computeVisibilityObb(s),s},l=Array.isArray(t.children)?t.children.map(d).filter(e=>null!=e):null,h=t.featureData?.length??!1,u=!0===t.isEmpty;return new c(e,t.mbs,o,"string"==typeof t.version?t.version:null,{isEmpty:!h&&u,hasSharedResource:null!=t.sharedResource,attributes:t.attributeData?e:void 0,texture:t.textureData&&t.textureData.length>0?e:void 0,geometry:null!=t.geometryData?e:void 0},l,Array.isArray(t.lodSelection)?t.lodSelection:null,r)}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes(e=>{null!=e.node&&(e.node.failed=!1)})}_getNodeLoadPriority(e){const t=this._getNodeDescriptor(e),i=this._getParentIndex(e);if(null==t||null==i&&null==t.node)return null==i?1/0:this._getNodeLoadPriority(i);let s=0;if(t.node&&null!=i){const e=this._getNodeDescriptor(i);s=e.traversalState?.lodLevel??0}const n=this._getHoleBonus(e);return-(this._viewportQueries.distToCameraPOIRay(t.nodeBoundingData??t.node)*(1+s)+s*this._progressiveLoadPenaltyWeight*this._viewportQueries.distCameraToPOI())+n}_getHoleBonus(e){return this._hasLoadedAncestor(e)?0:this._progressiveLoadPenaltyWeight*this._viewportQueries.distCameraToPOI()}_hasLoadedAncestor(e){let t=this._getParentIndex(e);for(;null!=t;){if(this._isLoaded(t))return!0;t=this._getParentIndex(t)}return!1}traverseVisible(e,t){const i=this._getNodeDescriptor(this._rootIndex);null!=i?this._traverseVisible(this._rootIndex,null,i,e,t):e(this._rootIndex,null,null)}_traverseVisible(e,t,i,s,n){const o=R(e,this._pageSize);if(n&&n.add(o),i.node&&0===i.childCount)return void(this.isGeometryVisible(e)&&s(e,i,t));if(!this.isNodeVisible(e))return;if(s(e,i,t),null==i.node)return;const r=this.nodeTraversalState(i.node);if(r?.nodeHasLOD&&r.lodLevel===this._maxLodLevel)return;const a=this._getPageFromPageIndex(o);for(let d=0;d<i.childCount;d++){const t=a.children[i.childOffset+d],o=this._getNodeDescriptor(t);if(o)this._traverseVisible(t,e,o,s,n);else{if(n){const e=R(t,this._pageSize);n.add(e)}s(t,null,e)}}}traverse(e,t){t(e)&&this.traverseDescendants(e,t)}traverseDescendants(e,t){++this._traverseDescendantsNestingLevel;const i=e.index,s=this._pageSize,n=R(i,s),o=this._getPageFromPageIndex(n);if(null==o)return;const r=this._frameNumber,a=this._nodePages,d=S(i,s),l=o.nodes[d],h=l.childCount;if(o.lastTraversed=r,0===h)return;const u=new Array,c=1===this._traverseDescendantsNestingLevel?this._traverseDescendantsQueue:[0];let g=0;{const{childOffset:e,childCount:t}=l,{children:i}=o;c.length=2**Math.ceil(Math.log2(g+t));for(let s=e;s<e+t;++s){const e=i[s];e>=0?(c[g]=e,++g):u.push(e)}}if(u.length>0){const e=this._clientNodePage;if(e){const i=e.children;let s=0;for(;s<u.length;){const n=u[s];++s;const o=-n-1,r=e.nodes[o],a=r.node;if(!a||!t(a))continue;const{childCount:d}=r;if(0===d)continue;const{childOffset:l}=r,h=l+d;for(let e=l;e<h;++e)u.push(i[e])}}}if(g>0){let e=0;if(s>0){let i=n*s,d=o,l=d.nodes;for(;e<g;){const n=c[e];let o;if(++e,i<=n&&n<i+s)o=d;else{const e=n/s|0,t=a.get(e);if(void 0===t)continue;o=t,o.lastTraversed=r,d=o,l=d.nodes,i=s*e}const h=l[n-i],u=h.node;if(null==u||!1===t(u))continue;const{childCount:_}=h;if(0===_)continue;const f=g+_;for(c.length<f&&(c.length=2**Math.ceil(Math.log2(g+_)));c.length<g+_;)c.length+=c.length;const m=o.children,{childOffset:v}=h,p=v+_;for(let e=v;e<p;++e)c[g]=m[e],++g}}else{const i=a.get(0);if(i)for(;e<g;){const s=c[e++],n=i.nodes[s],o=n.node;if(!o||!t(o))continue;const{childCount:r}=n;if(0===r)continue;c.length=Math.max(c.length,2**Math.ceil(Math.log2(g+r)));const a=i.children,{childOffset:d}=n,l=d+r;for(let e=d;e<l;++e)c[g]=a[e],++g}}}--this._traverseDescendantsNestingLevel}updateChildrenLoaded(e,t){let i=this.getNode(e);for(;null!=i;){const e=i.childrenLoaded,s=e+t;i.childrenLoaded=s;const n=0===e?1:0===s?-1:0,o=i.index;if(0!==n){this._getPage(o).numNodesWithLoadedChildren+=n}i=this.getParent(o)}}checkChildrenLoadedInvariant(){return!0}updateElevationInfo(e,t){this.needNodeElevationRange=t&&!!e&&("relative-to-ground"===e.mode||"relative-to-scene"===e.mode||"on-the-ground"===e.mode),this._viewportQueries.updateElevationInfo(e),this.invalidateAllElevationRanges()}invalidateAllElevationRanges(){this._forAllNodes(e=>{e?.invalidateBounds(),e.node?.invalidateElevationRange(),e.nodeBoundingData?.invalidateElevationRange()})}_forAllNodes(e){if(null!=this._clientNodePage){const t=this._clientNodePage;for(let i=0;i<t.nodes.length;i++)e(t.nodes[i],-(i+1))}for(const[t,i]of this._nodePages){const s=t*this._pageSize;for(let t=0;t<i.nodes.length;t++)e(i.nodes[t],s+t)}}clearCaches(){if(this._useNodePages){const e=this._nodePages,t=new Set;this.traverseVisible(e=>t.add(R(e,this._pageSize)));for(const[i,s]of e)if(0!==s.numNodesWithLoadedChildren||t.has(i))for(const e of s.nodes)e.traversalState=null;else this._deleteNodePage(i)}}_deleteNodePage(e){const t=this._nodePages.get(e);this._nodePages.delete(e),t?.destroy()}get test(){}}const p=new Map;class N{constructor(t){this.missing=t,this.update=new e({deallocator:null}),this.add=new e({deallocator:null}),this.remove=new e({deallocator:null}),this.cancel=[]}destroy(){this.update.prune(),this.add.prune(),this.remove.prune(),this.cancel.length=0}reset(e){this.add.clear(),this.update.clear(),this.cancel=e}}function b(e){return u(e,-2)}function P(e){return u(e,2)}function y(e,t){return t+(e?1:0)}function I(e,t){return(-2&e)===t}function x(e){return!(1&~e)}function R(e,t){return e<0?-1:t>0?e/t|0:0}function S(e,t){return e<0?-e-1:0===t?e:e%t}function C(e,t,i){return-1===t?-(e+1):0===i?e:t*i+e}const w=[["maxScreenThreshold",1],["screenSpaceRelative",2],["removedFeatureDiameter",3],["distanceRangeFromDefaultCamera",4]];function E(e){if(e)for(let t=0;t<e.length;t++)for(const i of w)if(i[0]===e[t].metricType)return{lodMetric:i[1],maxError:e[t].maxError};return{lodMetric:0,maxError:0}}class M{constructor(){this.known=0,this.knownNodes=0,this.missing=0,this.missingNodes=0,this.unremoved=0}}class D{constructor(){this.numFeatures=0,this.knownNodes=0,this.missingNodes=0}}function A(e){return Math.sqrt(e*(4/Math.PI))}const V=o(),L=o(),O=o(),B=o(),z=has("esri-mobile")?100:300;export{v as I3SIndex,E as selectErrorMetric};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{n as e,a as t,f as i,c as s,d as n,H as r,x as o,h as a,F as c,s as u,k as l,b as h,m as d,e as m,g as _}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as v}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as g}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as b}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as R}from"../../../../geometry/projection/projectors.js";import{create as S,fromMatrix as x,createPoints as M,intersectsSphere as C}from"../../../../geometry/support/frustum.js";import{getNormal as I,signedDistance as P}from"../../../../geometry/support/plane.js";import{isPlateCarree as E}from"../../../../geometry/support/spatialReferenceUtils.js";import{m as F,a as D}from"../../../../chunks/sphere.js";import{makeDehydratedPoint as O}from"../../../../layers/graphics/dehydratedPoint.js";import{evaluateElevationAlignmentAtPoint as A}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as B}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as V,extractExpressionInfo as j}from"../graphics/featureExpressionInfoUtils.js";import{isValidMbs as L,intersectBoundingRectWithMbs as y}from"./I3SUtil.js";import{Obb as w,computeOffsetObb as U}from"../../support/orientedBoundingBox.js";const k=1e5;class q{get _frustumMbsCenter(){return this._frustumMbs}get _frustumMbsRadius(){return this._frustumMbs[3]}get _frustumPlanes(){return this._frustum}constructor(e,t,i,s,n,r,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=n,this._elevationProvider=r,this._viewingMode=o,this._options=c,this._frustum=S(),this._frustumMbs=f(),this._useFrustumCulling=!1,this._poi=p(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmpObb=new w,this._tmp1=p(),this._tmp2=p(),this._tmp3=p(),this._tmp0=p(),this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s);const u=this._renderCoordsHelper.spatialReference;this._renderSR=u,this._renderSRSphericalPCPF=g(u),this._isGlobalMode=u===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._tmpPoint=O(0,0,0,e),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(u.isWebMercator||E(u)),this._indexSREllipsoidRadius=v(this._indexSR).radius,this._indexSRSphericalPCPF=g(e),this._projectorIndexSRToIndexSRSphericalPCPF=R(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=B.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(V(j(e,!1)))):this._elevationContext=null}updateCamera(n,r){if(this._useFrustumCulling=r,r){x(n.viewMatrix,n.projectionMatrix,this._frustum,N);{const r=n.eye,o=G;e(o,n.viewForward);const a=T;t(a,N[4],r);const c=.5*i(a,a)/i(o,a),u=this._frustumMbs;s(u,r,o,c);const l=1+c;u[3]=l}}this._screenSizeFactor=1/(n.perScreenPixelRatio/2),this._camPos=n.eye,this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.serviceMbsInIndexSR;if(!s)return;const n="relative-to-scene"===this._elevationContext.mode?"scene":"ground";if(this._elevationProvider.getSphereElevationBounds){const e=this._elevationProvider.getSphereElevationBounds(s,this._indexSR,n);if(e)return void i.expandElevationRange(e)}const r=s[0],o=s[1],a=s[2],c=this._elevationProvider.getElevation(r,o,a,this._indexSR,n);c&&i.expandElevationRangeValues(c,c);const u=t?null:this._elevationProvider.getRootElevationBounds?.();u&&i.expandElevationRange(u)}getServiceMbsInRenderSR(e){const t=e.serviceMbsInRenderSR;if(L(t))return t;const{serviceMbsInIndexSR:i}=e;i&&F(i,t);const s=e.elevationRangeMin;if(this._elevationContext&&Number.isFinite(s)){let i=0,n=0;const r=e.elevationRangeMax;switch(this._elevationContext.mode){case"relative-to-ground":case"relative-to-scene":i=this._elevationContext.geometryZWithOffset(t[2],this._renderCoordsHelper)+s-t[2],n=r-s;break;case"on-the-ground":i=s-t[2],n=r-s}t[2]+=i+.5*n,t[3]+=.5*n}else this._elevationContext&&t[3]<k&&(this._tmpPoint.x=t[0],this._tmpPoint.y=t[1],this._tmpPoint.z=t[2],t[2]=A(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper));return b(t,this._indexSR,t,this._renderSR),t}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:i,serviceObbInIndexSR:s}=e;if(null==s||!i||!s.isValid||this._isECEFOBBInLocalMode&&(s.halfSizeX>t||s.halfSizeY>t||s.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new w,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const n=i[3];let r=0,o=0;const a=s.centerZ,c=this._renderCoordsHelper,u=this._elevationContext;if(u&&e.elevationRangeValid){const t=e.elevationRangeMin,i=e.elevationRangeMax;switch(u.mode){case"relative-to-ground":case"relative-to-scene":r=u.geometryZWithOffset(a,c)+t-a,o=i-t;break;case"on-the-ground":r=t-a,o=i-t}}else if(u&&n<k){const e=this._tmpPoint;e.x=s.centerX,e.y=s.centerY,e.z=a,r=A(e,this._elevationProvider,u,c)-a}const l=o>0,h=l?this._tmpObb:t;return s.transform(h,this._indexSR,this._renderSR,r,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),l&&U(h,0,o,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;return t?(t.transform(Y,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),Y):null}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(1===this._viewingMode?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateElevationAgnosticBoundingVolumeGlobal(t){const s=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),o=t.elevationAgnosticBoundingVolume;let a,c=-1;if(s){const t=J;s.getCenter(t),e(t,t),a=t,s.getCorners(K);for(const s of K){e(s,s);const n=i(s,t);if(n<=0)return void o.invalidate();const r=Math.sqrt(1-n*n);c=Math.max(c,r)}}else{const i=t.serviceMbsInRenderSR;if(!L(i))return void o.invalidate();{const t=n(J,D(i)),s=i[3],u=r(t);if(u<s)return void o.invalidate();c=s/u,e(t,t),a=t}}const u=.001;o.set(a,c+u)}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(J);e[2]=0;let s=0;const n=Q;i.getCorners(K);for(const t of K){t[2]=0;const e=o(n,t);s=Math.max(s,e)}t.set(e,Math.sqrt(s))}else{const i=e.serviceMbsInRenderSR;if(L(i)){const e=n(J,D(i));e[2]=0,t.set(e,i[3])}}}isNodeVisible(e){const t=this.getServiceMbsInRenderSR(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const i=this.getAndUpdateVisibilityObbInRenderSR(e);return i?i.doesIntersectFrustumConservativeApproximation(this._frustum):C(this._frustum,t)}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||(!e.valid||(1===this._viewingMode?this._isConeVisibleInFrustum(e):this._isCylinderVisibleInFrustum(e)))}_isConeVisibleInFrustum(n){if(!this._isConeVisibleInFrustumMbs(n))return!1;const r=n.radius;if(-1===r||r>.9)return!0;const o=this._frustumPlanes,c=this._frustumMbsCenter,u=n.getAxis(ie),l=i(u,c),h=this._frustumMbsRadius,d=l-h,m=l+h;if(d<=0)return!0;const _=a(W,u,d),p=a(Z,u,m),f=r/Math.sqrt(1-r*r);for(const v of o){const n=I(v),r=e(X,n),o=i(r,u);if(Math.abs(1-o)<.01)continue;const c=$;a(c,u,o),t(c,c,r),e(c,c);const l=ee;s(l,_,c,d*f);if(P(v,l)<=0)continue;s(l,p,c,m*f);if(P(v,l)<=0)continue;return!1}return!0}_isConeVisibleInFrustumMbs(e){const t=e.radius;if(t>.9)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,o=r(n);if(o<=s)return!0;const u=e.getAxis(ie),l=i(u,n);{const e=a(H,u,l);if(c(e,n)<s)return!0}const h=l/o;if(l<=0){return-h<s}const d=Math.sqrt(1-h*h);if(d<t)return!0;const m=s/o;return d*Math.sqrt(1-m*m)-m*h<t}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling)return!0;if(!e.valid)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,r=this._frustumPlanes,o=K;if(t.getCorners(o),1===this._viewingMode){const t=e.getAxis(ie),c=i(t,n),u=c-s,l=c+s;if(u<=0)return!0;for(const e of r){let s=!0;for(const n of o){const r=i(n,t),o=te;if(a(o,n,u/r),P(e,o)<=0){s=!1;break}const c=te;if(a(c,n,l/r),P(e,c)<=0){s=!1;break}}if(s)return!1}}else{const e=n[2]-s,t=n[2]+s;for(const i of r){let s=!0;const n=I(i),r=n[0],a=n[1],c=n[2],u=i[3];for(const i of o){const n=r*i[0]+a*i[1]+u;if(n+c*e<=0||n+c*t<=0){s=!1;break}}if(s)return!1}}return!0}_isCylinderVisibleInFrustum(e){const t=this._frustumMbsCenter,i=this._frustumMbsRadius,s=n(H,t);s[2]=0;const r=e.radius,o=e.getAxis(ie);return c(s,o)<=r+i}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.doesIntersectFrustumConservativeApproximation(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||0!==y(this._clippingArea,e)}_screenSpaceDiameterMbs(e,t){const i=this.getServiceMbsInRenderSR(e),s=Math.sqrt(u(D(i),this._camPos)),n=s-i[3];return this._updateMinMaxDistance(s),n<0?.5*Number.MAX_VALUE:t/n*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getServiceMbsInRenderSR(e)[3]}calcCameraDistanceToCenter(e){const t=this.getServiceMbsInRenderSR(e),i=l(D(t),this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const t=this.getServiceMbsInRenderSR(e),i=t[3],s=(Math.abs(t[0]*(t[0]-this._camPos[0])+t[1]*(t[1]-this._camPos[1])+t[2]*(t[2]-this._camPos[2]))/h(D(t))+i)/l(D(t),this._camPos);return Math.min(1,s)}hasLOD(e){return 0!==e.lodMetric}_getDistanceGlobeMode(e,t){const s=h(D(t)),n=h(e)-s;a(this._tmp0,e,i(e,D(t))/d(e));const r=u(D(t),this._tmp0),o=t[3];if(r<=o*o)return Math.abs(n);{const r=a(this._tmp0,D(t),1/s),c=s,u=o*o/2/c,d=a(this._tmp1,r,c-u),p=e,f=m(this._tmp2,p,d),v=m(this._tmp2,f,a(this._tmp3,r,i(r,f))),g=_(this._tmp2,d,a(this._tmp2,v,o/h(v)));let b=l(p,g);if(n>=2e5){const e=m(this._tmp1,p,g);let t=i(e,r)/h(e);t<.08&&(t=1e-4),b/=t}return b}}_getDistance(e,t){return this._isGlobalMode?this._getDistanceGlobeMode(e,t):z(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(0===e.lodMetric)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 2:{const i=this.getServiceMbsInRenderSR(e),s=this._getDistance(this._camPos,i),n=2*s/this._screenSizeFactor,r=s+i[3];return this._updateMinMaxDistance(r),e.maxError*t<=n}case 1:{let i=this._screenSpaceDiameterMbs(e,e.serviceMbsInIndexSR[3]*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case 4:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToPOI(e){if(null==e)return 0;const t=this.getServiceMbsInRenderSR(e);return l(D(t),this._poi)-t[3]}distCameraToPOI(){return l(this._camPos,this._poi)}}function z(e,t){const i=e[0]-t[0],s=e[1]-t[1],n=e[2]-t[2],r=i*i+s*s,o=t[3];if(r<=o*o)return Math.abs(n);const a=Math.sqrt(r)-o;return Math.sqrt(n*n+a*a)}const G=p(),N=M(),T=p(),H=p(),W=p(),Z=p(),X=p(),Y=new w,J=p(),K=[p(),p(),p(),p(),p(),p(),p(),p()],Q=p(),$=p(),ee=p(),te=p(),ie=p();export{q as default};
5
+ import{n as e,a as t,f as i,c as s,G as n,e as r,d as o,H as a,x as c,h,F as u,s as l,k as d,b as m,m as _,g as p}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as g}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as b}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as R}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as S}from"../../../../geometry/projection/projectors.js";import{create as x,fromMatrix as M,createPoints as C,intersectsSphere as I}from"../../../../geometry/support/frustum.js";import{getNormal as P,signedDistance as D}from"../../../../geometry/support/plane.js";import{isPlateCarree as E}from"../../../../geometry/support/spatialReferenceUtils.js";import{m as O,a as F}from"../../../../chunks/sphere.js";import{makeDehydratedPoint as A}from"../../../../layers/graphics/dehydratedPoint.js";import{evaluateElevationAlignmentAtPoint as B}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as V}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as j,extractExpressionInfo as L}from"../graphics/featureExpressionInfoUtils.js";import{isValidMbs as y,intersectBoundingRectWithMbs as w}from"./I3SUtil.js";import{Obb as q,computeOffsetObb as G}from"../../support/orientedBoundingBox.js";const U=1e5;class k{get _frustumMbsCenter(){return this._frustumMbs}get _frustumMbsRadius(){return this._frustumMbs[3]}get _frustumPlanes(){return this._frustum}constructor(e,t,i,s,n,r,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=n,this._elevationProvider=r,this._viewingMode=o,this._options=c,this._frustum=x(),this._frustumMbs=v(),this._viewDirection=f(),this._useFrustumCulling=!1,this._poi=f(),this._cameraPOIDirection=f(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmpObb=new q,this._tmp1=f(),this._tmp2=f(),this._tmp3=f(),this._tmp0=f(),this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s);const h=this._renderCoordsHelper.spatialReference;this._renderSR=h,this._renderSRSphericalPCPF=b(h),this._isGlobalMode=h===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._tmpPoint=A(0,0,0,e),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(h.isWebMercator||E(h)),this._indexSREllipsoidRadius=g(this._indexSR).radius,this._indexSRSphericalPCPF=b(e),this._projectorIndexSRToIndexSRSphericalPCPF=S(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=V.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(j(L(e,!1)))):this._elevationContext=null}updateCamera(n,r){if(this._useFrustumCulling=r,e(this._viewDirection,n.viewForward),r){M(n.viewMatrix,n.projectionMatrix,this._frustum,N);{const e=n.eye,r=T;t(r,N[4],e);const o=.5*i(r,r)/i(this._viewDirection,r),a=this._frustumMbs;s(a,e,this._viewDirection,o);const c=1+o;a[3]=c}}this._screenSizeFactor=1/(n.perScreenPixelRatio/2),this._camPos=n.eye,this._updateCameraPOIDirection(),this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e,this._updateCameraPOIDirection()}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.serviceMbsInIndexSR;if(!s)return;const n="relative-to-scene"===this._elevationContext.mode?"scene":"ground";if(this._elevationProvider.getSphereElevationBounds){const e=this._elevationProvider.getSphereElevationBounds(s,this._indexSR,n);if(e)return void i.expandElevationRange(e)}const r=s[0],o=s[1],a=s[2],c=this._elevationProvider.getElevation(r,o,a,this._indexSR,n);c&&i.expandElevationRangeValues(c,c);const h=t?null:this._elevationProvider.getRootElevationBounds?.();h&&i.expandElevationRange(h)}getServiceMbsInRenderSR(e){const t=e.serviceMbsInRenderSR;if(y(t))return t;const{serviceMbsInIndexSR:i}=e;i&&O(i,t);const s=e.elevationRangeMin;if(this._elevationContext&&Number.isFinite(s)){let i=0,n=0;const r=e.elevationRangeMax;switch(this._elevationContext.mode){case"relative-to-ground":case"relative-to-scene":i=this._elevationContext.geometryZWithOffset(t[2],this._renderCoordsHelper)+s-t[2],n=r-s;break;case"on-the-ground":i=s-t[2],n=r-s}t[2]+=i+.5*n,t[3]+=.5*n}else this._elevationContext&&t[3]<U&&(this._tmpPoint.x=t[0],this._tmpPoint.y=t[1],this._tmpPoint.z=t[2],t[2]=B(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper));return R(t,this._indexSR,t,this._renderSR),t}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:i,serviceObbInIndexSR:s}=e;if(null==s||!i||!s.isValid||this._isECEFOBBInLocalMode&&(s.halfSizeX>t||s.halfSizeY>t||s.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new q,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const n=i[3];let r=0,o=0;const a=s.centerZ,c=this._renderCoordsHelper,h=this._elevationContext;if(h&&e.elevationRangeValid){const t=e.elevationRangeMin,i=e.elevationRangeMax;switch(h.mode){case"relative-to-ground":case"relative-to-scene":r=h.geometryZWithOffset(a,c)+t-a,o=i-t;break;case"on-the-ground":r=t-a,o=i-t}}else if(h&&n<U){const e=this._tmpPoint;e.x=s.centerX,e.y=s.centerY,e.z=a,r=B(e,this._elevationProvider,h,c)-a}const u=o>0,l=u?this._tmpObb:t;return s.transform(l,this._indexSR,this._renderSR,r,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),u&&G(l,0,o,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;return t?(t.transform(Y,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),Y):null}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(1===this._viewingMode?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateCameraPOIDirection(){n(this._poi,this._camPos)?this._cameraPOIDirection=this._viewDirection:(r(this._cameraPOIDirection,this._camPos,this._poi),e(this._cameraPOIDirection,this._cameraPOIDirection))}_updateElevationAgnosticBoundingVolumeGlobal(t){const s=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),n=t.elevationAgnosticBoundingVolume;let r,c=-1;if(s){const t=J;s.getCenter(t),e(t,t),r=t,s.getCorners(K);for(const s of K){e(s,s);const r=i(s,t);if(r<=0)return void n.invalidate();const o=Math.sqrt(1-r*r);c=Math.max(c,o)}}else{const i=t.serviceMbsInRenderSR;if(!y(i))return void n.invalidate();{const t=o(J,F(i)),s=i[3],h=a(t);if(h<s)return void n.invalidate();c=s/h,e(t,t),r=t}}const h=.001;n.set(r,c+h)}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(J);e[2]=0;let s=0;const n=Q;i.getCorners(K);for(const t of K){t[2]=0;const e=c(n,t);s=Math.max(s,e)}t.set(e,Math.sqrt(s))}else{const i=e.serviceMbsInRenderSR;if(y(i)){const e=o(J,F(i));e[2]=0,t.set(e,i[3])}}}isNodeVisible(e){const t=this.getServiceMbsInRenderSR(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const i=this.getAndUpdateVisibilityObbInRenderSR(e);return i?i.doesIntersectFrustumConservativeApproximation(this._frustum):I(this._frustum,t)}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||(!e.valid||(1===this._viewingMode?this._isConeVisibleInFrustum(e):this._isCylinderVisibleInFrustum(e)))}_isConeVisibleInFrustum(n){if(!this._isConeVisibleInFrustumMbs(n))return!1;const r=n.radius;if(-1===r||r>.9)return!0;const o=this._frustumPlanes,a=this._frustumMbsCenter,c=n.getAxis(ie),u=i(c,a),l=this._frustumMbsRadius,d=u-l,m=u+l;if(d<=0)return!0;const _=h(W,c,d),p=h(Z,c,m),f=r/Math.sqrt(1-r*r);for(const v of o){const n=P(v),r=e(X,n),o=i(r,c);if(Math.abs(1-o)<.01)continue;const a=$;h(a,c,o),t(a,a,r),e(a,a);const u=ee;s(u,_,a,d*f);if(D(v,u)<=0)continue;s(u,p,a,m*f);if(D(v,u)<=0)continue;return!1}return!0}_isConeVisibleInFrustumMbs(e){const t=e.radius;if(t>.9)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,r=a(n);if(r<=s)return!0;const o=e.getAxis(ie),c=i(o,n);{const e=h(H,o,c);if(u(e,n)<s)return!0}const l=c/r;if(c<=0){return-l<s}const d=Math.sqrt(1-l*l);if(d<t)return!0;const m=s/r;return d*Math.sqrt(1-m*m)-m*l<t}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling)return!0;if(!e.valid)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,r=this._frustumPlanes,o=K;if(t.getCorners(o),1===this._viewingMode){const t=e.getAxis(ie),a=i(t,n),c=a-s,u=a+s;if(c<=0)return!0;for(const e of r){let s=!0;for(const n of o){const r=i(n,t),o=te;if(h(o,n,c/r),D(e,o)<=0){s=!1;break}const a=te;if(h(a,n,u/r),D(e,a)<=0){s=!1;break}}if(s)return!1}}else{const e=n[2]-s,t=n[2]+s;for(const i of r){let s=!0;const n=P(i),r=n[0],a=n[1],c=n[2],h=i[3];for(const i of o){const n=r*i[0]+a*i[1]+h;if(n+c*e<=0||n+c*t<=0){s=!1;break}}if(s)return!1}}return!0}_isCylinderVisibleInFrustum(e){const t=this._frustumMbsCenter,i=this._frustumMbsRadius,s=o(H,t);s[2]=0;const n=e.radius,r=e.getAxis(ie);return u(s,r)<=n+i}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.doesIntersectFrustumConservativeApproximation(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||0!==w(this._clippingArea,e)}_screenSpaceDiameterMbs(e,t){const i=this.getServiceMbsInRenderSR(e),s=Math.sqrt(l(F(i),this._camPos)),n=s-i[3];return this._updateMinMaxDistance(s),n<0?.5*Number.MAX_VALUE:t/n*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getServiceMbsInRenderSR(e)[3]}calcCameraDistanceToCenter(e){const t=this.getServiceMbsInRenderSR(e),i=d(F(t),this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const t=this.getServiceMbsInRenderSR(e),i=t[3],s=(Math.abs(t[0]*(t[0]-this._camPos[0])+t[1]*(t[1]-this._camPos[1])+t[2]*(t[2]-this._camPos[2]))/m(F(t))+i)/d(F(t),this._camPos);return Math.min(1,s)}hasLOD(e){return 0!==e.lodMetric}_getDistanceGlobeMode(e,t){const s=m(F(t)),n=m(e)-s;h(this._tmp0,e,i(e,F(t))/_(e));const o=l(F(t),this._tmp0),a=t[3];if(o<=a*a)return Math.abs(n);{const o=h(this._tmp0,F(t),1/s),c=s,u=a*a/2/c,l=h(this._tmp1,o,c-u),_=e,f=r(this._tmp2,_,l),v=r(this._tmp2,f,h(this._tmp3,o,i(o,f))),g=p(this._tmp2,l,h(this._tmp2,v,a/m(v)));let b=d(_,g);if(n>=2e5){const e=r(this._tmp1,_,g);let t=i(e,o)/m(e);t<.08&&(t=1e-4),b/=t}return b}}_getDistance(e,t){return this._isGlobalMode?this._getDistanceGlobeMode(e,t):z(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(0===e.lodMetric)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 2:{const i=this.getServiceMbsInRenderSR(e),s=this._getDistance(this._camPos,i),n=2*s/this._screenSizeFactor,r=s+i[3];return this._updateMinMaxDistance(r),e.maxError*t<=n}case 1:{let i=this._screenSpaceDiameterMbs(e,e.serviceMbsInIndexSR[3]*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case 4:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToCameraPOIRay(e){if(null==e)return 0;const t=this.getServiceMbsInRenderSR(e),s=F(t),n=i(s,this._cameraPOIDirection),r=n*n,o=_(s)-r;return Math.sqrt(o)-t[3]}distCameraToPOI(){return d(this._camPos,this._poi)}}function z(e,t){const i=e[0]-t[0],s=e[1]-t[1],n=e[2]-t[2],r=i*i+s*s,o=t[3];if(r<=o*o)return Math.abs(n);const a=Math.sqrt(r)-o;return Math.sqrt(n*n+a*a)}const N=C(),T=f(),H=f(),W=f(),Z=f(),X=f(),Y=new q,J=f(),K=[f(),f(),f(),f(),f(),f(),f(),f()],Q=f(),$=f(),ee=f(),te=f(),ie=f();export{k as default};