@arcgis/core 5.2.0-next.47 → 5.2.0-next.49

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 (317) hide show
  1. package/applications/Components/OrientedImageryViewer/PanoramicViewer/utils.d.ts +33 -0
  2. package/applications/Components/OrientedImageryViewer/PanoramicViewer/utils.js +2 -0
  3. package/arcgisGlobal.d.ts +2 -0
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/003a87b16f8a4b476e14.js +1 -0
  6. package/assets/esri/core/workers/chunks/031ccf2e1583beebdf24.js +1 -0
  7. package/assets/esri/core/workers/chunks/0474af7687466d8befd2.js +1 -0
  8. package/assets/esri/core/workers/chunks/{2a4868acd546312aa6d8.js → 05f6887805d92da03122.js} +1 -1
  9. package/assets/esri/core/workers/chunks/069b6d8bdb34ee88d437.js +1 -0
  10. package/assets/esri/core/workers/chunks/{f9b2727b41943d83d4ca.js → 0a413d917f3d19440fc1.js} +1 -1
  11. package/assets/esri/core/workers/chunks/0b2ca406761c63529a6a.js +1 -0
  12. package/assets/esri/core/workers/chunks/{68f7eaa3122de7c00adb.js → 0ea374f7b16745b9bbc7.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{c369d4266f38e9ea6592.js → 1119a33245138e7b3914.js} +1 -1
  14. package/assets/esri/core/workers/chunks/12e0c5b7cc5c3f9e6f0f.js +1 -0
  15. package/assets/esri/core/workers/chunks/172571397c66f992d08c.js +1 -0
  16. package/assets/esri/core/workers/chunks/18edf2846d7546285e5e.js +1 -0
  17. package/assets/esri/core/workers/chunks/1b0557fcb058fc450230.js +1 -0
  18. package/assets/esri/core/workers/chunks/{98f575c038da74ced2a6.js → 1bc45872d22d61dbd7d1.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{835643f716f7058a2722.js → 1cf8fb704c48ac3d3b15.js} +1 -1
  20. package/assets/esri/core/workers/chunks/25cb56c3b538d00e7693.js +1 -0
  21. package/assets/esri/core/workers/chunks/{4d4710d57c72ec75cccc.js → 26f1fd3f2be5102aae1d.js} +1 -1
  22. package/assets/esri/core/workers/chunks/285a5bd708f0fe1c620c.js +1 -0
  23. package/assets/esri/core/workers/chunks/{7777a79f26a06a6c5240.js → 304a22c580ce103480cb.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{383392c63202ac044b6c.js → 33bd9785bd0b6ccef21b.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{2c0d92c0e3511775401a.js → 35cbf00f0c37a86517af.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{0f19bc532be24ca64755.js → 36fe6adf6517d8f80125.js} +1 -1
  27. package/assets/esri/core/workers/chunks/382d9491c2a56c1925fe.js +1 -0
  28. package/assets/esri/core/workers/chunks/3af2b9d6d5466cb2b957.js +256 -0
  29. package/assets/esri/core/workers/chunks/{b3cd17daf5a297b96705.js → 3bc2943035391b44d4cf.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{d36f17d32c654b1ac7fa.js → 3f1a7f8a9ead64bf0b7b.js} +1 -1
  31. package/assets/esri/core/workers/chunks/40f7bb0ebd918d76f078.js +1 -0
  32. package/assets/esri/core/workers/chunks/43b39abd49c4a8ce891f.js +1 -0
  33. package/assets/esri/core/workers/chunks/{821176ee3be724621bb0.js → 461c2de938bf4c9b1442.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{cc637aec16918052548e.js → 47af3525396f890f2a6b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/4ee7232ea41fa41c5ed4.js +29 -0
  36. package/assets/esri/core/workers/chunks/4ee900e5dbb130fa0c7b.js +1 -0
  37. package/assets/esri/core/workers/chunks/50674ba5f24129d61d89.js +1 -0
  38. package/assets/esri/core/workers/chunks/547a2fe53139f705f95e.js +1 -0
  39. package/assets/esri/core/workers/chunks/5ce09c4d06e98b1e9251.js +1 -0
  40. package/assets/esri/core/workers/chunks/5dbd28fce73751d2d1aa.js +1 -0
  41. package/assets/esri/core/workers/chunks/5ec8b02e097cf6718462.js +1 -0
  42. package/assets/esri/core/workers/chunks/5f54d927dc77e92cf145.js +1 -0
  43. package/assets/esri/core/workers/chunks/63e3d338751240479335.js +1 -0
  44. package/assets/esri/core/workers/chunks/69b9a327f23e052fced7.js +1 -0
  45. package/assets/esri/core/workers/chunks/6c2b5087a9df65267f4e.js +1 -0
  46. package/assets/esri/core/workers/chunks/6ccd5fa5e35dc70fcd5d.js +1 -0
  47. package/assets/esri/core/workers/chunks/6e520ef645c5edcd499a.js +1 -0
  48. package/assets/esri/core/workers/chunks/7659391f952d134164cf.js +1 -0
  49. package/assets/esri/core/workers/chunks/78add8e6b54b51eaa299.js +1 -0
  50. package/assets/esri/core/workers/chunks/{2b669473aa2c7cfb63c7.js → 7b0ed52363704cfce129.js} +1 -1
  51. package/assets/esri/core/workers/chunks/7b61f56d0f766421eaef.js +1 -0
  52. package/assets/esri/core/workers/chunks/7f2f2a92dce3f68e579b.js +1 -0
  53. package/assets/esri/core/workers/chunks/801a664f21e0218bc705.js +1 -0
  54. package/assets/esri/core/workers/chunks/{8f9fb4e8a7d73db41664.js → 851bcc75acac4a2f199b.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{6010b7be978698a642d0.js → 8977c85aecc7e08ab13c.js} +1 -1
  56. package/assets/esri/core/workers/chunks/8c5726c7ce40a92901e6.js +1 -0
  57. package/assets/esri/core/workers/chunks/8d21e2dabc5165f1c8ca.js +1 -0
  58. package/assets/esri/core/workers/chunks/9008090a5d8431ddfa22.js +1 -0
  59. package/assets/esri/core/workers/chunks/{f2adf1227a795604d3b8.js → 90ae80b797642bff0efa.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{71ce1009dadcae8f8094.js → 95b3b8fe45ef4ac6b277.js} +1 -1
  61. package/assets/esri/core/workers/chunks/96cec8a02ca96175d602.js +1 -0
  62. package/assets/esri/core/workers/chunks/99eccf9ce53582cfa5b5.js +1 -0
  63. package/assets/esri/core/workers/chunks/9b7cb96acea388d86fa4.js +1 -0
  64. package/assets/esri/core/workers/chunks/{dee4019338a79c1ecd26.js → 9d0a9d465ec3a8ba1ed2.js} +1 -1
  65. package/assets/esri/core/workers/chunks/9e474465d069cb9e94f5.js +1 -0
  66. package/assets/esri/core/workers/chunks/aa3abc07de2921ef6ca1.js +1 -0
  67. package/assets/esri/core/workers/chunks/{ae9f9e975d7a9d442fa5.js → ab5aa4280ed0cb7fcbe9.js} +1 -1
  68. package/assets/esri/core/workers/chunks/b03f09ee2224f0cc526a.js +1 -0
  69. package/assets/esri/core/workers/chunks/{ee58f4bbc0a1f7d03df0.js → b32ede7805c7c6644e4c.js} +1 -1
  70. package/assets/esri/core/workers/chunks/b49952541d189b4b9f7e.js +1 -0
  71. package/assets/esri/core/workers/chunks/b8bdacebd4d24ba90f3f.js +1 -0
  72. package/assets/esri/core/workers/chunks/{85cd0cd721b27c497b18.js → baac90da0703891d59c4.js} +1 -1
  73. package/assets/esri/core/workers/chunks/bb552089b34d6811fb03.js +1 -0
  74. package/assets/esri/core/workers/chunks/cd1f1a72483b7c80bd9a.js +1 -0
  75. package/assets/esri/core/workers/chunks/{744f34e379484e63277c.js → cdb331b58e22f8c1c988.js} +2 -2
  76. package/assets/esri/core/workers/chunks/{b23d1e10fc4161d1f3eb.js → d021775cf747556660a5.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{728ea88e7d4733230e1f.js → d1af0bd611a3dc549858.js} +85 -81
  78. package/assets/esri/core/workers/chunks/d2cb3d5ef0a9285afb78.js +1 -0
  79. package/assets/esri/core/workers/chunks/d49e42f36bc3dc256b9f.js +1 -0
  80. package/assets/esri/core/workers/chunks/d560ed96dde5ca3a5583.js +1 -0
  81. package/assets/esri/core/workers/chunks/dc1787d88b11ed985159.js +1 -0
  82. package/assets/esri/core/workers/chunks/{399e23d777a043efa9f1.js → dd95f50dac3f33cdb6d2.js} +1 -1
  83. package/assets/esri/core/workers/chunks/ddb92c815d17c67a45e6.js +1 -0
  84. package/assets/esri/core/workers/chunks/{7c2784ebbe17d79f669c.js → de50a19944617cd426b8.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{52efa4ded11c1e71f04f.js → e2e2162adbfb9b46bede.js} +1 -1
  86. package/assets/esri/core/workers/chunks/e4353f0792f45aa6a62f.js +1 -0
  87. package/assets/esri/core/workers/chunks/eac8cae89da9ce2f4946.js +1 -0
  88. package/assets/esri/core/workers/chunks/edf87407dd20685c82ab.js +1 -0
  89. package/assets/esri/core/workers/chunks/ee7c8a7f384ea6393487.js +705 -0
  90. package/assets/esri/core/workers/chunks/f1299b4fc760ccca1518.js +1 -0
  91. package/assets/esri/core/workers/chunks/f244632f7934a4b72c91.js +1 -0
  92. package/assets/esri/core/workers/chunks/fc639c730115e07a4a1a.js +1 -0
  93. package/assets/esri/libs/basisu/basis_encoder.wasm +0 -0
  94. package/assets/esri/libs/basisu/basis_transcoder.wasm +0 -0
  95. package/assets/esri/libs/dxtEncoder/dxt_encoder.wasm +0 -0
  96. package/chunks/Component.glsl.js +104 -67
  97. package/chunks/DefaultMaterial.glsl.js +1 -1
  98. package/chunks/LineMarker.glsl.js +31 -31
  99. package/chunks/RibbonLine.glsl.js +60 -49
  100. package/chunks/basis_encoder.js +1 -1
  101. package/chunks/basis_transcoder.js +1 -1
  102. package/chunks/dxt_encoder.js +1 -1
  103. package/chunks/vec3.js +1 -1
  104. package/config.js +1 -1
  105. package/core/has.js +1 -1
  106. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  107. package/core/promiseUtils.js +1 -1
  108. package/core/workers/workerFactory.js +1 -1
  109. package/geometry/Mesh.d.ts +4 -4
  110. package/geometry/support/MeshMaterialMetallicRoughness.d.ts +13 -1
  111. package/geometry/support/MeshMaterialMetallicRoughness.js +1 -1
  112. package/geometry/support/aaBoundingBox.js +1 -1
  113. package/geometry/support/buffer/math/vec3.js +1 -1
  114. package/geometry/support/frustum.js +1 -1
  115. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  116. package/geometry/support/meshUtils/extent.js +1 -1
  117. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  118. package/geometry/support/meshUtils/vertexSpaceConversion.js +1 -1
  119. package/geometry/support/meshUtils.d.ts +33 -5
  120. package/geometry/support/plane.js +1 -1
  121. package/kernel.js +1 -1
  122. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  123. package/layers/orientedImagery/transformations/utils.js +1 -1
  124. package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
  125. package/layers/raster/formats/JpgPlus.js +1 -1
  126. package/layers/raster/formats/RasterCodec.js +1 -1
  127. package/layers/raster/formats/TiffDecoder.js +1 -1
  128. package/layers/raster/formats/Zlib.js +2 -0
  129. package/package.json +2 -2
  130. package/rest/featureService/FeatureService.d.ts +74 -1
  131. package/rest/featureService/FeatureService.js +1 -1
  132. package/support/revision.js +1 -1
  133. package/symbols/ObjectSymbol3DLayer.d.ts +10 -8
  134. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  135. package/symbols/cim/CIMSymbolHelper.js +1 -1
  136. package/symbols/cim/TextRasterizer.js +1 -1
  137. package/symbols/cim/cimAnalyzer.js +1 -1
  138. package/symbols/cim/richTextUtils.js +2 -0
  139. package/symbols/support/ObjectSymbol3DLayerResource.d.ts +9 -4
  140. package/views/2d/analysis/AreaMeasurement/AreaMeasurementAreaVisualization.js +1 -1
  141. package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
  142. package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementTool.js +1 -1
  143. package/views/2d/engine/webgl/TextureManager.js +1 -1
  144. package/views/2d/engine/webgl/definitions.js +1 -1
  145. package/views/2d/engine/webgl/mesh/MultiTileMeshData.js +1 -1
  146. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  147. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  148. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  149. package/views/2d/engine/webgl/util/DimensionMatcher.js +1 -1
  150. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  151. package/views/2d/layers/features/Processor.js +1 -1
  152. package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
  153. package/views/2d/layers/features/processor/AggregateStrategy.js +2 -0
  154. package/views/2d/layers/features/processor/bins/BinAdapter.js +2 -0
  155. package/views/2d/layers/features/processor/bins/BinLevelState.js +2 -0
  156. package/views/2d/layers/features/processor/bins/BinState.js +2 -0
  157. package/views/2d/layers/features/processor/bins/createBinningStrategy.js +2 -0
  158. package/views/2d/layers/features/processor/clusters/ClusterAdapter.js +2 -0
  159. package/views/2d/layers/features/processor/clusters/ClusterLevelState.js +2 -0
  160. package/views/2d/layers/features/processor/clusters/ClusterSendState.js +2 -0
  161. package/views/2d/layers/features/processor/clusters/createClusterStrategy.js +2 -0
  162. package/views/2d/layers/features/processor/createAggregateStrategy.js +2 -0
  163. package/views/2d/layers/features/processor/tracks/Track.js +2 -0
  164. package/views/2d/layers/features/processor/tracks/TrackAdapter.js +2 -0
  165. package/views/2d/layers/features/processor/tracks/TrackLevelState.js +2 -0
  166. package/views/2d/layers/features/processor/tracks/TrackSendState.js +2 -0
  167. package/views/2d/layers/features/processor/tracks/createTrackStrategy.js +2 -0
  168. package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
  169. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  170. package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
  171. package/views/2d/layers/support/annodime/dimensionUtils.js +1 -1
  172. package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
  173. package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
  174. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  175. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  176. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  177. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  178. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  179. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  180. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  181. package/views/3d/focusAreaUtils.js +1 -1
  182. package/views/3d/glTF/LoaderResult.js +1 -1
  183. package/views/3d/glTF/internal/Resource.js +1 -1
  184. package/views/3d/glTF/loader.js +1 -1
  185. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  186. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  187. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  188. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  189. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  190. package/views/3d/layers/i3s/meshUtils.js +1 -1
  191. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  192. package/views/3d/webgl/RenderCamera.js +1 -1
  193. package/views/3d/webgl/RenderNode.js +1 -1
  194. package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
  195. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  196. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +2 -2
  197. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +2 -2
  198. package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +36 -25
  199. package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js +19 -20
  200. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +17 -10
  201. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  202. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  203. package/views/3d/webgl-engine/lib/NavigationDepthCache.js +1 -1
  204. package/views/3d/webgl-engine/lib/NavigationDepthCacheStore.js +2 -0
  205. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  206. package/views/3d/webgl-engine/lib/PolygonIntersections2D.js +1 -1
  207. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  208. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  209. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  210. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  211. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  212. package/views/3d/webgl-engine/lib/lodRendering/LodLevel.js +1 -1
  213. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  214. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  215. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  216. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  217. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  218. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  219. package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +8 -5
  220. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  221. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  222. package/views/3d/webgl-engine/shaders/RibbonLineLayouts.js +1 -1
  223. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  224. package/views/3d/webgl-engine/shaders/RibbonLineTextureBuffer.glsl.js +1 -1
  225. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  226. package/views/PopupView.js +1 -1
  227. package/views/SceneView.js +1 -1
  228. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  229. package/views/interactive/snapping/SnappingAlgorithm.js +1 -1
  230. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  231. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
  232. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  233. package/views/selection/SelectionOperation.js +1 -1
  234. package/views/support/AnalysisViewManager.js +1 -1
  235. package/views/support/DefaultsFromMap.js +1 -1
  236. package/views/support/LayerViewManager.js +1 -1
  237. package/views/support/TextureCompressionWorker.js +1 -1
  238. package/views/webgl/RenderingContext.js +1 -1
  239. package/widgets/Editor.js +1 -1
  240. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  241. package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
  242. package/widgets/OrientedImageryViewer/support/superimposeUtils.js +1 -1
  243. package/widgets/PanoramicViewer/support/PanoramicTileNode.d.ts +63 -0
  244. package/widgets/PanoramicViewer/support/PanoramicTileNode.js +1 -1
  245. package/widgets/PanoramicViewer/support/PanoramicTilePyramid.d.ts +66 -0
  246. package/widgets/PanoramicViewer/support/PanoramicTilePyramid.js +1 -1
  247. package/widgets/PanoramicViewer/utils.js +1 -1
  248. package/widgets/Sketch/VisibleElements.d.ts +0 -10
  249. package/widgets/Sketch.js +1 -1
  250. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  251. package/widgets/support/SelectionToolbar.js +1 -1
  252. package/widgets/support/Selector3D/selectorUtils.js +2 -0
  253. package/assets/esri/core/workers/chunks/0115681a3de6df0aebdf.js +0 -1
  254. package/assets/esri/core/workers/chunks/025caafc70ac26f0a4ed.js +0 -1
  255. package/assets/esri/core/workers/chunks/08e18fb12533fc76e49c.js +0 -1
  256. package/assets/esri/core/workers/chunks/0e64e20fedfe01a1985f.js +0 -1
  257. package/assets/esri/core/workers/chunks/0f674c625f24ac73e25a.js +0 -1
  258. package/assets/esri/core/workers/chunks/15351354afcbf840a23d.js +0 -29
  259. package/assets/esri/core/workers/chunks/176c5eaaa23a479c88e0.js +0 -1
  260. package/assets/esri/core/workers/chunks/1d1f5578c7d8619f7a46.js +0 -1
  261. package/assets/esri/core/workers/chunks/1f118d85d8271ad7690b.js +0 -1
  262. package/assets/esri/core/workers/chunks/2015f4def2ef201bdab8.js +0 -1
  263. package/assets/esri/core/workers/chunks/268637fd6c50264acfc3.js +0 -1
  264. package/assets/esri/core/workers/chunks/272c8ab189217240d05f.js +0 -1
  265. package/assets/esri/core/workers/chunks/296fa9fb80e521c30cb1.js +0 -1
  266. package/assets/esri/core/workers/chunks/354199a41de44902de84.js +0 -1
  267. package/assets/esri/core/workers/chunks/384b619854ef8a3f6e94.js +0 -1
  268. package/assets/esri/core/workers/chunks/3af923abeb6e65c4468f.js +0 -1
  269. package/assets/esri/core/workers/chunks/46d3ddf62fa7a76dd57d.js +0 -1
  270. package/assets/esri/core/workers/chunks/4b24f72b56edc28bb15e.js +0 -1
  271. package/assets/esri/core/workers/chunks/4f09f208ece2ec1db727.js +0 -1
  272. package/assets/esri/core/workers/chunks/57374213084bef59b776.js +0 -1
  273. package/assets/esri/core/workers/chunks/5f9c4dad6952c4c58ebf.js +0 -1
  274. package/assets/esri/core/workers/chunks/706230b70a36d2e038f7.js +0 -1
  275. package/assets/esri/core/workers/chunks/7cc729b57a6a52c8ac68.js +0 -1
  276. package/assets/esri/core/workers/chunks/8026cc0065f6520c4161.js +0 -1
  277. package/assets/esri/core/workers/chunks/804ab5f614efa12a131b.js +0 -1
  278. package/assets/esri/core/workers/chunks/81d55594cee124040565.js +0 -1
  279. package/assets/esri/core/workers/chunks/8d21f3d6edbcd7b335d0.js +0 -1
  280. package/assets/esri/core/workers/chunks/8d90bef1091204fba0f1.js +0 -1
  281. package/assets/esri/core/workers/chunks/8ec5e470583b75fceae1.js +0 -1
  282. package/assets/esri/core/workers/chunks/9114a575b78a7ea18d0f.js +0 -1
  283. package/assets/esri/core/workers/chunks/93e705c1147cc8ceca02.js +0 -1
  284. package/assets/esri/core/workers/chunks/9a97f6cda2f36941efae.js +0 -1
  285. package/assets/esri/core/workers/chunks/9ceeae787dc7c194d60e.js +0 -1
  286. package/assets/esri/core/workers/chunks/a8033e606b2db1ee332d.js +0 -1
  287. package/assets/esri/core/workers/chunks/a90f7b1c6c69b6033b4c.js +0 -1
  288. package/assets/esri/core/workers/chunks/a9c641bcdef161c754bf.js +0 -1
  289. package/assets/esri/core/workers/chunks/ad5c2b0de6713d0a93a4.js +0 -680
  290. package/assets/esri/core/workers/chunks/ae50b2d5e63f62c088d2.js +0 -1
  291. package/assets/esri/core/workers/chunks/aea247138617e12b699b.js +0 -1
  292. package/assets/esri/core/workers/chunks/b03dcf3d55266745f3d1.js +0 -1
  293. package/assets/esri/core/workers/chunks/b32bdf5730953c2fb16b.js +0 -1
  294. package/assets/esri/core/workers/chunks/bf287f0e2ecb4532dc00.js +0 -1
  295. package/assets/esri/core/workers/chunks/c01a121ebe571a848452.js +0 -1
  296. package/assets/esri/core/workers/chunks/c3cd38ca8690286d40d7.js +0 -1
  297. package/assets/esri/core/workers/chunks/c4b13124a9cfc78c42a6.js +0 -261
  298. package/assets/esri/core/workers/chunks/c5e36544b2d1792e4c5f.js +0 -1
  299. package/assets/esri/core/workers/chunks/c6042825f61cd70d54d8.js +0 -1
  300. package/assets/esri/core/workers/chunks/cba3316910ff088f4d77.js +0 -1
  301. package/assets/esri/core/workers/chunks/d8b67ca02cdc1e8191e3.js +0 -1
  302. package/assets/esri/core/workers/chunks/dadefe369f49e89a2610.js +0 -1
  303. package/assets/esri/core/workers/chunks/db416ba3132034e20642.js +0 -1
  304. package/assets/esri/core/workers/chunks/de9573871f64c01e9f01.js +0 -1
  305. package/assets/esri/core/workers/chunks/dfbdc72c7ea137e3841d.js +0 -1
  306. package/assets/esri/core/workers/chunks/e3e966777f18164afcd8.js +0 -1
  307. package/assets/esri/core/workers/chunks/e9c48630757bea465b7e.js +0 -1
  308. package/assets/esri/core/workers/chunks/f2c8122d31aedc2604ee.js +0 -1
  309. package/assets/esri/core/workers/chunks/f8f0de841be17cd05c8f.js +0 -1
  310. package/assets/esri/core/workers/chunks/ff089723a27859fe18d1.js +0 -1
  311. package/chunks/Zlib.js +0 -2
  312. package/views/2d/layers/features/processor/AAggregateStrategy.js +0 -2
  313. package/views/2d/layers/features/processor/BinningStrategy.js +0 -2
  314. package/views/2d/layers/features/processor/ClusterStrategy.js +0 -2
  315. package/views/2d/layers/features/processor/TrackStrategy.js +0 -2
  316. package/views/3d/analysis/Viewshed/ViewshedTool2.js +0 -2
  317. /package/assets/esri/core/workers/chunks/{744f34e379484e63277c.js.LICENSE.txt → cdb331b58e22f8c1c988.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"../../../../../core/has.js";import{OverrideHelper as e}from"../../../../../symbols/cim/OverrideHelper.js";import{FeatureMatcher as t}from"./Matcher.js";import{createDebugWriters as r}from"../../../layers/support/annodime/debugUtils.js";import s from"../../../layers/support/annodime/DimensionInfo.js";import{dimensionSymbols as i}from"../../../layers/support/annodime/dimensionSymbols.js";import{getFontForCIMTextSymbol as o,getFontNameForCIMTextSymbol as n}from"../../../layers/support/annodime/dimensionUtils.js";import{createDimensionMatcherFeatureInfo as a,mixFeature as m}from"../../../layers/support/annodime/MatcherGeometryOverride.js";import{createTileObjectId as c}from"../../../layers/support/annodime/TileObjectId.js";class h extends t{constructor(e,t){super(),this._context=e,this._schema=t,this._meshWriters=new Map,this._dimensionInfos=new Map,this._matcherGeometryOverrides=new Map,this._cachedGlyphsPerFont=new Map}static async fromDimensionSchema(e,t){return new h(e,t)}hasArcadeDependency(){return!1}doMatch(e,t,r){return this._meshWriters.get(c(r,e.getObjectId()))}async fetchResources(e,t,s,i){this._meshWriters.clear(),this._dimensionInfos.clear(),this._matcherGeometryOverrides.clear();const o=t.metadata.outSpatialReference,n=t.getCursor();for(;n.next();){const s=a(n);if(!s)continue;const h=m(n,s);if(!h)continue;const l=c(i,n.getObjectId()),y=this._readStyleId(n),d=this._getStyle(y);if(!d){let s=this._meshWriters.get(l);s||(s=await r(this._context,e,t.geometryType),this._meshWriters.set(l,s));continue}const p=await this._createDimensionInfo(d,h,o);await this._cacheGlyphs(p,h,e),this._dimensionInfos.set(l,p),this._matcherGeometryOverrides.set(l,s.geometryOverride);let u=this._meshWriters.get(l);u||(u=await this._createGroup(d,n,h,e,t.geometryType),this._meshWriters.set(l,u))}}async _createDimensionInfo(e,t,r){return await s.create(e,t,r,e=>this._getGlyphCacheForSymbol(e))}async _createGroup(e,t,s,o,n){const a=i.processDimensionStyle(e),[m,c,h,l,y]=await Promise.all([this._createMeshesForSymbol(a.beginDimensionLineSymbol,a.primitiveOverrides,t,s,o),this._createMeshesForSymbol(a.endDimensionLineSymbol,a.primitiveOverrides,t,s,o),this._createMeshesForSymbol(a.beginExtensionLineSymbol,a.primitiveOverrides,t,s,o),this._createMeshesForSymbol(a.endExtensionLineSymbol,a.primitiveOverrides,t,s,o),this._createMeshesForSymbol(a.textSymbol,a.primitiveOverrides,t,s,o)]),d=await this._context.createMeshWriters([...m,...c,...h,...l,...y]);if(has("esri-2d-annotation-dimension-debug")){const e=await r(this._context,o,n);return e.length?[...d,...e]:d}return d}async _createMeshesForSymbol(t,r,s,i,o){if(!t)return[];const n=await e.resolveSymbolOverrides({type:"CIMSymbolReference",primitiveOverrides:r,symbol:t},i,s.metadata.outSpatialReference,null,s.geometryType);if(!n)return[];const a=await o.fetchMeshResourceImmediate({type:"mesh-request",symbolReference:{type:"CIMSymbolReference",symbol:n}});return a?.meshes??[]}_readStyleId(e){return parseInt(`${e.readAttribute("STYLEID")}`,10)}_getStyle(e){return this._schema.styleCollection.find(t=>(t.iD??0)===e)}async _cacheGlyphs(e,t,r){const s=e.getTextString(t);if(!s)return;const i=await r.fetchResourceImmediate({type:"cim-rasterization-info",resource:{type:"text",textString:s||"",font:o(e.textSymbol)}});if(i&&"glyphs"in i){const t=i.glyphs;if(null!=t){const r=this._getGlyphCacheForSymbol(e.textSymbol);if(!r)return;for(const e of t)e&&!r.glyphs[e.code]&&(r.glyphs[e.code]=e)}}}_getGlyphCacheForSymbol(e){if(!e)return null;const t=n(e);let r=this._cachedGlyphsPerFont.get(t);return r||(r={type:"glyphs",glyphs:[],isRightToLeft:!1,sdfSize:24,sdfRadius:8,sdfPadding:3},this._cachedGlyphsPerFont.set(t,r)),r}cleanup(e,t,r){const s=t.getObjectId(),i=c(r,s);this._meshWriters.delete(i),this._dimensionInfos.delete(i),this._matcherGeometryOverrides.delete(i)}getAnalyzedGraphic(e){return this._dimensionInfos.get(e)||null}getMatcherGeometryOverride(e){return this._matcherGeometryOverrides.get(e)??null}}export{h as DimensionMatcher};
2
+ import has from"../../../../../core/has.js";import{OverrideHelper as e}from"../../../../../symbols/cim/OverrideHelper.js";import{hasRichTextFormattingTags as t}from"../../../../../symbols/cim/richTextUtils.js";import{FeatureMatcher as r}from"./Matcher.js";import{createDebugWriters as s}from"../../../layers/support/annodime/debugUtils.js";import i from"../../../layers/support/annodime/DimensionInfo.js";import{dimensionSymbols as o}from"../../../layers/support/annodime/dimensionSymbols.js";import{getFontForCIMTextSymbol as n}from"../../../layers/support/annodime/dimensionUtils.js";import{createDimensionMatcherFeatureInfo as m,mixFeature as a}from"../../../layers/support/annodime/MatcherGeometryOverride.js";import{createTileObjectId as c}from"../../../layers/support/annodime/TileObjectId.js";class h extends r{constructor(e,t){super(),this._context=e,this._schema=t,this._meshWriters=new Map,this._dimensionInfos=new Map,this._matcherGeometryOverrides=new Map}static async fromDimensionSchema(e,t){return new h(e,t)}hasArcadeDependency(){return!1}doMatch(e,t,r){return this._meshWriters.get(c(r,e.getObjectId()))}async fetchResources(e,t,r,i){this._meshWriters.clear(),this._dimensionInfos.clear(),this._matcherGeometryOverrides.clear();const o=t.metadata.outSpatialReference,n=t.getCursor();for(;n.next();){const r=m(n);if(!r)continue;const h=a(n,r);if(!h)continue;const l=c(i,n.getObjectId()),y=this._readStyleId(n),p=this._getStyle(y);if(!p){let r=this._meshWriters.get(l);r||(r=await s(this._context,e,t.geometryType),this._meshWriters.set(l,r));continue}const d=await this._createDimensionInfo(p,h,o);await this._cacheGlyphs(d,h,e),this._dimensionInfos.set(l,d),this._matcherGeometryOverrides.set(l,r.geometryOverride);let u=this._meshWriters.get(l);u||(u=await this._createGroup(p,n,h,e,t.geometryType),this._meshWriters.set(l,u))}}async _createDimensionInfo(e,t,r){return await i.create(e,t,r)}async _createGroup(e,t,r,i,n){const m=o.processDimensionStyle(e),[a,c,h,l,y]=await Promise.all([this._createMeshesForSymbol(m.beginDimensionLineSymbol,m.primitiveOverrides,t,r,i),this._createMeshesForSymbol(m.endDimensionLineSymbol,m.primitiveOverrides,t,r,i),this._createMeshesForSymbol(m.beginExtensionLineSymbol,m.primitiveOverrides,t,r,i),this._createMeshesForSymbol(m.endExtensionLineSymbol,m.primitiveOverrides,t,r,i),this._createMeshesForSymbol(m.textSymbol,m.primitiveOverrides,t,r,i)]),p=await this._context.createMeshWriters([...a,...c,...h,...l,...y]);if(has("esri-2d-annotation-dimension-debug")){const e=await s(this._context,i,n);return e.length?[...p,...e]:p}return p}async _createMeshesForSymbol(t,r,s,i,o){if(!t)return[];const n=await e.resolveSymbolOverrides({type:"CIMSymbolReference",primitiveOverrides:r,symbol:t},i,s.metadata.outSpatialReference,null,s.geometryType);if(!n)return[];const m=await o.fetchMeshResourceImmediate({type:"mesh-request",symbolReference:{type:"CIMSymbolReference",symbol:n}});return m?.meshes??[]}_readStyleId(e){return parseInt(`${e.readAttribute("STYLEID")}`,10)}_getStyle(e){return this._schema.styleCollection.find(t=>(t.iD??0)===e)}async _cacheGlyphs(e,r,s){const i=e.getTextString(r);if(!i)return;const o=await s.fetchResourceImmediate({type:"cim-rasterization-info",resource:{type:"text",textString:i||"",font:n(e.textSymbol),symbol:e.textSymbol,supportsRichText:t(i)}});"glyphs"!==o?.type&&"rich-glyphs"!==o?.type||e.setTextResource(o)}cleanup(e,t,r){const s=t.getObjectId(),i=c(r,s);this._meshWriters.delete(i),this._dimensionInfos.delete(i),this._matcherGeometryOverrides.delete(i)}getAnalyzedGraphic(e){return this._dimensionInfos.get(e)||null}getMatcherGeometryOverride(e){return this._matcherGeometryOverrides.get(e)??null}}export{h as DimensionMatcher};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../AggregateGraphic.js";import r from"../../../Graphic.js";import s from"../../../TrackGraphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import o from"../../../core/Error.js";import{makeHandle as n,handlesGroup as l}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as h}from"../../../core/maybe.js";import{notDeepEqual as c}from"../../../core/object.js";import{createAbortError as p,ignoreAbortErrors as d,throwIfNotAbortError as y,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as g,sync as f}from"../../../core/reactiveUtils.js";import{isScreenRect as w}from"../../../core/screenUtils.js";import{sqlAnd as v}from"../../../core/sql.js";import{getMetersPerUnitForSR as _}from"../../../core/units.js";import{property as b,subclass as S}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as A}from"../../../core/support/UpdatingHandles.js";import F from"../../../geometry/Extent.js";import{fromJSON as j}from"../../../geometry/support/jsonUtils.js";import x from"../../../geometry/support/rotate.js";import{isCurvedGeometry as E}from"../../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as I}from"../../../geometry/support/curves/densifyCurvedGeometry.js";import k from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as O}from"../../../layers/graphics/featureConversionUtils.js";import U from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as R}from"../../../layers/support/featureLayerUtils.js";import{packFields as V}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as C}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as Q}from"../../../layers/support/timeSupport.js";import q from"../../../rest/support/AggregateFeatureSet.js";import M from"../../../rest/support/AttributeBinsFeatureSet.js";import H from"../../../rest/support/AttributeBinsQuery.js";import P from"../../../rest/support/FeatureSet.js";import L from"../../../rest/support/Query.js";import{HittestDrawHelper as T}from"../../../symbols/cim/CIMSymbolDrawHelper.js";import{symbolToCIM as W}from"../../../symbols/cim/CIMSymbolHelper.js";import{getDisplayedSymbol as D}from"../../../symbols/support/symbolUtils.js";import{LayerView2D as G}from"./LayerView2D.js";import{FeatureContainer as N}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as J}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as z}from"./features/FeatureSourceEventLog.js";import{AnnotationLayerAdapter as B}from"./features/layerAdapters/AnnotationLayerAdapter.js";import{CatalogFootprintLayerAdapter as Z}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{DimensionLayerAdapter as K}from"./features/layerAdapters/DimensionLayerAdapter.js";import{FeatureLayerAdapter as $}from"./features/layerAdapters/FeatureLayerAdapter.js";import{createFeatureIdInfo as X}from"./features/layerAdapters/featureServiceUtils.js";import{InMemoryLayerAdapter as Y}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as ee}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as te}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as re}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as se}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as ie}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as ae}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as oe}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import{DebouncedFeatureOverride as ne}from"./support/DebouncedFeatureOverride.js";import{FeatureCommandQueue as le}from"./support/FeatureCommandQueue.js";import{handleNoEngineError as ue}from"./support/handleNoEngineError.js";import{toJSONGeometryType as he}from"./support/util.js";import{getMapPointsFromScreen as ce}from"../support/hitTestUtils.js";import{FeatureTileSubscriptionManager as pe}from"../tiling/FeatureTileSubscriptionManager.js";import{RefreshableLayerView as de}from"../../layers/RefreshableLayerView.js";import{getHighlightName as ye}from"../../support/highlightOptionsUtils.js";function me(e,t){const r=new Set;return e&&e.forEach(e=>r.add(e)),t&&t.forEach(e=>r.add(e)),r.has("*")?["*"]:Array.from(r)}const ge=4294967294;function fe(e,t){return l(e.map(e=>g(()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t},t,f)))}function we(e){if(!e.geometry)return e;if(!E(e.geometry))return e;const t=.001/_(e.geometry.spatialReference),r=100;return{geometry:I(e.geometry,{maxSegmentsPerCurve:12e3,maxSegmentLength:r*t,maxDeviation:0}),attributes:e.attributes}}const ve=l=>{const f=de(G(l));let _=class extends f{constructor(){super(...arguments),this._commandsQueue=new le({process:e=>{switch(e.type){case"override-batch":return this._doOverride(e);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._lastAvailableFields=[],this._lastTargetState=null,this.eventLog=new z,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new A,this._fields=null,this._hittestDrawHelper=null,this._sourceUpdating=!1,this.featureEffectView=new k}destroy(){this._editUpdatingHandles.destroy(),this._workerProxy?.destroy(),this._workerAttached.reject(p()),this._commandsQueue.destroy(),this._hittestDrawHelper?.destroy()}initialize(){this._workerAttached=Promise.withResolvers(),d(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===C(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await J(t)}async _attachProxy(){const e=x(this.view.extent,this.view.rotation,this.view.center),t={tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON(),initialViewExtent:e.toJSON()};try{await this._workerProxy.pipeline.onAttach(t),this._workerAttached.resolve()}catch(r){this._workerAttached.reject(p()),y(r)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryAllFeatures}get hasAllFeaturesInView(){const e=this.effectiveDisplayFilter?.where||null,t=!this.eventLog.willQueryAllFeatures&&null!=e&&"1=1"!==e;return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&!t}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryFullResolutionGeometry}get layerAdapter(){switch(this.layer.type){case"annotation-feature":return new B(this.layer);case"dimension-feature":return new K(this.layer);case"feature":return"memory"===this.layer.source.type?new Y(this.layer):new $(this.layer);case"geojson":case"csv":case"wfs":return new Y(this.layer);case"parquet":return new se(this.layer);case"subtype-group":return new ae(this.layer);case"ogc-feature":return new te(this.layer);case"stream":return new ie(this.layer);case"oriented-imagery":return new re(this.layer);case"knowledge-graph-sublayer":return new ee(this.layer);case"catalog-footprint":return new Z(this.layer);default:this.layer}return null}get timeExtent(){return Q(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}get usedMemory(){return this.container.usedMemory+this.eventLog.pipelineStatistics.usedMemory}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}highlight(e,t){let s;e instanceof r?s=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?s=[e]:a.isCollection(e)&&e.length>0?s=e.map(e=>e?.getObjectId()).toArray():Array.isArray(e)&&e.length>0&&(s="number"==typeof e[0]||"string"==typeof e[0]?e:e.map(e=>e?.getObjectId()));const o=s?.filter(i);if(!o?.length)return n();const l=ye(t);return this._addHighlights(o,l),n(()=>!this.destroyed&&this._removeHighlights(o,l))}async hitTest(e,i){const a=w(i),{trueHitIds:o,candidateHitIds:n}=await this.featureContainer.hitTest(i),l=await this.getWorker(),[u,h]=await Promise.all([l.pipeline.getDisplayFeatures(n),l.pipeline.getDisplayFeatures(o)]),{features:c,aggregates:p,tracks:d}=u,{features:y,aggregates:g,tracks:f}=h,v=[];if(a&&this.hasRenderer()){const e=new Map,t=new r;for(const r of c){t.attributes=r.attributes,t.geometry=j(r.geometry),t.symbol=null;const s=this.layerAdapter.getRenderer(t);if(!s){v.push(r);continue}const i=await D(t,{renderer:s,scale:this.view.scale,resolution:this.view.resolution,spatialReference:this.view.spatialReference,viewingMode:"2d",timeZone:this.view.timeZone});if(!i)continue;let a=null;const o=W(i);if("web-style"===o.type)try{const e=W(await o.fetchSymbol({acceptedFormats:["cim","web"]}));a="web-style"===e.type?null:e}catch(x){m(x),0;continue}else a=o;const n=a?.symbol;if(!n)continue;const l=this.view.stage.cimAnalyzer.analyzeSymbolReference(a,!1).some(e=>"alignment"in e&&0===e.alignment);e.set(r,{cimSymbol:n,isScreenAligned:l})}e.size>0&&!this._hittestDrawHelper&&(this._hittestDrawHelper=new T(this.view.stage.painter.textureManager.resourceManager));const{resolution:s,rotation:a}=this.view.state,o=ce(this.view,i);for(const[r,{cimSymbol:i,isScreenAligned:n}]of e){if(!r)continue;const e={hittestType:"rect",textInfo:null,mapRotation:a,resolution:s,searchDist:0,isScreenAligned:n};this._hittestDrawHelper.hitTest(o,i,r.geometry,e)&&v.push(r)}}else v.push(...c);const _=[...y,...v],b=[...g,...p],S=[...f,...d],A=this.featureContainer.getSortKeys(_.map(e=>e.displayId)),F=({displayId:e},{displayId:t})=>A.has(e)&&A.has(t)?A.get(e)-A.get(t):e-t;return _.sort(F).reverse(),b.sort(F).reverse(),[...b.map(r=>this._createAggregateGraphicHit(e,t.fromJSON(r))),...S.map(t=>this._createTrackGraphicHit(e,s.fromJSON(t))),..._.map(t=>this._createFeatureGraphicHit(a?null:e,r.fromJSON(t)))]}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r);return ue(i,{})}async queryUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForUniqueValues(this._cleanUpQuery(e),i,r);return ue(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),i,r);return ue(a,{uniqueValueInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),i,r);return ue(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForHistogram(this._cleanUpQuery(e),i,r);return ue(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return ue(r,0)}async queryAggregateHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),i,r);return ue(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return ue(r,[])}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return ue(r,{features:[]})}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),s=await ue(r,{features:[]});return M.fromJSON(s)}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await ue(r,{features:[]}),i=q.fromJSON(s);return i.features.forEach(e=>this.layerAdapter.setAggregateGraphicOrigin?.(e)),i}async queryClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForClassBreaks(this._cleanUpQuery(e),i,r);return ue(a,{classBreakInfos:[]})}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await ue(r,{count:0,extent:null});return{count:s.count,extent:F.fromJSON(s.extent)}}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return ue(r,0)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then(e=>{const t=P.fromJSON(e);return t.features.forEach(e=>this._setOriginForFeature(e)),t})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return ue(r,{features:[]})}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return ue(r,[])}async queryStatistics(){const e=await this.getWorker();return ue(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),i,r);return ue(a,{})}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await ue(r,{features:[]}),i=P.fromJSON(s);return i.features.forEach(e=>this._setOriginForFeature(e)),i}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptions)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this.featureContainer.getPresenting(),r=this._subscriptions.update(e.targetState,this._lastTargetState,t);r&&(this.featureContainer.updateSubscriptions(r),d(this._updatingHandles.addPromise(this.getWorker().then(e=>e.pipeline.updateSubscriptions(r))))),this._subscriptions.coverage&&this.featureContainer.setCoverage(this._subscriptions.coverage)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),d(this._updatingHandles.addPromise(this._workerAttached.promise)),d(this._attachProxy()),this.featureContainer=new N(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptions=new pe(this.view.featuresTilingScheme),this.requestUpdate(),this.addAttachHandles([fe([()=>this._displayRefreshVersion,()=>"displayFilterInfo"in this.layer&&this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilterClause,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],()=>this._update()),g(()=>this.updateSuspended,e=>{e||this._subscriptions.resume(this.featureContainer.getPresenting())}),g(()=>this.view.stationary,async e=>{if(e){const e=await this.getWorker(),t=x(this.view.extent,this.view.rotation,this.view.center);e.pipeline.updateStationaryExtent(t.toJSON(),this.featureContainer.requiresRefresh).catch(()=>{})}})]),this._update(),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",e=>this._editUpdatingHandles.addPromise(this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptions=h(this._subscriptions),this._workerProxy.pipeline.onDetach(),this._workerAttached=Promise.withResolvers(),d(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}addOverrides(e){return this._commandsQueue.push({type:"override",options:{...e,release:[]}})}removeOverrides(e){for(const r of e)if(null==r)throw new o("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:r});const t={added:[],updated:[],removed:[],release:e,isWeak:!1,historicMoment:null};return this._commandsQueue.push({type:"override",options:t})}onProxyClientEvent(e){}hasRenderer(){return"renderer"in this.layer&&null!=this.layer.renderer}isUpdating(){const e=this.hasRenderer(),t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,s=this.featureContainer.updating;return this.updateRequested||e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating}_createClientOptions(){const e=this;return{updateSchemaStart:()=>e.updateSchemaStart(),updateSchemaEnd:t=>e.updateSchemaEnd(t),openMemoryPorts:async()=>{if(this.layerAdapter?.openMessagePorts){const e=await this.layerAdapter.openMessagePorts();return{result:e,transferList:e}}throw new Error("InternalError: Layer adapter does not support opening message ports")},get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.onProxyClientEvent(e)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const s of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(s));return r}return Promise.all(t.map(t=>e.view.stage.painter.textureManager.rasterizeItem(t)))},fetchDictionary:e=>Promise.all(e.map(e=>this._fetchDictionaryRequest(e))),fetchMesh:e=>Promise.all(e.map(e=>this._fetchMeshRequest(e)))}}async _fetchDictionaryRequest(e){try{if(!("renderer"in this.layer)||!this.layer.renderer||"dictionary"!==this.layer.renderer.type)throw new Error("InternalError: Expected renderer to be of type 'dictionary'");const t=this.layer.renderer,r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const s={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map(e=>e.toJSON()));const i=r.visualVariableUniforms,a=he(this.layer.geometryType),o=await t.getSymbolForControlString(e.controlString,a,!1);if(!o||!o.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await oe({...o.data,hasTextStringTemplates:!0},{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}async _fetchMeshRequest(e){const{layer:t}=this;try{const r={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:null};this._fields||(this._fields=t.fields.map(e=>e.toJSON()));return{type:"mesh-response",meshes:await oe({...e.symbolReference,hasTextStringTemplates:!0},{path:"anno-like",schemaOptions:r,uniforms:{visualVariableColor:null,visualVariableOpacity:null,visualVariableRotation:null,visualVariableSizeStops:null,visualVariableSizeScaleStops:null,visualVariableSizeOutlineScaleStops:null,visualVariableSizeUnitValue:null,visualVariableSizeMinMaxValue:null}})}}catch(r){return{type:"mesh-response",meshes:[]}}}_cleanUpQuery(e){const t=L.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),"returnZ"in this.layer&&(t.returnZ??=this.layer.returnZ),"returnM"in this.layer&&(t.returnM??=this.layer.returnM),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=H.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=L.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const s of t.aggregateIds??[])r.push(s);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}_edit(e){return this._commandsQueue.push({type:"edit",event:e})}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%ge+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%ge+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?u.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const s="globalIdField"in this.layer&&this.layer.globalIdField,i=s&&this.availableFields.includes(s);if(r.length&&!i)return u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${s} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}_resolveOverrides(e){const t=!1,r=!1,s=he(this.layer.geometryType),i=X(this.layer),a=[];for(const n of e.added){const e=O(we(n),s,t,r,i);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.updated){const e=O(we(n),s,t,r,i);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.removed)if(null==n)throw new o("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:n});return{type:"override",updates:a,removed:e.removed,release:e.release,isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null}}async _resolveEdit(e){const t=this.layer,r=e.historicMoment?.getTime()??null,s="layerId"in t&&e.editedFeatures?.find(e=>e.layerId===t.layerId);if(s&&this._canEditByFeature(s)){const{adds:e,deletes:t,updates:i}=s.editedFeatures,a=this.layer.objectIdField,o=i.map(e=>e.current),n=t.map(e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e),l=await this._resolveIdenifiers(n);return this._resolveOverrides({added:e,updated:o,removed:l,historicMoment:r,isWeak:!0,release:[]})}const[i,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]);return{type:"override-by-id",updates:[...i,...a],removed:o,historicMoment:r,isWeak:!0}}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every(e=>this.view.spatialReference.equals(e.geometry?.spatialReference))&&r.every(e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference))}async updateSchemaStart(){const e=this.layer;"featureReduction"in e&&e.featureReduction&&e.featureReduction!==this._lastFeatureReduction&&(e.featureReduction=e.featureReduction?.clone(),this._lastFeatureReduction=e.featureReduction);try{if(await Promise.allSettled([this._handleChange(),R(e)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptions)return null;const t=this.featureContainer.updateStart("subtype-group"===e.type);this._lastFeatureEffect=this.featureEffect;const r={store:t,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},s=await this._createViewSchemaConfig(),i={source:await this.layerAdapter.createSourceSchema(s,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,s,this._displayRefreshVersion)};return c(this._lastSchema?.source.strategy,i.source.strategy)||c(this._lastSchema?.processor,i.processor)?(this._lastSchema=i,this._fields=null,i):null}catch(t){}return null}async updateSchemaEnd(e){try{this.featureEffectView.featureEffect=this._lastFeatureEffect,e&&this.featureEffectView.endTransition(),await this.featureContainer.updateEnd(this._lastSchema.processor,this.layerAdapter.getLabelingDeconflictionInfo(),e),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.updateEnd")}catch(t){}}async _doUpdate(){const e=Math.round(performance.now()),t=await this.getWorker();await t.pipeline.updateSchema(e),this.requestUpdate()}async _doOverride(e){const t=await this.getWorker();try{let r=new ne;for(const s of e.messages)switch(s.type){case"edit":r.tryAdd(await this._resolveEdit(s.event))||(await t.pipeline.onOverride(r.toMessage()),r=new ne,r.tryAdd(await this._resolveEdit(s.event)));break;case"override":r.tryAdd(this._resolveOverrides(s.options))||(await t.pipeline.onOverride(r.toMessage()),r=new ne,r.tryAdd(this._resolveOverrides(s.options)));break}await t.pipeline.onOverride(r.toMessage())}catch(r){m(r),0}}_getEffectiveAvailableFields(e){const t=me(this._lastAvailableFields,e);return this._lastAvailableFields=t,V(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[E(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilterClause),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),displayFilterEnabled:this.displayFilterEnabled,filters:t,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent,currentUser:e,spatialReference:this.view.spatialReference,extent:this.view.extent,returnZ:this.hasZ,returnM:this.hasM}}_processHighlight(){this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=this._getHighlights(),t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch(e=>{m(e)||u.getLogger(this).error(e)});this._updatingHandles.consumePromise(r)}_setOriginForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin(e)}_createFeatureGraphicHit(e,t){return this._setOriginForFeature(t),this._createGraphicHit(e,t)}_createTrackGraphicHit(e,t){return t.layer=t.sourceLayer=this.layer,this.layerAdapter.setTrackGraphicOrigin?.(t),this._createGraphicHit(e,t)}_createAggregateGraphicHit(e,t){return t.layer=t.sourceLayer=this.layer,this.layerAdapter.setAggregateGraphicOrigin?.(t),this._createGraphicHit(e,t)}_createGraphicHit(e,t){return null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function E(e,t,r,s,i,a){i&&(i=i.clone());const o=null!=i?i.timeExtent:null,n=null!=r&&null!=o?r.intersection(o):r||o;n&&(i??=new U,i.timeExtent=n),i=t.addFilters?.(i,e)??i,a&&(i??=new U,i.where=v(i.where,a));let l=i?.toJSON()??null;return s.size&&(l??=(new U).toJSON(),l.hiddenIds=Array.from(s)),l}return e([b()],_.prototype,"_commandsQueue",void 0),e([b()],_.prototype,"_sourceRefreshVersion",void 0),e([b()],_.prototype,"_displayRefreshVersion",void 0),e([b({readOnly:!0})],_.prototype,"_pipelineUpdating",void 0),e([b()],_.prototype,"_sourceUpdating",void 0),e([b({readOnly:!0})],_.prototype,"dataUpdating",null),e([b({readOnly:!0})],_.prototype,"hasAllFeatures",null),e([b({readOnly:!0})],_.prototype,"hasAllFeaturesInView",null),e([b({readOnly:!0})],_.prototype,"hasFullGeometries",null),e([b()],_.prototype,"featureEffectView",void 0),e([b()],_.prototype,"layerAdapter",null),e([b({readOnly:!0})],_.prototype,"timeExtent",null),_=e([S("esri.views.2d.layers.FeatureLikeLayerView2D")],_),_};export{ve as FeatureLikeLayerView2D};
2
+ import{__decorate as e}from"tslib";import t from"../../../AggregateGraphic.js";import r from"../../../Graphic.js";import s from"../../../TrackGraphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import o from"../../../core/Error.js";import{makeHandle as n,handlesGroup as l}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as h}from"../../../core/maybe.js";import{notDeepEqual as c}from"../../../core/object.js";import{createAbortError as p,ignoreAbortErrors as d,throwIfNotAbortError as y,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as g,sync as f}from"../../../core/reactiveUtils.js";import{isScreenRect as w}from"../../../core/screenUtils.js";import{sqlAnd as v}from"../../../core/sql.js";import{getMetersPerUnitForSR as _}from"../../../core/units.js";import{property as b,subclass as S}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as A}from"../../../core/support/UpdatingHandles.js";import F from"../../../geometry/Extent.js";import{fromJSON as j}from"../../../geometry/support/jsonUtils.js";import x from"../../../geometry/support/rotate.js";import{isCurvedGeometry as E}from"../../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as I}from"../../../geometry/support/curves/densifyCurvedGeometry.js";import k from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as O}from"../../../layers/graphics/featureConversionUtils.js";import U from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as R}from"../../../layers/support/featureLayerUtils.js";import{packFields as V}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as C}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as Q}from"../../../layers/support/timeSupport.js";import q from"../../../rest/support/AggregateFeatureSet.js";import M from"../../../rest/support/AttributeBinsFeatureSet.js";import H from"../../../rest/support/AttributeBinsQuery.js";import P from"../../../rest/support/FeatureSet.js";import L from"../../../rest/support/Query.js";import{HittestDrawHelper as T}from"../../../symbols/cim/CIMSymbolDrawHelper.js";import{symbolToCIM as W}from"../../../symbols/cim/CIMSymbolHelper.js";import{getDisplayedSymbol as D}from"../../../symbols/support/symbolUtils.js";import{LayerView2D as G}from"./LayerView2D.js";import{FeatureContainer as N}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as J}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as z}from"./features/FeatureSourceEventLog.js";import{AnnotationLayerAdapter as B}from"./features/layerAdapters/AnnotationLayerAdapter.js";import{CatalogFootprintLayerAdapter as Z}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{DimensionLayerAdapter as K}from"./features/layerAdapters/DimensionLayerAdapter.js";import{FeatureLayerAdapter as $}from"./features/layerAdapters/FeatureLayerAdapter.js";import{createFeatureIdInfo as X}from"./features/layerAdapters/featureServiceUtils.js";import{InMemoryLayerAdapter as Y}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as ee}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as te}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as re}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as se}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as ie}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as ae}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as oe}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import{DebouncedFeatureOverride as ne}from"./support/DebouncedFeatureOverride.js";import{FeatureCommandQueue as le}from"./support/FeatureCommandQueue.js";import{handleNoEngineError as ue}from"./support/handleNoEngineError.js";import{toJSONGeometryType as he}from"./support/util.js";import{getMapPointsFromScreen as ce}from"../support/hitTestUtils.js";import{FeatureTileSubscriptionManager as pe}from"../tiling/FeatureTileSubscriptionManager.js";import{RefreshableLayerView as de}from"../../layers/RefreshableLayerView.js";import{getHighlightName as ye}from"../../support/highlightOptionsUtils.js";function me(e,t){const r=new Set;return e&&e.forEach(e=>r.add(e)),t&&t.forEach(e=>r.add(e)),r.has("*")?["*"]:Array.from(r)}const ge=4294967294;function fe(e,t){return l(e.map(e=>g(()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t},t,f)))}function we(e){if(!e.geometry)return e;if(!E(e.geometry))return e;const t=.001/_(e.geometry.spatialReference),r=100;return{geometry:I(e.geometry,{maxSegmentsPerCurve:12e3,maxSegmentLength:r*t,maxDeviation:0}),attributes:e.attributes}}const ve=l=>{const f=de(G(l));let _=class extends f{constructor(){super(...arguments),this._commandsQueue=new le({process:e=>{switch(e.type){case"override-batch":return this._doOverride(e);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._lastAvailableFields=[],this._lastTargetState=null,this.eventLog=new z,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new A,this._fields=null,this._hittestDrawHelper=null,this._sourceUpdating=!1,this.featureEffectView=new k}destroy(){this._editUpdatingHandles.destroy(),this._workerProxy?.destroy(),this._workerAttached.reject(p()),this._commandsQueue.destroy(),this._hittestDrawHelper?.destroy()}initialize(){this._workerAttached=Promise.withResolvers(),d(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===C(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await J(t)}async _attachProxy(){const e=x(this.view.extent,this.view.rotation,this.view.center),t={tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON(),initialViewExtent:e.toJSON()};try{await this._workerProxy.pipeline.onAttach(t),this._workerAttached.resolve()}catch(r){this._workerAttached.reject(p()),y(r)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryAllFeatures}get hasAllFeaturesInView(){const e=this.effectiveDisplayFilter?.where||null,t=!this.eventLog.willQueryAllFeatures&&null!=e&&"1=1"!==e;return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&!t}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryFullResolutionGeometry}get layerAdapter(){switch(this.layer.type){case"annotation-feature":return new B(this.layer);case"dimension-feature":return new K(this.layer);case"feature":return"memory"===this.layer.source.type?new Y(this.layer):new $(this.layer);case"geojson":case"csv":case"wfs":return new Y(this.layer);case"parquet":return new se(this.layer);case"subtype-group":return new ae(this.layer);case"ogc-feature":return new te(this.layer);case"stream":return new ie(this.layer);case"oriented-imagery":return new re(this.layer);case"knowledge-graph-sublayer":return new ee(this.layer);case"catalog-footprint":return new Z(this.layer);default:this.layer}return null}get timeExtent(){return Q(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}get usedMemory(){return this.container.usedMemory+this.eventLog.pipelineStatistics.usedMemory}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}highlight(e,t){let s;e instanceof r?s=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?s=[e]:a.isCollection(e)&&e.length>0?s=e.map(e=>e?.getObjectId()).toArray():Array.isArray(e)&&e.length>0&&(s="number"==typeof e[0]||"string"==typeof e[0]?e:e.map(e=>e?.getObjectId()));const o=s?.filter(i);if(!o?.length)return n();const l=ye(t);return this._addHighlights(o,l),n(()=>!this.destroyed&&this._removeHighlights(o,l))}async hitTest(e,i){const a=w(i),{trueHitIds:o,candidateHitIds:n}=await this.featureContainer.hitTest(i),l=await this.getWorker(),[u,h]=await Promise.all([l.pipeline.getDisplayFeatures(n),l.pipeline.getDisplayFeatures(o)]),{features:c,aggregates:p,tracks:d}=u,{features:y,aggregates:g,tracks:f}=h,v=[];if(a&&this.hasRenderer()){const e=new Map,t=new r;for(const r of c){t.attributes=r.attributes,t.geometry=j(r.geometry),t.symbol=null;const s=this.layerAdapter.getRenderer(t);if(!s){v.push(r);continue}const i=await D(t,{renderer:s,scale:this.view.scale,resolution:this.view.resolution,spatialReference:this.view.spatialReference,viewingMode:"2d",timeZone:this.view.timeZone});if(!i)continue;let a=null;const o=W(i);if("web-style"===o.type)try{const e=W(await o.fetchSymbol({acceptedFormats:["cim","web"]}));a="web-style"===e.type?null:e}catch(x){m(x),0;continue}else a=o;const n=a?.symbol;if(!n)continue;const l=this.view.stage.cimAnalyzer.analyzeSymbolReference(a,!1).some(e=>"alignment"in e&&0===e.alignment);e.set(r,{cimSymbol:n,isScreenAligned:l})}e.size>0&&!this._hittestDrawHelper&&(this._hittestDrawHelper=new T(this.view.stage.painter.textureManager.resourceManager));const{resolution:s,rotation:a}=this.view.state,o=ce(this.view,i);for(const[r,{cimSymbol:i,isScreenAligned:n}]of e){if(!r)continue;const e={hittestType:"rect",textInfo:null,mapRotation:a,resolution:s,searchDist:0,isScreenAligned:n};this._hittestDrawHelper.hitTest(o,i,r.geometry,e)&&v.push(r)}}else v.push(...c);const _=[...y,...v],b=[...g,...p],S=[...f,...d],A=this.featureContainer.getSortKeys(_.map(e=>e.displayId)),F=({displayId:e},{displayId:t})=>A.has(e)&&A.has(t)?A.get(e)-A.get(t):e-t;return _.sort(F).reverse(),b.sort(F).reverse(),[...b.map(r=>this._createAggregateGraphicHit(e,t.fromJSON(r))),...S.map(t=>this._createTrackGraphicHit(e,s.fromJSON(t))),..._.map(t=>this._createFeatureGraphicHit(a?null:e,r.fromJSON(t)))]}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r);return ue(i,{})}async queryUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForUniqueValues(this._cleanUpQuery(e),i,r);return ue(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),i,r);return ue(a,{uniqueValueInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),i,r);return ue(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForHistogram(this._cleanUpQuery(e),i,r);return ue(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return ue(r,0)}async queryAggregateHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),i,r);return ue(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return ue(r,[])}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return ue(r,{features:[]})}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),s=await ue(r,{features:[]});return M.fromJSON(s)}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await ue(r,{features:[]}),i=q.fromJSON(s);return i.features.forEach(e=>this.layerAdapter.setAggregateGraphicOrigin?.(e)),i}async queryClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForClassBreaks(this._cleanUpQuery(e),i,r);return ue(a,{classBreakInfos:[]})}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await ue(r,{count:0,extent:null});return{count:s.count,extent:F.fromJSON(s.extent)}}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return ue(r,0)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then(e=>{const t=P.fromJSON(e);return t.features.forEach(e=>this._setOriginForFeature(e)),t})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return ue(r,{features:[]})}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return ue(r,[])}async queryStatistics(){const e=await this.getWorker();return ue(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),i,r);return ue(a,{})}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await ue(r,{features:[]}),i=P.fromJSON(s);return i.features.forEach(e=>this._setOriginForFeature(e)),i}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptions)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this.featureContainer.getPresenting(),r=this._subscriptions.update(e.targetState,this._lastTargetState,t);r&&(this.featureContainer.updateSubscriptions(r),d(this._updatingHandles.addPromise(this.getWorker().then(e=>e.pipeline.updateSubscriptions(r))))),this._subscriptions.coverage&&this.featureContainer.setCoverage(this._subscriptions.coverage)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),d(this._updatingHandles.addPromise(this._workerAttached.promise)),d(this._attachProxy()),this.featureContainer=new N(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptions=new pe(this.view.featuresTilingScheme),this.requestUpdate(),this.addAttachHandles([fe([()=>this._displayRefreshVersion,()=>"displayFilterInfo"in this.layer&&this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilterClause,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],()=>this._update()),g(()=>this.updateSuspended,e=>{e||this._subscriptions.resume(this.featureContainer.getPresenting())}),g(()=>this.view.stationary,e=>{e&&this.getWorker().then(e=>{if(this.destroyed)return;const t=x(this.view.extent,this.view.rotation,this.view.center);return e.pipeline.updateStationaryExtent(t.toJSON(),this.featureContainer.requiresRefresh)}).catch(()=>{})})]),this._update(),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",e=>this._editUpdatingHandles.addPromise(this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptions=h(this._subscriptions),this._workerProxy.pipeline.onDetach(),this._workerAttached=Promise.withResolvers(),d(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}addOverrides(e){return this._commandsQueue.push({type:"override",options:{...e,release:[]}})}removeOverrides(e){for(const r of e)if(null==r)throw new o("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:r});const t={added:[],updated:[],removed:[],release:e,isWeak:!1,historicMoment:null};return this._commandsQueue.push({type:"override",options:t})}onProxyClientEvent(e){}hasRenderer(){return"renderer"in this.layer&&null!=this.layer.renderer}isUpdating(){const e=this.hasRenderer(),t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,s=this.featureContainer.updating;return this.updateRequested||e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating}_createClientOptions(){const e=this;return{updateSchemaStart:()=>e.updateSchemaStart(),updateSchemaEnd:t=>e.updateSchemaEnd(t),openMemoryPorts:async()=>{if(this.layerAdapter?.openMessagePorts){const e=await this.layerAdapter.openMessagePorts();return{result:e,transferList:e}}throw new Error("InternalError: Layer adapter does not support opening message ports")},get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.onProxyClientEvent(e)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const s of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(s));return r}return Promise.all(t.map(t=>e.view.stage.painter.textureManager.rasterizeItem(t)))},fetchDictionary:e=>Promise.all(e.map(e=>this._fetchDictionaryRequest(e))),fetchMesh:e=>Promise.all(e.map(e=>this._fetchMeshRequest(e)))}}async _fetchDictionaryRequest(e){try{if(!("renderer"in this.layer)||!this.layer.renderer||"dictionary"!==this.layer.renderer.type)throw new Error("InternalError: Expected renderer to be of type 'dictionary'");const t=this.layer.renderer,r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const s={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map(e=>e.toJSON()));const i=r.visualVariableUniforms,a=he(this.layer.geometryType),o=await t.getSymbolForControlString(e.controlString,a,!1);if(!o||!o.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await oe({...o.data,hasTextStringTemplates:!0},{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}async _fetchMeshRequest(e){const{layer:t}=this;try{const r={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:null};this._fields||(this._fields=t.fields.map(e=>e.toJSON()));return{type:"mesh-response",meshes:await oe({...e.symbolReference,hasTextStringTemplates:!0},{path:"anno-like",schemaOptions:r,uniforms:{visualVariableColor:null,visualVariableOpacity:null,visualVariableRotation:null,visualVariableSizeStops:null,visualVariableSizeScaleStops:null,visualVariableSizeOutlineScaleStops:null,visualVariableSizeUnitValue:null,visualVariableSizeMinMaxValue:null}})}}catch(r){return{type:"mesh-response",meshes:[]}}}_cleanUpQuery(e){const t=L.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),"returnZ"in this.layer&&(t.returnZ??=this.layer.returnZ),"returnM"in this.layer&&(t.returnM??=this.layer.returnM),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=H.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=L.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const s of t.aggregateIds??[])r.push(s);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}_edit(e){return this._commandsQueue.push({type:"edit",event:e})}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%ge+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%ge+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?u.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const s="globalIdField"in this.layer&&this.layer.globalIdField,i=s&&this.availableFields.includes(s);if(r.length&&!i)return u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${s} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}_resolveOverrides(e){const t=!1,r=!1,s=he(this.layer.geometryType),i=X(this.layer),a=[];for(const n of e.added){const e=O(we(n),s,t,r,i);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.updated){const e=O(we(n),s,t,r,i);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.removed)if(null==n)throw new o("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:n});return{type:"override",updates:a,removed:e.removed,release:e.release,isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null}}async _resolveEdit(e){const t=this.layer,r=e.historicMoment?.getTime()??null,s="layerId"in t&&e.editedFeatures?.find(e=>e.layerId===t.layerId);if(s&&this._canEditByFeature(s)){const{adds:e,deletes:t,updates:i}=s.editedFeatures,a=this.layer.objectIdField,o=i.map(e=>e.current),n=t.map(e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e),l=await this._resolveIdenifiers(n);return this._resolveOverrides({added:e,updated:o,removed:l,historicMoment:r,isWeak:!0,release:[]})}const[i,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]);return{type:"override-by-id",updates:[...i,...a],removed:o,historicMoment:r,isWeak:!0}}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every(e=>this.view.spatialReference.equals(e.geometry?.spatialReference))&&r.every(e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference))}async updateSchemaStart(){const e=this.layer;"featureReduction"in e&&e.featureReduction&&e.featureReduction!==this._lastFeatureReduction&&(e.featureReduction=e.featureReduction?.clone(),this._lastFeatureReduction=e.featureReduction);try{if(await Promise.allSettled([this._handleChange(),R(e)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptions)return null;const t=this.featureContainer.updateStart("subtype-group"===e.type);this._lastFeatureEffect=this.featureEffect;const r={store:t,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},s=await this._createViewSchemaConfig(),i={source:await this.layerAdapter.createSourceSchema(s,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,s,this._displayRefreshVersion)};return c(this._lastSchema?.source.strategy,i.source.strategy)||c(this._lastSchema?.processor,i.processor)?(this._lastSchema=i,this._fields=null,i):null}catch(t){}return null}async updateSchemaEnd(e){try{this.featureEffectView.featureEffect=this._lastFeatureEffect,e&&this.featureEffectView.endTransition(),await this.featureContainer.updateEnd(this._lastSchema.processor,this.layerAdapter.getLabelingDeconflictionInfo(),e),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.updateEnd")}catch(t){}}async _doUpdate(){const e=Math.round(performance.now()),t=await this.getWorker();await t.pipeline.updateSchema(e),this.requestUpdate()}async _doOverride(e){const t=await this.getWorker();try{let r=new ne;for(const s of e.messages)switch(s.type){case"edit":r.tryAdd(await this._resolveEdit(s.event))||(await t.pipeline.onOverride(r.toMessage()),r=new ne,r.tryAdd(await this._resolveEdit(s.event)));break;case"override":r.tryAdd(this._resolveOverrides(s.options))||(await t.pipeline.onOverride(r.toMessage()),r=new ne,r.tryAdd(this._resolveOverrides(s.options)));break}await t.pipeline.onOverride(r.toMessage())}catch(r){m(r),0}}_getEffectiveAvailableFields(e){const t=me(this._lastAvailableFields,e);return this._lastAvailableFields=t,V(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[E(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilterClause),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),displayFilterEnabled:this.displayFilterEnabled,filters:t,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent,currentUser:e,spatialReference:this.view.spatialReference,extent:this.view.extent,returnZ:this.hasZ,returnM:this.hasM}}_processHighlight(){this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=this._getHighlights(),t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch(e=>{m(e)||u.getLogger(this).error(e)});this._updatingHandles.consumePromise(r)}_setOriginForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin(e)}_createFeatureGraphicHit(e,t){return this._setOriginForFeature(t),this._createGraphicHit(e,t)}_createTrackGraphicHit(e,t){return t.layer=t.sourceLayer=this.layer,this.layerAdapter.setTrackGraphicOrigin?.(t),this._createGraphicHit(e,t)}_createAggregateGraphicHit(e,t){return t.layer=t.sourceLayer=this.layer,this.layerAdapter.setAggregateGraphicOrigin?.(t),this._createGraphicHit(e,t)}_createGraphicHit(e,t){return null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function E(e,t,r,s,i,a){i&&(i=i.clone());const o=null!=i?i.timeExtent:null,n=null!=r&&null!=o?r.intersection(o):r||o;n&&(i??=new U,i.timeExtent=n),i=t.addFilters?.(i,e)??i,a&&(i??=new U,i.where=v(i.where,a));let l=i?.toJSON()??null;return s.size&&(l??=(new U).toJSON(),l.hiddenIds=Array.from(s)),l}return e([b()],_.prototype,"_commandsQueue",void 0),e([b()],_.prototype,"_sourceRefreshVersion",void 0),e([b()],_.prototype,"_displayRefreshVersion",void 0),e([b({readOnly:!0})],_.prototype,"_pipelineUpdating",void 0),e([b()],_.prototype,"_sourceUpdating",void 0),e([b({readOnly:!0})],_.prototype,"dataUpdating",null),e([b({readOnly:!0})],_.prototype,"hasAllFeatures",null),e([b({readOnly:!0})],_.prototype,"hasAllFeaturesInView",null),e([b({readOnly:!0})],_.prototype,"hasFullGeometries",null),e([b()],_.prototype,"featureEffectView",void 0),e([b()],_.prototype,"layerAdapter",null),e([b({readOnly:!0})],_.prototype,"timeExtent",null),_=e([S("esri.views.2d.layers.FeatureLikeLayerView2D")],_),_};export{ve as FeatureLikeLayerView2D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{notDeepEqual as t}from"../../../../core/object.js";import{throwIfAborted as s,after as r}from"../../../../core/promiseUtils.js";import{diff as i}from"../../../../core/accessorSupport/diffUtils.js";import{ignoreConnectionErrors as a}from"../../../../core/workers/utils.js";import{normalizeTransform as o,quantizeX as n,quantizeY as c}from"../../../../geometry/support/quantizationUtils.js";import{checkProjectionSupport as h}from"../../../../layers/graphics/data/projectionSupport.js";import{MultiTileMeshData as u}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as p}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as g}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{MeshWriterRegistry as y}from"../../engine/webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js";import{MatcherContext as d}from"../../engine/webgl/util/MatcherContext.js";import{BinningStrategy as _}from"./processor/BinningStrategy.js";import{ClusterStrategy as l}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as m}from"./processor/FeatureUpdateStrategy.js";import{TrackStrategy as f}from"./processor/TrackStrategy.js";import{AttributeStore as b}from"./support/AttributeStore.js";import{ComputedAttributeStorage as w}from"./support/ComputedAttributeStorage.js";class S{constructor(e,t){this._connection=e,this._source=t,this._version=1,this._registry=new y,this._proxy=new g({fetch:(e,t)=>this._connection.layerView.fetch(e,t),fetchDictionary:(e,t)=>this._connection.layerView.fetchDictionary(e,t),fetchMesh:(e,t)=>this._connection.layerView.fetchMesh(e,t)}),this._attributeStore=new b({isLocal:!1,update:e=>a(this._connection.container.updateAttributeView(e))})}destroy(){this._proxy.destroy(),this._strategy?.destroy(),this._attributeStore.destroy()}get hasClusters(){return"cluster"===this._schema?.mesh.strategy.type}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}get usedMemory(){let e=0;return e+=this._attributeStore.usedMemory,this._strategy&&(e+=this._strategy.usedMemory),e}get version(){return this._version}getDisplayFeatures(e){return this._strategy?this._strategy.getDisplayFeatures(e):{features:[],aggregates:[],tracks:[]}}getDisplayIds(e){const t={};return this._strategy?(this._strategy.displayMap(e,e=>e,(e,s,r)=>{t[r]=e}),t):t}getFeatureObjectIdsForAggregate(e){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(e):[]}onSubscribe(e){this._strategy?.onSubscribe(e)}onUnsubscribe(e){this._strategy?.onUnsubscribe(e)}requiresInvalidation(e){return this._strategy?.requiresInvalidation(e)??!1}async update(e,s,r,a,o){const n=e.processor,c=t(this._schema?.storage,n.storage),u=t(this._schema?.mesh.properties,n.mesh.properties),g=t(this._schema?.mesh.factory,n.mesh.factory),y=t(this._schema?.mesh.strategy,n.mesh.strategy),_=j(this._schema?.expressionProperties,n.expressionProperties),l=_.some(e=>this._attributeStore.hasArcadeDependency(e)),m=_.some(e=>this._factory?.hasArcadeDependency(e)??!1),f=_.some(e=>this._strategy?.hasArcadeDependency(e))||this._strategy?.isAggregate&&l,b=m||f,S=u||g||y;if(!(c||S||(m||l||f))&&!a)return!1;if(has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:i(this._schema,n),schema:n}),this._schema=n,"annotation-feature"===n.mesh.factory.symbology.type||"dimension-feature"===n.mesh.factory.symbology.type){const e=this._source.metadata.outSpatialReference,t=this._source.metadata.attributeSpatialReference??this._source.metadata.spatialReference??e;await h(t,e)}const I=new w({fields:this._source.metadata.fieldsIndex,spatialReference:this._source.metadata.outSpatialReference}),M={currentUser:n.mesh.properties.currentUser};if((c||S||l)&&(await this._attributeStore.update(n.storage,I,this._source.metadata,s),this._strategy?.invalidateAttributeData(v(n))),!a&&!S&&!b)return!1;(y||u||b)&&await this._updateStrategy(n.mesh.strategy,o,v(n),M),this._updateSortKey(I,"sortKey"in n.mesh.properties?n.mesh.properties.sortKey:null);const x="dictionary"===n.mesh.factory.symbology.type?n.mesh.factory.symbology.fieldMap:null,U=new d(I,this._proxy,r,this._registry,x);return(g||"dictionary"===n.mesh.factory.symbology.type)&&(this._factory=await p.create(U,n.mesh.factory)),this._version=s,!0}async applyOverrideUpdate(e,t){if(this._strategy)try{const s=await this._strategy.applyOverrideUpdate(e);s&&await this._process(s,t)}catch(s){}}async updateChunks(e,t,s){await this._doUpdateChunks(e,t,s),this._strategy?.afterUpdateChunks()}async removeChunks(e){this._strategy?.removeChunks(e),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:e}){if(!this._strategy||!this._strategy.hasSubscribers)return void this._attributeStore.setHighlight(e.map(({objectId:e,highlightFlags:t})=>({objectId:e,highlightFlags:t,displayId:-1})),e);const t=this._strategy.displayMap(e,({objectId:e})=>e,(e,{highlightFlags:t},s)=>({objectId:s,displayId:e,highlightFlags:t}));this._attributeStore.setHighlight(t,e)}invalidate(){this._strategy&&this._strategy.invalidate()}async _doUpdateChunks(e,t,s){if(this._strategy){try{const r=await this._strategy.updateChunks(e,t);r&&await this._process(r,s)}catch(r){}has("esri-2d-update-debug")&&console.log("SendUpdates"),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.log("SendUpdates.await")}}async _updateStrategy(e,t,s,r){switch(this._strategy?.destroy(),e.type){case"feature":this._strategy=new m(this._source,this._attributeStore,s,r);break;case"binning":this._strategy=await _.create(e,this._source,this._attributeStore,s,r);break;case"cluster":this._strategy=await l.create(this._connection,e,this._source,this._attributeStore,s,r);break;case"track":this._strategy=await f.create(e,this._source,this._attributeStore,s,r)}for(const i of t)this._strategy.onSubscribe(i)}async _updateSortKey(t,s){if(this._sortInfo=e(this._sortInfo?.computed),null!=s){const e=s.byRenderer?null:await t.createComputedField(s);this._sortInfo={...s,computed:e}}}async _process(e,t){switch(e.type){case"level-replace":return this._processLevelBatch(e,t);case"append":case"update":return this._processStandardBatch(e,t)}}async _processLevelBatch(e,t){const s=await this._connection.container.beginLevelMeshUpdate(e.level);await this._processBatchMessages(e.messages,t),await this._connection.container.applyLevelMeshUpdate(s)}async _processStandardBatch(e,t){return this._processBatchMessages(e.messages,t)}async _processBatchMessages(e,t){for(const r of e){const e=r.subscription;if(has("esri-2d-update-debug")){const t=e.tile;console.debug(`Version[${this._version}] Tile[${t.key.id}, end=${r.end}] Processor._process`)}const i={currentUser:this._schema?.mesh.properties.currentUser};await this._fetchResources(r,i),s(e.signal);const a=await this._write(r,e.tile.createArcadeEvaluationOptions(v(this._schema)),i,t),o=e.tile.tileInfoView.getLODInfoAt(e.tile.key);s(e.signal);const{message:n,transferList:c}=a.serialize(o),h={objectIdMap:null,inner:r.createMessage(n,this._version,this._attributeStore.epoch)};if(this._schema?.mesh.properties.returnMeshObjectId){h.objectIdMap={};const e=r.reader?.getCursor();if(e)for(;e.next();)h.objectIdMap[e.getDisplayId()]=e.getObjectId()}if(s(e.signal),await this._connection.container.onMessage(h,{signal:e.signal,transferList:c}),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")){const t=e.tile;console.debug(`Version[${this._version}] Tile[${t.key.id}, end=${r.end}] Processor._process.await`)}}}async _fetchResources(e,t){await this._fetchMatcherResources(e),await this._fetchWriterResources(e,t)}async _fetchMatcherResources(e){if(!e.reader)return;const t=e.subscription.tile.createArcadeEvaluationOptions(v(this._schema));return this._factory.enqueueMatcherRequests(this._proxy,e.reader,{scale:t.$view.scale,viewingMode:"2d"},e.id)}async _fetchWriterResources(e,t){if(!e.reader)return;const s=e.reader.getCursor(),r=e.subscription.tile.createArcadeEvaluationOptions(v(this._schema));for(;s.next();)this._factory.enqueueWriterRequests(this._proxy,s,r,t,e.id);await this._proxy.fetchEnqueuedResources()}async _write(e,t,i,a){const o=e.subscription.tile,n=e.reader?.getCursor(),c=n?.getSize()??0,h=o.tileInfoView.tileInfo.isWrappable,p=o.tileInfoView.spatialReference.isWGS84,g=this._schema?.mesh.factory.referenceScale,y=new u(o.key,this._strategy.enablePixelBuffering,h,p,c);if(!n)return y;const d=I(o.transform,a),_=o.createArcadeEvaluationOptions(v(this._schema));let l=0;for(;n.next();){++l%1e3||(await r(0),s(e.subscription));const a=this._getSortKeyValue(n,t);y.entityStart(n.getDisplayId(),a);try{this._factory.write(y,this._proxy,n,_,i,o.level,d,g)}catch(m){}y.entityEnd()}return y}_getSortKeyValue(e,t){if(!this._sortInfo)return 0;const{computed:s,order:r,byRenderer:i}=this._sortInfo,a=i?this._factory.getSortKey(e,t):s?.read(e,t);return null==a||isNaN(a)?0:a*("asc"===r?-1:1)}}function j(e,t){const s=[];return e?.timeExtent?.start===t.timeExtent?.start&&e?.timeExtent?.end===t.timeExtent?.end||s.push("timeProperties"),s}function v(e){const{timeZone:t}=e?.mesh.properties??{},{timeExtent:s}=e?.expressionProperties??{};return{timeZone:t,timeExtent:s}}function I(e,t){const s=o(e),r=[];for(const i of t.rings){const e=[];for(const t of i)e.push([n(s,t[0]),c(s,t[1])]);r.push(e)}return{rings:r}}export{S as default};
2
+ import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{notDeepEqual as t}from"../../../../core/object.js";import{throwIfAborted as s,after as r}from"../../../../core/promiseUtils.js";import{diff as i}from"../../../../core/accessorSupport/diffUtils.js";import{ignoreConnectionErrors as a}from"../../../../core/workers/utils.js";import{normalizeTransform as o,quantizeX as n,quantizeY as c}from"../../../../geometry/support/quantizationUtils.js";import{checkProjectionSupport as h}from"../../../../layers/graphics/data/projectionSupport.js";import{MultiTileMeshData as u}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as p}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as g}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{MeshWriterRegistry as y}from"../../engine/webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js";import{MatcherContext as d}from"../../engine/webgl/util/MatcherContext.js";import{createAggregateStrategy as l}from"./processor/createAggregateStrategy.js";import{AttributeStore as _}from"./support/AttributeStore.js";import{ComputedAttributeStorage as m}from"./support/ComputedAttributeStorage.js";class f{constructor(e,t){this._connection=e,this._source=t,this._version=1,this._registry=new y,this._proxy=new g({fetch:(e,t)=>this._connection.layerView.fetch(e,t),fetchDictionary:(e,t)=>this._connection.layerView.fetchDictionary(e,t),fetchMesh:(e,t)=>this._connection.layerView.fetchMesh(e,t)}),this._attributeStore=new _({isLocal:!1,update:e=>a(this._connection.container.updateAttributeView(e))})}destroy(){this._proxy.destroy(),this._strategy?.destroy(),this._attributeStore.destroy()}get hasClusters(){return"cluster"===this._schema?.mesh.strategy.type}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}get usedMemory(){let e=0;return e+=this._attributeStore.usedMemory,this._strategy&&(e+=this._strategy.usedMemory),e}get version(){return this._version}getDisplayFeatures(e){return this._strategy?this._strategy.getDisplayFeatures(e):{features:[],aggregates:[],tracks:[]}}getDisplayIds(e){const t={};return this._strategy?(this._strategy.displayMap(e,e=>e,(e,s,r)=>{t[r]=e}),t):t}getFeatureObjectIdsForAggregate(e){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(e):[]}onSubscribe(e){this._strategy?.onSubscribe(e)}onUnsubscribe(e){this._strategy?.onUnsubscribe(e)}requiresInvalidation(e){return this._strategy?.requiresInvalidation(e)??!1}async update(e,s,r,a,o){const n=e.processor,c=t(this._schema?.storage,n.storage),u=t(this._schema?.mesh.properties,n.mesh.properties),g=t(this._schema?.mesh.factory,n.mesh.factory),y=t(this._schema?.mesh.strategy,n.mesh.strategy),l=b(this._schema?.expressionProperties,n.expressionProperties),_=l.some(e=>this._attributeStore.hasArcadeDependency(e)),f=l.some(e=>this._factory?.hasArcadeDependency(e)??!1),S=l.some(e=>this._strategy?.hasArcadeDependency(e))||this._strategy?.isAggregate&&_,v=f||S,I=u||g||y;if(!(c||I||(f||_||S))&&!a)return!1;if(has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:i(this._schema,n),schema:n}),this._schema=n,"annotation-feature"===n.mesh.factory.symbology.type||"dimension-feature"===n.mesh.factory.symbology.type){const e=this._source.metadata.outSpatialReference,t=this._source.metadata.attributeSpatialReference??this._source.metadata.spatialReference??e;await h(t,e)}const j=new m({fields:this._source.metadata.fieldsIndex,spatialReference:this._source.metadata.outSpatialReference}),M={currentUser:n.mesh.properties.currentUser};if((c||I||_)&&(await this._attributeStore.update(n.storage,j,this._source.metadata,s),this._strategy?.invalidateAttributeData(w(n))),!a&&!I&&!v)return!1;(y||u||v)&&await this._updateStrategy(n.mesh.strategy,o,w(n),M),this._updateSortKey(j,"sortKey"in n.mesh.properties?n.mesh.properties.sortKey:null);const x="dictionary"===n.mesh.factory.symbology.type?n.mesh.factory.symbology.fieldMap:null,U=new d(j,this._proxy,r,this._registry,x);return(g||"dictionary"===n.mesh.factory.symbology.type)&&(this._factory=await p.create(U,n.mesh.factory)),this._version=s,!0}async applyOverrideUpdate(e,t){if(this._strategy)try{const s=await this._strategy.applyOverrideUpdate(e);s&&await this._process(s,t)}catch(s){}}async updateChunks(e,t,s){await this._doUpdateChunks(e,t,s),this._strategy?.afterUpdateChunks()}async removeChunks(e){this._strategy?.removeChunks(e),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:e}){if(!this._strategy||!this._strategy.hasSubscribers)return void this._attributeStore.setHighlight(e.map(({objectId:e,highlightFlags:t})=>({objectId:e,highlightFlags:t,displayId:-1})),e);const t=this._strategy.displayMap(e,({objectId:e})=>e,(e,{highlightFlags:t},s)=>({objectId:s,displayId:e,highlightFlags:t}));this._attributeStore.setHighlight(t,e)}invalidate(){this._strategy&&this._strategy.invalidate()}async _doUpdateChunks(e,t,s){if(this._strategy){try{const r=await this._strategy.updateChunks(e,t);r&&await this._process(r,s)}catch(r){}has("esri-2d-update-debug")&&console.log("SendUpdates"),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.log("SendUpdates.await")}}async _updateStrategy(e,t,s,r){this._strategy?.destroy(),this._strategy=await l(this._connection,e,this._source,this._attributeStore,s,r);for(const i of t)this._strategy.onSubscribe(i)}async _updateSortKey(t,s){if(this._sortInfo=e(this._sortInfo?.computed),null!=s){const e=s.byRenderer?null:await t.createComputedField(s);this._sortInfo={...s,computed:e}}}async _process(e,t){switch(e.type){case"level-replace":return this._processLevelBatch(e,t);case"append":case"update":return this._processStandardBatch(e,t)}}async _processLevelBatch(e,t){const s=await this._connection.container.beginLevelMeshUpdate(e.level);await this._processBatchMessages(e.messages,t),await this._connection.container.applyLevelMeshUpdate(s)}async _processStandardBatch(e,t){return this._processBatchMessages(e.messages,t)}async _processBatchMessages(e,t){for(const r of e){const e=r.subscription;if(has("esri-2d-update-debug")){const t=e.tile;console.debug(`Version[${this._version}] Tile[${t.key.id}, end=${r.end}] Processor._process`)}const i={currentUser:this._schema?.mesh.properties.currentUser};await this._fetchResources(r,i),s(e.signal);const a=await this._write(r,e.tile.createArcadeEvaluationOptions(w(this._schema)),i,t),o=e.tile.tileInfoView.getLODInfoAt(e.tile.key);s(e.signal);const{message:n,transferList:c}=a.serialize(o),h={objectIdMap:null,inner:r.createMessage(n,this._version,this._attributeStore.epoch)};if(this._schema?.mesh.properties.returnMeshObjectId){h.objectIdMap={};const e=r.reader?.getCursor();if(e)for(;e.next();)h.objectIdMap[e.getDisplayId()]=e.getObjectId()}if(s(e.signal),await this._connection.container.onMessage(h,{signal:e.signal,transferList:c}),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")){const t=e.tile;console.debug(`Version[${this._version}] Tile[${t.key.id}, end=${r.end}] Processor._process.await`)}}}async _fetchResources(e,t){await this._fetchMatcherResources(e),await this._fetchWriterResources(e,t)}async _fetchMatcherResources(e){if(!e.reader)return;const t=e.subscription.tile.createArcadeEvaluationOptions(w(this._schema));return this._factory.enqueueMatcherRequests(this._proxy,e.reader,{scale:t.$view.scale,viewingMode:"2d"},e.id)}async _fetchWriterResources(e,t){if(!e.reader)return;const s=e.reader.getCursor(),r=e.subscription.tile.createArcadeEvaluationOptions(w(this._schema));for(;s.next();)this._factory.enqueueWriterRequests(this._proxy,s,r,t,e.id);await this._proxy.fetchEnqueuedResources()}async _write(e,t,i,a){const o=e.subscription.tile,n=e.reader?.getCursor(),c=n?.getSize()??0,h=o.tileInfoView.tileInfo.isWrappable,p=o.tileInfoView.spatialReference.isWGS84,g=this._schema?.mesh.factory.referenceScale,y=new u(o.key,h,p,c);if(!n)return y;const d=S(o.transform,a),l=o.createArcadeEvaluationOptions(w(this._schema));let _=0;for(;n.next();){++_%1e3||(await r(0),s(e.subscription));const a=this._getSortKeyValue(n,t);y.entityStart(n.getDisplayId(),a);try{this._factory.write(y,this._proxy,n,l,i,o.level,d,g)}catch(m){}y.entityEnd()}return y}_getSortKeyValue(e,t){if(!this._sortInfo)return 0;const{computed:s,order:r,byRenderer:i}=this._sortInfo,a=i?this._factory.getSortKey(e,t):s?.read(e,t);return null==a||isNaN(a)?0:a*("asc"===r?-1:1)}}function b(e,t){const s=[];return e?.timeExtent?.start===t.timeExtent?.start&&e?.timeExtent?.end===t.timeExtent?.end||s.push("timeProperties"),s}function w(e){const{timeZone:t}=e?.mesh.properties??{},{timeExtent:s}=e?.expressionProperties??{};return{timeZone:t,timeExtent:s}}function S(e,t){const s=o(e),r=[];for(const i of t.rings){const e=[];for(const t of i)e.push([n(s,t[0]),c(s,t[1])]);r.push(e)}return{rings:r}}export{f as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"../../../../../core/has.js";class e{constructor(e){this.subscription=e,this.handledChunks=new Set,has("esri-2d-update-debug")&&console.debug(`Tile[${e.tile.id}] ASendState.create`)}destroy(){}}class t{constructor(){this.type="append",this.messages=[]}}class s{constructor(){this.type="update",this.messages=[]}}class r{constructor(e){this.level=e,this.type="level-replace",this.messages=[]}}class i{constructor(e,t,s){this._source=e,this._attributeStore=t,this._sqlOptions=s,this._sendStates=new Map}destroy(){}get enablePixelBuffering(){return!0}get isAggregate(){return!1}get usedMemory(){return 0}onSubscribe(e){const t=this.createState(e);this._sendStates.set(e.key.id,t)}onUnsubscribe(e){this._sendStates.get(e.key.id)?.destroy(),this._sendStates.delete(e.key.id)}get hasSubscribers(){return this._sendStates.size>0}requiresInvalidation(e){return!1}invalidate(){const e=Array.from(this._sendStates.values());this._sendStates.clear();for(const t of e)t.destroy(),this.onSubscribe(t.subscription)}invalidateAttributeData(e){}hasArcadeDependency(e){return!1}getFeatureObjectIdsForAggregate(e){throw new Error("InternalError: AggregateId lookup not supported")}getDisplayIds(e){return this.displayMap(e,e=>e,e=>e)}getDisplayAndObjectIds(e){return this.displayMap(e,e=>e,(e,t,s)=>[e,s])}afterUpdateChunks(){}}export{i as AProcessorStrategy,e as ASendState,t as AppendBatch,r as LevelReplaceBatch,s as UpdateBatch};
2
+ import has from"../../../../../core/has.js";class e{constructor(e){this.subscription=e,this.handledChunks=new Set,has("esri-2d-update-debug")&&console.debug(`Tile[${e.tile.id}] ASendState.create`)}destroy(){}}class t{constructor(){this.type="append",this.messages=[]}}class s{constructor(){this.type="update",this.messages=[]}}class r{constructor(e){this.level=e,this.type="level-replace",this.messages=[]}}class i{constructor(e,t,s){this._source=e,this._attributeStore=t,this._sqlOptions=s,this._sendStates=new Map}destroy(){}get isAggregate(){return!1}get usedMemory(){return 0}onSubscribe(e){const t=this.createState(e);this._sendStates.set(e.key.id,t)}onUnsubscribe(e){this._sendStates.get(e.key.id)?.destroy(),this._sendStates.delete(e.key.id)}get hasSubscribers(){return this._sendStates.size>0}requiresInvalidation(e){return!1}invalidate(){const e=Array.from(this._sendStates.values());this._sendStates.clear();for(const t of e)t.destroy(),this.onSubscribe(t.subscription)}invalidateAttributeData(e){}hasArcadeDependency(e){return!1}getFeatureObjectIdsForAggregate(e){throw new Error("InternalError: AggregateId lookup not supported")}getDisplayIds(e){return this.displayMap(e,e=>e,e=>e)}getDisplayAndObjectIds(e){return this.displayMap(e,e=>e,(e,t,s)=>[e,s])}afterUpdateChunks(){}}export{i as AProcessorStrategy,e as ASendState,t as AppendBatch,r as LevelReplaceBatch,s as UpdateBatch};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{EventEmitter as e}from"../../../../../core/Evented.js";import{create as t}from"../../../../../geometry/support/aaBoundingBox.js";import{getBoundsOptimizedGeometry as r}from"../../../../../layers/graphics/featureConversionUtils.js";import{optimizedFeatureQueryEngineAdapter as s}from"../../../../../layers/graphics/data/optimizedFeatureQueryEngineAdapter.js";import{QueryEngine as a}from"../../../../../layers/graphics/data/QueryEngine.js";import{collectExpressionDependencies as i}from"../../../../../support/ArcadeExpression.js";import{AProcessorStrategy as n,LevelReplaceBatch as l}from"./AProcessorStrategy.js";class o extends n{constructor(t,r,a,n,l,o){super(t,r,l),this.spatialReference=a,this.aggregateFields=n,this._adapter=o,this._arcadeDependencies=new Set,this._levelStates=new Map,this.events=new e,this.featureAdapter=s;for(const e of n)i(this._arcadeDependencies,e.computed)}get aggregateQueryEngine(){if(!this._aggregateQueryEngine){const{metadata:e}=this._adapter;this._aggregateQueryEngine=new a({featureStore:this,fieldsIndex:e.fieldsIndex,geometryType:e.geometryType,featureIdInfo:e.featureIdInfo,spatialReference:this.spatialReference})}return this._aggregateQueryEngine}get isAggregate(){return!0}removeChunks(e){}hasArcadeDependency(e){return this._arcadeDependencies.has(e)}destroy(){super.destroy();for(const e of this._levelStates.values())e.destroy();this._levelStates.clear()}onSubscribe(e){super.onSubscribe(e);const{scale:t,level:r}=e.tile;this._lastSubscribedLodInfo={scale:t,level:r}}onUnsubscribe(e){this._levelStates.get(e.tile.level)?.removeTile(e),super.onUnsubscribe(e)}requiresInvalidation(e){return!1}invalidate(){for(const e of this._levelStates.values())e.invalidate()}displayMap(e,t,r){return this.getActiveLevelState()?.displayMap(e,t,r)??[]}getDisplayFeatures(e){return this.getActiveLevelState()?.getDisplayFeatures(e)??{features:[],aggregates:[],tracks:[]}}getFeatureObjectIdsForAggregate(e){return this.getActiveLevelState()?.getFeatureObjectIdsForAggregate(e)??[]}applyOverrideUpdate(e){return this._adapter.applyOverrideUpdate(e,this._levelStates.values())}createState(e){return this._adapter.createSendState(e)}async updateChunks(e,t){const r=this._lastSubscribedLodInfo;if(null==r)return null;const s=this._getOrCreateLevelState(r),a=this._getSendStatesForLevel(r.level);await s.update(e,a);const i=new l(r.level);for(const n of a)i.messages.push(...s.createMessages(n,e,t,()=>{this.events.emit("changed")}));return await this._adapter.afterUpdateLevelState(s,e,a),i}getActiveLevelState(){const e=this._lastSubscribedLodInfo;return null==e?null:this._levelStates.get(e.level)}_getOrCreateLevelState(e){let t=this._levelStates.get(e.level);return null==t&&(t=this._adapter.createLevelState(e),this._levelStates.set(e.level,t)),t}_getSendStatesForLevel(e){return Array.from(this._sendStates.values()).filter(t=>t.subscription.tile.level===e)}forEach(e){this.getActiveLevelState()?.forEachAggregateWorldSpace(e)}forEachInBounds(e,t){}forEachBounds(e,s){const a=t();for(const t of e){const e=r(a,t.geometry);e&&s(e)}}}export{o as AggregateStrategy};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import e from"../../../../../../layers/support/FieldsIndex.js";import{BinLevelState as t}from"./BinLevelState.js";import{BinState as a}from"./BinState.js";import{FeatureMetadata as i}from"../../support/FeatureMetadata.js";import{Hashed as s}from"../../support/Hashed.js";class n{constructor(t,a,s,n,r,l,o,d){this._schema=t,this._featureFilter=a,this._arcadeContextInfo=s,this._aggregateFields=n,this._spatialReference=r,this._sqlOptions=d,this.metadata=i.createFeature({geometryType:"esriGeometryPolygon",hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new e(t.fields).toJSON(),globalIdField:null,spatialReference:l.metadata.spatialReference,outSpatialReference:l.metadata.outSpatialReference,attributeSpatialReference:null,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null}),this._getIndex=this._createGetIndex(),this._binContext={getIndex:this._getIndex,spatialReference:this._spatialReference,attributeStore:o,metadata:this.metadata,arcadeContextInfo:this._arcadeContextInfo,sqlOptions:this._sqlOptions}}createSendState(e){return new a(e)}createLevelState(e){return new t(e.level,this._binContext)}async applyOverrideUpdate(e,t){for(const a of t)a.invalidate();return null}afterUpdateLevelState(e,t,a){}_createGetIndex(){return(e,t)=>{switch(this._schema.index.type){case"geohash":return e.getGeohashIndex(new s({type:"geohash",fields:this._aggregateFields,featureFilter:this._featureFilter,geohashLevel:this._schema.index.fixBinLevel,spatialReference:this._spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:t.scale,sqlOptions:this._sqlOptions}));case"grid":{const a=this._schema.index.fixedBinLevel,i=null!=a?t.tileInfoView.getLODInfoAt(a).scale:t.scale;return e.getGridIndex(new s({type:"grid",fields:this._aggregateFields,cellSize:this._schema.index.size,featureFilter:this._featureFilter,spatialReference:this._spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:i,sqlOptions:this._sqlOptions}))}}}}}export{n as BinAdapter};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import has from"../../../../../../core/has.js";import{convertToFeature as e,unquantizeOptimizedGeometryInPlace as t}from"../../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as s}from"../../../../../../layers/graphics/OptimizedFeature.js";import{FeatureTileAppendMessage as o}from"../../sources/FeatureSourceMessage.js";import{FeatureSetReaderJSON as r}from"../../support/FeatureSetReaderJSON.js";class a{constructor(e,t){this.level=e,this._context=t,this._tileStates=new Map}destroy(){for(const e of this._tileStates.values())this._releaseTileState(e);this._tileStates.clear()}invalidate(){}update(e,t){}removeTile(e){const t=this._tileStates.get(e.key.id);null!=t&&(this._releaseTileState(t),this._tileStates.delete(e.key.id))}displayMap(e,t,s){const o=new Map(e.map(e=>[t(e),e])),r=[];for(const a of this._featuresWorldSpace()){const{objectId:e,displayId:t}=a,i=o.get(e);if(null!=i){const a=s(t,i,e);r.push(a),o.delete(e)}}return r}getDisplayFeatures(t){const s=new Set(t),o=new Set,r=[];for(const a of this._featuresWorldSpace())s.has(a.displayId)&&!o.has(a.objectId)&&(a.geometry&&r.push({...e(a,this._context.metadata.geometryType,!1,!1),displayId:a.displayId}),o.add(a.objectId));return{features:[],aggregates:r,tracks:[]}}getFeatureObjectIdsForAggregate(e){for(const t of this._tileStates.values())for(const s of t.bins.values())if(s.id===e){const e=[];for(const t of s.containedObjectIds)for(const s of t.values())e.push(s);return e}return[]}forEachAggregateWorldSpace(e){const t=new Set;for(const s of this._featuresWorldSpace())t.has(s.objectId)||(e(s),t.add(s.objectId))}createMessages(e,t,a,i){const{subscription:n}=e,c=this._getOrCreateTileState(n),l=this._takeTileState(c),d=n.tile,u=new Set;for(const s of t){this._context.getIndex(s,d).putBounded(c.bins,u,d.extent,d.resolution)}const f=[],p=n.tile.transform,h=n.tile.key.level;for(const o of c.bins.values()){const e=o.getGeometry(this._context.spatialReference,p),t=new s(e,o.getAttributes(),null,o.id);e||(t.centroid=o.getGeometricCentroid(this._context.spatialReference,p)),t.displayId=this._context.attributeStore.createDisplayIdForObjectId(`${t.objectId}.${h}`),c.featureCache.set(o.id,t),f.push(t)}i(),e.done||=!a;const b=r.fromOptimizedFeatures(f,this._context.metadata,p),g=b.getCursor(),S=e.subscription.tile.createArcadeEvaluationOptions(this._context.arcadeContextInfo);for(;g.next();)this._context.attributeStore.setAttributeData(g.getDisplayId(),g,S,this._context.sqlOptions);has("esri-2d-update-debug")&&console.debug(`Tile[${e.subscription.tile.id}] BinningStrategy._update`,{done:e.done});const _=new o(e.subscription,b,e.done,{});for(const s of l.featureCache.keys())this._context.attributeStore.releaseDisplayIdForObjectId(`${s}.${h}`);return[_]}_getOrCreateTileState(e){let t=this._tileStates.get(e.key.id);return null==t&&(t={subscription:e,bins:new Map,featureCache:new Map},this._tileStates.set(e.key.id,t)),t}_takeTileState(e){const t=e.bins,s=e.featureCache;return e.bins=new Map,e.featureCache=new Map,{bins:t,featureCache:s}}_releaseTileState(e){const t=e.subscription.tile.key.level;for(const s of e.featureCache.keys())this._context.attributeStore.releaseDisplayIdForObjectId(`${s}.${t}`);e.bins.clear(),e.featureCache.clear()}*_featuresWorldSpace(){for(const e of this._tileStates.values())for(const s of e.featureCache.values()){const o=s.clone();o.geometry&&t(o.geometry,e.subscription.tile.transform),yield o}}}export{a as BinLevelState};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{ASendState as r}from"../AProcessorStrategy.js";class s extends r{constructor(r){super(r),this.done=!1}}export{s as BinState};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import e from"../../../../../../geometry/SpatialReference.js";import{checkProjectionSupport as t}from"../../../../../../layers/graphics/data/projectionSupport.js";import{ComputedAggregateField as a}from"../../aggregation/ComputedAggregateField.js";import{AggregateStrategy as r}from"../AggregateStrategy.js";import{BinAdapter as o}from"./BinAdapter.js";import{ComputedAttributeStorage as i}from"../../support/ComputedAttributeStorage.js";import m from"../../support/FeatureFilterEvaluator.js";export{BinState}from"./BinState.js";async function p(p,n,s,f,l){const g=n.metadata.outSpatialReference,d=new i({spatialReference:g}),u=await Promise.all(p.fields.map(async e=>a.create(d,e))),c=p.featureFilter?await m.create({geometryType:n.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:n.metadata.timeInfo,fieldsIndex:n.metadata.fieldsIndex,spatialReference:g,filterJSON:p.featureFilter}):null;"geohash"===p.index.type&&await t(g,e.WGS84);const y=new o(p,c,f,u,g,n,s,l);return new r(n,s,g,u,l,y)}export{p as createBinningStrategy};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import e from"../../../../../../layers/support/FieldsIndex.js";import{ClusterLevelState as t}from"./ClusterLevelState.js";import{ClusterSendState as a}from"./ClusterSendState.js";import{FeatureMetadata as l}from"../../support/FeatureMetadata.js";class r{constructor(t,a,r,n,i,s,d){this.metadata=l.createFeature({geometryType:"esriGeometryPoint",hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new e([...n,...i.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}]).toJSON(),globalIdField:null,spatialReference:i.metadata.spatialReference,outSpatialReference:i.metadata.outSpatialReference,attributeSpatialReference:null,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null}),this._clusterContext={connection:t,clusterRadius:a,indexOptions:r,attributeStore:s,metadata:this.metadata,sqlOptions:d}}createSendState(e){return new a(e)}createLevelState(e){return new t(e.level,e.scale,this._clusterContext)}async applyOverrideUpdate(e,t){for(const a of t)a.invalidate();return null}afterUpdateLevelState(e,t,a){return e.updateStatistics()}}export{r as ClusterAdapter};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import has from"../../../../../../core/has.js";import{convertToFeature as t}from"../../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as e}from"../../../../../../layers/graphics/OptimizedFeature.js";import s from"../../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as i}from"../../../../engine/webgl/definitions.js";import{GridCell as n}from"../../aggregation/GridCell.js";import{pixelsPerMapUnit as r}from"../../aggregation/GridSpatialIndex.js";import{WithDisplayId as a}from"../support/WithDisplayId.js";import{FeatureTileAppendMessage as o}from"../../sources/FeatureSourceMessage.js";import{FeatureSetReaderJSON as l}from"../../support/FeatureSetReaderJSON.js";import{Hashed as c}from"../../support/Hashed.js";const d=128;class u{constructor(t,e,s){this.level=t,this._scale=e,this._context=s,this._statistics=new Map,this._handledChunks=new Set,this._handledIds=new Set,this._cells=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const t of this._clusters.values())this._context.attributeStore.releaseDisplayIdForObjectId(t.inner.id);this._clusters.clear()}invalidate(){this._cells.clear(),this._handledChunks.clear(),this._handledIds.clear()}removeTile(t){}*aggregatesWorldSpace(){for(const t of this._clusters.values()){const s=t.inner.getCentroid(null),i=new e(s,t.inner.getAttributes(),null,t.inner.id,t.displayId);yield i}}clusters(){return this._clusters.values()}displayMap(t,e,s){const i=new Map(t.map(t=>[e(t),t])),n=[];for(const r of this._clusters.values()){const t=i.get(r.inner.id);if(null!=t){const e=s(r.displayId,t,r.inner.id);n.push(e),i.delete(r.inner.id);continue}if(1===r.inner.count){const{firstObjectId:t}=r.inner,e=t?i.get(t):null;if(null!=e){const a=s(r.displayId,e,t);n.push(a),i.delete(t)}}}return n}getDisplayFeatures(e){const s=new Set(e),i=new Set,n=[],r=[];for(const a of this.aggregatesWorldSpace())if(s.has(a.displayId)&&!i.has(a.displayId)){const e=t(a,this._context.metadata.geometryType,!1,!1);if(i.add(a.displayId),1===e.attributes.cluster_count){n.push({...e,displayId:a.displayId});continue}r.push({...e,displayId:a.displayId})}return{features:n,aggregates:r,tracks:[]}}getFeatureObjectIdsForAggregate(t){for(const e of this._clusters.values())if(e.inner.id===t){const t=[];for(const s of e.inner.containedObjectIds)for(const e of s.values())t.push(e);return t}return[]}forEachAggregateWorldSpace(t){for(const e of this.aggregatesWorldSpace())t(e)}update(t,e){let s=!1;const i=new c({...this._context.indexOptions,scale:this._scale});for(const r of t){if(this._handledChunks.has(r.normalizedChunkId))continue;if(this._handledChunks.add(r.normalizedChunkId),null!=r.lodInfo&&r.lodInfo.level!==this.level)continue;r.getGridIndex(i).put(this._cells,this._handledIds),s=!0}const n=r(this._context.indexOptions.spatialReference,this._scale),a=this._context.indexOptions.cellSize,o={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0};for(const{subscription:r}of e){const t=r.tile.bounds,e=Math.floor(t[0]*n/a),s=Math.floor(t[1]*n/a),i=Math.ceil(t[2]*n/a),l=Math.ceil(t[3]*n/a);o.xMin=Math.min(o.xMin,e),o.yMin=Math.min(o.yMin,s),o.xMax=Math.max(o.xMax,i),o.yMax=Math.max(o.yMax,l)}null!=this._lastCellBounds&&o.xMin===this._lastCellBounds.xMin&&o.xMax===this._lastCellBounds.xMax&&o.yMin===this._lastCellBounds.yMin&&o.yMax===this._lastCellBounds.yMax||(this._lastCellBounds=o,s=!0),s&&this._clusterCells(o)}async updateStatistics(){let t=!1;for(const e of this._clusters.values())e.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,e.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map(([t,e])=>({fieldName:t,minValue:e.minValue,maxValue:e.maxValue}));await this._context.connection.container.updateStatistics(this.level,t)}}createMessages(t,e,s,i){const n=this._createAggregateFeatures(t);i(),t.done=t.done||!s;const r=n.getCursor(),a=t.subscription.tile.createArcadeEvaluationOptions(this._context.indexOptions.arcadeContextInfo);for(;r.next();)this._context.attributeStore.setAttributeData(r.getDisplayId(),r,a,this._context.sqlOptions);return has("esri-2d-update-debug")&&console.debug(`Tile[${t.subscription.tile.id}] ClusterStrategy._update`,{done:t.done}),[new o(t.subscription,n,t.done,{})]}_createAggregateFeatures(t){const n=t.subscription,r=[],a=n.tile.transform,o=Array.from(this._clusters.values()),c=o.length;for(const l of o){const t=l.inner.getCentroidX(a),n=l.inner.getCentroidY(a),o=1===l.inner.count?l.inner.firstObjectId:l.inner.id,c=l.displayId;if(t<i+d&&t>=-d&&n<i+d&&n>=-d){const i=new s([],[t,n]),a=new e(i,l.inner.getAttributes(),null,o,c);r.push(a)}}const u=l.fromOptimizedFeatures(r,this._context.metadata,n.tile.transform);return has("esri-2d-update-debug")&&console.debug(`Tile[${t.subscription.tile.id}] ClusterLevelState.createAggregateFeatures`,{clusters:u,levelClusterCount:c}),u}_clusterCells(t){const e=this._clusters;this._clusters=new Map;const s=this._context.clusterRadius*(1/r(this._context.indexOptions.spatialReference,this._scale));let i=Array.from(this._cells.values());i=i.sort((t,e)=>e.count-t.count);const o=new Set;for(const r of i){if(o.has(r.id))continue;if(r.gridX<t.xMin||r.gridX>t.xMax||r.gridY<t.yMin||r.gridY>t.yMax)continue;const e=1+this._context.clusterRadius/this._context.indexOptions.cellSize,i=this._context.attributeStore.createDisplayIdForObjectId(r.id),l=new a(r.clone(),i);o.add(r.id),this._clusters.set(r.id,l);const c=r.centroidXWorld,d=r.centroidYWorld;for(let t=r.gridY-e;t<=r.gridY+e;t++)for(let i=r.gridX-e;i<=r.gridX+e;i++){if(t===r.gridY&&i===r.gridX)continue;const e=this._cells.get(n.createId(i,t));if(!e||o.has(e.id))continue;const a=Math.abs(e.centroidXWorld-c),u=Math.abs(e.centroidYWorld-d);a<s&&u<s&&(l.inner.merge(e),o.add(e.id))}}for(const n of e.values())this._context.attributeStore.releaseDisplayIdForObjectId(n.inner.id)}_updateAggregateStatistics(t,e){let s=!1;for(const i of e.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const e=i.value,n=i.field,r=t.get(n.name);if(r){const{minValue:t,maxValue:i}=r,n=Math.min(r.minValue,e),a=Math.max(r.maxValue,e);t===n&&i===a||(r.minValue=n,r.maxValue=a,s=!0);continue}t.set(n.name,{minValue:e,maxValue:e}),s=!0}return s}}export{u as ClusterLevelState};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{ASendState as s}from"../AProcessorStrategy.js";class r extends s{constructor(s){super(s),this.didSend=!1,this.done=!1}}export{r as ClusterSendState};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{ComputedAggregateField as e}from"../../aggregation/ComputedAggregateField.js";import{AggregateStrategy as t}from"../AggregateStrategy.js";import{ClusterAdapter as a}from"./ClusterAdapter.js";import{ComputedAttributeStorage as r}from"../../support/ComputedAttributeStorage.js";import i from"../../support/FeatureFilterEvaluator.js";export{ClusterSendState}from"./ClusterSendState.js";async function s(s,o,l,n,f,p){const m=l.metadata.outSpatialReference,d=new r({spatialReference:m}),u=await Promise.all(o.fields.map(async t=>e.create(d,t))),c={type:"grid",fields:u,spatialReference:m,featureFilter:o.featureFilter?await i.create({geometryType:l.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:l.metadata.timeInfo,fieldsIndex:l.metadata.fieldsIndex,spatialReference:m,filterJSON:o.featureFilter}):null,cellSize:o.clusterRadius/4,arcadeContextInfo:f,sqlOptions:p},g=new a(s,o.clusterRadius,c,o.fields,l,n,p);return new t(l,n,c.spatialReference,u,p,g)}export{s as createClusterStrategy};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{FeatureUpdateStrategy as r}from"./FeatureUpdateStrategy.js";import{createBinningStrategy as t}from"./bins/createBinningStrategy.js";import{createClusterStrategy as e}from"./clusters/createClusterStrategy.js";import{createTrackStrategy as a}from"./tracks/createTrackStrategy.js";async function s(s,c,n,i,o,u){switch(c.type){case"feature":return new r(n,i,o,u);case"binning":return t(c,n,i,o,u);case"cluster":return e(s,c,n,i,o,u);case"track":return a(c,n,i,o,u)}}export{s as createAggregateStrategy};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{assertIsSome as t}from"../../../../../../core/maybe.js";import{load as e,execute as s}from"../../../../../../geometry/operators/gx/operatorGeodeticDensify.js";import{geodeticCurveType as r}from"../../../../../../geometry/operators/support/geodeticCurveType.js";import{intersectsWithMargin as i,fromValues as o,intersects as a,empty as n,expandPointInPlace as l}from"../../../../../../geometry/support/aaBoundingRect.js";import{getClosestDenormalizedXToReference as c}from"../../../../../../geometry/support/normalizeUtils.js";import{normalizeCentralMeridianForDisplay as h}from"../../../../../../geometry/support/normalizeUtilsSync.js";import{quantizeOptimizedGeometry as m,convertToGeometry as d,convertFromPolyline as u}from"../../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as p}from"../../../../../../layers/graphics/OptimizedFeature.js";import b from"../../../../../../layers/graphics/OptimizedGeometry.js";import{externalTrackLineOidPrefix as f,internalTimeReceivedField as _,internalTrackPartField as y}from"../../../../../../layers/support/streamLayerUtils.js";import{tileSize as g}from"../../../../engine/webgl/definitions.js";import{AccumulatedStatistics as v}from"../../aggregation/AccumulatedStatistics.js";let I;const x=32;class O{constructor(t,e,s,r,i){this.chunkIndex=t,this.featureIndex=e,this.objectId=s,this.displayId=r,this.time=i}}async function j(t){if(t.isWrappable||null!=I)return;const[s,r]=await Promise.all([import("../../../../../../geometry/operators/support/apiConverter.js"),import("../../../../../../geometry/operators/support/jsonConverter.js"),e()]);I={fromGeometryToGXGeometry:r.fromGeometryToGXGeometry,toGeometry:r.toGeometry,fromSpatialReference:s.fromSpatialReference}}class k{static getOid(t){return f+t}constructor(t,e,s,r){this._context=t,this.trackId=e,this.objectId=s,this.displayId=r,this._maxDisplayDuration=this._context.schema.maxDisplayDuration>0?this._context.schema.maxDisplayDuration:1/0,this._maxDisplayObservationsPerTrack=this._context.schema.maxDisplayObservationsPerTrack>=1?this._context.schema.maxDisplayObservationsPerTrack:1/0,this._observationRecords=[],this._nextObservationRecordsByObjectId=new Map,this._trackLinePath=[],this._bounds=[],this._trackLineGeometry=new b}get _trackLineAttributes(){const t={...this._latestObservationFeature?.attributes,aggregateId:this.objectId,[y]:0};if(null!=this._statistics)for(const e of this._statistics.values())t[e.field.name]=e.value;return t}get _startTimeField(){return this._context.metadata.timeInfo?.startTimeField}get length(){return this._observationRecords.length}*observations(){yield*this._observationRecords}*previousObservations(){for(let t=0;t<this._observationRecords.length-1;t++)yield this._observationRecords[t]}get latestObservationFeature(){return this._latestObservationFeature}get latestObservationRecord(){return this._latestObservationRecord}stageObservation(t,e){const s=e.getObjectId();this._nextObservationRecordsByObjectId.delete(s),this._nextObservationRecordsByObjectId.set(s,new O(t,e.getIndex(),s,e.getDisplayId(),null!=this._startTimeField?e.readAttributeAsTimestamp(this._startTimeField):null))}commitObservations(e,s,r){const i=Array.from(this._nextObservationRecordsByObjectId.values()),o=new Set(i.map(t=>t.objectId)),a=this._observationRecords.filter(t=>!o.has(t.objectId)).map(t=>t.objectId);let n,l;switch(this._observationRecords=[],this._trackLinePath=[],this._context.isStream||null==this._startTimeField||i.sort((t,e)=>{const s=t.time,r=e.time;return null!=s&&null!=r?s-r:0}),this._context.schema.timeField){case"startTimeField":n=this._context.metadata.timeInfo?.startTimeField;break;case"endTimeField":n=this._context.metadata.timeInfo?.endTimeField;break;case"timeReceived":n=this._context.isStream?_:null}l=this._context.isStream?r?.end??Date.now():r?.end??-1/0;const c=s.map(t=>t.reader.getCursor());let h;for(let m=i.length-1;m>=0&&!(this._observationRecords.length>=this._maxDisplayObservationsPerTrack);m--){const e=i[m],s=c[e.chunkIndex];t(s),s.setIndex(e.featureIndex);const r=null!=n?s.readAttributeAsTimestamp(n):null;(null!=r?l-r:0)>=this._maxDisplayDuration||(this._commitObservation(e,s),h??=e)}if(null!=h){const{chunkIndex:s,featureIndex:r}=h,i=`${h.objectId}.latest`,o=e.createDisplayIdForObjectId(i),n=c[s];t(n),n.setIndex(r);const l=new p(n.readGeometryWorldSpace(),{...n.readAttributes(),[y]:1},null,i,o);this._latestObservationFeature&&a.push(this._latestObservationFeature.objectId),this._latestObservationFeature=l,this._latestObservationRecord=h}else this._latestObservationFeature=null;return this._trackLineGeometry=F(this._trackLinePath,this._context.spatialReference),this._bounds=R(this._trackLineGeometry),this._nextObservationRecordsByObjectId.clear(),a}updateStatistics(e,s){this._statistics=v.create(this._context.aggregateFields);const r=e.map(t=>t.reader.getCursor());for(const{chunkIndex:i,featureIndex:o}of this._observationRecords){const e=r[i];t(e),e.setIndex(o),this._statistics.insert(e,s)}}overlapsTile(t){for(const e of this._bounds)if(i(e,t.bounds,x))return!0;return!1}getLatestObservationFeatureForTile(t){if(null==this._latestObservationFeature)return null;const{objectId:e,displayId:s,geometry:r,attributes:i}=this._latestObservationFeature,n=m(r,this._context.metadata.geometryType,t.subscription.tile.transform)??new b,c=o(1/0,1/0,-1/0,-1/0);T(n,(t,e)=>l(c,[t,e]));if(!a(c,o(0,0,g,g)))return null;return new p(n,i,null,e,s)}getTrackLineFeatureForTile(t){const e=m(this._trackLineGeometry,"esriGeometryPolyline",t.subscription.tile.transform)??new b;return new p(e,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineOptimizedFeature(){return new p(this._trackLineGeometry,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineDisplayFeature(){const{_trackLineGeometry:t,_trackLineAttributes:e,displayId:s}=this;return{geometry:d(t,"esriGeometryPolyline",!1,!1),attributes:e,displayId:s}}_commitObservation(t,e){const s=e.readCentroidWorldSpace();let r=s?.coords[0],i=s?.coords[1];null==s&&(r=e.readXWorldSpace(),i=e.readYWorldSpace()),null!=r&&null!=i&&(this._observationRecords.unshift(t),this._trackLinePath.unshift([r,i]))}}function F(e,i){if(e.length<2)return u({paths:[e]},!1,!1);if(i.isWrappable){let t=!1;for(let s=1;s<e.length;s++){const r=e[s][0],o=c(r,e[s-1][0],i);r!==o&&(e[s][0]=o,t=!0)}if(t){const t=h({paths:[e],spatialReference:i});if(null!=t)return u({paths:t.paths},!1,!1)}return u({paths:[e]},!1,!1)}t(I);const o=I.fromGeometryToGXGeometry({hasM:!1,hasZ:!1,paths:[e]}),a=I.fromSpatialReference(i);if(null!=a){const t=s(o,1e6,a,r.geodesic);if(null!=t){const e=I.toGeometry(t,a);if(null!=e&&"paths"in e)return u({paths:e.paths},!1,!1)}}return u({paths:[e]},!1,!1)}function T(t,e){const s=2,{coords:r,lengths:i}=t;if(!i.length)return void e(r[0],r[1]);let o=0;for(let a=0;a<i.length;a++){const t=i[a];let n=0,l=0;for(let i=0;i<t;i++)n+=r[s*(i+o)],l+=r[s*(i+o)+1],e(n,l);o+=t}}function R(t){const{lengths:e,coords:s}=t,r=2;if(!e.length)return[n()];const i=[];let o=0;for(let a=0;a<e.length;a++){const t=e[a],c=n();i.push(c);for(let e=0;e<t;e++){const t=s[r*(e+o)],i=s[r*(e+o)+1];l(c,[t,i])}o+=t}return i}export{O as ObservationRecord,k as Track,j as loadTrackGeometryOperator};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import e from"../../../../../../core/Logger.js";import{internalTrackPartField as t}from"../../../../../../layers/support/streamLayerUtils.js";import{TrackLevelState as a}from"./TrackLevelState.js";import{TrackSendState as r}from"./TrackSendState.js";import{FeatureMetadata as l}from"../../support/FeatureMetadata.js";const i=()=>e.getLogger("esri.views.2d.layers.features.processor.TrackStrategy");class s{constructor(e,a,r,i,s,n,o,d){const p=a.metadata.weakCloneWithAdditionalFields([{name:t,alias:"trackPart",type:"esriFieldTypeSmallInteger"}]),m=l.createFeature({geometryType:"esriGeometryPolyline",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:{fields:[...a.metadata.fieldsIndex.fields,...s,{name:t,alias:"trackPart",type:"esriFieldTypeSmallInteger"},{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],timeZoneByFieldName:null},globalIdField:null,spatialReference:a.metadata.spatialReference,outSpatialReference:a.metadata.outSpatialReference,attributeSpatialReference:null,subtypeField:null,subtypes:null,timeInfo:a.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null,hasZ:!1,hasM:!1});this.metadata=p,this._trackContext={schema:e,source:a,attributeStore:r,spatialReference:i,metadata:p,trackLineMetadata:m,aggregateFields:s,arcadeContextInfo:o,sqlOptions:d,featureFilter:n,isStream:a.isStream}}createSendState(e){return new r(e)}createLevelState(e){return new a(e.level,this._trackContext)}async applyOverrideUpdate(e,t){return i().error("Applying override to tracks is not supported"),null}afterUpdateLevelState(e,t,a){}}export{s as TrackAdapter};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{isSome as t}from"../../../../../../core/arrayUtils.js";import{internalTrackPartField as e}from"../../../../../../layers/support/streamLayerUtils.js";import{Track as s}from"./Track.js";import{FeatureTileAppendMessage as r}from"../../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as o}from"../../support/arcadeUtils.js";import{FeatureSetReaderIndirect as a}from"../../support/FeatureSetReaderIndirect.js";import{FeatureSetReaderJSON as i}from"../../support/FeatureSetReaderJSON.js";class n{constructor(t,e){this.level=t,this._context=e,this._chunks=[],this._tracks=new Map,this._handledChunks=new Set}destroy(){this._clear()}invalidate(){}removeTile(t){}update(t,e){const s=this._chunks,r=this._tracks,o=this._handledChunks;this._chunks=t,this._tracks=new Map,this._handledChunks=new Set,this._rebuildTracks(t),this._releaseState(s,r,o)}displayMap(t,e,s){const r=new Map(t.map(t=>[e(t),t])),o=[];for(const a of this._tracks.values()){const t=r.get(a.objectId);if(null!=t){const e=s(a.displayId,t,a.objectId);o.push(e),r.delete(a.objectId);continue}const e=a.latestObservationFeature;if(e?.objectId){const t=r.get(e.objectId);if(null!=t){const a=s(e.displayId,t,e.objectId);o.push(a),r.delete(e.objectId);continue}}for(const i of a.observations()){const t=r.get(i.objectId);if(null!=t){const e=s(i.displayId,t,i.objectId);o.push(e),r.delete(i.objectId)}}}return o}getDisplayFeatures(t){const e=new Set(t),s=[],r=[],o=this._chunks.map(t=>t.reader.getCursor());for(const a of this._tracks.values()){if(e.has(a.displayId)&&r.push(a.getTrackLineDisplayFeature()),null!=a.latestObservationFeature&&e.has(a.latestObservationFeature.displayId)){const{displayId:t,chunkIndex:e,featureIndex:r}=a.latestObservationRecord,i=o[e];i.setIndex(r),s.push({displayId:t,...i.readLegacyFeatureWorldSpace()})}for(const{displayId:t,chunkIndex:r,featureIndex:i}of a.observations())if(e.has(t)){const e=o[r];e.setIndex(i),s.push({displayId:t,...e.readLegacyFeatureWorldSpace()})}}return{features:s,aggregates:[],tracks:r}}getFeatureObjectIdsForAggregate(t){for(const e of this._tracks.values())if(e.objectId===t)return Array.from(e.observations(),t=>t.objectId);return[]}forEachAggregateWorldSpace(t){for(const e of this._tracks.values())t(e.getTrackLineOptimizedFeature())}createMessages(s,o,n,c){s.done=s.done||!n;const l=[],u=[];for(const t of this._tracks.values())if(t.length>0){if(this._context.schema.showLatestObservation){const e=t.getLatestObservationFeatureForTile(s);null!=e&&l.push(e)}this._context.schema.showTrackLine&&t.overlapsTile(s.subscription.tile)&&u.push(t.getTrackLineFeatureForTile(s))}const d=i.fromOptimizedFeatures(l,this._context.metadata,s.subscription.tile.transform),h=i.fromOptimizedFeatures(u,this._context.trackLineMetadata,s.subscription.tile.transform);let f=[];if(this._context.schema.showPreviousObservations){const r=this._chunks.map(()=>[]);for(const t of this._tracks.values())for(const{chunkIndex:e,featureIndex:s}of t.previousObservations())r[e].push(s);f=this._chunks.map((t,o)=>{const i=s.subscription.tile;let n;if("esriGeometryPolygon"===this._context.metadata.geometryType){const e=t.queryFeaturesInBounds(i.bounds);e.setTransformForDisplay(i.transform),n=e}else n=t.getTileReader(i);if(null==n)return null;const c=a.from(n,r[o]);return c.setProcessorAttributes({[e]:2}),"esriGeometryPoint"!==c.geometryType&&null!=c.getInTransform()||c.setTransformForDisplay(s.subscription.tile.transform),c}).filter(t)}c();const p=s.subscription.tile.createArcadeEvaluationOptions(this._context.arcadeContextInfo),_=h.getCursor();for(;_.next();)this._context.attributeStore.setAttributeData(_.getDisplayId(),_,p,this._context.sqlOptions);for(const t of f){const e=t.getCursor();for(;e.next();)this._context.attributeStore.setAttributeData(e.getDisplayId(),e,p,this._context.sqlOptions)}const b=d.getCursor();for(;b.next();)this._context.attributeStore.setAttributeData(b.getDisplayId(),b,p,this._context.sqlOptions);return[new r(s.subscription,h,!1,{}),...f.map(t=>new r(s.subscription,t,!1,{})),new r(s.subscription,d,s.done,{})]}_clear(){this._releaseState(this._chunks,this._tracks,this._handledChunks),this._chunks=[],this._tracks.clear(),this._handledChunks.clear()}_rebuildTracks(t){if(!t.length)return;const e=this._context.metadata.timeInfo?.trackIdField;if(null!=e){for(let r=0;r<t.length;r++){const o=t[r];if(null!=o.lodInfo&&o.lodInfo.level!==this.level)continue;if(this._handledChunks.has(o.chunkId))continue;this._handledChunks.add(o.chunkId);const a=o.reader.getCursor();for(;a.next();){const t=a.getObjectId();a.setDisplayId(this._context.attributeStore.createDisplayIdForObjectId(t));const o=a.readAttribute(e);if(null!=o&&null!=t&&(null===this._context.featureFilter||this._context.featureFilter.check(a,this._context.sqlOptions))){if(!this._tracks.has(o)){const t=s.getOid(o),e=this._context.attributeStore.createDisplayIdForObjectId(t),r=new s(this._context,o,t,e);this._tracks.set(o,r)}this._tracks.get(o).stageObservation(r,a)}}}for(const e of this._tracks.values()){const s=e.commitObservations(this._context.attributeStore,t,this._context.featureFilter?.timeExtent);for(const t of s)this._context.attributeStore.releaseDisplayIdForObjectId(t);e.updateStatistics(t,o(1,this._context.arcadeContextInfo))}}}_releaseState(t,e,s){for(const r of t)if(s.has(r.chunkId)){const t=r.reader.getCursor();for(;t.next();){const e=t.getObjectId();this._context.attributeStore.releaseDisplayIdForObjectId(e)}}for(const r of e.values())this._releaseTrack(r)}_releaseTrack(t){this._context.attributeStore.releaseDisplayIdForObjectId(t.objectId),null!=t.latestObservationFeature&&this._context.attributeStore.releaseDisplayIdForObjectId(t.latestObservationFeature.objectId)}}export{n as TrackLevelState};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{ASendState as r}from"../AProcessorStrategy.js";class s extends r{constructor(r){super(r),this.done=!1}}export{s as TrackSendState};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{ComputedAggregateField as e}from"../../aggregation/ComputedAggregateField.js";import{AggregateStrategy as t}from"../AggregateStrategy.js";import{loadTrackGeometryOperator as a}from"./Track.js";import{TrackAdapter as r}from"./TrackAdapter.js";import{ComputedAttributeStorage as o}from"../../support/ComputedAttributeStorage.js";import i from"../../support/FeatureFilterEvaluator.js";async function m(m,p,s,n,f){const l=p.metadata.outSpatialReference,d=new o({spatialReference:l}),g=await Promise.all(m.fields.map(async t=>e.create(d,t))),u=m.featureFilter?await i.create({geometryType:p.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:p.metadata.timeInfo,fieldsIndex:p.metadata.fieldsIndex,spatialReference:l,filterJSON:m.featureFilter}):null;await a(l);const c=new r(m,p,s,l,g,u,n,f);return new t(p,s,l,g,f,c)}export{m as createTrackStrategy};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../../../../core/Logger.js";import{pt2px as a}from"../../../../../../../core/screenUtils.js";import{generateGradient as i}from"../../../../../../../renderers/support/heatmapUtils.js";import l from"../../../../../../../symbols/SimpleFillSymbol.js";import r from"../../../../../../../symbols/SimpleLineSymbol.js";import t from"../../../../../../../symbols/SimpleMarkerSymbol.js";import{CIMSymbolHelper as o,slsDashToTemplateArray as s}from"../../../../../../../symbols/cim/CIMSymbolHelper.js";import{getSDFInfo as n}from"../../../../../../../symbols/cim/SDFHelper.js";import{getAlignmentFromPlacement as u}from"../../../../../engine/webgl/alignmentUtils.js";import{writeColor as c}from"../../../../../engine/webgl/color.js";import{dotDensityMaxFields as p}from"../../../../../engine/webgl/definitions.js";import{Techniques as f}from"../../../../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{maxPieChartFields as b}from"../../../../../engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js";import{premultiplyColor as m}from"../schemaUtils.js";import{createVisualVariableUniforms as S,getMaxSizeVVSize as V,noVisualVariables as y}from"../VisualVariablesSchema.js";import{createComplexSymbolInstances as v}from"./ComplexSymbolSchema.js";import{hasSizeVVUniform as h,hasRotationVVUniform as z}from"./utils.js";async function d(a,i){if(!a)return[];switch(a.type){case"simple-fill":return U(a,i);case"picture-fill":return F(a,i);case"simple-marker":return I(a,i);case"picture-marker":return w(a,i);case"simple-line":return P(a,i,!1);case"text":return A(a,i);case"label":return L(a,i);case"cim":return v(a.data,i);case"web-style":return d(await a.fetchSymbol({acceptedFormats:["cim","web"]}),i);case"line-3d":return e.getLogger("esri.views.layers.FeatureLayerView").warn("unsupported-symbol",`Symbol of type "${a.type}" unsupported in MapView. Defaulting to simple-line`),P(new r,i,!1);case"point-3d":return e.getLogger("esri.views.layers.FeatureLayerView").warn("unsupported-symbol",`Symbol of type "${a.type}" unsupported in MapView. Defaulting to simple-marker`),I(new t,i);case"polygon-3d":return e.getLogger("esri.views.layers.FeatureLayerView").warn("unsupported-symbol",`Symbol of type "${a.type}" unsupported in MapView. Defaulting to simple-fill`),U(new l,i);case"mesh-3d":case"label-3d":return e.getLogger("esri.views.layers.FeatureLayerView").warn("unsupported-symbol",`Symbol of type "${a.type}" unsupported in MapView. Ignoring`),[];case"CIMSymbolReference":throw new Error("InternalError: CIMSymbolReference should already be resolved")}}async function g(e,a){const{schemaOptions:i}=a,{store:r}=i,t=new Array(p),o=new Array(p/4);for(let l=0;l<p;l++){const a=l<e.attributes.length?e.attributes[l].color:null;t[l]=[0,0,0,0],c(t[l],a)}for(let l=0;l<p/4;l++)o[l]=[0,0,0,0],o[l][0]=4*l<e.attributes.length?1:0,o[l][1]=4*l+1<e.attributes.length?1:0,o[l][2]=4*l+2<e.attributes.length?1:0,o[l][3]=4*l+3<e.attributes.length?1:0;const s={uniforms:{isActive:o,colors:t,dotValue:e.dotValue,dotScale:e.referenceScale,blending:e.dotBlendingEnabled,dotSize:e.dotSize,seed:e.seed},optionalAttributes:{}},n=r.ensureInstance(f.dotDensity,s).createMeshInfo({effects:null}),u=[],b=new l({color:e.backgroundColor??[0,0,0,0],outline:null}),m=await d(b,a);if(u.push(...m),u.push(n),e.outline){const i=P(e.outline,a,!0);u.push(...i)}return u}async function M(e,l){const{store:r}=l,{radius:t,minDensity:o,maxDensity:s,referenceScale:n,field:u,valueExpression:c,colorStops:p}=e,b=i(p);return[r.ensureInstance(f.heatmap,{uniforms:{radius:a(t),minDensity:o,maxDensity:s,referenceScale:n,isFieldActive:!(!u&&!c),gradient:b,gradientHash:b.join(",")},optionalAttributes:{}}).createMeshInfo({effects:null})]}async function C(e,i){const{store:l}=i,r=e.outline?.width||0,t=S(e),o=Math.min(e.attributes.length,b),s=e.attributes.slice(0,o).map(e=>m(e.color));for(;s.length<b;)s.push([0,0,0,0]);const n=l.ensureInstance(f.pieChart,{uniforms:{shader:{chart:{outlineWidth:Math.round(a(r)),defaultColor:m(e.defaultColor),outlineColor:m(e.outline?.color),othersColor:m(e.othersCategory?.color),donutRatio:e.holePercentage,sectorThreshold:e.othersCategory?.threshold||0,colors:s,fieldCount:o},visualVariableOpacity:t.visualVariableOpacity,visualVariableSizeMinMaxValue:t.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:t.visualVariableSizeScaleStops,visualVariableSizeStops:t.visualVariableSizeStops,visualVariableSizeUnitValue:t.visualVariableSizeUnitValue}},optionalAttributes:{zoomRange:!0}}).createMeshInfo({size:e.size,outlineWidth:r,effects:null,scaleInfo:null,minPixelBuffer:V(t)});return[...e.backgroundFillSymbol?await U(e.backgroundFillSymbol,{schemaOptions:i,uniforms:y}):[],n]}function x(e){if("path"===e.style){if(null==e.path)throw new Error("Symbol with a style of type path must define a path");return{type:"sprite-rasterization-param",overrides:[],resource:{type:"path",path:e.path,asFill:!0}}}const a=o.fromSimpleMarker(e);if("outline"in e&&e.outline&&"none"!==e.outline.style){if("solid"!==e.outline.style){if(!a||!a.symbolLayers)throw new Error("Error handling marker! ");return{type:"sprite-rasterization-param",resource:a.symbolLayers[0],overrides:[]}}}return{type:"sprite-rasterization-param",resource:n(a),overrides:[]}}async function I(e,a){const{uniforms:i,schemaOptions:l}=a,{store:r}=l;if("path"===e.style||e.outline&&"solid"!==e.outline.style&&"none"!==e.outline.style){const l=o.fromSimpleMarker(e);if(!l||!l.symbolLayers)throw new Error("Error handling marker! ");if(i.visualVariableRotation&&(l.angleAlignment="Map"),"path"!==e.style){const e=l.symbolLayers[0];if(h(a.uniforms)){const i=V(a.uniforms,0,1);if(i>e.size){const a=i/e.size;e.size=i;const l=e.markerGraphics?.[0].symbol;(l.symbolLayers&&l.symbolLayers[0]).width*=a}}}return v({type:"CIMSymbolReference",symbol:l},a)}const t=r.ensureInstance(f.marker,{uniforms:{visualVariableColor:i.visualVariableColor,visualVariableOpacity:i.visualVariableOpacity,visualVariableSizeMinMaxValue:i.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:i.visualVariableSizeScaleStops,visualVariableSizeStops:i.visualVariableSizeStops,visualVariableSizeUnitValue:i.visualVariableSizeUnitValue,visualVariableRotation:i.visualVariableRotation},optionalAttributes:{zoomRange:!1}}),s=x(e);let n=e.color?.toArray()??[0,0,0,0];"CIMVectorMarker"===s.resource.type&&(n=[255,255,255,255]);const u="triangle"===e.style?124/116:1,c=e.size,p=c*u,b=null!=i.visualVariableColor&&("cross"===e.style||"x"===e.style);return[t.createMeshInfo({type:"simple",color:n,height:c,width:p,offsetX:e.xoffset,offsetY:e.yoffset,angle:e.angle,alignment:z(i)?1:0,outlineColor:e.outline?.color?.toArray()??[0,0,0,0],outlineSize:e.outline?.width??1,referenceSize:c,sprite:s,overrideOutlineColor:b,hasSizeVV:h(i),placement:null,effects:null,transforms:null,scaleInfo:null,minPixelBuffer:V(i)})]}function w(e,a){const{uniforms:i,schemaOptions:l}=a,{store:r}=l,t=r.ensureInstance(f.marker,{uniforms:{visualVariableColor:i.visualVariableColor,visualVariableOpacity:i.visualVariableOpacity,visualVariableSizeMinMaxValue:i.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:i.visualVariableSizeScaleStops,visualVariableSizeStops:i.visualVariableSizeStops,visualVariableSizeUnitValue:i.visualVariableSizeUnitValue,visualVariableRotation:i.visualVariableRotation},optionalAttributes:{zoomRange:!1}}),s=o.createPictureMarkerRasterizationParam(e);if(!s)return[];return[t.createMeshInfo({type:"picture",color:[255,255,255,255],height:e.height,width:e.width,offsetX:e.xoffset,offsetY:e.yoffset,angle:e.angle,alignment:z(i)?1:0,outlineColor:null,outlineSize:0,referenceSize:e.height,sprite:s,overrideOutlineColor:!1,hasSizeVV:h(i),placement:null,effects:null,transforms:null,scaleInfo:null,minPixelBuffer:V(i)})]}function O(e,a,i){const{uniforms:l,schemaOptions:r}=i,{store:t}=r,o=t.ensureInstance(f.marker,{uniforms:{visualVariableColor:l.visualVariableColor,visualVariableOpacity:l.visualVariableOpacity,visualVariableSizeMinMaxValue:l.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:l.visualVariableSizeScaleStops,visualVariableSizeStops:l.visualVariableSizeStops,visualVariableSizeUnitValue:l.visualVariableSizeUnitValue,visualVariableRotation:l.visualVariableRotation},optionalAttributes:{zoomRange:!1}}),s=x(e),n=6,u=n*a.width,c=u,p=e.color?.toArray()??a.color?.toArray()??[0,0,0,0],b="cross"===e.style||"x"===e.style;let m;switch(e.placement){case"begin-end":m="Both";break;case"begin":m="JustBegin";break;case"end":m="JustEnd";break;default:m="None"}const S={type:"cim-marker-placement-param",placement:{type:"CIMMarkerPlacementAtExtremities",angleToLine:!0,offset:0,extremityPlacement:m,offsetAlongLine:0},overrides:[]};return[o.createMeshInfo({type:"simple",color:p,height:c,width:u,offsetX:0,offsetY:0,angle:0,alignment:z(l)?1:0,outlineColor:p,outlineSize:b?a.width:0,referenceSize:c/n,sprite:s,overrideOutlineColor:b&&null!=l.visualVariableColor,hasSizeVV:h(l),placement:S,transforms:null,effects:null,scaleInfo:null,minPixelBuffer:V(l)})]}function A(e,a){const{uniforms:i,schemaOptions:l}=a,{store:r}=l;return[r.ensureInstance(f.text,{uniforms:{visualVariableColor:i.visualVariableColor,visualVariableOpacity:i.visualVariableOpacity,visualVariableRotation:i.visualVariableRotation,visualVariableSizeMinMaxValue:i.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:i.visualVariableSizeScaleStops,visualVariableSizeStops:i.visualVariableSizeStops,visualVariableSizeUnitValue:i.visualVariableSizeUnitValue},optionalAttributes:{zoomRange:!1,clipAngle:!1,referenceSymbol:!1,visibility:!1}}).createMeshInfo({alignment:0,boxBackgroundColor:e.backgroundColor?.toArray(),boxBorderLineColor:e.borderLineColor?.toArray(),boxBorderLineSize:e.borderLineSize??0,color:e.color?.toArray()??[0,0,0,0],offsetX:e.xoffset,offsetY:e.yoffset,postAngle:e.angle,fontSize:e.font.size,decoration:e.font.decoration,haloColor:e.haloColor?.toArray()??[0,0,0,0],haloSize:e.haloSize??0,outlineColor:[0,0,0,0],outlineSize:0,lineWidth:e.lineWidth,lineHeightRatio:e.lineHeight,horizontalAlignment:e.horizontalAlignment,verticalAlignment:e.verticalAlignment,useCIMAngleBehavior:!1,glyphs:{type:"text-rasterization-param",resource:{type:"text",font:e.font.toJSON(),textString:e.text,symbol:o.createCIMTextSymbolfromTextSymbol(e)},overrides:[]},referenceSize:null,effects:null,placement:null,scaleInfo:null,transforms:null,scaleFactor:1,minPixelBuffer:V(i),repeatLabel:null,repeatLabelDistance:null,allowOverrun:null,labelPosition:null,layerId:null,labelClassId:null})]}function L(e,i){const{schemaOptions:l,uniforms:r}=i,{store:t}=l,s=e.symbol,{allowOverrun:n,repeatLabel:c,repeatLabelDistance:p}=e,b={maxScale:e.maxScale??0,minScale:e.minScale??0},m=t.ensureInstance(f.label,{uniforms:{visualVariableColor:null,visualVariableOpacity:null,visualVariableRotation:r.visualVariableRotation,visualVariableSizeMinMaxValue:r.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:r.visualVariableSizeScaleStops,visualVariableSizeStops:r.visualVariableSizeStops,visualVariableSizeUnitValue:r.visualVariableSizeUnitValue},optionalAttributes:{zoomRange:!0,clipAngle:!0,referenceSymbol:!0,visibility:!0}}),S=e.labelPlacement,[y,v]=u(S);return[m.createMeshInfo({alignment:0,boxBackgroundColor:s.backgroundColor?.toArray(),boxBorderLineColor:s.borderLineColor?.toArray(),boxBorderLineSize:s.borderLineSize??0,color:s.color?.toArray()??[0,0,0,0],offsetX:s.xoffset,offsetY:s.yoffset,postAngle:s.angle,fontSize:s.font.size,decoration:s.font.decoration,outlineColor:[0,0,0,0],outlineSize:0,haloColor:s.haloColor?.toArray()??[0,0,0,0],haloSize:s.haloSize??0,lineWidth:s.lineWidth,lineHeightRatio:s.lineHeight,horizontalAlignment:y,verticalAlignment:v,repeatLabel:c,repeatLabelDistance:a(p),allowOverrun:n,labelPosition:e.labelPosition,scaleInfo:b,minPixelBuffer:V(r),useCIMAngleBehavior:!1,glyphs:{type:"text-rasterization-param",resource:{type:"text",font:s.font.toJSON(),textString:s.text,symbol:o.createCIMTextSymbolfromTextSymbol(s),primitiveName:"label-override"},useLegacyLabelEvaluationRules:null==e.labelExpressionInfo?.expression,overrides:[{valueExpressionInfo:{type:"CIMExpressionInfo",expression:e.labelExpressionInfo?.expression??e.labelExpression,returnType:"String"},primitiveName:"label-override",propertyName:"textString",defaultValue:""}]},referenceSize:null,effects:null,placement:null,transforms:null,scaleFactor:1,layerId:i.layerId,labelClassId:i.labelClassId})]}function R(e,a){const i=e.width;return{outlineColor:e.color?.toArray()||[0,0,0,1],width:i,referenceWidth:i,capType:e.cap??"round",joinType:e.join??"round",miterLimit:e.miterLimit,hasSizeVV:a,outlineUsesColorVV:!1}}function k(e,a){const{uniforms:i,schemaOptions:l}=a,{store:r}=l,t=e.color?.toArray()??[0,0,0,0],o={type:"sprite-rasterization-param",resource:{type:"fill-style",style:e.style},overrides:[]};if("solid"===e.outline?.style){return[r.ensureInstance(f.patternOutlineFill,{uniforms:{visualVariableColor:i.visualVariableColor,visualVariableOpacity:i.visualVariableOpacity,visualVariableSizeScaleStops:i.visualVariableSizeOutlineScaleStops,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null},optionalAttributes:{zoomRange:!1}}).createMeshInfo({color:t,...R(e.outline,!!i.visualVariableSizeOutlineScaleStops),sprite:o,scaleInfo:null,effects:null})]}const s=[],n=r.ensureInstance(f.patternFill,{uniforms:{visualVariableColor:i.visualVariableColor,visualVariableOpacity:i.visualVariableOpacity},optionalAttributes:{zoomRange:!1}}).createMeshInfo({color:e.color?.toArray()??[0,0,0,0],sprite:o,scaleInfo:null,effects:null});return s.push(n),e.outline&&s.push(...P(e.outline,a,!0)),s}function j(e,a){const{uniforms:i,schemaOptions:l}=a,{store:r}=l,t=e.color?.toArray()??[0,0,0,0];if("none"!==e.style&&"solid"===e.outline?.style){return[r.ensureInstance(f.outlineFill,{uniforms:{visualVariableColor:i.visualVariableColor,visualVariableOpacity:i.visualVariableOpacity,visualVariableSizeScaleStops:i.visualVariableSizeOutlineScaleStops,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null},optionalAttributes:{zoomRange:!1}}).createMeshInfo({color:t,...R(e.outline,!!i.visualVariableSizeOutlineScaleStops),scaleInfo:null,effects:null})]}const o=[];if("none"!==e.style){const e=r.ensureInstance(f.fill,{uniforms:{visualVariableColor:i.visualVariableColor,visualVariableOpacity:i.visualVariableOpacity},optionalAttributes:{zoomRange:!1}}).createMeshInfo({color:t,scaleInfo:null,effects:null});o.push(e)}return e.outline&&o.push(...P(e.outline,a,!0)),o}async function U(e,a){if("cim"===e.type)return v(e.data,a);const{style:i}=e;return i&&"none"!==i&&"solid"!==i?k(e,a):j(e,a)}function F(e,a){const{outline:i}=e,{uniforms:l,schemaOptions:r}=a,{store:t}=r,s=[],n=o.createPictureFillRasterizationParam(e);if(!n)return[];const{width:u,height:c,xoffset:p,yoffset:b,xscale:m,yscale:S}=e,V={color:[255,255,255,255],sprite:n,height:c,aspectRatio:u/c,offsetX:p,offsetY:b,scaleX:m,scaleY:S,angle:0,applyRandomOffset:!1,sampleAlphaOnly:!1,scaleProportionally:!1,effects:null,scaleInfo:null};if("solid"===i?.style){return[t.ensureInstance(f.complexOutlineFill,{uniforms:{visualVariableColor:l.visualVariableColor,visualVariableOpacity:l.visualVariableOpacity,visualVariableSizeScaleStops:l.visualVariableSizeOutlineScaleStops,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null},optionalAttributes:{zoomRange:!1}}).createMeshInfo({...V,...R(i,!!l.visualVariableSizeOutlineScaleStops)})]}const y=t.ensureInstance(f.complexFill,{uniforms:{visualVariableColor:l.visualVariableColor,visualVariableOpacity:l.visualVariableOpacity},optionalAttributes:{zoomRange:!1}});return s.push(y.createMeshInfo(V)),i&&s.push(...P(i,a,!0)),s}function P(e,a,i){const{color:l,style:r,width:t,cap:o,join:n}=e,{schemaOptions:u}=a,{store:c}=u,p=[],b=i?{...y,visualVariableSizeScaleStops:a.uniforms.visualVariableSizeOutlineScaleStops}:a.uniforms,m={uniforms:{visualVariableColor:b.visualVariableColor,visualVariableOpacity:b.visualVariableOpacity,visualVariableSizeMinMaxValue:b.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:b.visualVariableSizeScaleStops,visualVariableSizeStops:b.visualVariableSizeStops,visualVariableSizeUnitValue:b.visualVariableSizeUnitValue},optionalAttributes:{zoomRange:!1}},S={color:l?.toArray()??[0,0,0,0],width:t,referenceWidth:t,capType:o,joinType:n,miterLimit:e.miterLimit,hasSizeVV:h(b),effects:null,scaleInfo:null};if(null==r||"solid"===r){const e=c.ensureInstance(f.line,m).createMeshInfo(S);p.push(e)}else if("none"!==r){const e=c.ensureInstance(f.texturedLine,m).createMeshInfo({...S,offsetAlongLine:0,shouldScaleDash:!0,shouldSampleAlphaOnly:!1,isSDF:!0,sprite:{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:s(r,o)},overrides:[]}});p.push(e)}return null!=e.marker&&p.push(...O(e.marker,e,a)),p}export{g as createDotDensityMeshSchemas,M as createHeatmapMeshSchemas,P as createLineInstance,C as createPieChartMeshSchemas,d as createSymbolMeshSchemas};
2
+ import e from"../../../../../../../core/Logger.js";import{pt2px as i}from"../../../../../../../core/screenUtils.js";import{generateGradient as a}from"../../../../../../../renderers/support/heatmapUtils.js";import l from"../../../../../../../symbols/SimpleFillSymbol.js";import r from"../../../../../../../symbols/SimpleLineSymbol.js";import t from"../../../../../../../symbols/SimpleMarkerSymbol.js";import{CIMSymbolHelper as o,slsDashToTemplateArray as s}from"../../../../../../../symbols/cim/CIMSymbolHelper.js";import{hasRichTextFormattingTags as n}from"../../../../../../../symbols/cim/richTextUtils.js";import{getSDFInfo as u}from"../../../../../../../symbols/cim/SDFHelper.js";import{getAlignmentFromPlacement as c}from"../../../../../engine/webgl/alignmentUtils.js";import{writeColor as p}from"../../../../../engine/webgl/color.js";import{dotDensityMaxFields as f}from"../../../../../engine/webgl/definitions.js";import{Techniques as b}from"../../../../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{maxPieChartFields as m}from"../../../../../engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js";import{premultiplyColor as S}from"../schemaUtils.js";import{createVisualVariableUniforms as y,getMaxSizeVVSize as V,noVisualVariables as v}from"../VisualVariablesSchema.js";import{createComplexSymbolInstances as h}from"./ComplexSymbolSchema.js";import{hasSizeVVUniform as z,hasRotationVVUniform as d}from"./utils.js";async function g(i,a){if(!i)return[];switch(i.type){case"simple-fill":return F(i,a);case"picture-fill":return P(i,a);case"simple-marker":return w(i,a);case"picture-marker":return O(i,a);case"simple-line":return B(i,a,!1);case"text":return L(i,a);case"label":return R(i,a);case"cim":return h(i.data,a);case"web-style":return g(await i.fetchSymbol({acceptedFormats:["cim","web"]}),a);case"line-3d":return e.getLogger("esri.views.layers.FeatureLayerView").warn("unsupported-symbol",`Symbol of type "${i.type}" unsupported in MapView. Defaulting to simple-line`),B(new r,a,!1);case"point-3d":return e.getLogger("esri.views.layers.FeatureLayerView").warn("unsupported-symbol",`Symbol of type "${i.type}" unsupported in MapView. Defaulting to simple-marker`),w(new t,a);case"polygon-3d":return e.getLogger("esri.views.layers.FeatureLayerView").warn("unsupported-symbol",`Symbol of type "${i.type}" unsupported in MapView. Defaulting to simple-fill`),F(new l,a);case"mesh-3d":case"label-3d":return e.getLogger("esri.views.layers.FeatureLayerView").warn("unsupported-symbol",`Symbol of type "${i.type}" unsupported in MapView. Ignoring`),[];case"CIMSymbolReference":throw new Error("InternalError: CIMSymbolReference should already be resolved")}}async function x(e,i){const{schemaOptions:a}=i,{store:r}=a,t=new Array(f),o=new Array(f/4);for(let l=0;l<f;l++){const i=l<e.attributes.length?e.attributes[l].color:null;t[l]=[0,0,0,0],p(t[l],i)}for(let l=0;l<f/4;l++)o[l]=[0,0,0,0],o[l][0]=4*l<e.attributes.length?1:0,o[l][1]=4*l+1<e.attributes.length?1:0,o[l][2]=4*l+2<e.attributes.length?1:0,o[l][3]=4*l+3<e.attributes.length?1:0;const s={uniforms:{isActive:o,colors:t,dotValue:e.dotValue,dotScale:e.referenceScale,blending:e.dotBlendingEnabled,dotSize:e.dotSize,seed:e.seed},optionalAttributes:{}},n=r.ensureInstance(b.dotDensity,s).createMeshInfo({effects:null}),u=[],c=new l({color:e.backgroundColor??[0,0,0,0],outline:null}),m=await g(c,i);if(u.push(...m),u.push(n),e.outline){const a=B(e.outline,i,!0);u.push(...a)}return u}async function M(e,l){const{store:r}=l,{radius:t,minDensity:o,maxDensity:s,referenceScale:n,field:u,valueExpression:c,colorStops:p}=e,f=a(p);return[r.ensureInstance(b.heatmap,{uniforms:{radius:i(t),minDensity:o,maxDensity:s,referenceScale:n,isFieldActive:!(!u&&!c),gradient:f,gradientHash:f.join(",")},optionalAttributes:{}}).createMeshInfo({effects:null})]}async function C(e,a){const{store:l}=a,r=e.outline?.width||0,t=y(e),o=Math.min(e.attributes.length,m),s=e.attributes.slice(0,o).map(e=>S(e.color));for(;s.length<m;)s.push([0,0,0,0]);const n=l.ensureInstance(b.pieChart,{uniforms:{shader:{chart:{outlineWidth:Math.round(i(r)),defaultColor:S(e.defaultColor),outlineColor:S(e.outline?.color),othersColor:S(e.othersCategory?.color),donutRatio:e.holePercentage,sectorThreshold:e.othersCategory?.threshold||0,colors:s,fieldCount:o},visualVariableOpacity:t.visualVariableOpacity,visualVariableSizeMinMaxValue:t.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:t.visualVariableSizeScaleStops,visualVariableSizeStops:t.visualVariableSizeStops,visualVariableSizeUnitValue:t.visualVariableSizeUnitValue}},optionalAttributes:{zoomRange:!0}}).createMeshInfo({size:e.size,outlineWidth:r,effects:null,scaleInfo:null,minPixelBuffer:V(t)});return[...e.backgroundFillSymbol?await F(e.backgroundFillSymbol,{schemaOptions:a,uniforms:v}):[],n]}function I(e){if("path"===e.style){if(null==e.path)throw new Error("Symbol with a style of type path must define a path");return{type:"sprite-rasterization-param",overrides:[],resource:{type:"path",path:e.path,asFill:!0}}}const i=o.fromSimpleMarker(e);if("outline"in e&&e.outline&&"none"!==e.outline.style){if("solid"!==e.outline.style){if(!i||!i.symbolLayers)throw new Error("Error handling marker! ");return{type:"sprite-rasterization-param",resource:i.symbolLayers[0],overrides:[]}}}return{type:"sprite-rasterization-param",resource:u(i),overrides:[]}}async function w(e,i){const{uniforms:a,schemaOptions:l}=i,{store:r}=l;if("path"===e.style||e.outline&&"solid"!==e.outline.style&&"none"!==e.outline.style){const l=o.fromSimpleMarker(e);if(!l||!l.symbolLayers)throw new Error("Error handling marker! ");if(a.visualVariableRotation&&(l.angleAlignment="Map"),"path"!==e.style){const e=l.symbolLayers[0];if(z(i.uniforms)){const a=V(i.uniforms,0,1);if(a>e.size){const i=a/e.size;e.size=a;const l=e.markerGraphics?.[0].symbol;(l.symbolLayers&&l.symbolLayers[0]).width*=i}}}return h({type:"CIMSymbolReference",symbol:l},i)}const t=r.ensureInstance(b.marker,{uniforms:{visualVariableColor:a.visualVariableColor,visualVariableOpacity:a.visualVariableOpacity,visualVariableSizeMinMaxValue:a.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:a.visualVariableSizeScaleStops,visualVariableSizeStops:a.visualVariableSizeStops,visualVariableSizeUnitValue:a.visualVariableSizeUnitValue,visualVariableRotation:a.visualVariableRotation},optionalAttributes:{zoomRange:!1}}),s=I(e);let n=e.color?.toArray()??[0,0,0,0];"CIMVectorMarker"===s.resource.type&&(n=[255,255,255,255]);const u="triangle"===e.style?124/116:1,c=e.size,p=c*u,f=null!=a.visualVariableColor&&("cross"===e.style||"x"===e.style);return[t.createMeshInfo({type:"simple",color:n,height:c,width:p,offsetX:e.xoffset,offsetY:e.yoffset,angle:e.angle,alignment:d(a)?1:0,outlineColor:e.outline?.color?.toArray()??[0,0,0,0],outlineSize:e.outline?.width??1,referenceSize:c,sprite:s,overrideOutlineColor:f,hasSizeVV:z(a),placement:null,effects:null,transforms:null,scaleInfo:null,minPixelBuffer:V(a)})]}function O(e,i){const{uniforms:a,schemaOptions:l}=i,{store:r}=l,t=r.ensureInstance(b.marker,{uniforms:{visualVariableColor:a.visualVariableColor,visualVariableOpacity:a.visualVariableOpacity,visualVariableSizeMinMaxValue:a.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:a.visualVariableSizeScaleStops,visualVariableSizeStops:a.visualVariableSizeStops,visualVariableSizeUnitValue:a.visualVariableSizeUnitValue,visualVariableRotation:a.visualVariableRotation},optionalAttributes:{zoomRange:!1}}),s=o.createPictureMarkerRasterizationParam(e);if(!s)return[];return[t.createMeshInfo({type:"picture",color:[255,255,255,255],height:e.height,width:e.width,offsetX:e.xoffset,offsetY:e.yoffset,angle:e.angle,alignment:d(a)?1:0,outlineColor:null,outlineSize:0,referenceSize:e.height,sprite:s,overrideOutlineColor:!1,hasSizeVV:z(a),placement:null,effects:null,transforms:null,scaleInfo:null,minPixelBuffer:V(a)})]}function A(e,i,a){const{uniforms:l,schemaOptions:r}=a,{store:t}=r,o=t.ensureInstance(b.marker,{uniforms:{visualVariableColor:l.visualVariableColor,visualVariableOpacity:l.visualVariableOpacity,visualVariableSizeMinMaxValue:l.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:l.visualVariableSizeScaleStops,visualVariableSizeStops:l.visualVariableSizeStops,visualVariableSizeUnitValue:l.visualVariableSizeUnitValue,visualVariableRotation:l.visualVariableRotation},optionalAttributes:{zoomRange:!1}}),s=I(e),n=6,u=n*i.width,c=u,p=e.color?.toArray()??i.color?.toArray()??[0,0,0,0],f="cross"===e.style||"x"===e.style;let m;switch(e.placement){case"begin-end":m="Both";break;case"begin":m="JustBegin";break;case"end":m="JustEnd";break;default:m="None"}const S={type:"cim-marker-placement-param",placement:{type:"CIMMarkerPlacementAtExtremities",angleToLine:!0,offset:0,extremityPlacement:m,offsetAlongLine:0},overrides:[]};return[o.createMeshInfo({type:"simple",color:p,height:c,width:u,offsetX:0,offsetY:0,angle:0,alignment:d(l)?1:0,outlineColor:p,outlineSize:f?i.width:0,referenceSize:c/n,sprite:s,overrideOutlineColor:f&&null!=l.visualVariableColor,hasSizeVV:z(l),placement:S,transforms:null,effects:null,scaleInfo:null,minPixelBuffer:V(l)})]}function L(e,i){const{uniforms:a,schemaOptions:l}=i,{store:r}=l;return[r.ensureInstance(b.text,{uniforms:{visualVariableColor:a.visualVariableColor,visualVariableOpacity:a.visualVariableOpacity,visualVariableRotation:a.visualVariableRotation,visualVariableSizeMinMaxValue:a.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:a.visualVariableSizeScaleStops,visualVariableSizeStops:a.visualVariableSizeStops,visualVariableSizeUnitValue:a.visualVariableSizeUnitValue},optionalAttributes:{zoomRange:!1,clipAngle:!1,referenceSymbol:!1,visibility:!1}}).createMeshInfo({alignment:0,boxBackgroundColor:e.backgroundColor?.toArray(),boxBorderLineColor:e.borderLineColor?.toArray(),boxBorderLineSize:e.borderLineSize??0,color:e.color?.toArray()??[0,0,0,0],offsetX:e.xoffset,offsetY:e.yoffset,postAngle:e.angle,fontSize:e.font.size,decoration:e.font.decoration,haloColor:e.haloColor?.toArray()??[0,0,0,0],haloSize:e.haloSize??0,outlineColor:[0,0,0,0],outlineSize:0,lineWidth:e.lineWidth,lineHeightRatio:e.lineHeight,horizontalAlignment:e.horizontalAlignment,verticalAlignment:e.verticalAlignment,useCIMAngleBehavior:!1,glyphs:{type:"text-rasterization-param",resource:{type:"text",font:e.font.toJSON(),textString:e.text,symbol:o.createCIMTextSymbolfromTextSymbol(e),supportsRichText:n(e.text)},overrides:[]},referenceSize:null,effects:null,placement:null,scaleInfo:null,transforms:null,scaleFactor:1,minPixelBuffer:V(a),repeatLabel:null,repeatLabelDistance:null,allowOverrun:null,labelPosition:null,layerId:null,labelClassId:null})]}function R(e,a){const{schemaOptions:l,uniforms:r}=a,{store:t}=l,s=e.symbol,{allowOverrun:n,repeatLabel:u,repeatLabelDistance:p}=e,f={maxScale:e.maxScale??0,minScale:e.minScale??0},m=t.ensureInstance(b.label,{uniforms:{visualVariableColor:null,visualVariableOpacity:null,visualVariableRotation:r.visualVariableRotation,visualVariableSizeMinMaxValue:r.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:r.visualVariableSizeScaleStops,visualVariableSizeStops:r.visualVariableSizeStops,visualVariableSizeUnitValue:r.visualVariableSizeUnitValue},optionalAttributes:{zoomRange:!0,clipAngle:!0,referenceSymbol:!0,visibility:!0}}),S=e.labelPlacement,[y,v]=c(S);return[m.createMeshInfo({alignment:0,boxBackgroundColor:s.backgroundColor?.toArray(),boxBorderLineColor:s.borderLineColor?.toArray(),boxBorderLineSize:s.borderLineSize??0,color:s.color?.toArray()??[0,0,0,0],offsetX:s.xoffset,offsetY:s.yoffset,postAngle:s.angle,fontSize:s.font.size,decoration:s.font.decoration,outlineColor:[0,0,0,0],outlineSize:0,haloColor:s.haloColor?.toArray()??[0,0,0,0],haloSize:s.haloSize??0,lineWidth:s.lineWidth,lineHeightRatio:s.lineHeight,horizontalAlignment:y,verticalAlignment:v,repeatLabel:u,repeatLabelDistance:i(p),allowOverrun:n,labelPosition:e.labelPosition,scaleInfo:f,minPixelBuffer:V(r),useCIMAngleBehavior:!1,glyphs:{type:"text-rasterization-param",resource:{type:"text",font:s.font.toJSON(),textString:s.text,symbol:o.createCIMTextSymbolfromTextSymbol(s),primitiveName:"label-override",supportsRichText:!0},useLegacyLabelEvaluationRules:null==e.labelExpressionInfo?.expression,overrides:[{valueExpressionInfo:{type:"CIMExpressionInfo",expression:e.labelExpressionInfo?.expression??e.labelExpression,returnType:"String"},primitiveName:"label-override",propertyName:"textString",defaultValue:""}]},referenceSize:null,effects:null,placement:null,transforms:null,scaleFactor:1,layerId:a.layerId,labelClassId:a.labelClassId})]}function k(e,i){const a=e.width;return{outlineColor:e.color?.toArray()||[0,0,0,1],width:a,referenceWidth:a,capType:e.cap??"round",joinType:e.join??"round",miterLimit:e.miterLimit,hasSizeVV:i,outlineUsesColorVV:!1}}function j(e,i){const{uniforms:a,schemaOptions:l}=i,{store:r}=l,t=e.color?.toArray()??[0,0,0,0],o={type:"sprite-rasterization-param",resource:{type:"fill-style",style:e.style},overrides:[]};if("solid"===e.outline?.style){return[r.ensureInstance(b.patternOutlineFill,{uniforms:{visualVariableColor:a.visualVariableColor,visualVariableOpacity:a.visualVariableOpacity,visualVariableSizeScaleStops:a.visualVariableSizeOutlineScaleStops,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null},optionalAttributes:{zoomRange:!1}}).createMeshInfo({color:t,...k(e.outline,!!a.visualVariableSizeOutlineScaleStops),sprite:o,scaleInfo:null,effects:null})]}const s=[],n=r.ensureInstance(b.patternFill,{uniforms:{visualVariableColor:a.visualVariableColor,visualVariableOpacity:a.visualVariableOpacity},optionalAttributes:{zoomRange:!1}}).createMeshInfo({color:e.color?.toArray()??[0,0,0,0],sprite:o,scaleInfo:null,effects:null});return s.push(n),e.outline&&s.push(...B(e.outline,i,!0)),s}function U(e,i){const{uniforms:a,schemaOptions:l}=i,{store:r}=l,t=e.color?.toArray()??[0,0,0,0];if("none"!==e.style&&"solid"===e.outline?.style){return[r.ensureInstance(b.outlineFill,{uniforms:{visualVariableColor:a.visualVariableColor,visualVariableOpacity:a.visualVariableOpacity,visualVariableSizeScaleStops:a.visualVariableSizeOutlineScaleStops,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null},optionalAttributes:{zoomRange:!1}}).createMeshInfo({color:t,...k(e.outline,!!a.visualVariableSizeOutlineScaleStops),scaleInfo:null,effects:null})]}const o=[];if("none"!==e.style){const e=r.ensureInstance(b.fill,{uniforms:{visualVariableColor:a.visualVariableColor,visualVariableOpacity:a.visualVariableOpacity},optionalAttributes:{zoomRange:!1}}).createMeshInfo({color:t,scaleInfo:null,effects:null});o.push(e)}return e.outline&&o.push(...B(e.outline,i,!0)),o}async function F(e,i){if("cim"===e.type)return h(e.data,i);const{style:a}=e;return a&&"none"!==a&&"solid"!==a?j(e,i):U(e,i)}function P(e,i){const{outline:a}=e,{uniforms:l,schemaOptions:r}=i,{store:t}=r,s=[],n=o.createPictureFillRasterizationParam(e);if(!n)return[];const{width:u,height:c,xoffset:p,yoffset:f,xscale:m,yscale:S}=e,y={color:[255,255,255,255],sprite:n,height:c,aspectRatio:u/c,offsetX:p,offsetY:f,scaleX:m,scaleY:S,angle:0,applyRandomOffset:!1,sampleAlphaOnly:!1,scaleProportionally:!1,effects:null,scaleInfo:null};if("solid"===a?.style){return[t.ensureInstance(b.complexOutlineFill,{uniforms:{visualVariableColor:l.visualVariableColor,visualVariableOpacity:l.visualVariableOpacity,visualVariableSizeScaleStops:l.visualVariableSizeOutlineScaleStops,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null},optionalAttributes:{zoomRange:!1}}).createMeshInfo({...y,...k(a,!!l.visualVariableSizeOutlineScaleStops)})]}const V=t.ensureInstance(b.complexFill,{uniforms:{visualVariableColor:l.visualVariableColor,visualVariableOpacity:l.visualVariableOpacity},optionalAttributes:{zoomRange:!1}});return s.push(V.createMeshInfo(y)),a&&s.push(...B(a,i,!0)),s}function B(e,i,a){const{color:l,style:r,width:t,cap:o,join:n}=e,{schemaOptions:u}=i,{store:c}=u,p=[],f=a?{...v,visualVariableSizeScaleStops:i.uniforms.visualVariableSizeOutlineScaleStops}:i.uniforms,m={uniforms:{visualVariableColor:f.visualVariableColor,visualVariableOpacity:f.visualVariableOpacity,visualVariableSizeMinMaxValue:f.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:f.visualVariableSizeScaleStops,visualVariableSizeStops:f.visualVariableSizeStops,visualVariableSizeUnitValue:f.visualVariableSizeUnitValue},optionalAttributes:{zoomRange:!1}},S={color:l?.toArray()??[0,0,0,0],width:t,referenceWidth:t,capType:o,joinType:n,miterLimit:e.miterLimit,hasSizeVV:z(f),effects:null,scaleInfo:null};if(null==r||"solid"===r){const e=c.ensureInstance(b.line,m).createMeshInfo(S);p.push(e)}else if("none"!==r){const e=c.ensureInstance(b.texturedLine,m).createMeshInfo({...S,offsetAlongLine:0,shouldScaleDash:!0,shouldSampleAlphaOnly:!1,isSDF:!0,sprite:{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:s(r,o)},overrides:[]}});p.push(e)}return null!=e.marker&&p.push(...A(e.marker,e,i)),p}export{x as createDotDensityMeshSchemas,M as createHeatmapMeshSchemas,B as createLineInstance,C as createPieChartMeshSchemas,g as createSymbolMeshSchemas};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{baseObjectMemory as r}from"../../../../../core/memoryEstimations.js";import{normalizeTransform as e,quantizeX as t,quantizeY as s}from"../../../../../geometry/support/quantizationUtils.js";import{convertToGeometry as a}from"../../../../../layers/graphics/featureConversionUtils.js";import{FeatureSetReader as i}from"./FeatureSetReader.js";class d extends i{static from(r,e){if(r instanceof this){const t=new Set(e),s=r._indices.filter(r=>t.has(r));return new d(r._reader,s)}return new d(r.copy(),e)}constructor(r,e){super(r.metadata),this._currentIndex=-1,this._displayTransform=null,this._reader=r,this._indices=e}setTransformForDisplay(r){const t=this._reader.getInTransform();if(null==t)return void(this._displayTransform=e(r));const s=e(t),a=e(r),[i,d]=s.scale,[n,o]=s.translate,[h,u]=a.scale,[_,l]=a.translate,y=i/h,c=d/u,p=(n-_)/h,m=(o-l)/u;this._displayTransform={originPosition:"lowerLeft",scale:[1/y,1/c,1,1],translate:[-p/y,-m/c,0,0]}}getInTransform(){return this._reader.getInTransform()}getDisplayTransform(){return this._displayTransform}get fields(){return this._reader.fields}get hasNext(){return this._currentIndex+1<this._indices.length}getSize(){return this._indices.length}getCursor(){return this.copy()}copy(){const r=new d(this._reader.copy(),this._indices);return r._currentIndex=this._currentIndex,r._displayTransform=this._displayTransform,r._processorAttributes=this._processorAttributes,r}get contextTimeZone(){return this._reader.contextTimeZone}set contextTimeZone(r){this._reader.contextTimeZone=r}get usedMemory(){return r+this._reader.usedMemory}setProcessorAttributes(r){this._processorAttributes=Object.assign(this._processorAttributes??{},r)}_nextIndex(){return++this._currentIndex<this._indices.length&&(this._reader.setIndex(this._indices[this._currentIndex]),!0)}next(){for(;this._nextIndex()&&!this._reader._getExists(););return this._currentIndex<this._indices.length}readXForDisplay(){return this._displayTransform?t(this._displayTransform,this._reader.readXForDisplay()):this._reader.readXForDisplay()}readYForDisplay(){return this._displayTransform?s(this._displayTransform,this._reader.readYForDisplay()):this._reader.readYForDisplay()}readGeometryForDisplay(){return this._displayTransform?this._reader.readGeometryForDisplayTransformed(this._displayTransform):this._reader.readGeometryForDisplay()}readCentroidForDisplay(){const r=this._reader.readCentroidForDisplay()?.clone();if(r){const[e,a]=r.coords;this._displayTransform&&(r.coords[0]=t(this._displayTransform,e),r.coords[1]=s(this._displayTransform,a))}return r}get geometryType(){return this._reader.geometryType}get hasFeatures(){return this._reader.hasFeatures}get exceededTransferLimit(){return this._reader.exceededTransferLimit}get hasZ(){return this._reader.hasZ}get hasM(){return this._reader.hasM}readAttribute(r,e=!1){const t=this._reader.readAttribute(r,e);return null==t&&this._processorAttributes?this._processorAttributes[r]:t}readAttributes(){return{...this._processorAttributes,...this._reader.readAttributes()}}joinAttributes(r){return this._reader.joinAttributes(r)}getBounds(r){return this._reader.getBounds(r)}getAttributeHash(){return this._reader.getAttributeHash()}getObjectId(){return this._reader.getObjectId()}getDisplayId(){return this._reader.getDisplayId()}setDisplayId(r){return this._reader.setDisplayId(r)}setIndex(r){return this._reader.setIndex(r)}getIndex(){return this._reader.getIndex()}readXWorldSpace(){return this._reader.readXWorldSpace()}readYWorldSpace(){return this._reader.readYWorldSpace()}_readX(){return this._reader.readXForDisplay()}_readY(){return this._reader.readYForDisplay()}_readServerCentroid(){return this._reader._readServerCentroid()}readLegacyFeatureForDisplay(){const r=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(r&&{x:r.coords[0],y:r.coords[1]})??null}}readLegacyGeometryForDisplay(){const r=this.readGeometryForDisplay();return a(r,this.geometryType,!1,!1)}readGeometryArea(){return this._displayTransform?this._reader.readGeometryForDisplayTransformed(this._displayTransform)?.area()??0:this._reader.readGeometryArea()}readGeometryWorldSpace(){return this._reader.readGeometryWorldSpace()}_readGeometry(){return this._reader._readGeometry()}_readAttribute(r,e){throw new Error("Error: Should not be called. Underlying _reader should be used instead")}_readAttributes(){throw new Error("Error: Should not be called. Underlying _reader should be used instead")}readArcadeFeature(){return this._reader.readArcadeFeature()}geometry(){return this._reader.geometry()}field(r){return this._reader.field(r)}hasField(r){return this._reader.hasField(r)}setField(r,e){return this._reader.setField(r,e)}keys(){return this._reader.keys()}castToText(r=!1){return this._reader.castToText(r)}}export{d as FeatureSetReaderIndirect};
2
+ import{baseObjectMemory as r}from"../../../../../core/memoryEstimations.js";import{normalizeTransform as e,quantizeX as t,quantizeY as s}from"../../../../../geometry/support/quantizationUtils.js";import{convertToGeometry as i}from"../../../../../layers/graphics/featureConversionUtils.js";import{FeatureSetReader as a}from"./FeatureSetReader.js";class d extends a{static from(r,e){if(r instanceof this){const t=new Set(e),s=r._indices.filter(r=>t.has(r)),i=r.copy();return i._indices=s,i._currentIndex=-1,i}return new d(r.copy(),e)}constructor(r,e){super(r.metadata),this._currentIndex=-1,this._displayTransform=null,this._reader=r,this._indices=e}setTransformForDisplay(r){const t=this._reader.getInTransform();if(null==t)return void(this._displayTransform=e(r));const s=e(t),i=e(r),[a,d]=s.scale,[n,o]=s.translate,[h,u]=i.scale,[_,l]=i.translate,y=a/h,c=d/u,p=(n-_)/h,m=(o-l)/u;this._displayTransform={originPosition:"lowerLeft",scale:[1/y,1/c,1,1],translate:[-p/y,-m/c,0,0]}}getInTransform(){return this._reader.getInTransform()}getDisplayTransform(){return this._displayTransform}get fields(){return this._reader.fields}get hasNext(){return this._currentIndex+1<this._indices.length}getSize(){return this._indices.length}getCursor(){return this.copy()}copy(){const r=new d(this._reader.copy(),this._indices);return r._currentIndex=this._currentIndex,r._displayTransform=this._displayTransform,r._processorAttributes=this._processorAttributes,r}get contextTimeZone(){return this._reader.contextTimeZone}set contextTimeZone(r){this._reader.contextTimeZone=r}get usedMemory(){return r+this._reader.usedMemory}setProcessorAttributes(r){this._processorAttributes=Object.assign(this._processorAttributes??{},r)}_nextIndex(){return++this._currentIndex<this._indices.length&&(this._reader.setIndex(this._indices[this._currentIndex]),!0)}next(){for(;this._nextIndex()&&!this._reader._getExists(););return this._currentIndex<this._indices.length}readXForDisplay(){return this._displayTransform?t(this._displayTransform,this._reader.readXForDisplay()):this._reader.readXForDisplay()}readYForDisplay(){return this._displayTransform?s(this._displayTransform,this._reader.readYForDisplay()):this._reader.readYForDisplay()}readGeometryForDisplay(){return this._displayTransform?this._reader.readGeometryForDisplayTransformed(this._displayTransform):this._reader.readGeometryForDisplay()}readCentroidForDisplay(){const r=this._reader.readCentroidForDisplay()?.clone();if(r){const[e,i]=r.coords;this._displayTransform&&(r.coords[0]=t(this._displayTransform,e),r.coords[1]=s(this._displayTransform,i))}return r}get geometryType(){return this._reader.geometryType}get hasFeatures(){return this._reader.hasFeatures}get exceededTransferLimit(){return this._reader.exceededTransferLimit}get hasZ(){return this._reader.hasZ}get hasM(){return this._reader.hasM}readAttribute(r,e=!1){const t=this._reader.readAttribute(r,e);return null==t&&this._processorAttributes?this._processorAttributes[r]:t}readAttributes(){return{...this._processorAttributes,...this._reader.readAttributes()}}joinAttributes(r){return this._reader.joinAttributes(r)}getBounds(r){return this._reader.getBounds(r)}getAttributeHash(){return this._reader.getAttributeHash()}getObjectId(){return this._reader.getObjectId()}getDisplayId(){return this._reader.getDisplayId()}setDisplayId(r){return this._reader.setDisplayId(r)}setIndex(r){return this._reader.setIndex(r)}getIndex(){return this._reader.getIndex()}readXWorldSpace(){return this._reader.readXWorldSpace()}readYWorldSpace(){return this._reader.readYWorldSpace()}_readX(){return this._reader.readXForDisplay()}_readY(){return this._reader.readYForDisplay()}_readServerCentroid(){return this._reader._readServerCentroid()}readLegacyFeatureForDisplay(){const r=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(r&&{x:r.coords[0],y:r.coords[1]})??null}}readLegacyGeometryForDisplay(){const r=this.readGeometryForDisplay();return i(r,this.geometryType,!1,!1)}readGeometryArea(){return this._displayTransform?this._reader.readGeometryForDisplayTransformed(this._displayTransform)?.area()??0:this._reader.readGeometryArea()}readGeometryWorldSpace(){return this._reader.readGeometryWorldSpace()}_readGeometry(){return this._reader._readGeometry()}_readAttribute(r,e){throw new Error("Error: Should not be called. Underlying _reader should be used instead")}_readAttributes(){throw new Error("Error: Should not be called. Underlying _reader should be used instead")}readArcadeFeature(){return this._reader.readArcadeFeature()}geometry(){return this._reader.geometry()}field(r){return this._reader.field(r)}hasField(r){return this._reader.hasField(r)}setField(r,e){return this._reader.setField(r,e)}keys(){return this._reader.keys()}castToText(r=!1){return this._reader.castToText(r)}}export{d as FeatureSetReaderIndirect};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import i from"../../../../../core/Error.js";import n from"../../../../../core/Logger.js";import{deg2rad as t,rad2deg as e}from"../../../../../core/mathUtils.js";import{dist as s,set as o,equals as r,subtract as h,len as l,scale as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as _,create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isPolygon as a}from"../../../../../geometry/support/jsonTypeUtils.js";import g from"../../../../../layers/support/FieldsIndex.js";import{createRendererExpression as u}from"../../../../../support/ArcadeExpression.js";import{fromCIMHorizontalAlignment as c,fromCIMVerticalAlignment as x,fromCIMFontDecoration as P}from"../../../../../symbols/cim/utils.js";import p from"../../../arcade/callExpressionWithFeature.js";import{glyphSize as b,magicLabelLineHeight as f}from"../../../engine/webgl/definitions.js";import y from"../../../engine/webgl/Rect.js";import{shapeGlyphs as D}from"../../../engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as L,getLineWidth as S}from"../../graphics/graphicsUtils.js";import{initializeDimensionStyleDefaults as M}from"./dimensionStyleDefaults.js";import{DimensionRealFieldName as T,rectsOverlap as R,queryPointOnLine as w,angleFromXAxis as E,intersectLinesByPointsAndAngles as k,measureMarkerSymbolSize as N,translateRect as v,scaleRect as A,rotatePoint as B,rectsOverlapOnAxis as F}from"./dimensionUtils.js";import{getAttributeValue as I}from"./utils.js";class j{static async create(i,n,t,e){const s=e(i.textSymbol),o=new j(i,s);return await o.initialize(n,t),o}constructor(i,n){if(this._dimensionStyle=i,this._mosaicItems=n,this._textString=null,this._displayExtLines=!0,this._systemLength=0,this._dimensionAngleRad=0,this._dimensionLength=0,this._dimensionDirection=null,this._textSize=null,this._extAngleRad=Math.PI/2,this._compiledExpression=null,this._fieldsIndex=null,this._beginBaselinePoint=null,this._endBaselinePoint=null,this._dimensionLinePoint=null,this._beginDimensionPoint=null,this._endDimensionPoint=null,this._beginMarkerRect=null,this._endMarkerRect=null,this._textRect=null,this._textPoint=null,this._dimensionPolyline=null,this._dimensionExtensionLines=null,this._hasTextPoint=!1,this._doMarkersFit=!0,this._dimensionIsEvaluated=!1,null==i)throw new Error("dimension syle must be defined!");M(i)}async initialize(t,e){if(!this._dimensionStyle)return;const{attributes:s}=t;if("Expression"===(this._dimensionStyle.textOption??"None")){const{expression:s,expressionParserName:o}=this._dimensionStyle;s&&o&&"arcade"===o.toLowerCase()?(this._compiledExpression=await u(s,e),this._fieldsIndex=O(t)):n.getLogger("esri.layers.DimensionFeatureLayer").warn(new i("dimension-layer:unsupported-expression","Only Arcade expressions are supported",{expressionType:o,expression:s}))}const o=Number(I(T.extAngle,s));this._extAngleRad=isNaN(o)?Math.PI/2:o,this._systemLength=Number(I("__SYSTEM_LENGTH__",s));const{geometry:r}=t;if(r&&!a(r))throw new i("dimension-layer","processed geometry must be a valid 'polygon'.");const h=r?.rings[0];if(!h||h.length<3)throw new i("dimension-layer","processed geometry must have at least 3 points.");this._hasTextPoint=0!==h[3][0]&&0!==h[3][1]&&void 0!==h[3][0]&&void 0!==h[3][1],this._hasTextPoint&&(this._textPoint=h[3]);const l=this._dimensionStyle.textSymbol;s.__DIMENSION_ANGLE__+=l?.angle??0}getTextString(i){return null==this._textString&&(this._textString=this._getDimensionText(i)),this._textString}get textSymbol(){return this._dimensionStyle.textSymbol??null}get beginBaselinePoint(){return this._beginBaselinePoint}get endBaselinePoint(){return this._endBaselinePoint}get beginDimensionPoint(){return this._beginDimensionPoint}get endDimensionPoint(){return this._endDimensionPoint}get textPoint(){return this._textPoint}get dimensionLine(){return this._dimensionPolyline}get extensionLines(){return this._displayExtLines?this._dimensionExtensionLines:null}evaluateWithGeometry(i,n){this._dimensionIsEvaluated||(this._computeDimensionLineInfo(i,n),this._evaluateDefaultPlacement(n),this._updateExtensionLines(n),this._updateTextPoint(n),this._offsetTextPoint(n),this._dimensionIsEvaluated=!0)}_updateTextPoint(i){if(this._hasTextPoint)return;const{textFit:n}=this._dimensionStyle;let t=!0;if(!this._doMarkersFit){if(this._hasTextPoint)return;if("None"===n||!this._beginMarkerRect||!this._endMarkerRect||!this._textRect)return void(t=!0);if((R(this._beginMarkerRect,this._textRect)||R(this._endMarkerRect,this._textRect))&&(t=!1),!t){const i=this._textRect.width/2,t=this._beginMarkerRect.width/2,e=this._endMarkerRect.width/2;"MoveBegin"===n?(this._textPoint=w(this._beginDimensionPoint,this._endDimensionPoint,-(i+t)),this._extendDimensionLineForMovedText("begin",t+this._textRect.width)):"MoveEnd"===n&&(this._textPoint=w(this._endDimensionPoint,this._beginDimensionPoint,-(i+e)),this._extendDimensionLineForMovedText("end",e+this._textRect.width))}}}_extendDimensionLineForMovedText(i,n){if(this._dimensionPolyline?.length)if("begin"===i){const i=w(this._beginDimensionPoint,this._endDimensionPoint,-n);this._dimensionPolyline[0]=[i,this._beginDimensionPoint]}else{const i=w(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+n);this._dimensionPolyline[1]=[i,this._endDimensionPoint]}}_offsetTextPoint(i){if(this._hasTextPoint)return;const n=this._textPoint;if(!n)return;const t=.5*this._textSize*i,e=-t*this._dimensionDirection[1],s=t*this._dimensionDirection[0];n[0]+=e,n[1]+=s}_updateExtensionLines(i){if(!(this._displayExtLines&&this._beginDimensionPoint&&this._dimensionLinePoint&&this._endDimensionPoint))return;const{extensionLineOvershot:n,extensionLineOffset:t}=this._dimensionStyle;let e=this._dimensionLinePoint,o=this._endDimensionPoint;null==n||isNaN(n)||0===n||(e=w(this._dimensionLinePoint,this._beginBaselinePoint,-n*i),o=w(this._endDimensionPoint,this._endBaselinePoint,-n*i));let r=this._beginBaselinePoint,h=this._endBaselinePoint;if(null!=t&&!isNaN(t)&&0!==t){const i=s(e,this._beginBaselinePoint),n=s(o,this._endBaselinePoint);r=w(e,this._beginBaselinePoint,i-t),h=w(o,this._endBaselinePoint,n-t)}this._dimensionExtensionLines=[[e,r],[o,h]]}_computeDimensionLineInfo(n,s){if(!n||!a(n)||n.rings[0].length<3)throw new i("DimensionLayerView: bad geometry","Dimension cann't be applied to an empty geometry!");const g=n.rings[0],u=_(g[0][0],g[0][1]),c=_(g[1][0],g[1][1]),x=_(g[2][0],g[2][1]);this._beginBaselinePoint=o(d(),u[0],u[1]),this._endBaselinePoint=o(d(),c[0],c[1]),this._dimensionLinePoint=x;let P=this._extAngleRad;if(r(u,x))this._beginDimensionPoint=o(d(),u[0],u[1]),this._endDimensionPoint=o(d(),c[0],c[1]),this._displayExtLines=!1;else{const n=E([c[0]-u[0],c[1]-u[1]]),s=e(P);s>=-1&&s<=1?P+=t(1):s>=179&&s<=181&&(P-=t(1));const r=k(x,n,c,n+P);if(!r)throw new i("DimensionLayerView: bad geometry","Failed to construct dimension extension lines!");this._beginDimensionPoint=o(d(),x[0],x[1]),this._endDimensionPoint=o(d(),r[0],r[1])}this._dimensionDirection=h(d(),this._endDimensionPoint,this._beginDimensionPoint),this._dimensionAngleRad=E(this._dimensionDirection),this._dimensionLength=l(this._dimensionDirection),this._dimensionDirection=m(this._dimensionDirection,this._dimensionDirection,1/this._dimensionLength),this._hasTextPoint||(this._textPoint=w(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2))}_evaluateDefaultPlacement(i){const{beginMarkerSymbol:n,endMarkerSymbol:t}=this._dimensionStyle,e=N(n,this._dimensionAngleRad),s=N(t,this._dimensionAngleRad+Math.PI),o=this._measureDimensionText(this._textString||"",this._textPoint,i);this._textRect=o;const r=i*((e?.width??0)/2),h=i*((s?.width??0)/2),l=e&&this._beginDimensionPoint?v(A(e,i),this._beginDimensionPoint[0],this._beginDimensionPoint[1]):null,m=s&&this._endDimensionPoint?v(A(s,i),this._endDimensionPoint[0],this._endDimensionPoint[1]):null;if(this._beginMarkerRect=l,this._endMarkerRect=m,this._doMarkersFit=this._checkMarkerFit(l,m,o,i),this._doMarkersFit){const i=w(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2);this._dimensionPolyline=[[i,this._beginDimensionPoint],[i,this._endDimensionPoint]]}else{const i=w(this._beginDimensionPoint,this._endDimensionPoint,-4*r),n=w(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+4*h);this._dimensionPolyline=[[i,this._beginDimensionPoint],[n,this._endDimensionPoint]]}}_checkMarkerFit(i,n,t,e){if(!i||!n)return!1;const{markerFit:s,markerOption:o,markerFitTolerance:r}=this._dimensionStyle;if("None"===s)return!0;let h=!0;const l=(i,n)=>R(i,n)||F(i,n,this._dimensionDirection);if("Tolerance"===s)r*e>=this._dimensionLength&&(h=!1);else{if(this._hasTextPoint&&"Both"!==o)return!0;this._hasTextPoint&&"Both"===o?l(i,n)&&(h=!1):(l(i,n)&&(h=!1),h&&t&&(l(t,i)||l(t,n))&&(h=!1))}return h}_measureDimensionText(i,n,t){if(null==this._textString||null==n||null==this._mosaicItems)return null;const e=[];for(const c of i)c.codePointAt(0),e.push(this._mosaicItems.glyphs[c.codePointAt(0)]);const s=this._dimensionStyle.textSymbol;if(!s)return null;const o=c(s.horizontalAlignment),r=x(s.verticalAlignment),h=P(s),l=L(s.height||10);this._textSize=l;const m=!0,_=s.angle||0,d=l/b,a=S(s.lineWidth),g=f*Math.max(.25,Math.min(l||1,4)),u={...this._mosaicItems,glyphs:e.filter(i=>null!=i)},p=D(u,{scale:d,angle:_,xOffset:0,yOffset:0,horizontalAlignment:o,verticalAlignment:r,decoration:h,lineHeight:g,useCIMAngleBehavior:m,maxLineWidth:a,hasBackground:!1}),M=n;if(!M)return null;const T=t,R=[p.bounds.blX,p.bounds.trY],w=[p.bounds.trX,p.bounds.trY],E=[p.bounds.blX,p.bounds.blY],k=[p.bounds.trX,p.bounds.blY];R[0]-=p.bounds.x,R[1]-=p.bounds.y,w[0]-=p.bounds.x,w[1]-=p.bounds.y,E[0]-=p.bounds.x,E[1]-=p.bounds.y,k[0]-=p.bounds.x,k[1]-=p.bounds.y,R[0]*=T,R[1]*=T,w[0]*=T,w[1]*=T,E[0]*=T,E[1]*=T,k[0]*=T,k[1]*=T,this._dimensionAngleRad&&(B(R,this._dimensionAngleRad),B(w,this._dimensionAngleRad),B(E,this._dimensionAngleRad),B(k,this._dimensionAngleRad)),R[0]+=M[0],R[1]+=M[1],w[0]+=M[0],w[1]+=M[1],E[0]+=M[0],E[1]+=M[1],k[0]+=M[0],k[1]+=M[1];const N=Math.min(R[0],w[0],E[0],k[0]),v=Math.min(R[1],w[1],E[1],k[1]),A=Math.max(R[0],w[0],E[0],k[0]),F=Math.max(R[1],w[1],E[1],k[1]);return new y(N,v,1.1*(A-N),1.1*(F-v))}_getDimensionText(i){const{attributes:n}=i;let t=null;const e=1===Number(I(T.useCustomLength,n));t=Number(I(e?T.customLength:T.dimLength,n)),(0===t||isNaN(t)||null==t)&&(t=this._systemLength);let s=this._getDimensionString(t,i);return"number"==typeof s&&(s=s.toString()),n.__COMPUTED_TEXT_STRING__=s,s||""}_getDimensionString(i,n){const{convertUnits:t,displayUnits:e,displayPrecision:s,prefix:o,suffix:r,textOption:h}=this._dimensionStyle;if("None"===h)return null;if("Expression"===h&&this._compiledExpression&&n)return p(this._compiledExpression,n,{},"esriGeometryPolyline",this._fieldsIndex);let l=(i=null==s||isNaN(s)?parseFloat(i.toString()):parseFloat(i.toFixed(s))).toString();return"Suffix"===h&&(o&&(l=`${o} ${l}`),r&&(l=`${l} ${r}`)),l}}function O(i){const{attributes:n}=i,t=Object.keys(T).map(i=>({name:i,alias:i,type:"string"==typeof n[i]?"esriFieldTypeString":"esriFieldTypeDouble"}));return new g(t)}export{j as default};
2
+ import i from"../../../../../core/Error.js";import e from"../../../../../core/Logger.js";import{deg2rad as n,rad2deg as t}from"../../../../../core/mathUtils.js";import{dist as s,set as o,equals as r,subtract as h,len as l,scale as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as _,create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isPolygon as a}from"../../../../../geometry/support/jsonTypeUtils.js";import u from"../../../../../layers/support/FieldsIndex.js";import{createRendererExpression as g}from"../../../../../support/ArcadeExpression.js";import{fromCIMHorizontalAlignment as c,fromCIMVerticalAlignment as x,fromCIMFontDecoration as P}from"../../../../../symbols/cim/utils.js";import p from"../../../arcade/callExpressionWithFeature.js";import{magicLabelLineHeight as b}from"../../../engine/webgl/definitions.js";import f from"../../../engine/webgl/Rect.js";import{shapeTextResource as y}from"../../../engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as D,getLineWidth as L}from"../../graphics/graphicsUtils.js";import{initializeDimensionStyleDefaults as R}from"./dimensionStyleDefaults.js";import{DimensionRealFieldName as S,rectsOverlap as M,queryPointOnLine as T,angleFromXAxis as w,intersectLinesByPointsAndAngles as E,measureMarkerSymbolSize as k,translateRect as N,scaleRect as v,rotatePoint as A,rectsOverlapOnAxis as B}from"./dimensionUtils.js";import{getAttributeValue as F}from"./utils.js";class j{static async create(i,e,n){const t=new j(i);return await t.initialize(e,n),t}constructor(i){if(this._dimensionStyle=i,this._textString=null,this._displayExtLines=!0,this._systemLength=0,this._dimensionAngleRad=0,this._dimensionLength=0,this._dimensionDirection=null,this._textSize=null,this._extAngleRad=Math.PI/2,this._compiledExpression=null,this._fieldsIndex=null,this._textResource=null,this._beginBaselinePoint=null,this._endBaselinePoint=null,this._dimensionLinePoint=null,this._beginDimensionPoint=null,this._endDimensionPoint=null,this._beginMarkerRect=null,this._endMarkerRect=null,this._textRect=null,this._textPoint=null,this._dimensionPolyline=null,this._dimensionExtensionLines=null,this._hasTextPoint=!1,this._doMarkersFit=!0,this._dimensionIsEvaluated=!1,null==i)throw new Error("dimension syle must be defined!");R(i)}async initialize(n,t){if(!this._dimensionStyle)return;const{attributes:s}=n;if("Expression"===(this._dimensionStyle.textOption??"None")){const{expression:s,expressionParserName:o}=this._dimensionStyle;s&&o&&"arcade"===o.toLowerCase()?(this._compiledExpression=await g(s,t),this._fieldsIndex=I(n)):e.getLogger("esri.layers.DimensionFeatureLayer").warn(new i("dimension-layer:unsupported-expression","Only Arcade expressions are supported",{expressionType:o,expression:s}))}const o=Number(F(S.extAngle,s));this._extAngleRad=isNaN(o)?Math.PI/2:o,this._systemLength=Number(F("__SYSTEM_LENGTH__",s));const{geometry:r}=n;if(r&&!a(r))throw new i("dimension-layer","processed geometry must be a valid 'polygon'.");const h=r?.rings[0];if(!h||h.length<3)throw new i("dimension-layer","processed geometry must have at least 3 points.");this._hasTextPoint=0!==h[3][0]&&0!==h[3][1]&&void 0!==h[3][0]&&void 0!==h[3][1],this._hasTextPoint&&(this._textPoint=h[3]);const l=this._dimensionStyle.textSymbol;s.__DIMENSION_ANGLE__+=l?.angle??0}getTextString(i){return null==this._textString&&(this._textString=this._getDimensionText(i)),this._textString}get textSymbol(){return this._dimensionStyle.textSymbol??null}setTextResource(i){this._textResource=i??null}get beginBaselinePoint(){return this._beginBaselinePoint}get endBaselinePoint(){return this._endBaselinePoint}get beginDimensionPoint(){return this._beginDimensionPoint}get endDimensionPoint(){return this._endDimensionPoint}get textPoint(){return this._textPoint}get dimensionLine(){return this._dimensionPolyline}get extensionLines(){return this._displayExtLines?this._dimensionExtensionLines:null}evaluateWithGeometry(i,e){this._dimensionIsEvaluated||(this._computeDimensionLineInfo(i,e),this._evaluateDefaultPlacement(e),this._updateExtensionLines(e),this._updateTextPoint(e),this._offsetTextPoint(e),this._dimensionIsEvaluated=!0)}_updateTextPoint(i){if(this._hasTextPoint)return;const{textFit:e}=this._dimensionStyle;let n=!0;if(!this._doMarkersFit){if(this._hasTextPoint)return;if("None"===e||!this._beginMarkerRect||!this._endMarkerRect||!this._textRect)return void(n=!0);if((M(this._beginMarkerRect,this._textRect)||M(this._endMarkerRect,this._textRect))&&(n=!1),!n){const i=this._textRect.width/2,n=this._beginMarkerRect.width/2,t=this._endMarkerRect.width/2;"MoveBegin"===e?(this._textPoint=T(this._beginDimensionPoint,this._endDimensionPoint,-(i+n)),this._extendDimensionLineForMovedText("begin",n+this._textRect.width)):"MoveEnd"===e&&(this._textPoint=T(this._endDimensionPoint,this._beginDimensionPoint,-(i+t)),this._extendDimensionLineForMovedText("end",t+this._textRect.width))}}}_extendDimensionLineForMovedText(i,e){if(this._dimensionPolyline?.length)if("begin"===i){const i=T(this._beginDimensionPoint,this._endDimensionPoint,-e);this._dimensionPolyline[0]=[i,this._beginDimensionPoint]}else{const i=T(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+e);this._dimensionPolyline[1]=[i,this._endDimensionPoint]}}_offsetTextPoint(i){if(this._hasTextPoint)return;const e=this._textPoint;if(!e)return;const n=.5*this._textSize*i,t=-n*this._dimensionDirection[1],s=n*this._dimensionDirection[0];e[0]+=t,e[1]+=s}_updateExtensionLines(i){if(!(this._displayExtLines&&this._beginDimensionPoint&&this._dimensionLinePoint&&this._endDimensionPoint))return;const{extensionLineOvershot:e,extensionLineOffset:n}=this._dimensionStyle;let t=this._dimensionLinePoint,o=this._endDimensionPoint;null==e||isNaN(e)||0===e||(t=T(this._dimensionLinePoint,this._beginBaselinePoint,-e*i),o=T(this._endDimensionPoint,this._endBaselinePoint,-e*i));let r=this._beginBaselinePoint,h=this._endBaselinePoint;if(null!=n&&!isNaN(n)&&0!==n){const i=s(t,this._beginBaselinePoint),e=s(o,this._endBaselinePoint);r=T(t,this._beginBaselinePoint,i-n),h=T(o,this._endBaselinePoint,e-n)}this._dimensionExtensionLines=[[t,r],[o,h]]}_computeDimensionLineInfo(e,s){if(!e||!a(e)||e.rings[0].length<3)throw new i("DimensionLayerView: bad geometry","Dimension cann't be applied to an empty geometry!");const u=e.rings[0],g=_(u[0][0],u[0][1]),c=_(u[1][0],u[1][1]),x=_(u[2][0],u[2][1]);this._beginBaselinePoint=o(d(),g[0],g[1]),this._endBaselinePoint=o(d(),c[0],c[1]),this._dimensionLinePoint=x;let P=this._extAngleRad;if(r(g,x))this._beginDimensionPoint=o(d(),g[0],g[1]),this._endDimensionPoint=o(d(),c[0],c[1]),this._displayExtLines=!1;else{const e=w([c[0]-g[0],c[1]-g[1]]),s=t(P);s>=-1&&s<=1?P+=n(1):s>=179&&s<=181&&(P-=n(1));const r=E(x,e,c,e+P);if(!r)throw new i("DimensionLayerView: bad geometry","Failed to construct dimension extension lines!");this._beginDimensionPoint=o(d(),x[0],x[1]),this._endDimensionPoint=o(d(),r[0],r[1])}this._dimensionDirection=h(d(),this._endDimensionPoint,this._beginDimensionPoint),this._dimensionAngleRad=w(this._dimensionDirection),this._dimensionLength=l(this._dimensionDirection),this._dimensionDirection=m(this._dimensionDirection,this._dimensionDirection,1/this._dimensionLength),this._hasTextPoint||(this._textPoint=T(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2))}_evaluateDefaultPlacement(i){const{beginMarkerSymbol:e,endMarkerSymbol:n}=this._dimensionStyle,t=k(e,this._dimensionAngleRad),s=k(n,this._dimensionAngleRad+Math.PI),o=this._measureDimensionText(this._textString||"",this._textPoint,i);this._textRect=o;const r=i*((t?.width??0)/2),h=i*((s?.width??0)/2),l=t&&this._beginDimensionPoint?N(v(t,i),this._beginDimensionPoint[0],this._beginDimensionPoint[1]):null,m=s&&this._endDimensionPoint?N(v(s,i),this._endDimensionPoint[0],this._endDimensionPoint[1]):null;if(this._beginMarkerRect=l,this._endMarkerRect=m,this._doMarkersFit=this._checkMarkerFit(l,m,o,i),this._doMarkersFit){const i=T(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2);this._dimensionPolyline=[[i,this._beginDimensionPoint],[i,this._endDimensionPoint]]}else{const i=T(this._beginDimensionPoint,this._endDimensionPoint,-4*r),e=T(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+4*h);this._dimensionPolyline=[[i,this._beginDimensionPoint],[e,this._endDimensionPoint]]}}_checkMarkerFit(i,e,n,t){if(!i||!e)return!1;const{markerFit:s,markerOption:o,markerFitTolerance:r}=this._dimensionStyle;if("None"===s)return!0;let h=!0;const l=(i,e)=>M(i,e)||B(i,e,this._dimensionDirection);if("Tolerance"===s)r*t>=this._dimensionLength&&(h=!1);else{if(this._hasTextPoint&&"Both"!==o)return!0;this._hasTextPoint&&"Both"===o?l(i,e)&&(h=!1):(l(i,e)&&(h=!1),h&&n&&(l(n,i)||l(n,e))&&(h=!1))}return h}_measureDimensionText(i,e,n){if(null==this._textString||null==e||null==this._textResource)return null;const t=this._dimensionStyle.textSymbol;if(!t)return null;const s=c(t.horizontalAlignment),o=x(t.verticalAlignment),r=P(t),h=D(t.height||10);this._textSize="glyphs"===this._textResource.type?h:Math.max(h,...this._textResource.runs.map(i=>D(i.fontSize||0)));const l=!0,m=t.angle||0,_="glyphs"===this._textResource.type?this._textResource.sdfSize:this._textResource.runs[0]?.glyphs.sdfSize;if(!_)return null;const d=h/_,a=L(t.lineWidth),u=Math.max(.25,Math.min(h||1,4)),g=b*u,p=y(this._textResource,{scale:d,angle:m,xOffset:0,yOffset:0,horizontalAlignment:s,verticalAlignment:o,decoration:r,lineHeight:g,lineHeightRatio:u,useCIMAngleBehavior:l,maxLineWidth:a,hasBackground:!1}),R=e;if(!R)return null;const S=n,M=[p.bounds.blX,p.bounds.trY],T=[p.bounds.trX,p.bounds.trY],w=[p.bounds.blX,p.bounds.blY],E=[p.bounds.trX,p.bounds.blY];M[0]-=p.bounds.x,M[1]-=p.bounds.y,T[0]-=p.bounds.x,T[1]-=p.bounds.y,w[0]-=p.bounds.x,w[1]-=p.bounds.y,E[0]-=p.bounds.x,E[1]-=p.bounds.y,M[0]*=S,M[1]*=S,T[0]*=S,T[1]*=S,w[0]*=S,w[1]*=S,E[0]*=S,E[1]*=S,this._dimensionAngleRad&&(A(M,this._dimensionAngleRad),A(T,this._dimensionAngleRad),A(w,this._dimensionAngleRad),A(E,this._dimensionAngleRad)),M[0]+=R[0],M[1]+=R[1],T[0]+=R[0],T[1]+=R[1],w[0]+=R[0],w[1]+=R[1],E[0]+=R[0],E[1]+=R[1];const k=Math.min(M[0],T[0],w[0],E[0]),N=Math.min(M[1],T[1],w[1],E[1]),v=Math.max(M[0],T[0],w[0],E[0]),B=Math.max(M[1],T[1],w[1],E[1]);return new f(k,N,1.1*(v-k),1.1*(B-N))}_getDimensionText(i){const{attributes:e}=i;let n=null;const t=1===Number(F(S.useCustomLength,e));n=Number(F(t?S.customLength:S.dimLength,e)),(0===n||isNaN(n)||null==n)&&(n=this._systemLength);let s=this._getDimensionString(n,i);return"number"==typeof s&&(s=s.toString()),e.__COMPUTED_TEXT_STRING__=s,s||""}_getDimensionString(i,e){const{convertUnits:n,displayUnits:t,displayPrecision:s,prefix:o,suffix:r,textOption:h}=this._dimensionStyle;if("None"===h)return null;if("Expression"===h&&this._compiledExpression&&e)return p(this._compiledExpression,e,{},"esriGeometryPolyline",this._fieldsIndex);let l=(i=null==s||isNaN(s)?parseFloat(i.toString()):parseFloat(i.toFixed(s))).toString();return"Suffix"===h&&(o&&(l=`${o} ${l}`),r&&(l=`${l} ${r}`)),l}}function I(i){const{attributes:e}=i,n=Object.keys(S).map(i=>({name:i,alias:i,type:"string"==typeof e[i]?"esriFieldTypeString":"esriFieldTypeDouble"}));return new u(n)}export{j as default};