@arcgis/core 4.29.0-next.20240222 → 4.29.1

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 (279) hide show
  1. package/arcade/treeAnalysis.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{b43fde3e25d0c3b020b5.js → 039a872509872ce67ba4.js} +1 -1
  4. package/assets/esri/core/workers/chunks/0bc21d2a0b65bd4e9d76.js +1 -0
  5. package/assets/esri/core/workers/chunks/{5243f9ff21e768c620c2.js → 23a5d750d93a7829174f.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{47e6119be4a4a5ed640d.js → 2447a4d5886aeb0ff72a.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{7f45a9e9bdbcffc2d6e0.js → 348bcc57b99a975902a8.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{8c9fb2601488998013ba.js → 3523789a2948a4ab8cc8.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{24649b410b757599a549.js → 48db6e0bbb1a9c043193.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{752082be991f1cc8558f.js → 4984e2b79d862114d6a6.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{8d9736fd15cdb54d9855.js → 5227f9eea6988aadad7f.js} +1 -1
  12. package/assets/esri/core/workers/chunks/58723274ef657fe212eb.js +1 -0
  13. package/assets/esri/core/workers/chunks/60ab18c6a04d4b2f1d4c.js +1 -0
  14. package/assets/esri/core/workers/chunks/647515801d94180b8402.js +1 -0
  15. package/assets/esri/core/workers/chunks/6c3ae96ec90e9ed7dd50.js +1 -0
  16. package/assets/esri/core/workers/chunks/7a8bba91769ee18cc39f.js +1 -0
  17. package/assets/esri/core/workers/chunks/7a98d2e026f63a581b1e.js +1 -0
  18. package/assets/esri/core/workers/chunks/8c360923cd1850767d3e.js +1 -0
  19. package/assets/esri/core/workers/chunks/{1a25ba411b89e050fbb7.js → a61f337802ae963d7f65.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{d0c5318d7ef2e923aad0.js → a8ac511280f873960d46.js} +1 -1
  21. package/assets/esri/core/workers/chunks/b125ab84b7761e761734.js +1 -0
  22. package/assets/esri/core/workers/chunks/{b34d6e58b125fe111f91.js → b42a83db83851cb57d44.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{1497dd943df7eede0704.js → b9c55ff1f21db198ce03.js} +1 -1
  24. package/assets/esri/core/workers/chunks/bb3322ddb89c0bd444f0.js +1 -0
  25. package/assets/esri/core/workers/chunks/becfdaeeb07f089d8be7.js +1 -0
  26. package/assets/esri/core/workers/chunks/{b26e39a399963c176d33.js → c527692694688a5b3b07.js} +2 -2
  27. package/assets/esri/core/workers/chunks/{210a93e0b96c5bff44a3.js → c556644bb0cf88770939.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{e7b26c7e9e24dc6255be.js → cacf97b0a7a1057b9f79.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{a5e7b4acae17f88e2208.js → ce93027b6b81428ce9b0.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{b8ece275abac93f3dccf.js → d14f16bfa6c12909929c.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{1594f06a2d7d9439c62e.js → e2147c99cc5839654be1.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{d33ed3a2a0d4b640bd4a.js → e4c7d8c69e4957c9d27c.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{7709248f59520aee6f51.js → eceaa46f622f6fa31128.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{2286db4c83ff1b6fb088.js → ef3e6209e6ac6a56960b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/f59b5ea05caca8a1a398.js +1 -0
  36. package/chunks/Laserlines.glsl.js +3 -3
  37. package/chunks/Precipitation.glsl.js +1 -1
  38. package/chunks/SSAOBlur.glsl.js +2 -2
  39. package/chunks/boundedPlane.js +1 -1
  40. package/chunks/cameraUtilsSpherical.js +1 -1
  41. package/chunks/sphere.js +1 -1
  42. package/chunks/terrainUtilsPlanar.js +1 -1
  43. package/chunks/vec32.js +1 -1
  44. package/config.js +1 -1
  45. package/copyright.txt +56 -28
  46. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  47. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  48. package/core/libs/gl-matrix-2/vec3.js +1 -1
  49. package/geometry/support/axisAngleDegrees.js +1 -1
  50. package/geometry/support/coordinateSystem.js +1 -1
  51. package/geometry/support/lineSegment.js +1 -1
  52. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  53. package/geometry/support/meshUtils/georeference.js +1 -1
  54. package/geometry/support/meshUtils/merge.js +1 -1
  55. package/geometry/support/meshUtils/rotate.js +1 -1
  56. package/geometry/support/meshUtils/scale.js +1 -1
  57. package/geometry/support/meshUtils/vertexSpaceConversion.js +5 -0
  58. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  59. package/geometry/support/plane.js +1 -1
  60. package/geometry/support/ray.js +1 -1
  61. package/geometry/support/triangle.js +1 -1
  62. package/geometry/support/vector.js +1 -1
  63. package/interfaces.d.ts +12 -12
  64. package/kernel.js +1 -1
  65. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  66. package/layers/LinkChartLayer.js +1 -1
  67. package/layers/VoxelWasmPerSceneView.js +1 -1
  68. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  69. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  70. package/layers/mixins/FeatureReductionLayer.js +1 -1
  71. package/layers/orientedImagery/core/CameraOrientation.js +1 -1
  72. package/layers/orientedImagery/core/ElevationSourceDefinitions.js +1 -1
  73. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  74. package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
  75. package/layers/orientedImagery/transformations/imageToWorld.js +5 -0
  76. package/layers/orientedImagery/transformations/updateElevation.js +5 -0
  77. package/layers/orientedImagery/transformations/updateElevationUtils.js +5 -0
  78. package/layers/orientedImagery/transformations/utils.js +1 -1
  79. package/layers/orientedImagery/transformations/worldToImage.js +5 -0
  80. package/layers/support/EditingCapabilities.js +1 -1
  81. package/layers/support/editableLayers.js +1 -1
  82. package/layers/support/layerUtils.js +1 -1
  83. package/layers/video/VideoCameraSensorModel.js +1 -1
  84. package/layers/voxel/VoxelVolume.js +1 -1
  85. package/layers/voxel/voxelPlaneUtils.js +1 -1
  86. package/libs/linkchartlayout/LinkChartLayout.js +1 -1
  87. package/package.json +1 -1
  88. package/smartMapping/renderers/pieChart.js +1 -1
  89. package/support/revision.js +1 -1
  90. package/symbols/cim/cimAnalyzer.js +1 -1
  91. package/views/2d/arcade/callExpressionWithCursor.js +1 -1
  92. package/views/2d/engine/webgl/shaderGraph/techniques/createTestMeshData.js +1 -1
  93. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterInputEvaluator.js +1 -1
  94. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  95. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  96. package/views/2d/layers/features/Processor.js +1 -1
  97. package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
  98. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  99. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  100. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  101. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  102. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  103. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  104. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  105. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  106. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  107. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  108. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  109. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  110. package/views/2d/layers/features/sources/strategies/chunks/DrillDownTileSourceChunk.js +1 -1
  111. package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
  112. package/views/2d/layers/features/sources/strategies/chunks/OverrideChunk.js +1 -1
  113. package/views/2d/layers/features/sources/strategies/chunks/PagedTileSourceChunk.js +1 -1
  114. package/views/2d/layers/features/sources/strategies/chunks/StreamSourceChunk.js +1 -1
  115. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  116. package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
  117. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  118. package/views/2d/layers/features/support/Tile.js +1 -1
  119. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  120. package/views/2d/tiling/TileKey.js +1 -1
  121. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  122. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  123. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  124. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  125. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  126. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  127. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  128. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  129. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  130. package/views/3d/analysis/support/measurementUtils.js +1 -1
  131. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  132. package/views/3d/camera/constraintUtils/common.js +1 -1
  133. package/views/3d/camera/constraintUtils/distance.js +1 -1
  134. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  135. package/views/3d/camera/intersectionUtils.js +1 -1
  136. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  137. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  138. package/views/3d/environment/Fog.js +1 -1
  139. package/views/3d/environment/MarsAtmosphere.js +1 -1
  140. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  141. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  142. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  143. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  144. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  145. package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
  146. package/views/3d/interactive/editingTools/transformGraphic/ExtentScale.js +1 -1
  147. package/views/3d/interactive/editingTools/transformGraphic/extentUtils.js +1 -1
  148. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  149. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  150. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  151. package/views/3d/interactive/visualElements/support/Segment.js +1 -1
  152. package/views/3d/layers/I3SMeshView3D.js +1 -1
  153. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  154. package/views/3d/layers/PointCloudWorker.js +1 -1
  155. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  156. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  157. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  158. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  159. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  160. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  161. package/views/3d/layers/i3s/LoDUtil.js +1 -1
  162. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  163. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  164. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  165. package/views/3d/layers/support/uvUtils.js +1 -1
  166. package/views/3d/state/Frustum.js +1 -1
  167. package/views/3d/state/NearFarHeuristic.js +1 -1
  168. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  169. package/views/3d/state/controllers/RotateController.js +1 -1
  170. package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
  171. package/views/3d/state/controllers/global/ZoomController.js +1 -1
  172. package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
  173. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  174. package/views/3d/state/controllers/local/ZoomController.js +1 -1
  175. package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
  176. package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
  177. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  178. package/views/3d/state/utils/navigationUtils.js +1 -1
  179. package/views/3d/state/utils/viewUtils.js +1 -1
  180. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  181. package/views/3d/support/cameraUtils.js +1 -1
  182. package/views/3d/support/cameraUtilsInternal.js +1 -1
  183. package/views/3d/support/intersectionUtils.js +1 -1
  184. package/views/3d/support/mathUtils.js +1 -1
  185. package/views/3d/support/orientedBoundingBox.js +1 -1
  186. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  187. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  188. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  189. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  190. package/views/3d/support/sunUtils.js +1 -1
  191. package/views/3d/support/viewpointUtils.js +1 -1
  192. package/views/3d/terrain/OverlayManager.js +1 -1
  193. package/views/3d/terrain/PatchRenderData.js +1 -1
  194. package/views/3d/terrain/SphericalPatch.js +1 -1
  195. package/views/3d/terrain/TerrainRenderer.js +1 -1
  196. package/views/3d/terrain/Tile.js +1 -1
  197. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  198. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  199. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  200. package/views/3d/webgl-engine/core/util/TwoVectorPosition.js +1 -1
  201. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  202. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  203. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  204. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  205. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  206. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  207. package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
  208. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  209. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  210. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  211. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  212. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  213. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  214. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  215. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  216. package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
  217. package/views/3d/webgl-engine/lighting/SphericalHarmonics.js +1 -1
  218. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  219. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  220. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  221. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  222. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  223. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  224. package/views/3d/webgl-engine/materials/pbrUtils.js +1 -1
  225. package/views/SelectionManager.js +1 -1
  226. package/views/draw/support/createUtils.js +1 -1
  227. package/views/draw/support/surfaceCoordinateSystems.js +1 -1
  228. package/views/interactive/GraphicManipulator.js +1 -1
  229. package/views/interactive/SegmentLabels.js +1 -1
  230. package/views/interactive/coordinateHelper.js +1 -1
  231. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  232. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  233. package/views/interactive/sketch/constraints.js +1 -1
  234. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  235. package/views/interactive/snapping/candidates/ParallelLineSnappingCandidate.js +1 -1
  236. package/views/interactive/snapping/candidates/RightAngleTriangleSnappingCandidate.js +1 -1
  237. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  238. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  239. package/views/interactive/snapping/hints/IntersectionSnappingHint.js +1 -1
  240. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  241. package/views/interactive/snapping/hints/ParallelSnappingHint.js +1 -1
  242. package/views/interactive/snapping/hints/PointSnappingHint.js +1 -1
  243. package/views/interactive/snapping/hints/RightAngleSnappingHint.js +1 -1
  244. package/views/layers/FeatureLayerView.js +1 -1
  245. package/views/layers/support/editableLayerViews.js +5 -0
  246. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  247. package/views/support/angularMeasurementUtils.js +1 -1
  248. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  249. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  250. package/views/support/geometry3dUtils.js +1 -1
  251. package/widgets/Editor/EditorViewModel.js +1 -1
  252. package/widgets/Editor/support/EditorEditingCapabilities.js +1 -1
  253. package/widgets/Editor/support/EditorItem.js +1 -1
  254. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  255. package/widgets/FeatureForm.js +1 -1
  256. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  257. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  258. package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
  259. package/widgets/Features/FeaturesViewModel.js +1 -1
  260. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  261. package/widgets/OrientedImageryViewer.js +1 -1
  262. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  263. package/widgets/PanoramicViewer/utils.js +1 -1
  264. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  265. package/widgets/UtilityNetworkTrace.js +1 -1
  266. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  267. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  268. package/assets/esri/core/workers/chunks/0e83f3718a0b45652b5e.js +0 -1
  269. package/assets/esri/core/workers/chunks/1fa5c8af69a09a3730b3.js +0 -1
  270. package/assets/esri/core/workers/chunks/25f73748df0ee82d06cb.js +0 -1
  271. package/assets/esri/core/workers/chunks/2d7a18f8c540269ecee9.js +0 -1
  272. package/assets/esri/core/workers/chunks/4736f79b5c94ce103d43.js +0 -1
  273. package/assets/esri/core/workers/chunks/65f7adaaf1f535310c11.js +0 -1
  274. package/assets/esri/core/workers/chunks/79c041b292648c5eaecc.js +0 -1
  275. package/assets/esri/core/workers/chunks/7c4c2c0beddabac672b6.js +0 -1
  276. package/assets/esri/core/workers/chunks/9a758de08dfa57735879.js +0 -1
  277. package/assets/esri/core/workers/chunks/a4c3da057ec2a07bbbe8.js +0 -1
  278. package/assets/esri/core/workers/chunks/b252270b100351779f1f.js +0 -1
  279. package/assets/esri/core/workers/chunks/dc57aa9f2fc69e654559.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import s from"../request.js";import has from"../core/has.js";import r from"../core/Logger.js";import{isAbortError as i}from"../core/promiseUtils.js";import{watch as a,initial as n}from"../core/reactiveUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{p as h}from"../chunks/vec32.js";import{create as d}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{renderSRFromViewSR as u}from"../geometry/support/coordinateSystem.js";import{PointIndex as _,PlaneIndex as c}from"../geometry/support/frustum.js";import{WasmCullMode as m,VoxelRequestType as g,UpdateFlags as p,ContainerType as f}from"../libs/vxl/enums.js";import{loadVoxelWASM as x}from"../libs/vxl/VxlModule.js";import{ViewingMode as y}from"../views/ViewingMode.js";import{VoxelTarget as v}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as b}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as w}from"../views/3d/support/RenderCoordsHelper.js";import{SyncRenderPlugin as T}from"../views/3d/webgl-engine/effects/RenderPlugin.js";import{newIntersectorResult as R}from"../views/3d/webgl-engine/lib/Intersector.js";import{IntersectorType as L,StoreResults as E}from"../views/3d/webgl-engine/lib/IntersectorInterfaces.js";import{RenderFeature as V}from"../views/3d/webgl-engine/lib/RenderFeature.js";import{RenderSlot as C}from"../views/3d/webgl-engine/lib/RenderSlot.js";import{CompareFunction as F,Face as S,StencilOperation as P}from"../views/webgl/enums.js";var I;!function(e){e[e.Lifetime=1]="Lifetime",e[e.RequestResponse=2]="RequestResponse",e[e.Rendering=3]="Rendering",e[e.Error=4]="Error"}(I||(I={}));let U=class extends T{constructor(e){super(e),this._halfIntTexturesAvailable=!1,this._textureFloatLinearAvailable=!1,this._havePreparedWithAllLayers=!1,this._renderPluginContext=null,this._vxlPromise=null,this._vxl=null,this._pluginIsActive=!1,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this._rctx=null,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.produces=new Map([[C.VOXEL,()=>!!this._vxl&&"local"===this.view.viewingMode]]),this.type=L.VOXEL,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerUid=[]}_dbg(e,t){this._dbgFlags.has(e)&&(e===I.Error?r.getLogger(this).error(t):r.getLogger(this).warn(t))}_removeRenderPlugin(){this._pluginIsActive&&this.view._stage&&(this._dbg(I.Lifetime,"--removeRenderPlugin--"),this.view._stage.removeRenderPlugin(this)),this._pluginIsActive=!1}initialize(){this._dbg(I.Lifetime,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this.addHandles([a((()=>this.view.ready),(e=>{e&&"local"===this.view.viewingMode?(this._dbg(I.Lifetime,"view ready status changed to ready on a local view, calling addRenderPlugin"),this.view._stage.addRenderPlugin(this),this._pluginIsActive=!0):(this._dbg(I.Lifetime,"view ready status changed, not ready or not a local view!"),this._removeRenderPlugin())}),n),a((()=>this.view?.qualityProfile),(e=>{this._dbg(I.Rendering,"qualityProfile changed to "+e),this._vxl&&this._vxl.set_quality(this._toWasmQuality(e))}),n),a((()=>this.view?.timeExtent),(()=>{if(this._vxl){const e=this._getTimeArgs(this.view?.timeExtent);this._dbg(I.Rendering,"sceneView timeExtent changed to useTime="+e.useTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.useTime),this._renderPluginContext.requestRender()}}),n),a((()=>this.view?.stationary),(e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this._renderPluginContext.requestRender()}))])}initializeRenderContext(e){this._dbg(I.Lifetime,"--initializeRenderContext--");const t=e.renderContext.rctx;this._renderPluginContext=e,this._rctx=e.renderContext.rctx,this._halfIntTexturesAvailable=!!this._rctx.capabilities.textureNorm16,this._textureFloatLinearAvailable=this._rctx.capabilities.textureFloatLinear,this._initializeWasm(t.gl)}uninitializeRenderContext(){this._renderPluginContext=null,this._rctx=null,this._dbg(I.Lifetime,"--uninitializeRenderContext--")}_restoreFramebuffer(){if(!this._renderTargetToRestore)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(I.Error,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){const s=!!this._rctx,r=!!this._renderTargetToRestore;if(!s||!r)return 0;const i=this._renderTargetToRestore.fbo.depthStencilTexture;return i?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(i,e,!0),1):(this._dbg(I.Error,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,s){if(!this._rctx)return void this._dbg(I.Error,"modifyAllocation callback has no rendering context!");const r=e;1===s?this._rctx.instanceCounter.increment(r,t):this._rctx.instanceCounter.decrement(r,t)}_setBlendState(e,t,s,r){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,s),this._rctx.setBlendEquation(r)):this._dbg(I.Error,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(I.Error,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,s){this._rctx?(this._rctx.setDepthFunction(s),this._rctx.setDepthTestEnabled(1===e),this._rctx.setDepthWriteEnabled(1===t),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(F.ALWAYS,0,255),this._rctx.setStencilOpSeparate(S.FRONT,P.KEEP,P.INCR,P.KEEP),this._rctx.setStencilOpSeparate(S.BACK,P.KEEP,P.DECR,P.KEEP)):this._dbg(I.Error,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case m.None:this._rctx.setFaceCullingEnabled(!1);break;case m.Back:this._rctx.setCullFace(S.BACK),this._rctx.setFaceCullingEnabled(!0);break;case m.Front:this._rctx.setCullFace(S.FRONT),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(I.Error,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,s,r){this._rctx?this._rctx.setViewport(e,t,s,r):this._dbg(I.Error,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach(((e,t)=>{if(e.needMemoryUsageUpdate){const s=this._vxl.estimate_memory_usage(t);s>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(s))}}))}_syncRequestsResponses(){this._layers.forEach(((e,t)=>{const r=[];e.responses.forEach(((s,i)=>{r.push(i),this._dbg(I.RequestResponse,"responding for requestID:"+i+" size:"+s.size),this._vxl.respond(t,i,s),s.requestType!==g.TreeIndex&&s.requestType!==g.Section||(e.needMemoryUsageUpdate=!0)}));const a=e.responses;for(const s of r)a.delete(s);const n=this._vxl.get_new_requests(t),o=e.abortController.signal;for(const l in n){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const t=n[l],r={responseType:"array-buffer",signal:o,query:{...e.layerView.layer.customParameters,token:e.layerView.layer.apiKey}};this._dbg(I.RequestResponse,"making requestID:"+l+" url:"+t.url),s(t.url,r).then((s=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(I.RequestResponse,"have response for requestID:"+l);let r=0;if(s.data.byteLength>0){r=this._vxl._malloc(s.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,r,s.data.byteLength),t=new Uint8Array(s.data);for(let r=0;r<s.data.byteLength;++r)e[r]=t[r]}a.set(+l,{responseType:t.responseType,ptr:r,size:s.data.byteLength,success:!0,requestType:t.requestType})})).catch((s=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),i(s)||(this._dbg(I.Error,`requestID:${l} failed, error=${s.toString()}`),a.set(+l,{responseType:t.responseType,ptr:0,size:0,success:!1,requestType:t.requestType}))}))}}))}updateWasmCamera(e){this._vxl.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl.set_near_far(e.near,e.far)}isUpdating(e){if(!this._vxl&&this._vxlPromise)return!0;const t=this._layers.get(e);return!!t&&t.outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._layers.forEach(((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const s=this._vxl.get_layer_epoch_times(r,e.layer.currentVariableId);for(let e=0;e<s.length;++e)t.push(s[e])}})),t}getCurrentLayerTimeIndex(e){let t=0;return this._layers.forEach(((s,r)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl.get_layer_current_time_id(r))})),t}setEnabled(e,t){this._layers.forEach(((s,r)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.set_enabled(r,t),s.needMemoryUsageUpdate=!0,this._renderPluginContext.requestRender())}))}setIsInScaleRange(e,t){const s=this._layers.get(e.wasmLayerId);s&&t!==s.isInScaleRange&&(s.isInScaleRange=t,this._vxl.set_is_in_scale_range(e.wasmLayerId,t),s.needMemoryUsageUpdate=!t,this._renderPluginContext.requestRender())}setStaticSections(e,t){const s={mask:p.StaticSections,staticSections:t};return this._doMaskedUIUpdate(e,s,!0)}setCurrentVariable(e,t){const s={mask:p.CurrentVariable,currentVariable:t};return this._doMaskedUIUpdate(e,s,!0)}setRenderMode(e,t){const s={mask:p.RenderMode,renderMode:t};return this._doMaskedUIUpdate(e,s,!0)}setVerticalExaggerationAndOffset(e,t,s,r){const i={mask:p.ExaggerationAndOffset,volStyleDesc:{volumeId:t,verticalExaggeration:s,verticalOffset:r}};return this._doMaskedUIUpdate(e,i,!0)}setVariableStyles(e,t){const s={mask:p.VariableStyles,variableStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setVolumeStyles(e,t){const s={mask:p.VolumeStyles,volumeStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setEnableDynamicSections(e,t){const s={mask:p.ContainerVisibility,containerIsVisible:t,container:f.DynamicSections};return this._doMaskedUIUpdate(e,s,!0)}setEnableIsosurfaces(e,t){const s={mask:p.ContainerVisibility,containerIsVisible:t,container:f.Isosurfaces};return this._doMaskedUIUpdate(e,s,!0)}setEnableSections(e,t){const s={mask:p.ContainerVisibility,containerIsVisible:t,container:f.StaticSections};return this._doMaskedUIUpdate(e,s,!0)}setAnalysisSlice(e,t,s,r){const i={mask:p.AnalysisSlice,analysisSlice:{point:s,normal:r,enabled:t}};return this._doMaskedUIUpdate(e,i,!0)}_doMaskedUIUpdate(e,t,s){if(!this._vxl)return!1;let r=!1;return this._layers.forEach(((s,i)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(r=1===this._vxl.handle_masked_ui_update(i,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}})),r&&s&&this._renderPluginContext.requestRender(),r}_addTriangleToWasmBuffer(e,t,s,r,i){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],e[3*(t+=1)]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],t+=1}_addNormalToWasmBuffer(e,t,s){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,s=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),r=new Float32Array(this._vxl.HEAPF32.buffer,s,3*e),i=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,i,e),n=this._frustum.points[_.NEAR_BOTTOM_LEFT],o=this._frustum.points[_.NEAR_BOTTOM_RIGHT],l=this._frustum.points[_.NEAR_TOP_RIGHT],h=this._frustum.points[_.NEAR_TOP_LEFT],d=this._frustum.points[_.FAR_BOTTOM_LEFT],u=this._frustum.points[_.FAR_BOTTOM_RIGHT],m=this._frustum.points[_.FAR_TOP_RIGHT],g=this._frustum.points[_.FAR_TOP_LEFT];let p=0,f=0;const x=this._frustum.planes[c.NEAR];p=this._addTriangleToWasmBuffer(r,p,l,o,n),f=this._addNormalToWasmBuffer(a,f,x),p=this._addTriangleToWasmBuffer(r,p,n,h,l),f=this._addNormalToWasmBuffer(a,f,x);const y=this._frustum.planes[c.FAR];p=this._addTriangleToWasmBuffer(r,p,d,u,m),f=this._addNormalToWasmBuffer(a,f,y),p=this._addTriangleToWasmBuffer(r,p,m,g,d),f=this._addNormalToWasmBuffer(a,f,y);const v=this._frustum.planes[c.TOP];p=this._addTriangleToWasmBuffer(r,p,m,l,h),f=this._addNormalToWasmBuffer(a,f,v),p=this._addTriangleToWasmBuffer(r,p,h,g,m),f=this._addNormalToWasmBuffer(a,f,v);const b=this._frustum.planes[c.BOTTOM];p=this._addTriangleToWasmBuffer(r,p,n,o,u),f=this._addNormalToWasmBuffer(a,f,b),p=this._addTriangleToWasmBuffer(r,p,u,d,n),f=this._addNormalToWasmBuffer(a,f,b);const w=this._frustum.planes[c.LEFT];p=this._addTriangleToWasmBuffer(r,p,h,n,d),f=this._addNormalToWasmBuffer(a,f,w),p=this._addTriangleToWasmBuffer(r,p,d,g,h),f=this._addNormalToWasmBuffer(a,f,w);const T=this._frustum.planes[c.RIGHT];p=this._addTriangleToWasmBuffer(r,p,l,m,u),f=this._addNormalToWasmBuffer(a,f,T),p=this._addTriangleToWasmBuffer(r,p,u,o,l),f=this._addNormalToWasmBuffer(a,f,T),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(s,3*e,i,e,255,0,0,64),this._vxl._free(s),this._vxl._free(i),this._captureFrustum=!1,this._renderPluginContext.requestRender()}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=w.create(y.Local,u(!1,this.view.spatialReference))),null===this._frustum&&(this._frustum=new b(this._renderCoordsHelper)),this._captureFrustum=!0,null!==this._renderPluginContext&&this._renderPluginContext.requestRender()}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach(((t,s)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.toggle_full_volume_extent_draw(s),this._renderPluginContext.requestRender())}))}addVoxelLayer(e){if(!this._vxl){const t={layerView:e,resolveCallback:null,rejectCallback:null},s=new Promise(((e,s)=>{t.resolveCallback=e,t.rejectCallback=s}));return this._newLayers.push(t),s}const t=this._addVoxelLayer(e);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const t=this._newLayers.findIndex((t=>e.uid===t.layerView.uid));t>=0&&(this._newLayers[t].resolveCallback(-1),this._newLayers.splice(t,1));const s=this._newLayers.length;return 0===s&&(this._dbg(I.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),s}let t=-1;this._layers.forEach(((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){t=r,s.abortController.abort(),this._vxl.remove_layer(t);const i=this.layerUid.indexOf(e.layer.uid);-1!==i&&this.layerUid.splice(i,1)}})),t>=0&&this._layers.delete(t);const s=this._layers.size;return 0===s&&(this._dbg(I.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),s}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e<t)return t;return-1}_allocateBlock(e){e.byteCount=this._vxl.lengthBytesUTF8(e.str)+1;const t=this._getBlockSize(e.byteCount);return t<0?(e.isReusable=!1,e.ptr=this._vxl._malloc(e.byteCount)):(e.isReusable=!0,e.ptr=this._wasmMemBlocks.get(t),0===e.ptr&&(e.ptr=this._vxl._malloc(t),this._wasmMemBlocks.set(t,e.ptr))),0!==e.ptr&&(this._vxl.stringToUTF8(e.str,e.ptr,e.byteCount),!0)}_getTimeArgs(e){let t=-Number.MAX_VALUE,s=Number.MAX_VALUE,r=!1;return null!=e&&(e.isAllTime?r=!0:(null!=e.start&&(r=!0,t=e.start.getTime()/1e3),null!=e.end&&(r=!0,s=e.end.getTime()/1e3))),{startTime:t,endTime:s,useTime:r}}_addVoxelLayer(e){const t=e.layer;let s=-1;const i=t.getConfiguration();if(i.length<1)return-1;const a={str:i,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(a))return-1;const n=this._getTimeArgs(this.view?.timeExtent),o=this.view.spatialReference.isWGS84&&t.spatialReference.isWGS84?111319.49079327357:1;if(s=this._vxl.add_layer(t.serviceRoot,a.ptr,a.byteCount,o,o,n.startTime,n.endTime,n.useTime,this._toWasmQuality(this.view.qualityProfile)),a.isReusable||this._vxl._free(a.ptr),s>=0){t.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const i=new AbortController;if(this._layers.set(s,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:i,needMemoryUsageUpdate:!1,isInScaleRange:!0}),this.layerUid.push(e.layer.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let s="";for(const r of e.layer.variables)"Int16"!==r.renderingFormat.type&&"UInt16"!==r.renderingFormat.type||(t.push(r.name),r.id===e.layer.currentVariableId&&(s=r.name));""!==s&&r.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${s}' in this browser`),t.length>0&&r.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const t=[];let s="";for(const r of e.layer.variables)"Float32"===r.renderingFormat.type&&(t.push(r.name),r.id===e.layer.currentVariableId&&(s=r.name));""!==s&&r.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${s}' in this browser`),t.length>0&&r.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&r.getLogger(this).warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),s}return-1}prepareRender(e){if(!this._vxl)return;const t=e.bindParameters.camera.viewForward,s=e.bindParameters.camera.eye;this._vxl.update_camera_pos_and_direction(s[0],s[1],s[2],t[0],t[1],t[2]);const r=this._vxl.cull();this._dbg(I.RequestResponse,"missingResourceCount="+r),this._moreToLoad=r>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}renderNode(e){if(!this._vxl)return;for(const s of this._newLayers){const e=this._addVoxelLayer(s.layerView);-1===e?s.rejectCallback(-1):s.resolveCallback(e)}if(this._newLayers=[],0===this._layers.size)return void this._dbg(I.Error,"No voxel layers but RenderPlugin instance is being asked to render!");this._lastFrameWasStationary=this.view.stationary,this._syncRequestsResponses(),this._beforeDraw(),this._vxl.begin_color_frame(!this.view._stage.renderer.isFeatureEnabled(V.HighResolutionVoxel),e.bindParameters.lighting.mainLight.direction[0],e.bindParameters.lighting.mainLight.direction[1],e.bindParameters.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach((e=>{e.needMemoryUsageUpdate=!0}))),0===t.x&&0===t.y||this._dbg(I.Error,"Unsupported viewport parameters detected!"),this.updateWasmCamera(e.bindParameters.camera),this._captureFrustum&&(this._frustum.update(e.bindParameters.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this._renderPluginContext.requestRender()}destroy(){this._dbg(I.Lifetime,"--destroy--"),this._removeRenderPlugin(),this._vxl&&(this._layers.forEach((e=>{e.abortController.abort()})),this._wasmMemBlocks.forEach((e=>{0!==e&&this._vxl._free(e)})),this._vxl.uninitialize_voxel_wasm(),this._vxl=null)}_initializeWasm(e){return this._vxl?Promise.resolve():(this._vxlPromise||(this._vxlPromise=x(e).then((e=>{if(this._vxl=e,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(I.Lifetime," no voxel layers left after WASM downloaded, removing RenderPlugin and destroying"),void this.destroy();const t=this._getTimeArgs(this.view?.timeExtent),s=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),r=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),i=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),a=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),n=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),o=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),l=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),h=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),d=this._halfIntTexturesAvailable&&!has("mac"),u=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(s,r,i,a,n,o,l,h,t.startTime,t.endTime,t.useTime,d,u),this._renderPluginContext&&this._renderPluginContext.requestRender()})).catch((()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(I.Error," WASM failed to download, removing RenderPlugin and destroying"),this.destroy()}))),this._vxlPromise)}pickDepth(e,t,s){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const r=s.viewport[3]-t;if(e<0||e>s.viewport[2]||t<0||t>s.viewport[3])return this._dbg(I.Error,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${r.toFixed(0)}]]`),null;this._beforeDraw();const i=s.viewForward,a=s.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],i[0],i[1],i[2]),this.updateWasmCamera(s),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,r);if(this._afterDraw(),n.success){return n.distanceToCamera}return null}pickObject(e,t,s,r){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const i=Math.round(e),a=Math.round(t);if(i<0||i>s.viewport[2]||a<0||a>s.viewport[3])return this._dbg(I.Error,`[js] pickObject: outOfRange, screenXY=[${i}, ${a}], vp=[${s.viewport.toString()}]`),null;this._beforeDraw();const n=s.viewForward,o=s.eye;this._vxl.update_camera_pos_and_direction(o[0],o[1],o[2],n[0],n[1],n[2]),this.updateWasmCamera(s),this._vxl.begin_frame();let l=null;if(0===r.length)l=this._vxl.pick_object(i,a,0,0);else{const e={str:JSON.stringify({layerIds:r}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(l=this._vxl.pick_object(i,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._afterDraw(),l}_beforeDraw(){this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()},this._rctx.setPolygonOffsetFillEnabled(!1),this._rctx.setScissorTestEnabled(!1),this._rctx.setColorMask(!0,!0,!0,!0)}_afterDraw(){this._renderTargetToRestore.fbo=null,this._rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),this._rctx.externalVertexArrayObjectUpdate(),this._rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate()}intersect(e,t,s,r,i){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered)return;if(null==i||i[0]<0||i[0]>e.camera.viewport[2]||i[1]<0||i[1]>e.camera.viewport[3])return this._dbg(I.Error,`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${i[0].toFixed(0)}, ${i[1].toFixed(0)}]`),null;const a=[];this._layers.forEach((t=>{e.options.filteredLayerUids.includes(t.layerView.layer.uid)&&a.push(t.layerView.wasmLayerId)}));const n=this.pickObject(i[0],i[1],e.camera,a);if(null==n||-1===n.layerId)return;const o=this._layers.get(n.layerId);if(o){const t=o.layerView.layer.uid,i=n.distanceToCamera/h(s,r),a=d();a[0]=n.worldX,a[1]=n.worldY,a[2]=n.worldZ;const l={};if(null!=n.continuousValue&&null!=n.continuousValueUnits?l["Voxel.ServiceValue"]=`${n.continuousValue.toLocaleString()} ${n.continuousValueUnits}`:null!=n.uniqueValueLabel&&null!=n.uniqueValue?l["Voxel.ServiceValue"]=`${n.uniqueValueLabel} (${n.uniqueValue})`:null!=n.uniqueValue&&(l["Voxel.ServiceValue"]=`${n.uniqueValue}`),l["Voxel.ServiceVariableLabel"]=n.variableLabel,l["Voxel.Position"]=n.voxelSpacePosition,null!=n.epochTime&&null!=n.nativeTime&&null!=n.nativeTimeUnits){const e=new Date(n.epochTime);l["Voxel.ServiceLocalTime"]=e.toString(),l["Voxel.ServiceNativeTime"]=`${n.nativeTime.toLocaleString()} ${n.nativeTimeUnits}`}null!=n.depth&&null!=n.depthUnits&&(l["Voxel.ServiceDepth"]=`${n.depth.toLocaleString()} ${n.depthUnits}`);const u=n.faceNormal;l["Voxel.WorldPosition"]=`[${a[0]}, ${a[1]}, ${a[2]}]`;const _=e=>{const s=new v(a,t,(()=>this._createVoxelGraphic(o.layerView.layer,l)));e.set(this.type,s,i,u)},c=e.results,m=e.options.store===E.ALL;if((null==c.min.dist||i<c.min.dist)&&_(c.min),(null==c.max.dist||i>c.max.dist)&&_(c.max),m){const t=R(e.ray);_(t),e.results.all.push(t)}}}_createVoxelGraphic(e,s){return new t({layer:e,sourceLayer:e,attributes:s})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,s){this._vxl&&this._vxl.set_upscaling_limits(e,t,s)}};e([o({constructOnly:!0})],U.prototype,"view",void 0),U=e([l("esri.layers.VoxelWasmPerSceneView")],U);const k=U;export{k as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import s from"../request.js";import has from"../core/has.js";import r from"../core/Logger.js";import{isAbortError as i}from"../core/promiseUtils.js";import{watch as a,initial as n}from"../core/reactiveUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{q as h}from"../chunks/vec32.js";import{create as d}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{renderSRFromViewSR as u}from"../geometry/support/coordinateSystem.js";import{PointIndex as _,PlaneIndex as c}from"../geometry/support/frustum.js";import{WasmCullMode as m,VoxelRequestType as g,UpdateFlags as p,ContainerType as f}from"../libs/vxl/enums.js";import{loadVoxelWASM as x}from"../libs/vxl/VxlModule.js";import{ViewingMode as y}from"../views/ViewingMode.js";import{VoxelTarget as v}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as b}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as w}from"../views/3d/support/RenderCoordsHelper.js";import{SyncRenderPlugin as T}from"../views/3d/webgl-engine/effects/RenderPlugin.js";import{newIntersectorResult as R}from"../views/3d/webgl-engine/lib/Intersector.js";import{IntersectorType as L,StoreResults as E}from"../views/3d/webgl-engine/lib/IntersectorInterfaces.js";import{RenderFeature as V}from"../views/3d/webgl-engine/lib/RenderFeature.js";import{RenderSlot as C}from"../views/3d/webgl-engine/lib/RenderSlot.js";import{CompareFunction as F,Face as S,StencilOperation as P}from"../views/webgl/enums.js";var I;!function(e){e[e.Lifetime=1]="Lifetime",e[e.RequestResponse=2]="RequestResponse",e[e.Rendering=3]="Rendering",e[e.Error=4]="Error"}(I||(I={}));let U=class extends T{constructor(e){super(e),this._halfIntTexturesAvailable=!1,this._textureFloatLinearAvailable=!1,this._havePreparedWithAllLayers=!1,this._renderPluginContext=null,this._vxlPromise=null,this._vxl=null,this._pluginIsActive=!1,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this._rctx=null,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.produces=new Map([[C.VOXEL,()=>!!this._vxl&&"local"===this.view.viewingMode]]),this.type=L.VOXEL,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerUid=[]}_dbg(e,t){this._dbgFlags.has(e)&&(e===I.Error?r.getLogger(this).error(t):r.getLogger(this).warn(t))}_removeRenderPlugin(){this._pluginIsActive&&this.view._stage&&(this._dbg(I.Lifetime,"--removeRenderPlugin--"),this.view._stage.removeRenderPlugin(this)),this._pluginIsActive=!1}initialize(){this._dbg(I.Lifetime,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this.addHandles([a((()=>this.view.ready),(e=>{e&&"local"===this.view.viewingMode?(this._dbg(I.Lifetime,"view ready status changed to ready on a local view, calling addRenderPlugin"),this.view._stage.addRenderPlugin(this),this._pluginIsActive=!0):(this._dbg(I.Lifetime,"view ready status changed, not ready or not a local view!"),this._removeRenderPlugin())}),n),a((()=>this.view?.qualityProfile),(e=>{this._dbg(I.Rendering,"qualityProfile changed to "+e),this._vxl&&this._vxl.set_quality(this._toWasmQuality(e))}),n),a((()=>this.view?.timeExtent),(()=>{if(this._vxl){const e=this._getTimeArgs(this.view?.timeExtent);this._dbg(I.Rendering,"sceneView timeExtent changed to useTime="+e.useTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.useTime),this._renderPluginContext.requestRender()}}),n),a((()=>this.view?.stationary),(e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this._renderPluginContext.requestRender()}))])}initializeRenderContext(e){this._dbg(I.Lifetime,"--initializeRenderContext--");const t=e.renderContext.rctx;this._renderPluginContext=e,this._rctx=e.renderContext.rctx,this._halfIntTexturesAvailable=!!this._rctx.capabilities.textureNorm16,this._textureFloatLinearAvailable=this._rctx.capabilities.textureFloatLinear,this._initializeWasm(t.gl)}uninitializeRenderContext(){this._renderPluginContext=null,this._rctx=null,this._dbg(I.Lifetime,"--uninitializeRenderContext--")}_restoreFramebuffer(){if(!this._renderTargetToRestore)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(I.Error,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){const s=!!this._rctx,r=!!this._renderTargetToRestore;if(!s||!r)return 0;const i=this._renderTargetToRestore.fbo.depthStencilTexture;return i?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(i,e,!0),1):(this._dbg(I.Error,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,s){if(!this._rctx)return void this._dbg(I.Error,"modifyAllocation callback has no rendering context!");const r=e;1===s?this._rctx.instanceCounter.increment(r,t):this._rctx.instanceCounter.decrement(r,t)}_setBlendState(e,t,s,r){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,s),this._rctx.setBlendEquation(r)):this._dbg(I.Error,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(I.Error,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,s){this._rctx?(this._rctx.setDepthFunction(s),this._rctx.setDepthTestEnabled(1===e),this._rctx.setDepthWriteEnabled(1===t),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(F.ALWAYS,0,255),this._rctx.setStencilOpSeparate(S.FRONT,P.KEEP,P.INCR,P.KEEP),this._rctx.setStencilOpSeparate(S.BACK,P.KEEP,P.DECR,P.KEEP)):this._dbg(I.Error,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case m.None:this._rctx.setFaceCullingEnabled(!1);break;case m.Back:this._rctx.setCullFace(S.BACK),this._rctx.setFaceCullingEnabled(!0);break;case m.Front:this._rctx.setCullFace(S.FRONT),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(I.Error,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,s,r){this._rctx?this._rctx.setViewport(e,t,s,r):this._dbg(I.Error,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach(((e,t)=>{if(e.needMemoryUsageUpdate){const s=this._vxl.estimate_memory_usage(t);s>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(s))}}))}_syncRequestsResponses(){this._layers.forEach(((e,t)=>{const r=[];e.responses.forEach(((s,i)=>{r.push(i),this._dbg(I.RequestResponse,"responding for requestID:"+i+" size:"+s.size),this._vxl.respond(t,i,s),s.requestType!==g.TreeIndex&&s.requestType!==g.Section||(e.needMemoryUsageUpdate=!0)}));const a=e.responses;for(const s of r)a.delete(s);const n=this._vxl.get_new_requests(t),o=e.abortController.signal;for(const l in n){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const t=n[l],r={responseType:"array-buffer",signal:o,query:{...e.layerView.layer.customParameters,token:e.layerView.layer.apiKey}};this._dbg(I.RequestResponse,"making requestID:"+l+" url:"+t.url),s(t.url,r).then((s=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(I.RequestResponse,"have response for requestID:"+l);let r=0;if(s.data.byteLength>0){r=this._vxl._malloc(s.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,r,s.data.byteLength),t=new Uint8Array(s.data);for(let r=0;r<s.data.byteLength;++r)e[r]=t[r]}a.set(+l,{responseType:t.responseType,ptr:r,size:s.data.byteLength,success:!0,requestType:t.requestType})})).catch((s=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),i(s)||(this._dbg(I.Error,`requestID:${l} failed, error=${s.toString()}`),a.set(+l,{responseType:t.responseType,ptr:0,size:0,success:!1,requestType:t.requestType}))}))}}))}updateWasmCamera(e){this._vxl.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl.set_near_far(e.near,e.far)}isUpdating(e){if(!this._vxl&&this._vxlPromise)return!0;const t=this._layers.get(e);return!!t&&t.outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._layers.forEach(((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const s=this._vxl.get_layer_epoch_times(r,e.layer.currentVariableId);for(let e=0;e<s.length;++e)t.push(s[e])}})),t}getCurrentLayerTimeIndex(e){let t=0;return this._layers.forEach(((s,r)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl.get_layer_current_time_id(r))})),t}setEnabled(e,t){this._layers.forEach(((s,r)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.set_enabled(r,t),s.needMemoryUsageUpdate=!0,this._renderPluginContext.requestRender())}))}setIsInScaleRange(e,t){const s=this._layers.get(e.wasmLayerId);s&&t!==s.isInScaleRange&&(s.isInScaleRange=t,this._vxl.set_is_in_scale_range(e.wasmLayerId,t),s.needMemoryUsageUpdate=!t,this._renderPluginContext.requestRender())}setStaticSections(e,t){const s={mask:p.StaticSections,staticSections:t};return this._doMaskedUIUpdate(e,s,!0)}setCurrentVariable(e,t){const s={mask:p.CurrentVariable,currentVariable:t};return this._doMaskedUIUpdate(e,s,!0)}setRenderMode(e,t){const s={mask:p.RenderMode,renderMode:t};return this._doMaskedUIUpdate(e,s,!0)}setVerticalExaggerationAndOffset(e,t,s,r){const i={mask:p.ExaggerationAndOffset,volStyleDesc:{volumeId:t,verticalExaggeration:s,verticalOffset:r}};return this._doMaskedUIUpdate(e,i,!0)}setVariableStyles(e,t){const s={mask:p.VariableStyles,variableStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setVolumeStyles(e,t){const s={mask:p.VolumeStyles,volumeStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setEnableDynamicSections(e,t){const s={mask:p.ContainerVisibility,containerIsVisible:t,container:f.DynamicSections};return this._doMaskedUIUpdate(e,s,!0)}setEnableIsosurfaces(e,t){const s={mask:p.ContainerVisibility,containerIsVisible:t,container:f.Isosurfaces};return this._doMaskedUIUpdate(e,s,!0)}setEnableSections(e,t){const s={mask:p.ContainerVisibility,containerIsVisible:t,container:f.StaticSections};return this._doMaskedUIUpdate(e,s,!0)}setAnalysisSlice(e,t,s,r){const i={mask:p.AnalysisSlice,analysisSlice:{point:s,normal:r,enabled:t}};return this._doMaskedUIUpdate(e,i,!0)}_doMaskedUIUpdate(e,t,s){if(!this._vxl)return!1;let r=!1;return this._layers.forEach(((s,i)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(r=1===this._vxl.handle_masked_ui_update(i,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}})),r&&s&&this._renderPluginContext.requestRender(),r}_addTriangleToWasmBuffer(e,t,s,r,i){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],e[3*(t+=1)]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],t+=1}_addNormalToWasmBuffer(e,t,s){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,s=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),r=new Float32Array(this._vxl.HEAPF32.buffer,s,3*e),i=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,i,e),n=this._frustum.points[_.NEAR_BOTTOM_LEFT],o=this._frustum.points[_.NEAR_BOTTOM_RIGHT],l=this._frustum.points[_.NEAR_TOP_RIGHT],h=this._frustum.points[_.NEAR_TOP_LEFT],d=this._frustum.points[_.FAR_BOTTOM_LEFT],u=this._frustum.points[_.FAR_BOTTOM_RIGHT],m=this._frustum.points[_.FAR_TOP_RIGHT],g=this._frustum.points[_.FAR_TOP_LEFT];let p=0,f=0;const x=this._frustum.planes[c.NEAR];p=this._addTriangleToWasmBuffer(r,p,l,o,n),f=this._addNormalToWasmBuffer(a,f,x),p=this._addTriangleToWasmBuffer(r,p,n,h,l),f=this._addNormalToWasmBuffer(a,f,x);const y=this._frustum.planes[c.FAR];p=this._addTriangleToWasmBuffer(r,p,d,u,m),f=this._addNormalToWasmBuffer(a,f,y),p=this._addTriangleToWasmBuffer(r,p,m,g,d),f=this._addNormalToWasmBuffer(a,f,y);const v=this._frustum.planes[c.TOP];p=this._addTriangleToWasmBuffer(r,p,m,l,h),f=this._addNormalToWasmBuffer(a,f,v),p=this._addTriangleToWasmBuffer(r,p,h,g,m),f=this._addNormalToWasmBuffer(a,f,v);const b=this._frustum.planes[c.BOTTOM];p=this._addTriangleToWasmBuffer(r,p,n,o,u),f=this._addNormalToWasmBuffer(a,f,b),p=this._addTriangleToWasmBuffer(r,p,u,d,n),f=this._addNormalToWasmBuffer(a,f,b);const w=this._frustum.planes[c.LEFT];p=this._addTriangleToWasmBuffer(r,p,h,n,d),f=this._addNormalToWasmBuffer(a,f,w),p=this._addTriangleToWasmBuffer(r,p,d,g,h),f=this._addNormalToWasmBuffer(a,f,w);const T=this._frustum.planes[c.RIGHT];p=this._addTriangleToWasmBuffer(r,p,l,m,u),f=this._addNormalToWasmBuffer(a,f,T),p=this._addTriangleToWasmBuffer(r,p,u,o,l),f=this._addNormalToWasmBuffer(a,f,T),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(s,3*e,i,e,255,0,0,64),this._vxl._free(s),this._vxl._free(i),this._captureFrustum=!1,this._renderPluginContext.requestRender()}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=w.create(y.Local,u(!1,this.view.spatialReference))),null===this._frustum&&(this._frustum=new b(this._renderCoordsHelper)),this._captureFrustum=!0,null!==this._renderPluginContext&&this._renderPluginContext.requestRender()}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach(((t,s)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.toggle_full_volume_extent_draw(s),this._renderPluginContext.requestRender())}))}addVoxelLayer(e){if(!this._vxl){const t={layerView:e,resolveCallback:null,rejectCallback:null},s=new Promise(((e,s)=>{t.resolveCallback=e,t.rejectCallback=s}));return this._newLayers.push(t),s}const t=this._addVoxelLayer(e);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const t=this._newLayers.findIndex((t=>e.uid===t.layerView.uid));t>=0&&(this._newLayers[t].resolveCallback(-1),this._newLayers.splice(t,1));const s=this._newLayers.length;return 0===s&&(this._dbg(I.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),s}let t=-1;this._layers.forEach(((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){t=r,s.abortController.abort(),this._vxl.remove_layer(t);const i=this.layerUid.indexOf(e.layer.uid);-1!==i&&this.layerUid.splice(i,1)}})),t>=0&&this._layers.delete(t);const s=this._layers.size;return 0===s&&(this._dbg(I.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),s}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e<t)return t;return-1}_allocateBlock(e){e.byteCount=this._vxl.lengthBytesUTF8(e.str)+1;const t=this._getBlockSize(e.byteCount);return t<0?(e.isReusable=!1,e.ptr=this._vxl._malloc(e.byteCount)):(e.isReusable=!0,e.ptr=this._wasmMemBlocks.get(t),0===e.ptr&&(e.ptr=this._vxl._malloc(t),this._wasmMemBlocks.set(t,e.ptr))),0!==e.ptr&&(this._vxl.stringToUTF8(e.str,e.ptr,e.byteCount),!0)}_getTimeArgs(e){let t=-Number.MAX_VALUE,s=Number.MAX_VALUE,r=!1;return null!=e&&(e.isAllTime?r=!0:(null!=e.start&&(r=!0,t=e.start.getTime()/1e3),null!=e.end&&(r=!0,s=e.end.getTime()/1e3))),{startTime:t,endTime:s,useTime:r}}_addVoxelLayer(e){const t=e.layer;let s=-1;const i=t.getConfiguration();if(i.length<1)return-1;const a={str:i,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(a))return-1;const n=this._getTimeArgs(this.view?.timeExtent),o=this.view.spatialReference.isWGS84&&t.spatialReference.isWGS84?111319.49079327357:1;if(s=this._vxl.add_layer(t.serviceRoot,a.ptr,a.byteCount,o,o,n.startTime,n.endTime,n.useTime,this._toWasmQuality(this.view.qualityProfile)),a.isReusable||this._vxl._free(a.ptr),s>=0){t.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const i=new AbortController;if(this._layers.set(s,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:i,needMemoryUsageUpdate:!1,isInScaleRange:!0}),this.layerUid.push(e.layer.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let s="";for(const r of e.layer.variables)"Int16"!==r.renderingFormat.type&&"UInt16"!==r.renderingFormat.type||(t.push(r.name),r.id===e.layer.currentVariableId&&(s=r.name));""!==s&&r.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${s}' in this browser`),t.length>0&&r.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const t=[];let s="";for(const r of e.layer.variables)"Float32"===r.renderingFormat.type&&(t.push(r.name),r.id===e.layer.currentVariableId&&(s=r.name));""!==s&&r.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${s}' in this browser`),t.length>0&&r.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&r.getLogger(this).warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),s}return-1}prepareRender(e){if(!this._vxl)return;const t=e.bindParameters.camera.viewForward,s=e.bindParameters.camera.eye;this._vxl.update_camera_pos_and_direction(s[0],s[1],s[2],t[0],t[1],t[2]);const r=this._vxl.cull();this._dbg(I.RequestResponse,"missingResourceCount="+r),this._moreToLoad=r>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}renderNode(e){if(!this._vxl)return;for(const s of this._newLayers){const e=this._addVoxelLayer(s.layerView);-1===e?s.rejectCallback(-1):s.resolveCallback(e)}if(this._newLayers=[],0===this._layers.size)return void this._dbg(I.Error,"No voxel layers but RenderPlugin instance is being asked to render!");this._lastFrameWasStationary=this.view.stationary,this._syncRequestsResponses(),this._beforeDraw(),this._vxl.begin_color_frame(!this.view._stage.renderer.isFeatureEnabled(V.HighResolutionVoxel),e.bindParameters.lighting.mainLight.direction[0],e.bindParameters.lighting.mainLight.direction[1],e.bindParameters.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach((e=>{e.needMemoryUsageUpdate=!0}))),0===t.x&&0===t.y||this._dbg(I.Error,"Unsupported viewport parameters detected!"),this.updateWasmCamera(e.bindParameters.camera),this._captureFrustum&&(this._frustum.update(e.bindParameters.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this._renderPluginContext.requestRender()}destroy(){this._dbg(I.Lifetime,"--destroy--"),this._removeRenderPlugin(),this._vxl&&(this._layers.forEach((e=>{e.abortController.abort()})),this._wasmMemBlocks.forEach((e=>{0!==e&&this._vxl._free(e)})),this._vxl.uninitialize_voxel_wasm(),this._vxl=null)}_initializeWasm(e){return this._vxl?Promise.resolve():(this._vxlPromise||(this._vxlPromise=x(e).then((e=>{if(this._vxl=e,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(I.Lifetime," no voxel layers left after WASM downloaded, removing RenderPlugin and destroying"),void this.destroy();const t=this._getTimeArgs(this.view?.timeExtent),s=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),r=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),i=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),a=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),n=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),o=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),l=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),h=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),d=this._halfIntTexturesAvailable&&!has("mac"),u=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(s,r,i,a,n,o,l,h,t.startTime,t.endTime,t.useTime,d,u),this._renderPluginContext&&this._renderPluginContext.requestRender()})).catch((()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(I.Error," WASM failed to download, removing RenderPlugin and destroying"),this.destroy()}))),this._vxlPromise)}pickDepth(e,t,s){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const r=s.viewport[3]-t;if(e<0||e>s.viewport[2]||t<0||t>s.viewport[3])return this._dbg(I.Error,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${r.toFixed(0)}]]`),null;this._beforeDraw();const i=s.viewForward,a=s.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],i[0],i[1],i[2]),this.updateWasmCamera(s),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,r);if(this._afterDraw(),n.success){return n.distanceToCamera}return null}pickObject(e,t,s,r){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const i=Math.round(e),a=Math.round(t);if(i<0||i>s.viewport[2]||a<0||a>s.viewport[3])return this._dbg(I.Error,`[js] pickObject: outOfRange, screenXY=[${i}, ${a}], vp=[${s.viewport.toString()}]`),null;this._beforeDraw();const n=s.viewForward,o=s.eye;this._vxl.update_camera_pos_and_direction(o[0],o[1],o[2],n[0],n[1],n[2]),this.updateWasmCamera(s),this._vxl.begin_frame();let l=null;if(0===r.length)l=this._vxl.pick_object(i,a,0,0);else{const e={str:JSON.stringify({layerIds:r}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(l=this._vxl.pick_object(i,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._afterDraw(),l}_beforeDraw(){this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()},this._rctx.setPolygonOffsetFillEnabled(!1),this._rctx.setScissorTestEnabled(!1),this._rctx.setColorMask(!0,!0,!0,!0)}_afterDraw(){this._renderTargetToRestore.fbo=null,this._rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),this._rctx.externalVertexArrayObjectUpdate(),this._rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate()}intersect(e,t,s,r,i){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered)return;if(null==i||i[0]<0||i[0]>e.camera.viewport[2]||i[1]<0||i[1]>e.camera.viewport[3])return this._dbg(I.Error,`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${i[0].toFixed(0)}, ${i[1].toFixed(0)}]`),null;const a=[];this._layers.forEach((t=>{e.options.filteredLayerUids.includes(t.layerView.layer.uid)&&a.push(t.layerView.wasmLayerId)}));const n=this.pickObject(i[0],i[1],e.camera,a);if(null==n||-1===n.layerId)return;const o=this._layers.get(n.layerId);if(o){const t=o.layerView.layer.uid,i=n.distanceToCamera/h(s,r),a=d();a[0]=n.worldX,a[1]=n.worldY,a[2]=n.worldZ;const l={};if(null!=n.continuousValue&&null!=n.continuousValueUnits?l["Voxel.ServiceValue"]=`${n.continuousValue.toLocaleString()} ${n.continuousValueUnits}`:null!=n.uniqueValueLabel&&null!=n.uniqueValue?l["Voxel.ServiceValue"]=`${n.uniqueValueLabel} (${n.uniqueValue})`:null!=n.uniqueValue&&(l["Voxel.ServiceValue"]=`${n.uniqueValue}`),l["Voxel.ServiceVariableLabel"]=n.variableLabel,l["Voxel.Position"]=n.voxelSpacePosition,null!=n.epochTime&&null!=n.nativeTime&&null!=n.nativeTimeUnits){const e=new Date(n.epochTime);l["Voxel.ServiceLocalTime"]=e.toString(),l["Voxel.ServiceNativeTime"]=`${n.nativeTime.toLocaleString()} ${n.nativeTimeUnits}`}null!=n.depth&&null!=n.depthUnits&&(l["Voxel.ServiceDepth"]=`${n.depth.toLocaleString()} ${n.depthUnits}`);const u=n.faceNormal;l["Voxel.WorldPosition"]=`[${a[0]}, ${a[1]}, ${a[2]}]`;const _=e=>{const s=new v(a,t,(()=>this._createVoxelGraphic(o.layerView.layer,l)));e.set(this.type,s,i,u)},c=e.results,m=e.options.store===E.ALL;if((null==c.min.dist||i<c.min.dist)&&_(c.min),(null==c.max.dist||i>c.max.dist)&&_(c.max),m){const t=R(e.ray);_(t),e.results.all.push(t)}}}_createVoxelGraphic(e,s){return new t({layer:e,sourceLayer:e,attributes:s})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,s){this._vxl&&this._vxl.set_upscaling_limits(e,t,s)}};e([o({constructOnly:!0})],U.prototype,"view",void 0),U=e([l("esri.layers.VoxelWasmPerSceneView")],U);const k=U;export{k as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../core/Accessor.js";import i from"../../core/Error.js";import n from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{parseWhereClause as s}from"../../core/sql.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{encodeGeohash as p}from"../../geohash/geohashUtils.js";import d from"../../geometry/Polygon.js";import{initializeProjection as m,project as l}from"../../geometry/projection.js";import{wgs84 as h}from"../../geometry/support/spatialReferenceUtils.js";import c from"./SessionMemoryStorage.js";import{extentToInBoundsRings as y}from"./supportUtils.js";import{executeQueryStreaming as u}from"../../rest/knowledgeGraphService.js";import f from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import g from"../../rest/support/Query.js";import b from"../../geometry/Extent.js";const w="ESRI__ID",T="ESRI__ORIGIN_ID",D="ESRI__DESTINATION_ID",M="ESRI__LAYOUT_GEOMETRY",I=12;let k=class extends t{constructor(e){super(e),this._processingCacheUpdatesLookup=new Map,this.knowledgeGraph=null,this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this.nodeConnectionsLookup=new Map,this.relationshipConnectionsLookup=new Map,this.memberIdTypeLookup=new Map;const t=new Map;e.knowledgeGraph.dataModel.entityTypes?.forEach((i=>{i.name&&(t.set(i.name,"entity"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.entityTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((i=>{i.name&&(t.set(i.name,"relationship"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.relationshipTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,s)=>{if("entity"===t.get(s))this.entityTypeNames.add(s);else{if("relationship"!==t.get(s))return n.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);this.relationshipTypeNames.add(s)}const a=new Map;i.members?.forEach((e=>{o(this.memberIdTypeLookup,e.id,(()=>new Set)).add(s);const t=this.getById(e.id);t&&a.set(e.id,t)})),this.sublayerCaches.set(s,a)}))}addToLayer(e){e.forEach((({typeName:e,id:t})=>{if(!this.inclusionModeDefinition)throw new i("knowledge-graph:layer-data-manager","You cannot add to a layer's exclusion list if it was not created with an exclusion list originally");if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){const i=this.inclusionModeDefinition.namedTypeDefinitions.get(e);i.members||(i.members=new Map),i.members.set(t,{id:t}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}else{const i=new Map;i.set(t,{id:t}),this.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:i}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}))}getById(e){return c.getInstance().readFromStoreById(e)}async getData(e,t,i){if(t.objectType.name&&this.inclusionModeDefinition?.namedTypeDefinitions&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(t.objectType.name))return[];let n;if(n=e||new g({where:"1=1",outFields:["*"]}),"link-chart"===t.parentCompositeLayer.type){const e=t.parentCompositeLayer,i=this._processingCacheUpdatesLookup.get(t.objectType.name??""),o=n.outFields,s=n.geometry;let a="",r="";s&&s.extent&&(a=p(s.extent.ymin,s.extent.xmin,I),r=p(s.extent.ymax,s.extent.xmax,I)),o&&1===o.length&&o[0]===w&&"1=1"===n.where||await Promise.all(i??[]);const d=this.sublayerCaches.has(t.objectType.name??"")?Array.from(this.sublayerCaches.get(t.objectType.name)?.values()):[],m=[];return d.forEach((i=>{if(this.relationshipTypeNames.has(t.objectType.name)?i.geometry=e.relationshipLinkChartDiagramLookup.get(i.attributes[t.objectIdField]):i.geometry=e.entityLinkChartDiagramLookup.get(i.attributes[t.objectIdField]),i.attributes[M]=i.geometry,a&&r){const n=e.linkChartGeohashLookup.get(i.attributes[t.objectIdField]);n?n>=a&&n<=r&&m.push(i):m.push(i)}else m.push(i)})),m}return this.retrieveDataFromService(n,t,i)}async getConnectedRecordIds(e,t){const i=[];let o="";const s=[],a=new Map;if(e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e)){if(!this.entityTypeNames.has(t))return;a.has(t)?a.get(t)?.push(e):a.set(t,[e])}})),t&&0!==t?.length){for(const e of t)o=o+e+"|";o=o.slice(0,-1)}return a.forEach(((e,a)=>{let r;r=t&&0!==t?.length?`MATCH (n:${a})-[r:${o}]-(m) WHERE id(n) IN $ids RETURN id(r), type(r), id(m), labels(m)[0]`:`MATCH (n:${a})-[r]-(m) WHERE id(n) IN $ids RETURN id(r), type(r), id(m), labels(m)[0]`;const p=new Promise((t=>{(async()=>{const t=(await u(this.knowledgeGraph,new f({openCypherQuery:r,bindParameters:{ids:e}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;for(let t=0;t<n.length;t++){const e=n[t];i.push({id:e[0],typeName:e[1]}),i.push({id:e[2],typeName:e[3]})}}}catch(o){if("AbortError"!==o.name)throw o;n.getLogger(this).info("Request aborted as expected")}})().then((()=>{t()}))}));s.push(p)})),this.refreshCacheContent(),await Promise.all(s),i}async refreshCacheContent(e,t,n,s=!0){const a=c.getInstance(),r=[],p=new Map,d=new Map;this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),this.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),e||this.inclusionModeDefinition?e?e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e))p.has(t)?p.get(t)?.push(e):p.set(t,[e])})):this.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e.useAllData?p.set(t,null):e.members&&e.members.forEach((e=>{p.has(t)&&null!==p.get(t)?p.get(t)?.push(e.id):p.set(t,[e.id])}))})):(this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})),this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})));for(const[m,l]of p){const e=new Promise((e=>{const r=async()=>{const e=new Set,r=[];let p,h="",c=!1;if(t||d.get(m)?.properties?.forEach((t=>{t.name&&e.add(t.name)})),n&&this.geographicLookup.has(m)){const t=this.geographicLookup.get(m)?.name;t&&e.add(t)}if(this.entityTypeNames.has(m))h=`MATCH (n:${m}) ${l?"WHERE id(n) IN $ids ":""}return ID(n)`,e.forEach((e=>{h+=`, n.${e}`,r.push(e)}));else{if(!this.relationshipTypeNames.has(m))throw new i("knowledge-graph:layer-data-manager",`The graph type of ${m} could not be determined. Was this type set in the KG data model and inclusion definition?`);c=!0,h=`MATCH ()-[n:${m}]->() ${l?"WHERE id(n) IN $ids ":""}return ID(n), id(startNode(n)), id(endNode(n))`,e.forEach((e=>{h+=`, n.${e}`,r.push(e)}))}p=new f(l?{openCypherQuery:h,bindParameters:{ids:l}}:{openCypherQuery:h});const y=(await u(this.knowledgeGraph,p)).resultRowsStream.getReader();for(;;){const{done:e,value:t}=await y.read();if(e)break;const i=[];for(let s=0;s<t.length;s++){const e=t[s];let n=0,a=0;const p={properties:{}};for(p.id=e[n],n++,a++,c&&(p.originId=e[n],n++,a++,p.destinationId=e[n],n++,a++,o(this.nodeConnectionsLookup,p.originId,(()=>new Set)).add(p.id),o(this.nodeConnectionsLookup,p.destinationId,(()=>new Set)).add(p.id),o(this.relationshipConnectionsLookup,p.id,(()=>[p.originId,p.destinationId])));n<e.length;n++)p.properties[r[n-a]]=e[n];i.push(p)}const n=a.writeToStore(i,w,this.geographicLookup.get(m)?.name);this.sublayerCaches.has(m)||this.sublayerCaches.set(m,new Map),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.has(m)&&this.inclusionModeDefinition?.namedTypeDefinitions.set(m,{useAllData:!1,members:new Map}),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members&&(this.inclusionModeDefinition.namedTypeDefinitions.get(m).members=new Map);const p=this.sublayerCaches.get(m);n.forEach((e=>{p?.set(e.attributes[w],e),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members.has(e.attributes[w])&&(this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members.set(e.attributes[w],{id:e.attributes[w]}),o(this.memberIdTypeLookup,e.attributes[w],(()=>new Set)).add(m))}))}};r().then((()=>{e(null)}))}));r.push(e),this._processingCacheUpdatesLookup.get(m)?.push(e)}await Promise.all(r)}removeFromLayer(e){const t=new Set,i=new Set(e.map((e=>e.id)));for(const n of e)t.add(n.typeName),1===this.memberIdTypeLookup.get(n.id)?.size?this.memberIdTypeLookup.delete(n.id):this.memberIdTypeLookup.get(n.id)?.delete(n.typeName),this.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{t===n.typeName&&e.members?.has(n.id)&&e.members.delete(n.id)}));t.forEach((e=>{this.sublayerCaches.get(e)?.forEach(((t,n)=>{i.has(n)&&this.sublayerCaches.get(e)?.delete(n)}))}))}async retrieveDataFromService(e,t,n){const o=c.getInstance(),a=new Set,r=[];let p,g="",T=[];const D="relationship"===t.graphType,M=this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData,I=t.parentCompositeLayer.sublayerIdsCache.get(t.objectType.name);let k=!M&&I?Array.from(I).sort():null;if(this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData)this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData&&null!=e.objectIds&&(k=e.objectIds);else if(null!=e.objectIds&&k&&k.length>0){const t=e.objectIds;e.objectIds=k.filter((e=>t.includes(e)))}else if(null!=e.objectIds)k=e.objectIds;else{if(this.inclusionModeDefinition?.namedTypeDefinitions.has(t.objectType.name)&&(!this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members||this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members?.size<1))return e.objectIds=[],[];e.objectIds=k}if(null!=e.outFields){const i=e.outFields;i.includes("*")?t.fields.forEach((e=>{a.add(e.name)})):i.forEach((e=>{e!==w&&e!==t.geometryFieldName&&a.add(e)}))}if(null!=e.geometry){const n=e.geometry;let o;const c=t.parentCompositeLayer.dataManager.knowledgeGraph.serviceDefinition,u=c?.spatialReference,w=c?.serviceCapabilities?.geometryCapabilities;let T=w?.geometryMaxBoundingRectangleSizeX,M=w?.geometryMaxBoundingRectangleSizeY;if(n?.extent?.spatialReference&&!n.spatialReference?.isWGS84?(await m(n.extent.spatialReference,h),o=l(n.extent,h)):o=n.extent,T&&M&&u){if(4326!==u.wkid){const e=new b({spatialReference:u,xmax:T,ymax:M}),t=l(e,h);T=t.xmax,M=t.ymax}if(o.xmax-o.xmin>T)throw new i("knowledge-graph:layer-data-manager",`Extent x bounds should be within ${T}° latitude, limit exceeded`);if(o.ymax-o.ymin>M)throw new i("knowledge-graph:layer-data-manager",`Extent y bounds should be within ${M}° longitude, limit exceeded`)}if(null!=e.where&&"1=1"!==e.where){const i=await s(e.where.toUpperCase(),t.fieldsIndex);t.fields.forEach((e=>{i.fieldNames.includes(e.name)&&a.add(e.name)}))}g=D?`Match ()-[n:${t.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${t.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n)`,t.geometryFieldName&&a.add(t.geometryFieldName),a.forEach((e=>{g+=`, n.${e}`,r.push(e)})),p=new f({openCypherQuery:g,bindParameters:{param_filter_geom:new d({rings:y(o)})}})}else{let i="";if(null!=e.where&&"1=1"!==e.where){const n=await s(e.where,t.fieldsIndex);t.fields.forEach((e=>{n.fieldNames.includes(e.name)&&a.add(e.name)}));const o=new Set(["column-reference","string","number","binary-expression"]),r=new Set(["=","<","<=","<>",">",">=","AND","OR","LIKE"]);let p=!1;const d=e=>{if("column-reference"===e.type)return`n.${e.column}`;if("string"===e.type)return`'${e.value}'`;if("number"===e.type)return`${e.value}`;if("binary-expression"===e.type&&o.has(e.left.type)&&o.has(e.right.type)&&r.has(e.operator))return`${d(e.left)} ${e.operator} ${d(e.right)}`;if("binary-expression"===e.type&&"LIKE"===e.operator){let t="";if("function"===e.left.type&&"column-reference"===e.left.args.value[0].type)t+=`lower(n.${e.left.args.value[0].column})`;else{if("column-reference"!==e.left.type)return p=!0,"";t+=`lower(n.${e.left.column})`}if(t+=" CONTAINS (","string"!==e.right.type)return p=!0,"";{let i=e.right.value;"%"===i.charAt(0)&&(i=i.slice(1)),"%"===i.charAt(i.length-1)&&(i=i.slice(0,-1)),t+=`'${i.toLowerCase()}')`}return t}return p=!0,""};i=d(n.parseTree),p&&(i="")}let n="";n=D?`Match ()-[n:${t.objectType.name}]->()`:`Match (n:${t.objectType.name})`;let o=!1;k&&(o=!0,n+=" WHERE ID(n) IN $ids"),i&&(n+=o?" AND":" WHERE",n+=` ${i}`),n+=" return ID(n)",D&&(n+=", id(startNode(n)), id(endNode(n))"),e.returnGeometry&&t.geometryFieldName&&a.add(t.geometryFieldName),a.forEach((e=>{n+=`, n.${e}`,r.push(e)})),p=new f(k?{openCypherQuery:n,bindParameters:{ids:k}}:{openCypherQuery:n})}const E=(await u(t.parentCompositeLayer.dataManager.knowledgeGraph,p,n)).resultRowsStream.getReader();for(;;){const{done:e,value:i}=await E.read();if(e)break;const n=[];for(let t=0;t<i.length;t++){const e=i[t];let o=0,s=0;const a={properties:{}};for(a.id=e[o],o++,s++,D&&(a.originId=e[o],o++,s++,a.destinationId=e[o],o++,s++);o<e.length;o++)a.properties[r[o-s]]=e[o];n.push(a)}T=T.concat(o.writeToStore(n,w,t.parentCompositeLayer.dataManager.geographicLookup.get(t.objectType.name)?.name))}return T}};e([a()],k.prototype,"knowledgeGraph",void 0),e([a()],k.prototype,"inclusionModeDefinition",void 0),e([a()],k.prototype,"entityTypeNames",void 0),e([a()],k.prototype,"relationshipTypeNames",void 0),e([a()],k.prototype,"geographicLookup",void 0),e([a()],k.prototype,"sublayerCaches",void 0),e([a()],k.prototype,"nodeConnectionsLookup",void 0),e([a()],k.prototype,"relationshipConnectionsLookup",void 0),e([a()],k.prototype,"memberIdTypeLookup",void 0),k=e([r("esri.rest.knowledgeGraph.knowledgeGraphLayer.KnowledgeGraphLayerDataManager")],k);export{k as KnowledgeGraphLayerDataManager,I as geohashEncodingPrecision,D as mockDestinationIdFieldName,M as mockLayoutGeometryFieldName,w as mockOidFieldName,T as mockOriginIdFieldName};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../core/Accessor.js";import i from"../../core/Error.js";import n from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{parseWhereClause as s}from"../../core/sql.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{encodeGeohash as p}from"../../geohash/geohashUtils.js";import d from"../../geometry/Polygon.js";import{initializeProjection as m,project as l}from"../../geometry/projection.js";import{wgs84 as h}from"../../geometry/support/spatialReferenceUtils.js";import c from"./SessionMemoryStorage.js";import{extentToInBoundsRings as y}from"./supportUtils.js";import{executeQueryStreaming as u}from"../../rest/knowledgeGraphService.js";import f from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import g from"../../rest/support/Query.js";import b from"../../geometry/Extent.js";const w="ESRI__ID",T="ESRI__ORIGIN_ID",D="ESRI__DESTINATION_ID",I="ESRI__LAYOUT_GEOMETRY",M="ESRI__AGGREGATION_COUNT",k=12;let E=class extends t{constructor(e){super(e),this._processingCacheUpdatesLookup=new Map,this.knowledgeGraph=null,this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this.nodeConnectionsLookup=new Map,this.relationshipConnectionsLookup=new Map,this.memberIdTypeLookup=new Map;const t=new Map;e.knowledgeGraph.dataModel.entityTypes?.forEach((i=>{i.name&&(t.set(i.name,"entity"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.entityTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((i=>{i.name&&(t.set(i.name,"relationship"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.relationshipTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,s)=>{if("entity"===t.get(s))this.entityTypeNames.add(s);else{if("relationship"!==t.get(s))return n.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);this.relationshipTypeNames.add(s)}const a=new Map;i.members?.forEach((e=>{o(this.memberIdTypeLookup,e.id,(()=>new Set)).add(s);const t=this.getById(e.id);t&&a.set(e.id,t)})),this.sublayerCaches.set(s,a)}))}addToLayer(e){e.forEach((({typeName:e,id:t})=>{if(!this.inclusionModeDefinition)throw new i("knowledge-graph:layer-data-manager","You cannot add to a layer's exclusion list if it was not created with an exclusion list originally");if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){const i=this.inclusionModeDefinition.namedTypeDefinitions.get(e);i.members||(i.members=new Map),i.members.set(t,{id:t}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}else{const i=new Map;i.set(t,{id:t}),this.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:i}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}))}getById(e){return c.getInstance().readFromStoreById(e)}async getData(e,t,i){if(t.objectType.name&&this.inclusionModeDefinition?.namedTypeDefinitions&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(t.objectType.name))return[];let n;if(n=e||new g({where:"1=1",outFields:["*"]}),"link-chart"===t.parentCompositeLayer.type){const e=t.parentCompositeLayer,i=this._processingCacheUpdatesLookup.get(t.objectType.name??""),o=n.outFields,s=n.geometry;let a="",r="";s&&s.extent&&(a=p(s.extent.ymin,s.extent.xmin,k),r=p(s.extent.ymax,s.extent.xmax,k)),o&&1===o.length&&o[0]===w&&"1=1"===n.where||await Promise.all(i??[]);const d=this.sublayerCaches.has(t.objectType.name??"")?Array.from(this.sublayerCaches.get(t.objectType.name)?.values()):[],m=[];return d.forEach((i=>{if(this.relationshipTypeNames.has(t.objectType.name)?i.geometry=e.relationshipLinkChartDiagramLookup.get(i.attributes[t.objectIdField]):i.geometry=e.entityLinkChartDiagramLookup.get(i.attributes[t.objectIdField]),i.attributes[I]=i.geometry,a&&r){const n=e.linkChartGeohashLookup.get(i.attributes[t.objectIdField]);n?n>=a&&n<=r&&m.push(i):m.push(i)}else m.push(i)})),m}return this.retrieveDataFromService(n,t,i)}async getConnectedRecordIds(e,t){const i=[];let o="";const s=[],a=new Map;if(e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e)){if(!this.entityTypeNames.has(t))return;a.has(t)?a.get(t)?.push(e):a.set(t,[e])}})),t&&0!==t?.length){for(const e of t)o=o+e+"|";o=o.slice(0,-1)}return a.forEach(((e,a)=>{let r;r=t&&0!==t?.length?`MATCH (n:${a})-[r:${o}]-(m) WHERE id(n) IN $ids RETURN id(r), type(r), id(m), labels(m)[0]`:`MATCH (n:${a})-[r]-(m) WHERE id(n) IN $ids RETURN id(r), type(r), id(m), labels(m)[0]`;const p=new Promise((t=>{(async()=>{const t=(await u(this.knowledgeGraph,new f({openCypherQuery:r,bindParameters:{ids:e}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;for(let t=0;t<n.length;t++){const e=n[t];i.push({id:e[0],typeName:e[1]}),i.push({id:e[2],typeName:e[3]})}}}catch(o){if("AbortError"!==o.name)throw o;n.getLogger(this).info("Request aborted as expected")}})().then((()=>{t()}))}));s.push(p)})),this.refreshCacheContent(),await Promise.all(s),i}async refreshCacheContent(e,t,n,s=!0){const a=c.getInstance(),r=[],p=new Map,d=new Map;this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),this.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),e||this.inclusionModeDefinition?e?e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e))p.has(t)?p.get(t)?.push(e):p.set(t,[e])})):this.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e.useAllData?p.set(t,null):e.members&&e.members.forEach((e=>{p.has(t)&&null!==p.get(t)?p.get(t)?.push(e.id):p.set(t,[e.id])}))})):(this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})),this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})));for(const[m,l]of p){const e=new Promise((e=>{const r=async()=>{const e=new Set,r=[];let p,h="",c=!1;if(t||d.get(m)?.properties?.forEach((t=>{t.name&&e.add(t.name)})),n&&this.geographicLookup.has(m)){const t=this.geographicLookup.get(m)?.name;t&&e.add(t)}if(this.entityTypeNames.has(m))h=`MATCH (n:${m}) ${l?"WHERE id(n) IN $ids ":""}return ID(n)`,e.forEach((e=>{h+=`, n.${e}`,r.push(e)}));else{if(!this.relationshipTypeNames.has(m))throw new i("knowledge-graph:layer-data-manager",`The graph type of ${m} could not be determined. Was this type set in the KG data model and inclusion definition?`);c=!0,h=`MATCH ()-[n:${m}]->() ${l?"WHERE id(n) IN $ids ":""}return ID(n), id(startNode(n)), id(endNode(n))`,e.forEach((e=>{h+=`, n.${e}`,r.push(e)}))}p=new f(l?{openCypherQuery:h,bindParameters:{ids:l}}:{openCypherQuery:h});const y=(await u(this.knowledgeGraph,p)).resultRowsStream.getReader();for(;;){const{done:e,value:t}=await y.read();if(e)break;const i=[];for(let s=0;s<t.length;s++){const e=t[s];let n=0,a=0;const p={properties:{}};for(p.id=e[n],n++,a++,c&&(p.originId=e[n],n++,a++,p.destinationId=e[n],n++,a++,o(this.nodeConnectionsLookup,p.originId,(()=>new Set)).add(p.id),o(this.nodeConnectionsLookup,p.destinationId,(()=>new Set)).add(p.id),o(this.relationshipConnectionsLookup,p.id,(()=>[p.originId,p.destinationId])));n<e.length;n++)p.properties[r[n-a]]=e[n];i.push(p)}const n=a.writeToStore(i,w,this.geographicLookup.get(m)?.name);this.sublayerCaches.has(m)||this.sublayerCaches.set(m,new Map),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.has(m)&&this.inclusionModeDefinition?.namedTypeDefinitions.set(m,{useAllData:!1,members:new Map}),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members&&(this.inclusionModeDefinition.namedTypeDefinitions.get(m).members=new Map);const p=this.sublayerCaches.get(m);n.forEach((e=>{p?.set(e.attributes[w],e),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members.has(e.attributes[w])&&(this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members.set(e.attributes[w],{id:e.attributes[w]}),o(this.memberIdTypeLookup,e.attributes[w],(()=>new Set)).add(m))}))}};r().then((()=>{e(null)}))}));r.push(e),this._processingCacheUpdatesLookup.get(m)?.push(e)}await Promise.all(r)}removeFromLayer(e){const t=new Set,i=new Set(e.map((e=>e.id)));for(const n of e)t.add(n.typeName),1===this.memberIdTypeLookup.get(n.id)?.size?this.memberIdTypeLookup.delete(n.id):this.memberIdTypeLookup.get(n.id)?.delete(n.typeName),this.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{t===n.typeName&&e.members?.has(n.id)&&e.members.delete(n.id)}));t.forEach((e=>{this.sublayerCaches.get(e)?.forEach(((t,n)=>{i.has(n)&&this.sublayerCaches.get(e)?.delete(n)}))}))}async retrieveDataFromService(e,t,n){const o=c.getInstance(),a=new Set,r=[];let p,g="",T=[];const D="relationship"===t.graphType,I=this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData,M=t.parentCompositeLayer.sublayerIdsCache.get(t.objectType.name);let k=!I&&M?Array.from(M).sort():null;if(this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData)this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData&&null!=e.objectIds&&(k=e.objectIds);else if(null!=e.objectIds&&k&&k.length>0){const t=e.objectIds;e.objectIds=k.filter((e=>t.includes(e)))}else if(null!=e.objectIds)k=e.objectIds;else{if(this.inclusionModeDefinition?.namedTypeDefinitions.has(t.objectType.name)&&(!this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members||this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members?.size<1))return e.objectIds=[],[];e.objectIds=k}if(null!=e.outFields){const i=e.outFields;i.includes("*")?t.fields.forEach((e=>{a.add(e.name)})):i.forEach((e=>{e!==w&&e!==t.geometryFieldName&&a.add(e)}))}if(null!=e.geometry){const n=e.geometry;let o;const c=t.parentCompositeLayer.dataManager.knowledgeGraph.serviceDefinition,u=c?.spatialReference,w=c?.serviceCapabilities?.geometryCapabilities;let T=w?.geometryMaxBoundingRectangleSizeX,I=w?.geometryMaxBoundingRectangleSizeY;if(n?.extent?.spatialReference&&!n.spatialReference?.isWGS84?(await m(n.extent.spatialReference,h),o=l(n.extent,h)):o=n.extent,T&&I&&u){if(4326!==u.wkid){const e=new b({spatialReference:u,xmax:T,ymax:I}),t=l(e,h);T=t.xmax,I=t.ymax}if(o.xmax-o.xmin>T)throw new i("knowledge-graph:layer-data-manager",`Extent x bounds should be within ${T}° latitude, limit exceeded`);if(o.ymax-o.ymin>I)throw new i("knowledge-graph:layer-data-manager",`Extent y bounds should be within ${I}° longitude, limit exceeded`)}if(null!=e.where&&"1=1"!==e.where){const i=await s(e.where.toUpperCase(),t.fieldsIndex);t.fields.forEach((e=>{i.fieldNames.includes(e.name)&&a.add(e.name)}))}g=D?`Match ()-[n:${t.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${t.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n)`,t.geometryFieldName&&a.add(t.geometryFieldName),a.forEach((e=>{g+=`, n.${e}`,r.push(e)})),p=new f({openCypherQuery:g,bindParameters:{param_filter_geom:new d({rings:y(o)})}})}else{let i="";if(null!=e.where&&"1=1"!==e.where){const n=await s(e.where,t.fieldsIndex);t.fields.forEach((e=>{n.fieldNames.includes(e.name)&&a.add(e.name)}));const o=new Set(["column-reference","string","number","binary-expression"]),r=new Set(["=","<","<=","<>",">",">=","AND","OR","LIKE"]);let p=!1;const d=e=>{if("column-reference"===e.type)return`n.${e.column}`;if("string"===e.type)return`'${e.value}'`;if("number"===e.type)return`${e.value}`;if("binary-expression"===e.type&&o.has(e.left.type)&&o.has(e.right.type)&&r.has(e.operator))return`${d(e.left)} ${e.operator} ${d(e.right)}`;if("binary-expression"===e.type&&"LIKE"===e.operator){let t="";if("function"===e.left.type&&"column-reference"===e.left.args.value[0].type)t+=`lower(n.${e.left.args.value[0].column})`;else{if("column-reference"!==e.left.type)return p=!0,"";t+=`lower(n.${e.left.column})`}if(t+=" CONTAINS (","string"!==e.right.type)return p=!0,"";{let i=e.right.value;"%"===i.charAt(0)&&(i=i.slice(1)),"%"===i.charAt(i.length-1)&&(i=i.slice(0,-1)),t+=`'${i.toLowerCase()}')`}return t}return p=!0,""};i=d(n.parseTree),p&&(i="")}let n="";n=D?`Match ()-[n:${t.objectType.name}]->()`:`Match (n:${t.objectType.name})`;let o=!1;k&&(o=!0,n+=" WHERE ID(n) IN $ids"),i&&(n+=o?" AND":" WHERE",n+=` ${i}`),n+=" return ID(n)",D&&(n+=", id(startNode(n)), id(endNode(n))"),e.returnGeometry&&t.geometryFieldName&&a.add(t.geometryFieldName),a.forEach((e=>{n+=`, n.${e}`,r.push(e)})),p=new f(k?{openCypherQuery:n,bindParameters:{ids:k}}:{openCypherQuery:n})}const E=(await u(t.parentCompositeLayer.dataManager.knowledgeGraph,p,n)).resultRowsStream.getReader();for(;;){const{done:e,value:i}=await E.read();if(e)break;const n=[];for(let t=0;t<i.length;t++){const e=i[t];let o=0,s=0;const a={properties:{}};for(a.id=e[o],o++,s++,D&&(a.originId=e[o],o++,s++,a.destinationId=e[o],o++,s++);o<e.length;o++)a.properties[r[o-s]]=e[o];n.push(a)}T=T.concat(o.writeToStore(n,w,t.parentCompositeLayer.dataManager.geographicLookup.get(t.objectType.name)?.name))}return T}};e([a()],E.prototype,"knowledgeGraph",void 0),e([a()],E.prototype,"inclusionModeDefinition",void 0),e([a()],E.prototype,"entityTypeNames",void 0),e([a()],E.prototype,"relationshipTypeNames",void 0),e([a()],E.prototype,"geographicLookup",void 0),e([a()],E.prototype,"sublayerCaches",void 0),e([a()],E.prototype,"nodeConnectionsLookup",void 0),e([a()],E.prototype,"relationshipConnectionsLookup",void 0),e([a()],E.prototype,"memberIdTypeLookup",void 0),E=e([r("esri.rest.knowledgeGraph.knowledgeGraphLayer.KnowledgeGraphLayerDataManager")],E);export{E as KnowledgeGraphLayerDataManager,k as geohashEncodingPrecision,M as mockAggregationCountFieldName,D as mockDestinationIdFieldName,I as mockLayoutGeometryFieldName,w as mockOidFieldName,T as mockOriginIdFieldName};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import{fromJSON as r}from"../../renderers/support/jsonUtils.js";import{rendererTypes as o}from"../../renderers/support/types.js";import"../../core/workers/workers.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{initializeProjection as a,project as n}from"../../geometry/projection.js";import{wgs84 as p}from"../../geometry/support/spatialReferenceUtils.js";import l from"../Layer.js";import y from"../graphics/data/FeatureStore.js";import{QueryEngine as m}from"../graphics/data/QueryEngine.js";import{createCapabilities as u,createDrawingInfo as d}from"../graphics/sources/support/clientSideDefaults.js";import{mockOidFieldName as h,mockLayoutGeometryFieldName as c}from"./KnowledgeGraphLayerDataManager.js";import{KnowledgeGraphSublayerBase as g}from"./KnowledgeGraphSublayerBase.js";import{BlendLayer as f}from"../mixins/BlendLayer.js";import{FeatureReductionLayer as j}from"../mixins/FeatureReductionLayer.js";import{RefreshableLayer as b}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as T}from"../mixins/ScaleRangeLayer.js";import{popupEnabled as w}from"../support/commonProperties.js";import S from"../support/Field.js";import{fixRendererFields as F}from"../support/fieldUtils.js";import x from"../../rest/support/FeatureSet.js";import Q from"../../rest/support/Query.js";import{createPopupTemplate as O}from"../../support/popupUtils.js";import L from"../../core/workers/RemoteClient.js";import v from"../../geometry/Extent.js";import E from"../../geometry/Polygon.js";import N from"../../geometry/Polyline.js";import{featureGeometryTypeKebabDictionary as C}from"../../geometry/support/typeUtils.js";let M=class extends(j(g(f(T(b(l)))))){constructor(e){if(super(e),this.capabilities=u(!1,!1),this.definitionExpression="",this.displayField="",this.elevationInfo=null,this.geometryType=null,this.geometryFieldName=null,this.graphType=null,this.hasM=!1,this.hasZ=!1,this.labelsVisible=null,this.labelingInfo=null,this.objectIdField=h,this.objectType=null,this.parentCompositeLayer=null,this.popupEnabled=!0,this.popupTemplate=null,this.source={openPorts:()=>this.load().then((()=>{const e=new MessageChannel;return new L(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=Q.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]}))},this.type="knowledge-graph-sublayer","link-chart"===e.parentCompositeLayer.type)"relationship"===e.graphType?this.geometryType="polyline":this.geometryType="point",this.geometryFieldName=c;else if(e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name)?.geometryType&&"esriGeometryNull"!==e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name)?.geometryType){const t=e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name);this.geometryFieldName=t?.name??null,this.geometryType=t?.geometryType?C.fromJSON(t.geometryType):null;const r=t?.name,o=r?e.objectType.properties?.[r]:null;o?(this.hasM=o.hasM??!1,this.hasZ=o.hasZ??!1):(this.hasM=!1,this.hasZ=!1)}else this.geometryType=null;e.objectType.properties?.forEach((e=>{let t=null,r=e.fieldType;"esriFieldTypeOID"===r&&(r="esriFieldTypeInteger"),this.fields.push(S.fromJSON({name:e.name,type:r,alias:e.alias,defaultValue:t,editable:e.editable,nullable:e.nullable}))})),this.fields.push(S.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1})),this._set("fields",[...this.fields]),e.parentCompositeLayer.dataManager.knowledgeGraph.dataModel?.spatialReference&&(this.spatialReference=e.parentCompositeLayer.dataManager.knowledgeGraph.dataModel.spatialReference),"link-chart"===e.parentCompositeLayer.type?"relationship"===e.graphType?this.renderer=r(d(C.toJSON("polyline")).renderer):this.renderer=r(d(C.toJSON("point")).renderer):this.renderer=r(d(C.toJSON(this.geometryType)).renderer)}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){F(e,this.fieldsIndex),this._set("renderer",e)}createPopupTemplate(e){return O(this,e)}createQuery(){return new Q({where:"1=1",outFields:["*"]})}getField(e){for(let t=0;t<this.fields.length;t++)if(this.fields[t].name===e)return this.fields[t];return null}getFieldDomain(e,t){return null}async queryFeatures(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e),s=x.fromJSON(await o.executeQuery(r.toJSON(),t?.signal));return s.features.forEach((e=>{e.sourceLayer=this})),s}async queryFeaturesJSON(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return await o.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return o.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){const r={...e,returnGeometry:!0},{resolvedQuery:o,queryEngine:s}=await this._setupQueryObjects(r),i=await s.executeQueryForExtent(o.toJSON(),t?.signal);let a;return a=null!=i.extent?.xmin&&null!=i.extent?.xmax&&null!=i.extent?.ymin&&null!=i.extent?.ymax?new v(i.extent):new v,{count:i.count,extent:a}}async queryObjectIds(e,t){const r=Q.from(e);let o;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)o=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);o=this.loadQueryEngine(e)}return o.executeQueryForIds(r.toJSON(),t?.signal)}loadQueryEngine(e){const t=new y({geometryType:C.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new m({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:C.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,objectIdField:this.objectIdField,spatialReference:this.spatialReference.toJSON(),timeInfo:null,featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new Q({where:"1=1",outFields:[h]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}async _setupQueryObjects(e,t){const r=Q.from(e),o=r.geometry;let s;if(o&&!o.spatialReference?.isWGS84&&(await a(o.spatialReference,p),r.geometry=n(o instanceof E||o instanceof N?o:o.extent,p)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)s=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);s=this.loadQueryEngine(e)}return{resolvedQuery:r,queryEngine:s}}};e([s()],M.prototype,"capabilities",void 0),e([s({readOnly:!0})],M.prototype,"defaultPopupTemplate",null),e([s()],M.prototype,"definitionExpression",void 0),e([s()],M.prototype,"displayField",void 0),e([s()],M.prototype,"elevationInfo",void 0),e([s()],M.prototype,"geometryType",void 0),e([s()],M.prototype,"geometryFieldName",void 0),e([s()],M.prototype,"graphType",void 0),e([s()],M.prototype,"hasM",void 0),e([s()],M.prototype,"hasZ",void 0),e([s()],M.prototype,"labelsVisible",void 0),e([s()],M.prototype,"labelingInfo",void 0),e([s()],M.prototype,"objectIdField",void 0),e([s()],M.prototype,"objectType",void 0),e([s()],M.prototype,"parentCompositeLayer",void 0),e([s(w)],M.prototype,"popupEnabled",void 0),e([s({type:t,json:{name:"popupInfo",write:!0}})],M.prototype,"popupTemplate",void 0),e([s({types:o,json:{write:{target:"layerDefinition.drawingInfo.renderer"}}})],M.prototype,"renderer",null),e([s()],M.prototype,"source",void 0),e([s({json:{read:!1}})],M.prototype,"type",void 0),M=e([i("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],M);const R=M;export{R as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import{fromJSON as r}from"../../renderers/support/jsonUtils.js";import{rendererTypes as o}from"../../renderers/support/types.js";import"../../core/workers/workers.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{initializeProjection as a,project as n}from"../../geometry/projection.js";import{wgs84 as p}from"../../geometry/support/spatialReferenceUtils.js";import l from"../Layer.js";import y from"../graphics/data/FeatureStore.js";import{QueryEngine as m}from"../graphics/data/QueryEngine.js";import{createCapabilities as u,createDrawingInfo as d}from"../graphics/sources/support/clientSideDefaults.js";import{mockOidFieldName as h,mockLayoutGeometryFieldName as c,mockAggregationCountFieldName as g}from"./KnowledgeGraphLayerDataManager.js";import{KnowledgeGraphSublayerBase as f}from"./KnowledgeGraphSublayerBase.js";import{BlendLayer as j}from"../mixins/BlendLayer.js";import{FeatureReductionLayer as b}from"../mixins/FeatureReductionLayer.js";import{RefreshableLayer as T}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as w}from"../mixins/ScaleRangeLayer.js";import{popupEnabled as S}from"../support/commonProperties.js";import F from"../support/Field.js";import{fixRendererFields as x}from"../support/fieldUtils.js";import O from"../../rest/support/FeatureSet.js";import Q from"../../rest/support/Query.js";import{createPopupTemplate as L}from"../../support/popupUtils.js";import v from"../../core/workers/RemoteClient.js";import E from"../../geometry/Extent.js";import N from"../../geometry/Polygon.js";import C from"../../geometry/Polyline.js";import{featureGeometryTypeKebabDictionary as M}from"../../geometry/support/typeUtils.js";let I=class extends(b(f(j(w(T(l)))))){constructor(e){if(super(e),this.capabilities=u(!1,!1),this.definitionExpression="",this.displayField="",this.elevationInfo=null,this.geometryType=null,this.geometryFieldName=null,this.graphType=null,this.hasM=!1,this.hasZ=!1,this.labelsVisible=null,this.labelingInfo=null,this.objectIdField=h,this.objectType=null,this.parentCompositeLayer=null,this.popupEnabled=!0,this.popupTemplate=null,this.source={openPorts:()=>this.load().then((()=>{const e=new MessageChannel;return new v(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=Q.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]}))},this.type="knowledge-graph-sublayer","link-chart"===e.parentCompositeLayer.type)"relationship"===e.graphType?this.geometryType="polyline":this.geometryType="point",this.geometryFieldName=c;else if(e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name)?.geometryType&&"esriGeometryNull"!==e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name)?.geometryType){const t=e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name);this.geometryFieldName=t?.name??null,this.geometryType=t?.geometryType?M.fromJSON(t.geometryType):null;const r=t?.name,o=r?e.objectType.properties?.[r]:null;o?(this.hasM=o.hasM??!1,this.hasZ=o.hasZ??!1):(this.hasM=!1,this.hasZ=!1)}else this.geometryType=null;e.objectType.properties?.forEach((e=>{let t=null,r=e.fieldType;"esriFieldTypeOID"===r&&(r="esriFieldTypeInteger"),this.fields.push(F.fromJSON({name:e.name,type:r,alias:e.alias,defaultValue:t,editable:e.editable,nullable:e.nullable}))})),this.fields.push(F.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1})),this.fields.push(F.fromJSON({name:g,type:"esriFieldTypeInteger",alias:g,editable:!1})),this._set("fields",[...this.fields]),e.parentCompositeLayer.dataManager.knowledgeGraph.dataModel?.spatialReference&&(this.spatialReference=e.parentCompositeLayer.dataManager.knowledgeGraph.dataModel.spatialReference),"link-chart"===e.parentCompositeLayer.type?"relationship"===e.graphType?this.renderer=r(d(M.toJSON("polyline")).renderer):this.renderer=r(d(M.toJSON("point")).renderer):this.renderer=r(d(M.toJSON(this.geometryType)).renderer)}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){x(e,this.fieldsIndex),this._set("renderer",e)}createPopupTemplate(e){return L(this,e)}createQuery(){return new Q({where:"1=1",outFields:["*"]})}getField(e){for(let t=0;t<this.fields.length;t++)if(this.fields[t].name===e)return this.fields[t];return null}getFieldDomain(e,t){return null}async queryFeatures(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e),s=O.fromJSON(await o.executeQuery(r.toJSON(),t?.signal));return s.features.forEach((e=>{e.sourceLayer=this})),s}async queryFeaturesJSON(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return await o.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return o.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){const r={...e,returnGeometry:!0},{resolvedQuery:o,queryEngine:s}=await this._setupQueryObjects(r),i=await s.executeQueryForExtent(o.toJSON(),t?.signal);let a;return a=null!=i.extent?.xmin&&null!=i.extent?.xmax&&null!=i.extent?.ymin&&null!=i.extent?.ymax?new E(i.extent):new E,{count:i.count,extent:a}}async queryObjectIds(e,t){const r=Q.from(e);let o;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)o=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);o=this.loadQueryEngine(e)}return o.executeQueryForIds(r.toJSON(),t?.signal)}loadQueryEngine(e){const t=new y({geometryType:M.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new m({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:M.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,objectIdField:this.objectIdField,spatialReference:this.spatialReference.toJSON(),timeInfo:null,featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new Q({where:"1=1",outFields:[h]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}async _setupQueryObjects(e,t){const r=Q.from(e),o=r.geometry;let s;if(o&&!o.spatialReference?.isWGS84&&(await a(o.spatialReference,p),r.geometry=n(o instanceof N||o instanceof C?o:o.extent,p)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)s=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);s=this.loadQueryEngine(e)}return{resolvedQuery:r,queryEngine:s}}};e([s()],I.prototype,"capabilities",void 0),e([s({readOnly:!0})],I.prototype,"defaultPopupTemplate",null),e([s()],I.prototype,"definitionExpression",void 0),e([s()],I.prototype,"displayField",void 0),e([s()],I.prototype,"elevationInfo",void 0),e([s()],I.prototype,"geometryType",void 0),e([s()],I.prototype,"geometryFieldName",void 0),e([s()],I.prototype,"graphType",void 0),e([s()],I.prototype,"hasM",void 0),e([s()],I.prototype,"hasZ",void 0),e([s()],I.prototype,"labelsVisible",void 0),e([s()],I.prototype,"labelingInfo",void 0),e([s()],I.prototype,"objectIdField",void 0),e([s()],I.prototype,"objectType",void 0),e([s()],I.prototype,"parentCompositeLayer",void 0),e([s(S)],I.prototype,"popupEnabled",void 0),e([s({type:t,json:{name:"popupInfo",write:!0}})],I.prototype,"popupTemplate",void 0),e([s({types:o,json:{write:{target:"layerDefinition.drawingInfo.renderer"}}})],I.prototype,"renderer",null),e([s()],I.prototype,"source",void 0),e([s({json:{read:!1}})],I.prototype,"type",void 0),I=e([i("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],I);const R=I;export{R as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import r from"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import"../../core/Logger.js";import{watch as s,sync as t}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import o from"../support/AggregateField.js";import{featureReductionProperty as a}from"../support/featureReductionUtils.js";import u from"../../renderers/visualVariables/SizeVariable.js";import l from"../../renderers/visualVariables/support/SizeStop.js";import{createInferredClusterRenderer as d}from"../../views/2d/layers/support/clusterUtils.js";const c=c=>{let p=class extends c{constructor(...e){super(...e),this.addHandles(s((()=>this.renderer),(()=>{if(this.featureReduction){const e=this._normalizeFeatureReduction(this.featureReduction);this._set("featureReduction",e)}}),t))}set featureReduction(e){const r=this._normalizeFeatureReduction(e);this._set("featureReduction",r)}set renderer(e){}_withClusterVariable(e,r,s){const t=e.clone();if("visualVariables"in t){t.visualVariables||(t.visualVariables=[]);t.visualVariables.some((e=>"size"===e.type))||t.visualVariables.push(new u({field:"cluster_count",stops:[new l({value:1}),new l({useMinValue:!0,size:r}),new l({useMaxValue:!0,size:s})]}))}return t}_normalizeFeatureReduction(e){if("cluster"!==e?.type)return e;const s=e.clone(),t=[new o({name:"cluster_count",isAutoGenerated:!0,statisticType:"count"})],i=(s.fields??[]).filter((e=>!e.isAutoGenerated)),n=e.renderer&&!e.renderer.authoringInfo?.isAutoGenerated,{clusterMinSize:a,clusterMaxSize:u}=s;if(n){s.fields=[...t,...i];const e=this._withClusterVariable(s.renderer,a,u);return s.effectiveFeatureRenderer=e,s.effectiveClusterRenderer=e,s}if(e.symbol){if(s.fields=[...t,...i],s.renderer=null,!this.renderer)return s.effectiveFeatureRenderer=null,s.effectiveClusterRenderer=null,s;const n=d(t,this.renderer),o=this._withClusterVariable(n,a,u),l="visualVariables"in o&&o.visualVariables?o.visualVariables:[],c=new r({symbol:e.symbol,visualVariables:l});return s.effectiveFeatureRenderer=o,s.effectiveClusterRenderer=c,s}if(!this.renderer)return e;const l=d(t,this.renderer);s.fields=[...t,...i],s.renderer=l;const c=this._withClusterVariable(l,a,u);return s.effectiveFeatureRenderer=c,s.effectiveClusterRenderer=c,s}};return e([i(a)],p.prototype,"featureReduction",null),p=e([n("esri.layers.mixins.FeatureReductionLayer")],p),p};export{c as FeatureReductionLayer};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import r from"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import"../../core/Logger.js";import{watch as s,sync as t}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import o from"../support/AggregateField.js";import{featureReductionProperty as a}from"../support/featureReductionUtils.js";import u from"../../renderers/visualVariables/SizeVariable.js";import l from"../../renderers/visualVariables/support/SizeStop.js";import{createInferredClusterRenderer as d}from"../../views/2d/layers/support/clusterUtils.js";const c=c=>{let p=class extends c{constructor(...e){super(...e),this.addHandles(s((()=>this.renderer),(()=>{if(this.featureReduction){const e=this._normalizeFeatureReduction(this.featureReduction);this._set("featureReduction",e)}}),t))}set featureReduction(e){const r=this._normalizeFeatureReduction(e);this._set("featureReduction",r)}set renderer(e){}_withClusterVariable(e,r,s){const t=e.clone();if("visualVariables"in t){t.visualVariables||(t.visualVariables=[]);t.visualVariables.some((e=>"size"===e.type))||t.visualVariables.push(new u({field:"cluster_count",stops:[new l({value:1}),new l({useMinValue:!0,size:r}),new l({useMaxValue:!0,size:s})]}))}return t}_normalizeFeatureReduction(e){if("cluster"!==e?.type)return e;const s=e.clone(),t=[new o({name:"cluster_count",isAutoGenerated:!0,statisticType:"count"})],i=(s.fields??[]).filter((e=>!e.isAutoGenerated)),n=e.renderer&&!e.renderer.authoringInfo?.isAutoGenerated,{clusterMinSize:a,clusterMaxSize:u}=s;if(n){s.fields=[...t,...i];const e=this._withClusterVariable(s.renderer,a,u);return s.effectiveFeatureRenderer=e,s.effectiveClusterRenderer=e,s}if(e.symbol){if(s.fields=[...t,...i],s.renderer=null,!this.renderer)return s.effectiveFeatureRenderer=null,s.effectiveClusterRenderer=null,s;const n=d(t,this.renderer),o=this._withClusterVariable(n,a,u),l="visualVariables"in o&&o.visualVariables?o.visualVariables:[],c=new r({symbol:e.symbol,visualVariables:l});return s.fields=[...t,...i],s.effectiveFeatureRenderer=o,s.effectiveClusterRenderer=c,s}if(!this.renderer)return e;const l=d(t,this.renderer);s.fields=[...t,...i],s.renderer=l;const c=this._withClusterVariable(l,a,u);return s.effectiveFeatureRenderer=c,s.effectiveClusterRenderer=c,s}};return e([i(a)],p.prototype,"featureReduction",null),p=e([n("esri.layers.mixins.FeatureReductionLayer")],p),p};export{c as FeatureReductionLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import{getHeightModel as i,getVerticalUnit as s,getHorizontalUnit as n}from"../constants/utils.js";let p=class extends t{constructor(){super(...arguments),this.verticalWKID=null}get isAdvanced(){const{affineTransformations:o,focalLength:t,principalOffsetPoint:r,radialDistortionCoefficients:e,tangentialDistortionCoefficients:i}=this;return o?.length>1&&!Number.isNaN(t)&&r?.length>1&&e?.length>1&&i?.length>1}getInfo(){const{horizontalWKID:o,verticalWKID:t}=this;let r=o,e=t;const p=this;if(4===p.type){const{properties:o}=p;r=4326,e=o.verticalWKID}return{heightModel:i(e,r),heightUnit:s(e,r),horizontalUnit:n(r)}}};o([r({json:{write:!0}})],p.prototype,"affineTransformations",void 0),o([r({json:{write:!0}})],p.prototype,"focalLength",void 0),o([r({json:{write:!0}})],p.prototype,"principalOffsetPoint",void 0),o([r({json:{write:!0}})],p.prototype,"radialDistortionCoefficients",void 0),o([r({json:{write:!0}})],p.prototype,"tangentialDistortionCoefficients",void 0),o([r({json:{write:!0}})],p.prototype,"horizontalWKID",void 0),o([r({json:{write:!0}})],p.prototype,"verticalWKID",void 0),o([r({json:{write:!0}})],p.prototype,"x",void 0),o([r({json:{write:!0}})],p.prototype,"y",void 0),o([r({json:{write:!0}})],p.prototype,"z",void 0),o([r({json:{write:!0}})],p.prototype,"type",void 0),p=o([e("esri.layers.orientedImagery.core.CameraOrientation")],p);const a=p;export{a as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import o from"../../../core/Accessor.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{getHeightModel as i,getVerticalUnit as s,getHorizontalUnit as n}from"../constants/utils.js";let p=class extends o{constructor(){super(...arguments),this.verticalWKID=null}get isAdvanced(){const{affineTransformations:t,focalLength:o,principalOffsetPoint:e,radialDistortionCoefficients:r,tangentialDistortionCoefficients:i}=this;return t?.length>1&&!Number.isNaN(o)&&e?.length>1&&r?.length>1&&i?.length>1}get unitAndHeightInfo(){const{horizontalWKID:t,verticalWKID:o}=this;let e=t,r=o;const p=this;if(4===p.type){const{properties:t}=p;e=4326,r=t.verticalWKID}return{heightModel:i(r,e),heightUnit:s(r,e),horizontalUnit:n(e)}}};t([e({json:{write:!0}})],p.prototype,"affineTransformations",void 0),t([e({json:{write:!0}})],p.prototype,"focalLength",void 0),t([e({json:{write:!0}})],p.prototype,"principalOffsetPoint",void 0),t([e({json:{write:!0}})],p.prototype,"radialDistortionCoefficients",void 0),t([e({json:{write:!0}})],p.prototype,"tangentialDistortionCoefficients",void 0),t([e({json:{write:!0}})],p.prototype,"horizontalWKID",void 0),t([e({json:{write:!0}})],p.prototype,"verticalWKID",void 0),t([e({json:{write:!0}})],p.prototype,"x",void 0),t([e({json:{write:!0}})],p.prototype,"y",void 0),t([e({json:{write:!0}})],p.prototype,"z",void 0),t([e({json:{write:!0}})],p.prototype,"type",void 0),t([e({readOnly:!0})],p.prototype,"unitAndHeightInfo",null),p=t([r("esri.layers.orientedImagery.core.CameraOrientation")],p);const a=p;export{a as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import o from"../../../core/Error.js";import{JSONSupport as r}from"../../../core/JSONSupport.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{fetchArcGISServiceJSON as i}from"../../../support/requestPresets.js";let n=class extends r{constructor(){super(...arguments),this.url=null}};e([t({type:Number,json:{write:!0}})],n.prototype,"lod",void 0),e([t({type:String,json:{write:!0}})],n.prototype,"rasterFunction",void 0),e([t({type:String,json:{write:!0}})],n.prototype,"url",void 0),n=e([s("esri.layers.orientedImagery.core.ElevationSourceDefinitions.ElevationSource")],n);let p=class extends r{};e([t({type:Number,json:{write:!0}})],p.prototype,"constantElevation",void 0),p=e([s("esri.layers.orientedImagery.cor.ElevationSourceDefinitions.ConstantElevation")],p);const a=e=>"constantElevation"in e;async function c(e){const r=await i(e),{tileInfo:t,cacheType:s}=r;return r.hasOwnProperty("bandCount")&&r.hasOwnProperty("pixelSizeX")?"LERC"!==t?.format?.toUpperCase()||s&&"elevation"!==s.toLowerCase()?{isSupported:!0,isDynamic:!0}:{isSupported:!0}:{isSupported:!1,error:new o("elevation-source:invalid-service-url",`ElevationSource URL expects an elevation 3D image service but given ${e}`)}}export{p as ConstantElevation,n as ElevationSource,a as isConstantElevation,c as validateElevationSourceURL};
5
+ import{_ as o}from"../../../chunks/tslib.es6.js";import e from"../../../core/Error.js";import{JSONSupport as r}from"../../../core/JSONSupport.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{fetchArcGISServiceJSON as n}from"../../../support/requestPresets.js";let i=class extends r{constructor(){super(...arguments),this.url=null}};o([t({type:Number,json:{write:!0}})],i.prototype,"lod",void 0),o([t({type:String,json:{write:!0}})],i.prototype,"rasterFunction",void 0),o([t({type:String,json:{write:!0}})],i.prototype,"url",void 0),i=o([s("esri.layers.orientedImagery.core.ElevationSourceDefinitions.ElevationSource")],i);let p=class extends r{constructor(){super(...arguments),this.constantElevation=null}};o([t({type:Number,json:{write:!0}})],p.prototype,"constantElevation",void 0),p=o([s("esri.layers.orientedImagery.cor.ElevationSourceDefinitions.ConstantElevation")],p);const a=o=>null!=o&&"constantElevation"in o&&"number"==typeof o.constantElevation,c=o=>null!=o&&"url"in o&&!!o.url;async function l(o){const r=await n(o),{tileInfo:t,cacheType:s}=r;return r.hasOwnProperty("bandCount")&&r.hasOwnProperty("pixelSizeX")?"LERC"!==t?.format?.toUpperCase()||s&&"elevation"!==s.toLowerCase()?{isSupported:!0,isDynamic:!0}:{isSupported:!0}:{isSupported:!1,error:new e("elevation-source:invalid-service-url",`ElevationSource URL expects an elevation 3D image service but given ${o}`)}}export{p as ConstantElevation,i as ElevationSource,a as isConstantElevation,c as isElevationSource,l as validateElevationSourceURL};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import"../../../geometry.js";import{zeros as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{y as t,g as a}from"../../../chunks/vec32.js";import r from"../../../geometry/Circle.js";import n from"../../../geometry/Mesh.js";import{earth as i}from"../../../geometry/support/Ellipsoid.js";import{MeshVertexAttributes as s}from"../../../geometry/support/MeshVertexAttributes.js";import{isWebMercator as c}from"../../../geometry/support/spatialReferenceUtils.js";import{calculateRotationMatrix as o,transformMat3 as f,scaleAndAddWithFactor as l,scaleWithFactor as h}from"../transformations/utils.js";import m from"../../../geometry/Polygon.js";import y from"../../../geometry/SpatialReference.js";const g=Math.PI/180;function p(s){const{attributes:y}=s,{horizontalFieldOfView:p,geometry:u,verticalFieldOfView:x}=y;let R,H=1,w=null;if(u&&c(u?.spatialReference)&&(H=1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*u.y/i.radius)))),y.isSpherical){if(R=new r({center:u,radius:y.farDistance*H}),y.nearDistance){const e=new r({center:u,radius:y.nearDistance*H});R.addRing(e.rings[0])}const e=R.center;e&&(e.z=y.cameraHeight,w=n.createSphere(e,{size:2*y.farDistance}),w.centerAt(e))}else{let r=y.cameraPitch,n=y.cameraRoll,i=150;const c=[];p>150&&(r=90,n=0,i=5);const D=Math.ceil(p/i);if(D%2==0)for(let e=0;e<D/2;e++)c.push(y.cameraHeading-p/D*(e+.5),y.cameraHeading+p/D*(e+.5));else{c.push(y.cameraHeading);for(let e=1;e<D/2;e++)c.push(y.cameraHeading-p/D*e,y.cameraHeading+p/D*e)}c.sort();let j=y.farDistance?y.farDistance*H:y.cameraHeight*H/Math.cos(r*g);y.cameraPitch+x/2>=90&&(j=(y.farDistance||20)*H),R=new m({spatialReference:u?.spatialReference});for(const m of c){const i=o("HPR",[m,r,n]);w=M(s,i);const c=f([0,0,-1],i),{x:P,y:z}=u,F=l([P,z,y.cameraHeight],c,j,H),O=2*Math.tan(x*g/2)*j,V=2*Math.tan(p/D*g/2)*j,b=f([0,1,0],i),v=f([1,0,0],i),q=h(b,O/2,H),A=h(v,V/2,H),C=t(e(),q,A),S=a(e(),q,A),I=[a(e(),F,C),a(e(),F,S),t(e(),F,C),t(e(),F,S)].map((e=>d(e,y.cameraHeight,u,H)));I.push(I[0]),R.addRing(I)}}return{polygon:R,frustum:w}}function u(e,t){return e.contains(t)}function x(e,t){return Math.sign(e)!==Math.sign(t)}function M(r,i,c){const o=r.attributes,m=o.geometry,p=m.spatialReference??r.spatialReference;m.spatialReference=p instanceof y?p:y.fromJSON(p);const u=H(m),x=o.nearDistance<0?0:o.nearDistance*u;let M=o.cameraHeight*u/Math.cos(o.cameraPitch*g),d=!0;o.cameraPitch+o.verticalFieldOfView/2>=90&&(M=(o.farDistance??20)*u,d=!1);const R=2*Math.tan(o.verticalFieldOfView*g/2)*x,w=2*Math.tan(o.horizontalFieldOfView*g/2)*x,D=2*Math.tan(o.verticalFieldOfView*g/2)*M,j=2*Math.tan(o.horizontalFieldOfView*g/2)*M;let P,z;c?(P=c,z=h(t(e(),P,[m.x,m.y,o.cameraHeight]),1/M,1/u)):(z=[0,0,-1],z=f(z,i),P=l([m.x,m.y,o.cameraHeight],z,M,u),d&&(P[2]=0));const F=l([m.x,m.y,o.cameraHeight],z,x,u);let O=[0,1,0];O=f(O,i);let V=[1,0,0];V=f(V,i);let b=[],v=[];x?(v=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],b=b.concat(a(e(),F,t(e(),h(O,R/2,u),h(V,w/2,u)))),b=b.concat(a(e(),F,a(e(),h(O,R/2,u),h(V,w/2,u)))),b=b.concat(t(e(),F,t(e(),h(O,R/2,u),h(V,w/2,u)))),b=b.concat(t(e(),F,a(e(),h(O,R/2,u),h(V,w/2,u))))):(b=[m.x,m.y,o.cameraHeight],v=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),b=b.concat(a(e(),P,t(e(),h(O,D/2,u),h(V,j/2,u)))),b=b.concat(a(e(),P,a(e(),h(O,D/2,u),h(V,j/2,u)))),b=b.concat(t(e(),P,t(e(),h(O,D/2,u),h(V,j/2,u)))),b=b.concat(t(e(),P,a(e(),h(O,D/2,u),h(V,j/2,u))));const q=new s({position:Float64Array.from(b)});return new n({vertexAttributes:q,components:v,spatialReference:m.spatialReference})}function d(a,r,n,i){{const s=Math.sqrt((a[2]-r)**2+(Math.sqrt((a[0]-n.x)**2+(a[1]-n.y)**2)/i)**2)*i,c=h(t(e(),[a[0],a[1],a[2]],[n.x,n.y,r]),1/s,1/i),o=r/(r-a[2]),f={x:(1-o)*n.x+o*a[0],y:(1-o)*n.y+o*a[1],z:(1-o)*r+o*a[2]},l=Math.sqrt((f.z-r)**2+(Math.sqrt((f.x-n.x)**2+(f.y-n.y)**2)/i)**2)*i,m=h(t(e(),[f.x,f.y,f.z],[n.x,n.y,r]),1/l,1/i);return x(c[0],m[0])&&x(c[1],m[1])&&x(c[2],m[2])||a[2]>=0?[a[0],a[1],0]:[f.x,f.y,f.z]}}function R(e){const{spatialReference:t,x:a,y:r}=e.geometry,{cameraHeading:n,cameraPitch:i,farDistance:s,nearDistance:c}=e,o=H(e.geometry),f=new m({spatialReference:t}),l=Math.abs(1.44*s*o);let h=Math.abs(1.44*c*o);(i<20||null==n)&&(h=l);const y=[];return y[0]={x:a+l*Math.sin((n-45)*g),y:r+l*Math.cos((n-45)*g)},y[1]={x:a+l*Math.sin((n+45)*g),y:r+l*Math.cos((n+45)*g)},y[2]={x:a+h*Math.sin((n+135)*g),y:r+h*Math.cos((n+135)*g)},y[3]={x:a+h*Math.sin((n+225)*g),y:r+h*Math.cos((n+225)*g)},f.addRing([[y[0].x,y[0].y,0],[y[1].x,y[1].y,0],[y[2].x,y[2].y,0],[y[3].x,y[3].y,0],[y[0].x,y[0].y,0]]),f}function H(e){return e&&c(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/i.radius))):1}function w(a,n){const i=1+n/100;if("esri.geometry.Circle"===a.declaredClass){const{radius:e,center:t}=a,n=new r({radius:e*i,center:t});return a.rings.length>1&&n.addRing(a.rings[1]),n}if("esri.geometry.Polygon"===a.declaredClass){const r=new m({spatialReference:a.spatialReference}),n=a.centroid;if(n){const s=[];for(let r=0;r<a.rings[0].length;r++){const c=Math.sqrt((n.x-a.rings[0][r][0])**2+(n.y-a.rings[0][r][1])**2),o=h(t(e(),[a.rings[0][r][0],a.rings[0][r][1],0],[n.x,n.y,0]),1/c,1),f=l([n.x,n.y,0],o,c*i,1);s.push({x:f[0],y:f[1]})}r.addRing([[s[0].x,s[0].y,0],[s[1].x,s[1].y,0],[s[2].x,s[2].y,0],[s[3].x,s[3].y,0],[s[0].x,s[0].y,0]])}return r}return a}export{u as checkIfPolygonContainsSelectedPoint,R as computePolygonForInspection,p as createCoveragePolygon,w as resizePolygon};
5
+ import"../../../geometry.js";import{zeros as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{z as t,g as a}from"../../../chunks/vec32.js";import r from"../../../geometry/Circle.js";import n from"../../../geometry/Mesh.js";import{earth as i}from"../../../geometry/support/Ellipsoid.js";import{MeshVertexAttributes as s}from"../../../geometry/support/MeshVertexAttributes.js";import{isWebMercator as c}from"../../../geometry/support/spatialReferenceUtils.js";import{calculateRotationMatrix as o,transformMat3 as f,scaleAndAddWithFactor as l,scaleWithFactor as h}from"../transformations/utils.js";import m from"../../../geometry/Polygon.js";import y from"../../../geometry/SpatialReference.js";const g=Math.PI/180;function p(s){const{attributes:y}=s,{horizontalFieldOfView:p,geometry:u,verticalFieldOfView:x}=y;let R,H=1,w=null;if(u&&c(u?.spatialReference)&&(H=1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*u.y/i.radius)))),y.isSpherical){if(R=new r({center:u,radius:y.farDistance*H}),y.nearDistance){const e=new r({center:u,radius:y.nearDistance*H});R.addRing(e.rings[0])}const e=R.center;e&&(e.z=y.cameraHeight,w=n.createSphere(e,{size:2*y.farDistance}),w.centerAt(e))}else{let r=y.cameraPitch,n=y.cameraRoll,i=150;const c=[];p>150&&(r=90,n=0,i=5);const D=Math.ceil(p/i);if(D%2==0)for(let e=0;e<D/2;e++)c.push(y.cameraHeading-p/D*(e+.5),y.cameraHeading+p/D*(e+.5));else{c.push(y.cameraHeading);for(let e=1;e<D/2;e++)c.push(y.cameraHeading-p/D*e,y.cameraHeading+p/D*e)}c.sort();let j=y.farDistance?y.farDistance*H:y.cameraHeight*H/Math.cos(r*g);y.cameraPitch+x/2>=90&&(j=(y.farDistance||20)*H),R=new m({spatialReference:u?.spatialReference});for(const m of c){const i=o("HPR",[m,r,n]);w=M(s,i);const c=f([0,0,-1],i),{x:P,y:z}=u,F=l([P,z,y.cameraHeight],c,j,H),O=2*Math.tan(x*g/2)*j,V=2*Math.tan(p/D*g/2)*j,b=f([0,1,0],i),v=f([1,0,0],i),q=h(b,O/2,H),A=h(v,V/2,H),C=t(e(),q,A),S=a(e(),q,A),I=[a(e(),F,C),a(e(),F,S),t(e(),F,C),t(e(),F,S)].map((e=>d(e,y.cameraHeight,u,H)));I.push(I[0]),R.addRing(I)}}return{polygon:R,frustum:w}}function u(e,t){return e.contains(t)}function x(e,t){return Math.sign(e)!==Math.sign(t)}function M(r,i,c){const o=r.attributes,m=o.geometry,p=m.spatialReference??r.spatialReference;m.spatialReference=p instanceof y?p:y.fromJSON(p);const u=H(m),x=o.nearDistance<0?0:o.nearDistance*u;let M=o.cameraHeight*u/Math.cos(o.cameraPitch*g),d=!0;o.cameraPitch+o.verticalFieldOfView/2>=90&&(M=(o.farDistance??20)*u,d=!1);const R=2*Math.tan(o.verticalFieldOfView*g/2)*x,w=2*Math.tan(o.horizontalFieldOfView*g/2)*x,D=2*Math.tan(o.verticalFieldOfView*g/2)*M,j=2*Math.tan(o.horizontalFieldOfView*g/2)*M;let P,z;c?(P=c,z=h(t(e(),P,[m.x,m.y,o.cameraHeight]),1/M,1/u)):(z=[0,0,-1],z=f(z,i),P=l([m.x,m.y,o.cameraHeight],z,M,u),d&&(P[2]=0));const F=l([m.x,m.y,o.cameraHeight],z,x,u);let O=[0,1,0];O=f(O,i);let V=[1,0,0];V=f(V,i);let b=[],v=[];x?(v=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],b=b.concat(a(e(),F,t(e(),h(O,R/2,u),h(V,w/2,u)))),b=b.concat(a(e(),F,a(e(),h(O,R/2,u),h(V,w/2,u)))),b=b.concat(t(e(),F,t(e(),h(O,R/2,u),h(V,w/2,u)))),b=b.concat(t(e(),F,a(e(),h(O,R/2,u),h(V,w/2,u))))):(b=[m.x,m.y,o.cameraHeight],v=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),b=b.concat(a(e(),P,t(e(),h(O,D/2,u),h(V,j/2,u)))),b=b.concat(a(e(),P,a(e(),h(O,D/2,u),h(V,j/2,u)))),b=b.concat(t(e(),P,t(e(),h(O,D/2,u),h(V,j/2,u)))),b=b.concat(t(e(),P,a(e(),h(O,D/2,u),h(V,j/2,u))));const q=new s({position:Float64Array.from(b)});return new n({vertexAttributes:q,components:v,spatialReference:m.spatialReference})}function d(a,r,n,i){{const s=Math.sqrt((a[2]-r)**2+(Math.sqrt((a[0]-n.x)**2+(a[1]-n.y)**2)/i)**2)*i,c=h(t(e(),[a[0],a[1],a[2]],[n.x,n.y,r]),1/s,1/i),o=r/(r-a[2]),f={x:(1-o)*n.x+o*a[0],y:(1-o)*n.y+o*a[1],z:(1-o)*r+o*a[2]},l=Math.sqrt((f.z-r)**2+(Math.sqrt((f.x-n.x)**2+(f.y-n.y)**2)/i)**2)*i,m=h(t(e(),[f.x,f.y,f.z],[n.x,n.y,r]),1/l,1/i);return x(c[0],m[0])&&x(c[1],m[1])&&x(c[2],m[2])||a[2]>=0?[a[0],a[1],0]:[f.x,f.y,f.z]}}function R(e){const{spatialReference:t,x:a,y:r}=e.geometry,{cameraHeading:n,cameraPitch:i,farDistance:s,nearDistance:c}=e,o=H(e.geometry),f=new m({spatialReference:t}),l=Math.abs(1.44*s*o);let h=Math.abs(1.44*c*o);(i<20||null==n)&&(h=l);const y=[];return y[0]={x:a+l*Math.sin((n-45)*g),y:r+l*Math.cos((n-45)*g)},y[1]={x:a+l*Math.sin((n+45)*g),y:r+l*Math.cos((n+45)*g)},y[2]={x:a+h*Math.sin((n+135)*g),y:r+h*Math.cos((n+135)*g)},y[3]={x:a+h*Math.sin((n+225)*g),y:r+h*Math.cos((n+225)*g)},f.addRing([[y[0].x,y[0].y,0],[y[1].x,y[1].y,0],[y[2].x,y[2].y,0],[y[3].x,y[3].y,0],[y[0].x,y[0].y,0]]),f}function H(e){return e&&c(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/i.radius))):1}function w(a,n){const i=1+n/100;if("esri.geometry.Circle"===a.declaredClass){const{radius:e,center:t}=a,n=new r({radius:e*i,center:t});return a.rings.length>1&&n.addRing(a.rings[1]),n}if("esri.geometry.Polygon"===a.declaredClass){const r=new m({spatialReference:a.spatialReference}),n=a.centroid;if(n){const s=[];for(let r=0;r<a.rings[0].length;r++){const c=Math.sqrt((n.x-a.rings[0][r][0])**2+(n.y-a.rings[0][r][1])**2),o=h(t(e(),[a.rings[0][r][0],a.rings[0][r][1],0],[n.x,n.y,0]),1/c,1),f=l([n.x,n.y,0],o,c*i,1);s.push({x:f[0],y:f[1]})}r.addRing([[s[0].x,s[0].y,0],[s[1].x,s[1].y,0],[s[2].x,s[2].y,0],[s[3].x,s[3].y,0],[s[0].x,s[0].y,0]])}return r}return a}export{u as checkIfPolygonContainsSelectedPoint,R as computePolygonForInspection,p as createCoveragePolygon,w as resizePolygon};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import"../../../geometry.js";import{deg2rad as e}from"../../../core/mathUtils.js";import{zeros as t,create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{y as r,g as i}from"../../../chunks/vec32.js";import n from"../../../geometry/Point.js";import{initializeProjection as s,project as o}from"../../../geometry/projection.js";import{fromPoints as c,fromValues as f}from"../../../geometry/support/ray.js";import{b as y,h as l}from"../../../chunks/sphere.js";import{geographicToWebMercator as x,webMercatorToGeographic as p}from"../../../geometry/support/webMercatorUtils.js";import{createCoveragePolygon as z}from"../core/coverageUtils.js";import m from"../core/ExposurePoint.js";import{transformPoints as u,updateElevation as h}from"./groundToImageUtils.js";import{getWebMercatorScalingFactor as w,convertPixelToHeadingPitch as R,convertHeadingPitchToSphereVertex as g,scaleAndAddWithFactor as b,ltpToGeographic as d,computeHFOVAndVFOV as P,projectiveTransform2 as M,scaleWithFactor as j,calculateRotationMatrix as O,transformMat3 as v,projectiveTransform as H,getPlaneLineIntersectionPoint as S}from"./utils.js";import{defaultImageSphereCenter as E}from"../../../widgets/PanoramicViewer/constants.js";import{isNumber as V}from"../../../widgets/support/dataUtils.js";import F from"../../../geometry/SpatialReference.js";import U from"../../../geometry/Polygon.js";function k(e,t){if(!e)return Promise.resolve([]);const a=t.feature;let r=a.attributes;return r instanceof m||(r=m.fromJSON(a),r&&(a.attributes=r)),D(e,t)}function D(e,t){const{attributes:a}=t.feature;if(a.isSpherical||360===a.horizontalFieldOfView){const{location:r,cameraOrientation:i,farDistance:n,cameraHeading:s,cameraHeight:o}=a;return G(e,r,n,[t.imageProperties.width,t.imageProperties.height],s,o,i)}return W(e,t)}async function G(e,t,r,i,s,o,p){let z=new n(t);const m=w(z);z.spatialReference.isGeographic&&z.spatialReference.isWGS84&&4!==p?.type&&(z=x(z));const u=new Array,[h,d,P]=z.toArray(),M=y([h,d,P??0],r/m),j=E.toArray();for(const y of e){let e,t;if(V(y.heading)&&V(y.pitch))e=y.heading,t=y.pitch;else{const a=R({x:y.x,y:y.y},i[0],i[1]);e=a.heading,t=a.pitch}e=(e+s)%360;const r=c([j[0],j[1],j[2]],g(e,t)),x=f([h,d,P??0],r.direction),p=a();l(M,x,p);const w=(z.z??0)-o;if(p[2]<w){const e=Math.abs((z.z-w)/-r.direction[2])*m;b([z.x,z.y,z.z],r.direction,e,m,p)}else p[2]=w;u.push(new n(p,z.spatialReference))}return u}async function W(e,t){const{feature:a}=t,{attributes:r}=a;let i=new n(r.location);if(4===r.cameraOrientation?.type){const e=r.cameraOrientation;i=new n(d(i,[e.latitude,e.longitude,e.ellipsoidRadius,e.squaredEccentricity]))}let c=!1;i.spatialReference.isWGS84&&(c=!0,i=x(i));const f=i.spatialReference.isWebMercator?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*i.y/6378137))):1,y=A(t,i,f),l=4===r.cameraOrientation?.type?y.map((e=>p(new n(e)))):y,z=await u(l,t,!0),m=await Promise.all(z);m.forEach((e=>{e.z=1}));const w=P(r.horizontalFieldOfView,r.verticalFieldOfView,r.cameraRoll??0).vfov;return Promise.all(e.map((async e=>{e.z=1;let a,y=M(e,m,l);if(a=4===r.cameraOrientation?.type?(await u([p(new n({...y,spatialReference:i.spatialReference}))],t,!0))[0]:(await u([new n({...y,spatialReference:i.spatialReference})],t,!0))[0],!a)return null;let x,z=Math.abs(e.x-a.x)+Math.abs(e.y-a.y);if(z>1){const r=await N(e,a,m,l,i,y,t);y=r.point,z=r.error}if(r.elevationSource){await s(i.spatialReference,t.footprintExtent.spatialReference,null,t.options);let a=await I(t);if(a?.extent){let s=Z(a,i,y);if(!s)return null;const l={x:s.x,y:s.y,z:s.z,hasZ:!0,spatialReference:i.spatialReference},z=new n(l);if(s){const l=o(z,t.footprintExtent.spatialReference),m=h([l],t,!1);let R;R=m instanceof Promise?await m:m,z.z=s.z=R[0].z;const g=await u([4===r.cameraOrientation?.type?p(z):z],t);if(!g[0])return null;let b=Math.abs(e.x-g[0].x)+Math.abs(e.y-g[0].y);if(x=s.z,b>1){let l=0;const z=async m=>{if(b>1){const R=m.width/10,g=m.height/10;if(!m||R<1||g<1)return y=q(y,i,f,x,r.cameraPitch,w,c),y;const d=[{x:s.x-R,y:s.y-g,spatialReference:i.spatialReference},{x:s.x+R,y:s.y-g,spatialReference:i.spatialReference},{x:s.x+R,y:s.y+g,spatialReference:i.spatialReference},{x:s.x-R,y:s.y+g,spatialReference:i.spatialReference}].map((e=>new n(e))),P=await h(d,t,!1);if(a=new U({rings:[[[P[0].x,P[0].y,P[0].z],[P[1].x,P[1].y,P[1].z],[P[2].x,P[2].y,P[2].z],[P[3].x,P[3].y,P[3].z],[P[0].x,P[0].y,P[0].z]]],spatialReference:i.spatialReference}),s=Z(a,i,y),s){const m=o(new n({x:s.x,y:s.y,z:s.z,spatialReference:i.spatialReference}),t.footprintExtent.spatialReference),h=await u([4===r.cameraOrientation?.type?p(m):m],t);if(h[0])return b=Math.abs(e.x-h[0].x)+Math.abs(e.y-h[0].y),x=s.z,b<=1||8===l?q(y,i,f,x,r.cameraPitch,w,c):(l+=1,z(a.extent))}return q(y,i,f,i.z-r.cameraHeight,r.cameraPitch,w,c)}return q(y,i,f,i.z-r.cameraHeight,r.cameraPitch,w,c)};return z(a.extent)}return q(y,i,f,i.z-r.cameraHeight,r.cameraPitch,w,c)}return q(y,i,f,i.z-r.cameraHeight,r.cameraPitch,w,c)}}return q(y,i,f,i.z-r.cameraHeight,r.cameraPitch,w,c)})))}function q(e,a,i,s,o,c,f){const y=Math.sqrt((e.z-a.z)**2+(Math.sqrt((e.x-a.x)**2+(e.y-a.y)**2)/i)**2)*i,l=j(r(t(),[e.x,e.y,e.z],[a.x,a.y,a.z]),1/y,1/i);if(e.z<s||o+c/2<90){const t=Math.abs((a.z-s)/-l[2])*i,r=b([a.x,a.y,a.z],l,t,i);e={x:r[0],y:r[1],z:r[2]}}else e.z=s;return e.spatialReference=a.spatialReference,e=new n(e),f&&(e=p(e)),e}function A(a,s,o){const{feature:c}=a,{attributes:f}=c,y=2*Math.tan(e(f.verticalFieldOfView)/2)*f.farDistance*o,l=2*Math.tan(e(f.horizontalFieldOfView)/2)*f.farDistance*o,x=O("HPR",[f.cameraHeading,f.cameraPitch,f.cameraRoll??0]),p=v([0,0,-1],x),z=b([s.x,s.y,s.z],p,f.farDistance*o,o),m=v([0,1,0],x),u=v([1,0,0],x),h=j(m,y/2,o),w=j(u,l/2,o),R=r(t(),h,w),g=i(t(),h,w);return[i(t(),z,R),i(t(),z,g),r(t(),z,R),r(t(),z,g)].map((e=>{const[t,a,r]=e;return new n({x:t,y:a,z:r,spatialReference:s.spatialReference})}))}function I(e){const{feature:t}=e,{polygon:a}=z(e.feature);if(!a.extent)return Promise.resolve(null);const r=J(a.extent),i=t.attributes.location.spatialReference.isWGS84?new F({wkid:102100}):t.attributes.location.spatialReference;return h(r,e,!1).then((e=>{const t=e.map((e=>o(e,i)));return new U({hasZ:!0,rings:[t.map((e=>[e.x,e.y,e.z]))],spatialReference:i})}))}function J(e){const{xmin:t,xmax:a,ymin:r,ymax:i,spatialReference:s}=e;return[new n({x:t,y:i,spatialReference:s}),new n({x:a,y:i,spatialReference:s}),new n({x:a,y:r,spatialReference:s}),new n({x:t,y:r,spatialReference:s})]}async function N(e,t,a,r,i,s,o){const{feature:{attributes:c}}=o;let f=Math.abs(e.x-t.x)+Math.abs(e.y-t.y);if(f>1)for(let y=0;y<9;y++)if(f>1){let t,l={x:e.x-f,y:e.y-f,z:1},x={x:e.x+f,y:e.y-f,z:1},z={x:e.x+f,y:e.y+f,z:1},m={x:e.x-f,y:e.y+f,z:1};l=H(l,a[0],a[1],a[2],a[3],{x:r[0].x,y:r[0].y,z:r[0].z},{x:r[1].x,y:r[1].y,z:r[1].z},{x:r[2].x,y:r[2].y,z:r[2].z},{x:r[3].x,y:r[3].y,z:r[3].z}),x=H(x,a[0],a[1],a[2],a[3],{x:r[0].x,y:r[0].y,z:r[0].z},{x:r[1].x,y:r[1].y,z:r[1].z},{x:r[2].x,y:r[2].y,z:r[2].z},{x:r[3].x,y:r[3].y,z:r[3].z}),z=H(z,a[0],a[1],a[2],a[3],{x:r[0].x,y:r[0].y,z:r[0].z},{x:r[1].x,y:r[1].y,z:r[1].z},{x:r[2].x,y:r[2].y,z:r[2].z},{x:r[3].x,y:r[3].y,z:r[3].z}),m=H(m,a[0],a[1],a[2],a[3],{x:r[0].x,y:r[0].y,z:r[0].z},{x:r[1].x,y:r[1].y,z:r[1].z},{x:r[2].x,y:r[2].y,z:r[2].z},{x:r[3].x,y:r[3].y,z:r[3].z}),l.spatialReference=i.spatialReference,x.spatialReference=i.spatialReference,z.spatialReference=i.spatialReference,m.spatialReference=i.spatialReference,t=4===c.cameraOrientation?.type?await u([p(new n(l)),p(new n(x)),p(new n(z)),p(new n(m))],o,!0):await u([new n(l),new n(x),new n(z),new n(m)],o,!0);const h=await Promise.all(t);h.forEach((e=>{e.z=0}));const w=H(e,h[0],h[1],h[2],h[3],l,x,z,m);let R;if(R=4===c.cameraOrientation?.type?(await u([p(new n({x:w.x,y:w.y,z:w.z,spatialReference:i.spatialReference}))],o,!0))[0]:(await u([new n({x:w.x,y:w.y,z:w.z,spatialReference:i.spatialReference})],o,!0))[0],f=Math.abs(e.x-R.x)+Math.abs(e.y-R.y),f<=1||8===y){s=w;break}}return{error:f,point:s}}function Z(e,t,a){const r={x:e.rings[0][0][0],y:e.rings[0][0][1],z:e.rings[0][0][2]},i={x:e.rings[0][1][0],y:e.rings[0][1][1],z:e.rings[0][1][2]},n={x:e.rings[0][1][0],y:e.rings[0][1][1],z:e.rings[0][1][2]},s={x:e.rings[0][2][0],y:e.rings[0][2][1],z:e.rings[0][2][2]},o=(s.z-n.z)*(i.y-r.y)-(s.y-n.y)*(i.z-r.z),c=-((s.z-n.z)*(i.x-r.x)-(i.z-r.z)*(s.x-n.x)),f=(s.y-n.y)*(i.x-r.x)-(i.y-r.y)*(s.x-n.x),y=-(o*r.x+c*r.y+f*r.z);return S(t.toJSON(),a,o,c,f,y)}export{k as transformPoints};
5
+ import"../../../geometry.js";import{deg2rad as e}from"../../../core/mathUtils.js";import{zeros as t,create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{z as r,g as i}from"../../../chunks/vec32.js";import n from"../../../geometry/Point.js";import{initializeProjection as s,project as o}from"../../../geometry/projection.js";import{fromPoints as c,fromValues as f}from"../../../geometry/support/ray.js";import{b as y,h as l}from"../../../chunks/sphere.js";import{geographicToWebMercator as x,webMercatorToGeographic as p}from"../../../geometry/support/webMercatorUtils.js";import{createCoveragePolygon as z}from"../core/coverageUtils.js";import m from"../core/ExposurePoint.js";import{transformPoints as u,updateElevation as h}from"./groundToImageUtils.js";import{getWebMercatorScalingFactor as w,convertPixelToHeadingPitch as R,convertHeadingPitchToSphereVertex as g,scaleAndAddWithFactor as b,ltpToGeographic as d,computeHFOVAndVFOV as P,projectiveTransform2 as M,scaleWithFactor as j,calculateRotationMatrix as O,transformMat3 as v,projectiveTransform as H,getPlaneLineIntersectionPoint as S}from"./utils.js";import{defaultImageSphereCenter as E}from"../../../widgets/PanoramicViewer/constants.js";import{isNumber as V}from"../../../widgets/support/dataUtils.js";import F from"../../../geometry/SpatialReference.js";import U from"../../../geometry/Polygon.js";function k(e,t){if(!e)return Promise.resolve([]);const a=t.feature;let r=a.attributes;return r instanceof m||(r=m.fromJSON(a),r&&(a.attributes=r)),D(e,t)}function D(e,t){const{attributes:a}=t.feature;if(a.isSpherical||360===a.horizontalFieldOfView){const{location:r,cameraOrientation:i,farDistance:n,cameraHeading:s,cameraHeight:o}=a;return G(e,r,n,[t.imageProperties.width,t.imageProperties.height],s,o,i)}return W(e,t)}async function G(e,t,r,i,s,o,p){let z=new n(t);const m=w(z);z.spatialReference.isGeographic&&z.spatialReference.isWGS84&&4!==p?.type&&(z=x(z));const u=new Array,[h,d,P]=z.toArray(),M=y([h,d,P??0],r/m),j=E.toArray();for(const y of e){let e,t;if(V(y.heading)&&V(y.pitch))e=y.heading,t=y.pitch;else{const a=R({x:y.x,y:y.y},i[0],i[1]);e=a.heading,t=a.pitch}e=(e+s)%360;const r=c([j[0],j[1],j[2]],g(e,t)),x=f([h,d,P??0],r.direction),p=a();l(M,x,p);const w=(z.z??0)-o;if(p[2]<w){const e=Math.abs((z.z-w)/-r.direction[2])*m;b([z.x,z.y,z.z],r.direction,e,m,p)}else p[2]=w;u.push(new n(p,z.spatialReference))}return u}async function W(e,t){const{feature:a}=t,{attributes:r}=a;let i=new n(r.location);if(4===r.cameraOrientation?.type){const e=r.cameraOrientation;i=new n(d(i,[e.latitude,e.longitude,e.ellipsoidRadius,e.squaredEccentricity]))}let c=!1;i.spatialReference.isWGS84&&(c=!0,i=x(i));const f=i.spatialReference.isWebMercator?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*i.y/6378137))):1,y=A(t,i,f),l=4===r.cameraOrientation?.type?y.map((e=>p(new n(e)))):y,z=await u(l,t,!0),m=await Promise.all(z);m.forEach((e=>{e.z=1}));const w=P(r.horizontalFieldOfView,r.verticalFieldOfView,r.cameraRoll??0).vfov;return Promise.all(e.map((async e=>{e.z=1;let a,y=M(e,m,l);if(a=4===r.cameraOrientation?.type?(await u([p(new n({...y,spatialReference:i.spatialReference}))],t,!0))[0]:(await u([new n({...y,spatialReference:i.spatialReference})],t,!0))[0],!a)return null;let x,z=Math.abs(e.x-a.x)+Math.abs(e.y-a.y);if(z>1){const r=await N(e,a,m,l,i,y,t);y=r.point,z=r.error}if(r.elevationSource){await s(i.spatialReference,t.footprintExtent.spatialReference,null,t.options);let a=await I(t);if(a?.extent){let s=Z(a,i,y);if(!s)return null;const l={x:s.x,y:s.y,z:s.z,hasZ:!0,spatialReference:i.spatialReference},z=new n(l);if(s){const l=o(z,t.footprintExtent.spatialReference),m=h([l],t,!1);let R;R=m instanceof Promise?await m:m,z.z=s.z=R[0].z;const g=await u([4===r.cameraOrientation?.type?p(z):z],t);if(!g[0])return null;let b=Math.abs(e.x-g[0].x)+Math.abs(e.y-g[0].y);if(x=s.z,b>1){let l=0;const z=async m=>{if(b>1){const R=m.width/10,g=m.height/10;if(!m||R<1||g<1)return y=q(y,i,f,x,r.cameraPitch,w,c),y;const d=[{x:s.x-R,y:s.y-g,spatialReference:i.spatialReference},{x:s.x+R,y:s.y-g,spatialReference:i.spatialReference},{x:s.x+R,y:s.y+g,spatialReference:i.spatialReference},{x:s.x-R,y:s.y+g,spatialReference:i.spatialReference}].map((e=>new n(e))),P=await h(d,t,!1);if(a=new U({rings:[[[P[0].x,P[0].y,P[0].z],[P[1].x,P[1].y,P[1].z],[P[2].x,P[2].y,P[2].z],[P[3].x,P[3].y,P[3].z],[P[0].x,P[0].y,P[0].z]]],spatialReference:i.spatialReference}),s=Z(a,i,y),s){const m=o(new n({x:s.x,y:s.y,z:s.z,spatialReference:i.spatialReference}),t.footprintExtent.spatialReference),h=await u([4===r.cameraOrientation?.type?p(m):m],t);if(h[0])return b=Math.abs(e.x-h[0].x)+Math.abs(e.y-h[0].y),x=s.z,b<=1||8===l?q(y,i,f,x,r.cameraPitch,w,c):(l+=1,z(a.extent))}return q(y,i,f,i.z-r.cameraHeight,r.cameraPitch,w,c)}return q(y,i,f,i.z-r.cameraHeight,r.cameraPitch,w,c)};return z(a.extent)}return q(y,i,f,i.z-r.cameraHeight,r.cameraPitch,w,c)}return q(y,i,f,i.z-r.cameraHeight,r.cameraPitch,w,c)}}return q(y,i,f,i.z-r.cameraHeight,r.cameraPitch,w,c)})))}function q(e,a,i,s,o,c,f){const y=Math.sqrt((e.z-a.z)**2+(Math.sqrt((e.x-a.x)**2+(e.y-a.y)**2)/i)**2)*i,l=j(r(t(),[e.x,e.y,e.z],[a.x,a.y,a.z]),1/y,1/i);if(e.z<s||o+c/2<90){const t=Math.abs((a.z-s)/-l[2])*i,r=b([a.x,a.y,a.z],l,t,i);e={x:r[0],y:r[1],z:r[2]}}else e.z=s;return e.spatialReference=a.spatialReference,e=new n(e),f&&(e=p(e)),e}function A(a,s,o){const{feature:c}=a,{attributes:f}=c,y=2*Math.tan(e(f.verticalFieldOfView)/2)*f.farDistance*o,l=2*Math.tan(e(f.horizontalFieldOfView)/2)*f.farDistance*o,x=O("HPR",[f.cameraHeading,f.cameraPitch,f.cameraRoll??0]),p=v([0,0,-1],x),z=b([s.x,s.y,s.z],p,f.farDistance*o,o),m=v([0,1,0],x),u=v([1,0,0],x),h=j(m,y/2,o),w=j(u,l/2,o),R=r(t(),h,w),g=i(t(),h,w);return[i(t(),z,R),i(t(),z,g),r(t(),z,R),r(t(),z,g)].map((e=>{const[t,a,r]=e;return new n({x:t,y:a,z:r,spatialReference:s.spatialReference})}))}function I(e){const{feature:t}=e,{polygon:a}=z(e.feature);if(!a.extent)return Promise.resolve(null);const r=J(a.extent),i=t.attributes.location.spatialReference.isWGS84?new F({wkid:102100}):t.attributes.location.spatialReference;return h(r,e,!1).then((e=>{const t=e.map((e=>o(e,i)));return new U({hasZ:!0,rings:[t.map((e=>[e.x,e.y,e.z]))],spatialReference:i})}))}function J(e){const{xmin:t,xmax:a,ymin:r,ymax:i,spatialReference:s}=e;return[new n({x:t,y:i,spatialReference:s}),new n({x:a,y:i,spatialReference:s}),new n({x:a,y:r,spatialReference:s}),new n({x:t,y:r,spatialReference:s})]}async function N(e,t,a,r,i,s,o){const{feature:{attributes:c}}=o;let f=Math.abs(e.x-t.x)+Math.abs(e.y-t.y);if(f>1)for(let y=0;y<9;y++)if(f>1){let t,l={x:e.x-f,y:e.y-f,z:1},x={x:e.x+f,y:e.y-f,z:1},z={x:e.x+f,y:e.y+f,z:1},m={x:e.x-f,y:e.y+f,z:1};l=H(l,a[0],a[1],a[2],a[3],{x:r[0].x,y:r[0].y,z:r[0].z},{x:r[1].x,y:r[1].y,z:r[1].z},{x:r[2].x,y:r[2].y,z:r[2].z},{x:r[3].x,y:r[3].y,z:r[3].z}),x=H(x,a[0],a[1],a[2],a[3],{x:r[0].x,y:r[0].y,z:r[0].z},{x:r[1].x,y:r[1].y,z:r[1].z},{x:r[2].x,y:r[2].y,z:r[2].z},{x:r[3].x,y:r[3].y,z:r[3].z}),z=H(z,a[0],a[1],a[2],a[3],{x:r[0].x,y:r[0].y,z:r[0].z},{x:r[1].x,y:r[1].y,z:r[1].z},{x:r[2].x,y:r[2].y,z:r[2].z},{x:r[3].x,y:r[3].y,z:r[3].z}),m=H(m,a[0],a[1],a[2],a[3],{x:r[0].x,y:r[0].y,z:r[0].z},{x:r[1].x,y:r[1].y,z:r[1].z},{x:r[2].x,y:r[2].y,z:r[2].z},{x:r[3].x,y:r[3].y,z:r[3].z}),l.spatialReference=i.spatialReference,x.spatialReference=i.spatialReference,z.spatialReference=i.spatialReference,m.spatialReference=i.spatialReference,t=4===c.cameraOrientation?.type?await u([p(new n(l)),p(new n(x)),p(new n(z)),p(new n(m))],o,!0):await u([new n(l),new n(x),new n(z),new n(m)],o,!0);const h=await Promise.all(t);h.forEach((e=>{e.z=0}));const w=H(e,h[0],h[1],h[2],h[3],l,x,z,m);let R;if(R=4===c.cameraOrientation?.type?(await u([p(new n({x:w.x,y:w.y,z:w.z,spatialReference:i.spatialReference}))],o,!0))[0]:(await u([new n({x:w.x,y:w.y,z:w.z,spatialReference:i.spatialReference})],o,!0))[0],f=Math.abs(e.x-R.x)+Math.abs(e.y-R.y),f<=1||8===y){s=w;break}}return{error:f,point:s}}function Z(e,t,a){const r={x:e.rings[0][0][0],y:e.rings[0][0][1],z:e.rings[0][0][2]},i={x:e.rings[0][1][0],y:e.rings[0][1][1],z:e.rings[0][1][2]},n={x:e.rings[0][1][0],y:e.rings[0][1][1],z:e.rings[0][1][2]},s={x:e.rings[0][2][0],y:e.rings[0][2][1],z:e.rings[0][2][2]},o=(s.z-n.z)*(i.y-r.y)-(s.y-n.y)*(i.z-r.z),c=-((s.z-n.z)*(i.x-r.x)-(i.z-r.z)*(s.x-n.x)),f=(s.y-n.y)*(i.x-r.x)-(i.y-r.y)*(s.x-n.x),y=-(o*r.x+c*r.y+f*r.z);return S(t.toJSON(),a,o,c,f,y)}export{k as transformPoints};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
+ */
5
+ import"../../../geometry.js";import{deg2rad as e}from"../../../core/mathUtils.js";import{memoize as t}from"../../../core/memoize.js";import{zeros as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{z as r,g as o}from"../../../chunks/vec32.js";import{webMercatorToGeographic as i,geographicToWebMercator as n}from"../../../geometry/support/webMercatorUtils.js";import c from"../core/cameraOrientationFactory.js";import{scaleWithFactor as s,scaleAndAddWithFactor as l,projectiveTransform2 as m,ltpToGeographic as f,computeHFOVAndVFOV as p,calculateRotationMatrix as y,transformMat3 as u}from"./utils.js";import{worldToImageWithLTPFlag as g,worldToImage as z,getScalingFactor as h}from"./worldToImage.js";import x from"../../../geometry/Point.js";function d(e,t){const a=Array.isArray(e)?e:[e],{effectiveVerticalFieldOfView:r,imageVertices:o,scalingFactor:i,shouldConvertToLatLong:n,worldFootprint:c,localTangentPlane:s,cameraLocation:l}=L(t),m=new Array;for(const f of a){const e=R(c,o,{...f,z:1},l,t,s);m.push(w(e,l,i,(l.z??0)-t.cameraHeight,t.cameraPitch,r,n))}return 1===m.length?m[0]:m}function w(e,t,o,n,c,m,f){let p=e.clone();const y=Math.sqrt((e.z-t.z)**2+(Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)/o)**2)*o,u=s(r(a(),[e.x,e.y,e.z],[t.x,t.y,t.z]),1/y,1/o);if(e.z<n||c+m/2<90){const a=Math.abs((t.z-n)/-u[2])*o,r=l([t.x,t.y,t.z],u,a,o);p=new x({x:r[0],y:r[1],z:r[2],spatialReference:e.spatialReference})}else p.z=n;return f&&(p=i(e)),p}function R(e,t,a,r,o,i){let n=null;const c=9;let s,l=0,f=e,p=t;for(;l<=c;){const e=F(a,p,f,{...o,cameraLocation:r},a);if(s=e.error,n=e.transformedPoint,s<=1||l===c)break;f=[{x:a.x-s,y:a.y-s,z:1},{x:a.x+s,y:a.y-s,z:1},{x:a.x+s,y:a.y+s,z:1},{x:a.x-s,y:a.y+s,z:1}].map((e=>new x({...m(e,t,f),spatialReference:r.spatialReference}))),p=g(i,f,o),l++}return n}function F(e,t,a,r,o){const{cameraLocation:i}=r,n=new x({...m(e,t,a),spatialReference:i.spatialReference});return{transformedPoint:n,error:O(o,z(n,r))}}function O(e,t){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)}function L(e){const t="string"==typeof e.cameraOrientation?c.getCameraOrientation(e.cameraOrientation):e.cameraOrientation,a=4===t?.type,r=e.cameraLocation.spatialReference.isWGS84&&a;let o=new x(e.cameraLocation);if(a){const e=t;o=new x(f(o,[e.latitude,e.longitude,e.ellipsoidRadius,e.squaredEccentricity]))}o.spatialReference.isGeographic&&(o=n(o));const i=h(o);o.z||(o.z=e.cameraHeight);const s=j({...e,scalingFactor:i});return{cameraOrientation:t,cameraLocation:o,imageVertices:g(a,s,e),localTangentPlane:a,effectiveVerticalFieldOfView:p(e.horizontalFieldOfView,e.verticalFieldOfView,e.cameraRoll??0).vfov,worldFootprint:s,scalingFactor:i,shouldConvertToLatLong:r}}const j=t((t=>{const{cameraLocation:i,scalingFactor:n}=t,c=2*Math.tan(e(t.verticalFieldOfView)/2)*t.farDistance*n,m=2*Math.tan(e(t.horizontalFieldOfView)/2)*t.farDistance*n,f=y("HPR",[t.cameraHeading,t.cameraPitch,t.cameraRoll??0]),p=u([0,0,-1],f),g=l([i.x,i.y,i.z],p,t.farDistance*n,n),z=u([0,1,0],f),h=u([1,0,0],f),d=s(z,c/2,n),w=s(h,m/2,n),R=r(a(),d,w),F=o(a(),d,w);return[o(a(),g,R),o(a(),g,F),r(a(),g,R),r(a(),g,F)].map((e=>{const[t,a,r]=e;return new x({x:t,y:a,z:r,spatialReference:i.spatialReference})}))}));export{d as imageToWorld};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
+ */
5
+ import{isConstantElevation as e,isElevationSource as t}from"../core/ElevationSourceDefinitions.js";import{updateUsingElevationSampler as n,updateUsingConstant as o,updateUsingElevationSource as i,updateUsingCameraProperties as a}from"./updateElevationUtils.js";async function l(l,r,v){const c="elevationSample"in r&&null!=r.elevationSample,s="elevationSource"in r?r.elevationSource:void 0,u="extent"in r?r.extent:void 0;return c?n(l,r.elevationSample,v):e(s)?o(l,s.constantElevation,!0,v):t(s)?i(l,{...s,extent:u},v):a(r,l)}export{l as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
+ */
5
+ import e from"../../../core/Error.js";import t from"../../../core/Logger.js";import{memoize as r}from"../../../core/memoize.js";import{waitTick as o,isAbortError as a}from"../../../core/promiseUtils.js";import{projectWithZConversion as n}from"../../../geometry/projection.js";import{fromExtent as i}from"../../../geometry/support/aaBoundingRect.js";import s from"../../ElevationLayer.js";import c from"../../ImageryLayer.js";import{TileElevationSampler as l}from"../../support/ElevationSampler.js";import{ElevationTile as p}from"../../support/ElevationTile.js";import{ElevationTileData as u}from"../../support/ElevationTileData.js";import m from"../../support/RasterFunction.js";import f from"../../support/TileInfo.js";import{TileKey as w}from"../../support/TileKey.js";import{fetchArcGISServiceJSON as y}from"../../../support/requestPresets.js";import{logAndThrow as g}from"../../../widgets/OrientedImageryViewer/utils.js";async function v(t,r,o){const a="url"in r?await j(r):r;if(!a)throw g("esri.layers.orientedImagery.transformations",new e("update-elevation:elevation-source","could not create a sampler using provided elevation source",r));return d(t,a,o)}async function d(e,t,r){await o(r);const a=new Array,n=z(t,r);for(const o of e){const e=await n(o);a.push(e)}return a}async function E(e,t,r=!0,a){await o(a);const{cameraHeight:n,cameraLocation:i,cameraOrientation:s}=e;return A(t,s&&"number"==typeof i.z?i.z-n:0,r,a)}var h;!function(e){e[e.DYNAMIC=0]="DYNAMIC",e[e.ELEVATION=1]="ELEVATION"}(h||(h={}));const j=r((async(e,r)=>{let o;const{extent:n,rasterFunction:i,url:s}=e;try{o=await R(s)}catch(c){if(a(c))return;t.getLogger("esri.layers.orientedImagery.transformations").error("updateElevationUsingElevationSource",c)}switch(o){case h.DYNAMIC:return await L(s,n,i,r);case h.ELEVATION:return await I(s,n,r);default:return}}));async function I(e,r,o){const n=new s(e);let i;try{await n.load(),i=await n.createElevationSampler(r,o)}catch(c){if(a(c))return;t.getLogger(n).error(c)}finally{n.destroy()}return i}async function L(e,t,r,o){const a=r?new m({functionName:r}):void 0,n=new c({url:e,rasterFunction:a,format:"lerc"});await n.load(o);let s,y=512,g=512;const v=t.width/t.height;v>1?(g/=v,s=t.height/g):(y*=v,s=t.width/y);const d=await n.fetchImage(t,y,g,o),E=f.create({scales:[s],size:512,spatialReference:t.spatialReference}),h=new w(null,0,0,0,i(t)),j=new u(d.pixelData.pixelBlock.pixels[0],y,g,0),I=new p(h,j);return new l(I,E,void 0)}async function R(t){const r=await y(t),{tileInfo:o,cacheType:a}=r;if(!r.hasOwnProperty("bandCount")||!r.hasOwnProperty("pixelSizeX"))throw new e("elevation-source:invalid-service-url",`ElevationSource URL expects an elevation 3D image service but given ${t}`);return"LERC"!==o?.format?.toUpperCase()||a&&"elevation"!==a.toLowerCase()?h.DYNAMIC:h.ELEVATION}function z(e,t){return async r=>{let o=r.clone();const a=r.spatialReference.equals(e.spatialReference)?o:await n(r,e.spatialReference,t),i=e.queryElevation(a);if(i){o=r.spatialReference.equals(e.spatialReference)?i.clone():await n(i,r.spatialReference,t)}return o.z=o.z??1,o}}async function A(e,t,r=!0,a){if(await o(a),r)return e.map((e=>(e.z=t,e)));for(const o of e)o.z=t;return e}export{j as getElevationSampler,E as updateUsingCameraProperties,A as updateUsingConstant,d as updateUsingElevationSampler,v as updateUsingElevationSource,R as validateElevationSourceURL};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{rad2deg as t,deg2rad as a}from"../../../core/mathUtils.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{zeros as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{invertOrIdentity as M}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{initializeProjection as i,projectWithZConversion as o}from"../../../geometry/projection.js";import{earth as r}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as c}from"../../../geometry/support/spatialReferenceUtils.js";import{defaultImageSphereSize as e}from"../../../widgets/PanoramicViewer/constants.js";function z(t,a,n){const[s,h,M,i]=a,[o,r,c,e]=n;return u(t,s,h,M,i,o,r,c,e)}function u(t,a,n,h,i,o,r,c,e){let z=!1;0===a.z&&0===n.z&&0===h.z&&0===i.z&&(a.z=n.z=h.z=i.z=1,t.z=1),a.z=a.z??1,n.z=n.z??1,h.z=h.z??1,i.z=i.z??1,0===o.z&&0===r.z&&0===c.z&&0===e.z&&(z=!0,o.z=r.z=c.z=e.z=1),o.z=o.z??1,r.z=r.z??1,c.z=c.z??1,e.z=e.z??1;const u=m(a,n,h,i),f=m(o,r,c,e),x=M(s(),u),y=s();y[0]=f[0]*x[0]+f[1]*x[4]+f[2]*x[8]+f[3]*x[12],y[1]=f[0]*x[1]+f[1]*x[5]+f[2]*x[9]+f[3]*x[13],y[2]=f[0]*x[2]+f[1]*x[6]+f[2]*x[10]+f[3]*x[14],y[3]=f[0]*x[3]+f[1]*x[7]+f[2]*x[11]+f[3]*x[15],y[4]=f[4]*x[0]+f[5]*x[4]+f[6]*x[8]+f[7]*x[12],y[5]=f[4]*x[1]+f[5]*x[5]+f[6]*x[9]+f[7]*x[13],y[6]=f[4]*x[2]+f[5]*x[6]+f[6]*x[10]+f[7]*x[14],y[7]=f[4]*x[3]+f[5]*x[7]+f[6]*x[11]+f[7]*x[15],y[8]=f[8]*x[0]+f[9]*x[4]+f[10]*x[8]+f[11]*x[12],y[9]=f[8]*x[1]+f[9]*x[5]+f[10]*x[9]+f[11]*x[13],y[10]=f[8]*x[2]+f[9]*x[6]+f[10]*x[10]+f[11]*x[14],y[11]=f[8]*x[3]+f[9]*x[7]+f[10]*x[11]+f[11]*x[15],y[12]=f[12]*x[0]+f[13]*x[4]+f[14]*x[8]+f[15]*x[12],y[13]=f[12]*x[1]+f[13]*x[5]+f[14]*x[9]+f[15]*x[13],y[14]=f[12]*x[2]+f[13]*x[6]+f[14]*x[10]+f[15]*x[14],y[15]=f[12]*x[3]+f[13]*x[7]+f[14]*x[11]+f[15]*x[15];const p=y[0]*t.x+y[1]*t.y+y[2]*t.z+y[3],l=y[4]*t.x+y[5]*t.y+y[6]*t.z+y[7],b=y[8]*t.x+y[9]*t.y+y[10]*t.z+y[11];let g=y[12]*t.x+y[13]*t.y+y[14]*t.z+y[15];return 0===g&&(g=1),{x:p/g,y:l/g,z:z?0:b/g}}function m(t,a,n,s){const h=p([s.x,s.y,s.z,1],M(new Array(16),[t.x,a.x,n.x,0,t.y,a.y,n.y,0,t.z,a.z,n.z,0,1,1,1,1])),i=h[0],o=h[1],r=h[2],c=new Array(16);return c[0]=i*t.x,c[1]=o*a.x,c[2]=r*n.x,c[3]=0,c[4]=i*t.y,c[5]=o*a.y,c[6]=r*n.y,c[7]=0,c[8]=i*t.z,c[9]=o*a.z,c[10]=r*n.z,c[11]=0,c[12]=i,c[13]=o,c[14]=r,c[15]=1,c}function f(t,a,n,s,M=h()){return M[0]=t[0]+a[0]*n,M[1]=t[1]+a[1]*n,M[2]=t[2]+a[2]*(n/s),M}function x(t,a,n){const s=h();return s[0]=t[0]*a,s[1]=t[1]*a,s[2]=t[2]*(a/n),s}function y(t,a){const[n,s,M]=t,i=h();return i[0]=n*a[0]+s*a[3]+M*a[6],i[1]=n*a[1]+s*a[4]+M*a[7],i[2]=n*a[2]+s*a[5]+M*a[8],i}function p(t,a){const[n,s,h,M]=t,i=new Array(4);return i[0]=n*a[0]+s*a[1]+h*a[2]+M*a[3],i[1]=n*a[4]+s*a[5]+h*a[6]+M*a[7],i[2]=n*a[8]+s*a[9]+h*a[10]+M*a[11],i[3]=n*a[12]+s*a[13]+h*a[14]+M*a[15],i}function l(t,a){const s=Math.PI/180,h=n();if("OPK"===t){const t=Number(a[0])*s,n=Number(a[1])*s,M=Number(a[2])*s;h[0]=Math.cos(n)*Math.cos(M),h[1]=Math.cos(t)*Math.sin(M)+Math.sin(t)*Math.sin(n)*Math.cos(M),h[2]=Math.sin(t)*Math.sin(M)-Math.cos(t)*Math.sin(n)*Math.cos(M),h[3]=-Math.cos(n)*Math.sin(M),h[4]=Math.cos(t)*Math.cos(M)-Math.sin(t)*Math.sin(n)*Math.sin(M),h[5]=Math.sin(t)*Math.cos(M)+Math.cos(t)*Math.sin(n)*Math.sin(M),h[6]=Math.sin(n),h[7]=-Math.sin(t)*Math.cos(n),h[8]=Math.cos(t)*Math.cos(n)}else{const t=Number(a[0])*s,n=Number(a[1])*s,M=Number(a[2])*s;h[0]=Math.cos(t)*Math.cos(M)-Math.sin(t)*Math.cos(n)*Math.sin(M),h[1]=Math.sin(t)*Math.cos(M)*-1-Math.cos(t)*Math.cos(n)*Math.sin(M),h[2]=Math.sin(M)*Math.sin(n)*-1,h[3]=Math.cos(t)*Math.sin(M)+Math.sin(t)*Math.cos(n)*Math.cos(M),h[4]=Math.sin(t)*Math.sin(M)*-1+Math.cos(t)*Math.cos(n)*Math.cos(M),h[5]=Math.cos(M)*Math.sin(n),h[6]=Math.sin(t)*Math.sin(n)*-1,h[7]=Math.cos(t)*Math.sin(n)*-1,h[8]=Math.cos(n)}return h}function b(t,a,n){const s=Math.sin(n*Math.PI/180),h=Math.cos(n*Math.PI/180),M=[[t,0],[t,a],[0,a]];M.forEach(((t,a)=>{M[a]=[h*t[0]-s*t[1],s*t[0]+h*t[1]]}));const i={xmin:Math.min(0,M[0][0],M[1][0],M[2][0]),xmax:Math.max(0,M[0][0],M[1][0],M[2][0]),ymin:Math.min(0,M[0][1],M[1][1],M[2][1]),ymax:Math.max(0,M[0][1],M[1][1],M[2][1])};return{hfov:Math.abs(i.xmax-i.xmin),vfov:Math.abs(i.ymax-i.ymin)}}function g(t,a,n,s,h,M){const i=n*(a.x-t.x)+s*(a.y-t.y)+h*(a.z-t.z);if(0===i)return null;const o=-(n*t.x+s*t.y+h*t.z+M)/i;return{x:t.x+o*(a.x-t.x),y:t.y+o*(a.y-t.y),z:t.z+o*(a.z-t.z)}}function j(t,a){const n=Math.PI/180,s=t.y*n,h=t.x*n,M=t.z||0,i=a[0]*n,o=a[1]*n,r=a[2]/Math.sqrt(1-a[3]*Math.sin(i)**2),c=h-o,e=a[2]/Math.sqrt(1-a[3]*Math.sin(s)**2),z=a[3]*(r*Math.sin(i)-e*Math.sin(s));return{x:(e+M)*Math.cos(s)*Math.sin(c),y:(e+M)*(Math.sin(s)*Math.cos(i)-Math.sin(i)*Math.cos(s)*Math.cos(c))+z*Math.cos(i),z:(e+M)*(Math.sin(s)*Math.sin(i)+Math.cos(i)*Math.cos(s)*Math.cos(c))-r+z*Math.sin(i)}}function q(t,a){const n=Math.PI/180,s=Number(t.x),h=Number(t.y),M=Number(t.z),i=a[0]*n,o=a[1]*n,r=a[2]/Math.sqrt(1-a[3]*Math.sin(i)**2),c=s/r,e=h/r,z=M/r,u=Math.cos(i)-Math.sin(i)*e+Math.cos(i)*z,m=Math.sin(i)+Math.cos(i)*e+Math.sin(i)*z,f=Math.sqrt(u**2+c**2),x=a[3]*r*Math.sin(i),y=i,p=Math.atan(m/f-(x-a[3]*(a[2]/Math.sqrt(1-a[3]*Math.sin(y)**2))*Math.sin(y))/(r*f)),l=Math.atan(m/f-(x-a[3]*(a[2]/Math.sqrt(1-a[3]*Math.sin(p)**2))*Math.sin(p))/(r*f)),b=Math.atan(m/f-(x-a[3]*(a[2]/Math.sqrt(1-a[3]*Math.sin(l)**2))*Math.sin(l))/(r*f)),g=Math.atan(m/f-(x-a[3]*(a[2]/Math.sqrt(1-a[3]*Math.sin(b)**2))*Math.sin(b))/(r*f)),j=Math.atan(s/(r*u))+o;return{x:j/n,y:g/n,z:s/(Math.cos(g)*Math.sin(j-o))-a[2]/Math.sqrt(1-a[3]*Math.sin(g)**2),spatialReference:{wkid:4326}}}function N(t){return t&&c(t?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t.y/r.radius))):1}function d(t,a,n){const s=360/a,h=180/n;return{heading:(t.x-a/2)*s,pitch:90-(t.y-n/2)*h}}function w(t,a,n,s=e/2){const{heading:h,pitch:M}=I(t,s);return P(h,M,a,n)}function P(t,a,n,s){return{x:n/2+t/(360/n),y:s-a/(180/s),heading:t,pitch:a}}function I(a,n){const s=t(Math.acos(-a.z/n));return{heading:t(Math.atan2(a.x,a.y)),pitch:s}}function R(t,n,s=e/2){return[s*(Math.sin(a(t))*Math.sin(a(n))),s*(Math.cos(a(t))*Math.sin(a(n))),s*Math.cos(a(180-n))]}async function v(a,n,s){await i(n.spatialReference,a.spatialReference,null,s);const h=await o(n,a.spatialReference,s);let M=t(Math.atan2(h.y-a.y,h.x-a.x));return M=M>=0&&M<=90?90-M:M>90&&M<=180?360-M+90:90+Math.abs(M),M}export{l as calculateRotationMatrix,b as computeHFOVAndVFOV,R as convertHeadingPitchToSphereVertex,P as convertOrientationToPixelLocation,d as convertPixelToHeadingPitch,I as convertSphereVertexToOrientation,w as convertSphereVertexToPixelLocation,j as geographicToLTP,v as getInitialAngle,g as getPlaneLineIntersectionPoint,N as getWebMercatorScalingFactor,m as linearEquationSolve,q as ltpToGeographic,u as projectiveTransform,z as projectiveTransform2,f as scaleAndAddWithFactor,x as scaleWithFactor,y as transformMat3,p as transformMat4};
5
+ import{rad2deg as t,deg2rad as a}from"../../../core/mathUtils.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{zeros as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{invertOrIdentity as M}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{initializeProjection as i,projectWithZConversion as o}from"../../../geometry/projection.js";import{earth as r}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as c}from"../../../geometry/support/spatialReferenceUtils.js";import{defaultImageSphereSize as e}from"../../../widgets/PanoramicViewer/constants.js";function z(t,a,n){const[s,h,M,i]=a,[o,r,c,e]=n;return u(t,s,h,M,i,o,r,c,e)}function u(t,a,n,h,i,o,r,c,e){let z=!1;0===a.z&&0===n.z&&0===h.z&&0===i.z&&(a.z=n.z=h.z=i.z=1,t.z=1),a.z=a.z??1,n.z=n.z??1,h.z=h.z??1,i.z=i.z??1,0===o.z&&0===r.z&&0===c.z&&0===e.z&&(z=!0,o.z=r.z=c.z=e.z=1),o.z=o.z??1,r.z=r.z??1,c.z=c.z??1,e.z=e.z??1;const u=m(a,n,h,i),f=m(o,r,c,e),x=M(s(),u),y=s();y[0]=f[0]*x[0]+f[1]*x[4]+f[2]*x[8]+f[3]*x[12],y[1]=f[0]*x[1]+f[1]*x[5]+f[2]*x[9]+f[3]*x[13],y[2]=f[0]*x[2]+f[1]*x[6]+f[2]*x[10]+f[3]*x[14],y[3]=f[0]*x[3]+f[1]*x[7]+f[2]*x[11]+f[3]*x[15],y[4]=f[4]*x[0]+f[5]*x[4]+f[6]*x[8]+f[7]*x[12],y[5]=f[4]*x[1]+f[5]*x[5]+f[6]*x[9]+f[7]*x[13],y[6]=f[4]*x[2]+f[5]*x[6]+f[6]*x[10]+f[7]*x[14],y[7]=f[4]*x[3]+f[5]*x[7]+f[6]*x[11]+f[7]*x[15],y[8]=f[8]*x[0]+f[9]*x[4]+f[10]*x[8]+f[11]*x[12],y[9]=f[8]*x[1]+f[9]*x[5]+f[10]*x[9]+f[11]*x[13],y[10]=f[8]*x[2]+f[9]*x[6]+f[10]*x[10]+f[11]*x[14],y[11]=f[8]*x[3]+f[9]*x[7]+f[10]*x[11]+f[11]*x[15],y[12]=f[12]*x[0]+f[13]*x[4]+f[14]*x[8]+f[15]*x[12],y[13]=f[12]*x[1]+f[13]*x[5]+f[14]*x[9]+f[15]*x[13],y[14]=f[12]*x[2]+f[13]*x[6]+f[14]*x[10]+f[15]*x[14],y[15]=f[12]*x[3]+f[13]*x[7]+f[14]*x[11]+f[15]*x[15];const p=y[0]*t.x+y[1]*t.y+y[2]*t.z+y[3],l=y[4]*t.x+y[5]*t.y+y[6]*t.z+y[7],b=y[8]*t.x+y[9]*t.y+y[10]*t.z+y[11];let g=y[12]*t.x+y[13]*t.y+y[14]*t.z+y[15];return 0===g&&(g=1),{x:p/g,y:l/g,z:z?0:b/g}}function m(t,a,n,s){const h=p([s.x,s.y,s.z,1],M(new Array(16),[t.x,a.x,n.x,0,t.y,a.y,n.y,0,t.z,a.z,n.z,0,1,1,1,1])),i=h[0],o=h[1],r=h[2],c=new Array(16);return c[0]=i*t.x,c[1]=o*a.x,c[2]=r*n.x,c[3]=0,c[4]=i*t.y,c[5]=o*a.y,c[6]=r*n.y,c[7]=0,c[8]=i*t.z,c[9]=o*a.z,c[10]=r*n.z,c[11]=0,c[12]=i,c[13]=o,c[14]=r,c[15]=1,c}function f(t,a,n,s,M=h()){return M[0]=t[0]+a[0]*n,M[1]=t[1]+a[1]*n,M[2]=t[2]+a[2]*(n/s),M}function x(t,a,n){const s=h();return s[0]=t[0]*a,s[1]=t[1]*a,s[2]=t[2]*(a/n),s}function y(t,a){const[n,s,M]=t,i=h();return i[0]=n*a[0]+s*a[3]+M*a[6],i[1]=n*a[1]+s*a[4]+M*a[7],i[2]=n*a[2]+s*a[5]+M*a[8],i}function p(t,a){const[n,s,h,M]=t,i=new Array(4);return i[0]=n*a[0]+s*a[1]+h*a[2]+M*a[3],i[1]=n*a[4]+s*a[5]+h*a[6]+M*a[7],i[2]=n*a[8]+s*a[9]+h*a[10]+M*a[11],i[3]=n*a[12]+s*a[13]+h*a[14]+M*a[15],i}function l(t,a){const s=Math.PI/180,h=n();if("OPK"===t){const t=Number(a[0])*s,n=Number(a[1])*s,M=Number(a[2])*s;h[0]=Math.cos(n)*Math.cos(M),h[1]=Math.cos(t)*Math.sin(M)+Math.sin(t)*Math.sin(n)*Math.cos(M),h[2]=Math.sin(t)*Math.sin(M)-Math.cos(t)*Math.sin(n)*Math.cos(M),h[3]=-Math.cos(n)*Math.sin(M),h[4]=Math.cos(t)*Math.cos(M)-Math.sin(t)*Math.sin(n)*Math.sin(M),h[5]=Math.sin(t)*Math.cos(M)+Math.cos(t)*Math.sin(n)*Math.sin(M),h[6]=Math.sin(n),h[7]=-Math.sin(t)*Math.cos(n),h[8]=Math.cos(t)*Math.cos(n)}else{const t=Number(a[0])*s,n=Number(a[1])*s,M=Number(a[2])*s;h[0]=Math.cos(t)*Math.cos(M)-Math.sin(t)*Math.cos(n)*Math.sin(M),h[1]=Math.sin(t)*Math.cos(M)*-1-Math.cos(t)*Math.cos(n)*Math.sin(M),h[2]=Math.sin(M)*Math.sin(n)*-1,h[3]=Math.cos(t)*Math.sin(M)+Math.sin(t)*Math.cos(n)*Math.cos(M),h[4]=Math.sin(t)*Math.sin(M)*-1+Math.cos(t)*Math.cos(n)*Math.cos(M),h[5]=Math.cos(M)*Math.sin(n),h[6]=Math.sin(t)*Math.sin(n)*-1,h[7]=Math.cos(t)*Math.sin(n)*-1,h[8]=Math.cos(n)}return h}function b(t,a,n){const s=Math.sin(n*Math.PI/180),h=Math.cos(n*Math.PI/180),M=[[t,0],[t,a],[0,a]];M.forEach(((t,a)=>{M[a]=[h*t[0]-s*t[1],s*t[0]+h*t[1]]}));const i={xmin:Math.min(0,M[0][0],M[1][0],M[2][0]),xmax:Math.max(0,M[0][0],M[1][0],M[2][0]),ymin:Math.min(0,M[0][1],M[1][1],M[2][1]),ymax:Math.max(0,M[0][1],M[1][1],M[2][1])};return{hfov:Math.abs(i.xmax-i.xmin),vfov:Math.abs(i.ymax-i.ymin)}}function g(t,a,n,s,h,M){const i=n*(a.x-t.x)+s*(a.y-t.y)+h*(a.z-t.z);if(0===i)return null;const o=-(n*t.x+s*t.y+h*t.z+M)/i;return{x:t.x+o*(a.x-t.x),y:t.y+o*(a.y-t.y),z:t.z+o*(a.z-t.z)}}function j(t,a){const n=Math.PI/180,s=t.y*n,h=t.x*n,M=t.z||0,i=a[0]*n,o=a[1]*n,r=a[2]/Math.sqrt(1-a[3]*Math.sin(i)**2),c=h-o,e=a[2]/Math.sqrt(1-a[3]*Math.sin(s)**2),z=a[3]*(r*Math.sin(i)-e*Math.sin(s));return{x:(e+M)*Math.cos(s)*Math.sin(c),y:(e+M)*(Math.sin(s)*Math.cos(i)-Math.sin(i)*Math.cos(s)*Math.cos(c))+z*Math.cos(i),z:(e+M)*(Math.sin(s)*Math.sin(i)+Math.cos(i)*Math.cos(s)*Math.cos(c))-r+z*Math.sin(i)}}function q(t,a){const n=Math.PI/180,s=Number(t.x),h=Number(t.y),M=Number(t.z),i=a[0]*n,o=a[1]*n,r=a[2]/Math.sqrt(1-a[3]*Math.sin(i)**2),c=s/r,e=h/r,z=M/r,u=Math.cos(i)-Math.sin(i)*e+Math.cos(i)*z,m=Math.sin(i)+Math.cos(i)*e+Math.sin(i)*z,f=Math.sqrt(u**2+c**2),x=a[3]*r*Math.sin(i),y=i,p=Math.atan(m/f-(x-a[3]*(a[2]/Math.sqrt(1-a[3]*Math.sin(y)**2))*Math.sin(y))/(r*f)),l=Math.atan(m/f-(x-a[3]*(a[2]/Math.sqrt(1-a[3]*Math.sin(p)**2))*Math.sin(p))/(r*f)),b=Math.atan(m/f-(x-a[3]*(a[2]/Math.sqrt(1-a[3]*Math.sin(l)**2))*Math.sin(l))/(r*f)),g=Math.atan(m/f-(x-a[3]*(a[2]/Math.sqrt(1-a[3]*Math.sin(b)**2))*Math.sin(b))/(r*f)),j=Math.atan(s/(r*u))+o;return{x:j/n,y:g/n,z:s/(Math.cos(g)*Math.sin(j-o))-a[2]/Math.sqrt(1-a[3]*Math.sin(g)**2),spatialReference:{wkid:4326}}}function N(t){return t&&c(t?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t.y/r.radius))):1}function d(t,a,n){const s=360/a,h=180/n;return{heading:(t.x-a/2)*s,pitch:90-(t.y-n/2)*h}}function w(t,a,n,s=e/2){const{heading:h,pitch:M}=I(t,s);return P(h,M,a,n)}function P(t,a,n,s){return{x:n/2+t/(360/n),y:s-a/(180/s),heading:t,pitch:a}}function I(a,n){const s=t(Math.acos(-a.z/n));return{heading:t(Math.atan2(a.x,a.y)),pitch:s}}function R(t,n,s=e/2){return[s*(Math.sin(a(t))*Math.sin(a(n))),s*(Math.cos(a(t))*Math.sin(a(n))),s*Math.cos(a(180-n))]}async function v(a,n,s){await i(n.spatialReference,a.spatialReference,null,s);const h=await o(n,a.spatialReference,s);let M=t(Math.atan2(h.y-a.y,h.x-a.x));return M=M>=0&&M<=90?90-M:M>90&&M<=180?360-M+90:90+Math.abs(M),M}function A(t,a,n){const s=Math.cos(n),h=Math.sin(n),M=[1,0,0,1,0,0],i=M[0]*s+M[2]*h,o=M[1]*s+M[3]*h,r=-M[0]*h+M[2]*s,c=-M[1]*h+M[3]*s;M[0]=i,M[1]=o,M[2]=r,M[3]=c;return[t*M[0]+a*M[2]+M[4],t*M[1]+a*M[3]+M[5]]}export{l as calculateRotationMatrix,b as computeHFOVAndVFOV,R as convertHeadingPitchToSphereVertex,P as convertOrientationToPixelLocation,d as convertPixelToHeadingPitch,I as convertSphereVertexToOrientation,w as convertSphereVertexToPixelLocation,j as geographicToLTP,v as getInitialAngle,g as getPlaneLineIntersectionPoint,N as getWebMercatorScalingFactor,m as linearEquationSolve,q as ltpToGeographic,u as projectiveTransform,z as projectiveTransform2,A as rotatePixel,f as scaleAndAddWithFactor,x as scaleWithFactor,y as transformMat3,p as transformMat4};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
+ */
5
+ import"../../../geometry.js";import{deg2rad as t}from"../../../core/mathUtils.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{mul as e}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{earth as r}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as i}from"../../../geometry/support/spatialReferenceUtils.js";import{webMercatorToGeographic as o,geographicToWebMercator as n}from"../../../geometry/support/webMercatorUtils.js";import c from"../core/cameraOrientationFactory.js";import{geographicToLTP as s,calculateRotationMatrix as m}from"./utils.js";import f from"../../../geometry/Point.js";function l(t,a){const{cameraOrientation:e,cameraLocation:r,pointsToTransform:i,rotationMatrix:o,scalingFactor:n}=g(t,a),c=new Array;return e?.isAdvanced?u(i,c,o,{...a,cameraOrientation:e,scalingFactor:n,cameraLocation:r}):h(i,c,o,{...a,cameraOrientation:e,scalingFactor:n,cameraLocation:r}),1===c.length?c[0]:c}function p(t,a,e){return l(t?a.map((t=>o(t))):a,e).map((t=>({...t,z:1})))}function u(t,a,e,r){const{cameraOrientation:i,cameraLocation:o,scalingFactor:n}=r,{principalOffsetPoint:c,focalLength:s,radialDistortionCoefficients:m,affineTransformations:f,tangentialDistortionCoefficients:l}=i;for(const p of t){const[t,r,u]=y(p,i,o,n),g=(e[0]*t+e[1]*r+e[2]*u)/(e[6]*t+e[7]*r+e[8]*u),h=(e[3]*t+e[4]*r+e[5]*u)/(e[6]*t+e[7]*r+e[8]*u),O=g**2+h**2;let d=0,x=0,M=0,b=0,R=0,j=0,F=0;m&&(d=m[0]??0,x=m[1]??0,M=m[2]??0),l&&(b=l[0],R=l[1]),c&&(j=c[0]??0,F=c[1]??0);const P=1+(d||0)*O+(x||0)*O*O+(M||0)*O*O*O;let z=g*P+(b||0)*(O+2*g**2)+2*(R||0)*g*h,L=h*P+(R||0)*(O+2*h**2)+2*(b||0)*g*h;z=-(s??0)*z+j,L=-(s??0)*L+F;const w=Number(f[0])+Number(f[1])*z+Number(f[2])*L,N=Number(f[3])+Number(f[4])*z+Number(f[5])*L;a.push({x:w,y:N})}}function g(t,a){const e=Array.isArray(t)||"items"in t?t:[t],r="string"==typeof a.cameraOrientation?c.getCameraOrientation(a.cameraOrientation):a.cameraOrientation,i=O({...a,cameraOrientation:r});let o=new f(a.cameraLocation);(o.spatialReference.isWGS84&&4!==r?.type||o.spatialReference.isGeographic)&&(o=n(o)),o.z||(o.z=a.cameraHeight);return{cameraOrientation:r,pointsToTransform:e,rotationMatrix:i,scalingFactor:d(o),cameraLocation:o}}function h(r,i,o,n){const{horizontalFieldOfView:c,verticalFieldOfView:s,cameraOrientation:m,cameraLocation:f,scalingFactor:l}=n,p=t(n.imageRotation??0),u=Math.sin(p),g=Math.cos(p),h=n.imageWidth||1,O=n.imageHeight||1,d=[Math.abs(g*h+u*O),Math.abs(g*O-u*h)],x={horizontal:1/(2*Math.tan(t(c)/2)),vertical:1/(2*Math.tan(t(s)/2))},M=a();M[0]=-x.horizontal,M[2]=.5,M[4]=x.vertical,M[5]=.5;const b=e(a(),o,M);for(const t of r){const[a,e,r]=y(t,m,f,l),o=(b[0]*a+b[1]*e+b[2]*r)/(b[6]*a+b[7]*e+b[8]*r),n=(b[3]*a+b[4]*e+b[5]*r)/(b[6]*a+b[7]*e+b[8]*r),c={x:o*d[0],y:n*d[1]};i.push({x:g*(c.x-d[0]/2)+u*(c.y-d[1]/2)+h/2,y:-u*(c.x-d[0]/2)+g*(c.y-d[1]/2)+O/2})}}function y(t,a,e,r){let i=new f(t);if(i.spatialReference.isGeographic)if(i.spatialReference.isWGS84&&4===a?.type){const{latitude:t,longitude:e,ellipsoidRadius:r,squaredEccentricity:o}=a;i=new f(s(i,[t,e,r,o]))}else i=n(i);const o=(i.z??0)-(e.z??0),c=(i.y-e.y)/r;return[(i.x-e.x)/r,c,o]}function O(t){const{cameraHeading:a,cameraPitch:e,cameraRoll:r,cameraOrientation:i}=t;if("OPK"===(i?.isAdvanced&&2===i.type?"OPK":"HPR")){const{omega:t,phi:a,kappa:e}=i;return m("OPK",[t,a,e])}return m("HPR",[a,e,r])}function d(t){return i(t?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t.y/r.radius))):1}export{d as getScalingFactor,l as worldToImage,p as worldToImageWithLTPFlag};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{getEffectiveEditingEnabled as s,getEffectiveLayerCapabilities as a}from"./layerUtils.js";let p=class extends t{constructor(e){super(e),this.layer=null}get attachments(){return{enabled:this._effectiveEnabled&&!!this._effectiveCapabilities?.data.supportsAttachment}}get create(){const{_effectiveCapabilities:e,layer:t}=this,r=this._createEnabled,i=!(!r||!e?.editing.supportsGeometryUpdate),s=t.capabilities?.operations.supportsAdd,a=!!e?.operations.supportsAdd;return{attachments:{enabled:r&&this.attachments.enabled},attributes:r,enabled:r,geometry:i,reliesOnOwnerAdminPrivileges:!s&&a}}get delete(){const{_effectiveCapabilities:e,layer:t}=this,r=t.capabilities?.operations.supportsDelete,i=!!e?.operations.supportsDelete;return{enabled:this._effectiveEnabled&&!!e?.operations.supportsDelete,reliesOnOwnerAdminPrivileges:!r&&i}}get reliesOnOwnerAdminPrivileges(){return this._effectiveEnabled&&!this.layer.editingEnabled||this.create.reliesOnOwnerAdminPrivileges||this.update.reliesOnOwnerAdminPrivileges||this.delete.reliesOnOwnerAdminPrivileges}get update(){const{_effectiveCapabilities:e,layer:t}=this,r=this._updateEnabled,i=!(!r||!e?.editing.supportsGeometryUpdate),s=t.capabilities?.operations.supportsUpdate,a=!!e?.operations.supportsUpdate,p=this.attachments.enabled,n=p&&this._canCreateOrUpdate;return{attachments:{enabled:p,create:n,update:n},attributes:r,enabled:r,geometry:i,reliesOnOwnerAdminPrivileges:!s&&a}}get _createEnabled(){return this._effectiveEnabled&&!!this._effectiveCapabilities?.operations.supportsAdd}get _updateEnabled(){return this._effectiveEnabled&&!!this._effectiveCapabilities?.operations.supportsUpdate}get _canCreateOrUpdate(){return!(!this._createEnabled&&!this._updateEnabled)}get _effectiveEnabled(){return s(this.layer)}get _effectiveCapabilities(){return a(this.layer)}};e([r()],p.prototype,"attachments",null),e([r()],p.prototype,"create",null),e([r()],p.prototype,"delete",null),e([r()],p.prototype,"layer",void 0),e([r()],p.prototype,"reliesOnOwnerAdminPrivileges",null),e([r()],p.prototype,"update",null),e([r()],p.prototype,"_createEnabled",null),e([r()],p.prototype,"_updateEnabled",null),e([r()],p.prototype,"_canCreateOrUpdate",null),e([r()],p.prototype,"_effectiveEnabled",null),e([r()],p.prototype,"_effectiveCapabilities",null),p=e([i("esri.layers.support.EditingCapabilities")],p);const n=p;export{n as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{getEffectiveEditingEnabled as s,getEffectiveLayerCapabilities as a}from"./layerUtils.js";let n=class extends t{constructor(e){super(e),this.layer=null}get attachments(){return{enabled:this._effectiveEnabled&&!!this._effectiveCapabilities?.data.supportsAttachment}}get create(){const{_effectiveCapabilities:e,layer:t}=this,r=this._createEnabled,i=r,s=t.capabilities?.operations.supportsAdd,a=!!e?.operations.supportsAdd;return{attachments:{enabled:r&&this.attachments.enabled},attributes:r,enabled:r,geometry:i,reliesOnOwnerAdminPrivileges:!s&&a}}get delete(){const{_effectiveCapabilities:e,layer:t}=this,r=t.capabilities?.operations.supportsDelete,i=!!e?.operations.supportsDelete;return{enabled:this._effectiveEnabled&&!!e?.operations.supportsDelete,reliesOnOwnerAdminPrivileges:!r&&i}}get reliesOnOwnerAdminPrivileges(){return this._effectiveEnabled&&!this.layer.editingEnabled||this.create.reliesOnOwnerAdminPrivileges||this.update.reliesOnOwnerAdminPrivileges||this.delete.reliesOnOwnerAdminPrivileges}get update(){const{_effectiveCapabilities:e,layer:t}=this,r=this._updateEnabled,i=!(!r||!e?.editing.supportsGeometryUpdate),s=t.capabilities?.operations.supportsUpdate,a=!!e?.operations.supportsUpdate,n=this.attachments.enabled,p=n&&this._canCreateOrUpdate;return{attachments:{enabled:n,create:p,update:p},attributes:r,enabled:r,geometry:i,reliesOnOwnerAdminPrivileges:!s&&a}}get _createEnabled(){return this._effectiveEnabled&&!!this._effectiveCapabilities?.operations.supportsAdd}get _updateEnabled(){return this._effectiveEnabled&&!!this._effectiveCapabilities?.operations.supportsUpdate}get _canCreateOrUpdate(){return!(!this._createEnabled&&!this._updateEnabled)}get _effectiveEnabled(){return s(this.layer)}get _effectiveCapabilities(){return a(this.layer)}};e([r()],n.prototype,"attachments",null),e([r()],n.prototype,"create",null),e([r()],n.prototype,"delete",null),e([r()],n.prototype,"layer",void 0),e([r()],n.prototype,"reliesOnOwnerAdminPrivileges",null),e([r()],n.prototype,"update",null),e([r()],n.prototype,"_createEnabled",null),e([r()],n.prototype,"_updateEnabled",null),e([r()],n.prototype,"_canCreateOrUpdate",null),e([r()],n.prototype,"_effectiveEnabled",null),e([r()],n.prototype,"_effectiveCapabilities",null),n=e([i("esri.layers.support.EditingCapabilities")],n);const p=n;export{p as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Logger.js";import{equals as r}from"../../geometry/support/spatialReferenceUtils.js";import{getMimeTypeFormatId as t,getFilenameFormatId as i}from"./infoFor3D.js";import{getEffectiveLayerCapabilities as s,getEffectiveEditingEnabled as a}from"./layerUtils.js";function o(e){return!(!(e&&"object"==typeof e&&"loaded"in e&&e.loaded&&s(e)?.operations?.supportsEditing&&"type"in e)||"editingEnabled"in e&&!a(e)||"scene"===e.type&&!n(e))}function n(s){const{associatedLayer:a}=s,o=a?.infoFor3D;if(!!!o)return!0;const{supportedFormats:n,queryFormats:l}=o,d=t("model/gltf-binary",n)??i("glb",n);if(!(null!=d&&l.includes(d)))return e.getLogger("esri.layers.support.editableLayers").warnOnce(`SceneLayer (${s.title??"Untitled layer"}, ${s.id}) is not editable because it does not support GLB queries.`),!1;const c=s.spatialReference,p=a.spatialReference;if(!r(c,p))return e.getLogger("esri.layers.support.editableLayers").warnOnce(`SceneLayer (${s.title??"Untitled layer"}, ${s.id}) is not editable because its spatial reference (wkid:${c.wkid}) is different from its associated FeatureLayer's spatial reference (wkid:${p.wkid}).`),!1;const f=a.sourceJSON.sourceSpatialReference;return!(null!=f&&!r(f,p))||(e.getLogger("esri.layers.support.editableLayers").warnOnce(`SceneLayer (${s.title??"Untitled layer"}, ${s.id}) is not editable because the spatial reference of its associated FeatureLayer's service (wkid:${p.wkid}) is different from its source spatial reference (wkid:${f.wkid}).`),!1)}export{o as isEditableLayer};
5
+ import{getEffectiveLayerCapabilities as t,getEffectiveEditingEnabled as e}from"./layerUtils.js";function i(i){return!(!(i&&"object"==typeof i&&"loaded"in i&&i.loaded&&t(i)?.operations?.supportsEditing&&"type"in i)||"editingEnabled"in i&&!e(i))}export{i as isEditableLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{id as e}from"../../kernel.js";import t from"../../request.js";function n(e){return l(e)||o(e)}function r(e){return null!=e&&"object"==typeof e&&"type"in e&&"feature"===e.type}function i(e){return null!=e&&"object"==typeof e&&"type"in e&&"graphics"===e.type}function u(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-notes"===e.type&&"sublayers"in e}function s(e){return null!=e&&"object"==typeof e&&"type"in e&&"knowledge-graph"===e.type&&"layers"in e}function a(e){return null!=e&&"object"==typeof e&&"type"in e&&"link-chart"===e.type&&"layers"in e}function o(e){return"scene"===e?.type}function c(e){return null!=e&&"object"==typeof e&&"type"in e&&"subtype-group"===e.type&&"sublayers"in e}function l(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function f(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function y(e){return null!=e&&"type"in e&&"group"===e.type}const p={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function g(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function d(e){return"IntegratedMeshLayer"===e||"IntegratedMesh3DTilesLayer"===e}function b(e){return"integrated-mesh"===e||"integrated-mesh-3dtiles"===e}function m(e){return"voxel"===e?.type}function h(e){return"imagery-tile"===e?.type}function v(e){return null!=e?.parent&&"declaredClass"in e.parent&&"esri.Basemap"===e.parent.declaredClass&&e.parent.baseLayers.includes(e)}function j(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function w(e){return("feature"===e?.type||"subtype-group"===e?.type)&&"feature-layer"===e.source?.type}function L(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}function E(e){const t=/[:;]/,n=[];let r=!1;if(e&&(e.forEach(((e,i)=>{n.push([i,e]),!r&&t.test(e)&&(r=!0)})),n.length>0)){let e;if(r){const t={};n.forEach((e=>{t[e[0]]=e[1]})),e=JSON.stringify(t)}else{const t=[];n.forEach((e=>{t.push(e[0]+":"+e[1])})),e=t.join(";")}return e}return null}function S(e){if(!e)return;const t=[];return e.forEach(((e,n)=>{t.push('"'+n+'":'+JSON.stringify(e))})),t.length?"{"+t.join(",")+"}":void 0}function C(e){if(e.activeLayer){const t=e.activeLayer.tileMatrixSet;if(t)return t;const n=e.activeLayer.tileMatrixSets;if(n)return n}return null}async function M(n,r){const i=e?.findServerInfo(n);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const u=n.toLowerCase().indexOf("/rest/services");if(-1===u)return null;const s=`${n.substring(0,u)}/rest/info`,a=null!=r?r.signal:null,{data:o}=await t(s,{query:{f:"json"},responseType:"json",signal:a});return o?.owningSystemUrl||null}function x(e){if(!("capabilities"in e))return!1;switch(e.type){case"catalog":case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function I(e){return null!=e&&"object"==typeof e&&"isTable"in e&&!!e.isTable}function k(e){return x(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function O(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}function T(e){return!!O(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}export{T as getEffectiveEditingEnabled,k as getEffectiveLayerCapabilities,M as getOwningPortalUrl,C as getTileMaxtrixSetFromActiveLayer,v as isBaseLayer,n as isBasemap3DSupportedLayer,l as isBasemapSupportedTiledLayer,j as isFeatureCollectionLayer,r as isFeatureLayer,L as isFeatureServiceLayer,i as isGraphicsLayer,y as isGroupLayer,h as isImageryTileLayer,b as isIntegratedMeshLayer,d as isIntegratedMeshOperationalLayer,s as isKnowledgeGraphLayer,w as isLayerWithFeatureLayerSource,a as isLinkChartLayer,u as isMapNotesLayer,o as isSceneLayer,g as isSceneServiceLayer,c as isSubtypeGroupLayer,I as isTable,f as isTiledLayer,m as isVoxelLayer,p as sceneServiceLayerTypeToClassName,E as serializeLayerDefinitions,S as serializeTimeOptions};
5
+ import{id as e}from"../../kernel.js";import t from"../../request.js";function n(e){return f(e)||o(e)}function r(e){return null!=e&&"object"==typeof e&&"type"in e&&"feature"===e.type}function i(e){return null!=e&&"object"==typeof e&&"type"in e&&"graphics"===e.type}function u(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-notes"===e.type&&"sublayers"in e}function s(e){return null!=e&&"object"==typeof e&&"type"in e&&"knowledge-graph"===e.type&&"layers"in e}function a(e){return null!=e&&"object"==typeof e&&"type"in e&&"link-chart"===e.type&&"layers"in e}function o(e){return"scene"===e?.type}function c(e){return null!=e&&"object"==typeof e&&"type"in e&&"subtype-group"===e.type&&"sublayers"in e}function l(e){return"subtype-sublayer"===e?.type}function f(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function y(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function p(e){return null!=e&&"type"in e&&"group"===e.type}const g={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function b(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function d(e){return"IntegratedMeshLayer"===e||"IntegratedMesh3DTilesLayer"===e}function m(e){return"integrated-mesh"===e||"integrated-mesh-3dtiles"===e}function h(e){return"voxel"===e?.type}function v(e){return"imagery-tile"===e?.type}function j(e){return null!=e?.parent&&"declaredClass"in e.parent&&"esri.Basemap"===e.parent.declaredClass&&e.parent.baseLayers.includes(e)}function w(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function L(e){return("feature"===e?.type||"subtype-group"===e?.type)&&"feature-layer"===e.source?.type}function E(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}function S(e){const t=/[:;]/,n=[];let r=!1;if(e&&(e.forEach(((e,i)=>{n.push([i,e]),!r&&t.test(e)&&(r=!0)})),n.length>0)){let e;if(r){const t={};n.forEach((e=>{t[e[0]]=e[1]})),e=JSON.stringify(t)}else{const t=[];n.forEach((e=>{t.push(e[0]+":"+e[1])})),e=t.join(";")}return e}return null}function C(e){if(!e)return;const t=[];return e.forEach(((e,n)=>{t.push('"'+n+'":'+JSON.stringify(e))})),t.length?"{"+t.join(",")+"}":void 0}function M(e){if(e.activeLayer){const t=e.activeLayer.tileMatrixSet;if(t)return t;const n=e.activeLayer.tileMatrixSets;if(n)return n}return null}async function x(n,r){const i=e?.findServerInfo(n);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const u=n.toLowerCase().indexOf("/rest/services");if(-1===u)return null;const s=`${n.substring(0,u)}/rest/info`,a=null!=r?r.signal:null,{data:o}=await t(s,{query:{f:"json"},responseType:"json",signal:a});return o?.owningSystemUrl||null}function I(e){if(!("capabilities"in e))return!1;switch(e.type){case"catalog":case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function k(e){return null!=e&&"object"==typeof e&&"isTable"in e&&!!e.isTable}function O(e){return I(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function T(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}function B(e){return!!T(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}export{B as getEffectiveEditingEnabled,O as getEffectiveLayerCapabilities,x as getOwningPortalUrl,M as getTileMaxtrixSetFromActiveLayer,j as isBaseLayer,n as isBasemap3DSupportedLayer,f as isBasemapSupportedTiledLayer,w as isFeatureCollectionLayer,r as isFeatureLayer,E as isFeatureServiceLayer,i as isGraphicsLayer,p as isGroupLayer,v as isImageryTileLayer,m as isIntegratedMeshLayer,d as isIntegratedMeshOperationalLayer,s as isKnowledgeGraphLayer,L as isLayerWithFeatureLayerSource,a as isLinkChartLayer,u as isMapNotesLayer,o as isSceneLayer,b as isSceneServiceLayer,c as isSubtypeGroupLayer,l as isSubtypeSublayer,k as isTable,y as isTiledLayer,h as isVoxelLayer,g as sceneServiceLayerTypeToClassName,S as serializeLayerDefinitions,C as serializeTimeOptions};