@arcgis/core 4.34.0-next.54 → 4.34.0-next.56

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 (391) hide show
  1. package/WebScene.js +1 -1
  2. package/analysis/ElevationProfile/ElevationProfileGroundLine.d.ts +4 -0
  3. package/analysis/ElevationProfile/ElevationProfileGroundLine.js +5 -0
  4. package/analysis/ElevationProfile/ElevationProfileInputLine.d.ts +4 -0
  5. package/analysis/ElevationProfile/ElevationProfileInputLine.js +5 -0
  6. package/analysis/ElevationProfile/ElevationProfileLine.d.ts +4 -0
  7. package/analysis/ElevationProfile/ElevationProfileLine.js +5 -0
  8. package/analysis/ElevationProfile/ElevationProfileLineChartOptions.d.ts +4 -0
  9. package/analysis/ElevationProfile/{LineChartOptions.js → ElevationProfileLineChartOptions.js} +1 -1
  10. package/analysis/ElevationProfile/ElevationProfileLineViewOptions.d.ts +4 -0
  11. package/analysis/ElevationProfile/{LineViewOptions.js → ElevationProfileLineViewOptions.js} +1 -1
  12. package/analysis/ElevationProfile/ElevationProfileQueryLine.d.ts +4 -0
  13. package/analysis/ElevationProfile/ElevationProfileQueryLine.js +5 -0
  14. package/analysis/ElevationProfile/ElevationProfileSceneLine.d.ts +4 -0
  15. package/analysis/ElevationProfile/ElevationProfileSceneLine.js +5 -0
  16. package/analysis/ElevationProfile/ElevationProfileUnits.d.ts +4 -0
  17. package/analysis/ElevationProfile/{Units.js → ElevationProfileUnits.js} +1 -1
  18. package/analysis/ElevationProfile/ElevationProfileViewOptions.d.ts +4 -0
  19. package/analysis/ElevationProfile/{ViewOptions.js → ElevationProfileViewOptions.js} +1 -1
  20. package/analysis/ElevationProfile/elevationProfileLineTypes.js +1 -1
  21. package/analysis/ElevationProfileAnalysis.js +1 -1
  22. package/applications/KnowledgeStudio/resourceSerializationUtils.js +1 -1
  23. package/assets/esri/core/workers/RemoteClient.js +1 -1
  24. package/assets/esri/core/workers/chunks/01e8b9dc77a57d1c2a52.js +1 -0
  25. package/assets/esri/core/workers/chunks/027cfcde29fe87aa2ffe.js +1 -0
  26. package/assets/esri/core/workers/chunks/0a4586e596413ef7a4b5.js +1 -0
  27. package/assets/esri/core/workers/chunks/10b46438885916d18425.js +1 -0
  28. package/assets/esri/core/workers/chunks/1166ed298cf5ca7ad444.js +1 -0
  29. package/assets/esri/core/workers/chunks/13797036850dcc3671c3.js +1 -0
  30. package/assets/esri/core/workers/chunks/18ceea59e469a0f2721b.js +1 -0
  31. package/assets/esri/core/workers/chunks/199a17b0a0f75cbaed16.js +1 -0
  32. package/assets/esri/core/workers/chunks/1eee7cf11df01a52c1bf.js +1 -0
  33. package/assets/esri/core/workers/chunks/{ac41b882f9cbf8d56f0c.js → 222f981e876f60ae282f.js} +1 -1
  34. package/assets/esri/core/workers/chunks/22334a464f798b5279b2.js +1 -0
  35. package/assets/esri/core/workers/chunks/{99b9392946d776a62997.js → 23e600e368ac829680b5.js} +1 -1
  36. package/assets/esri/core/workers/chunks/24ac204d8a045aa821be.js +1 -0
  37. package/assets/esri/core/workers/chunks/27197b0a2ffb2b6104ea.js +1 -0
  38. package/assets/esri/core/workers/chunks/{93af38d29d066f27ed28.js → 2cb14d040e67a261b31c.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{0021118bafefd1e47ff7.js → 31c088966ccfff2ea1db.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{c9c109d43a1e5160955d.js → 3490d47cac7c8dec70cd.js} +2 -2
  41. package/assets/esri/core/workers/chunks/3d800fbc449bea18b1cd.js +1 -0
  42. package/assets/esri/core/workers/chunks/43a56c8fa4e5be18c12a.js +1 -0
  43. package/assets/esri/core/workers/chunks/4874aabdb5c60ca66216.js +1 -0
  44. package/assets/esri/core/workers/chunks/4b58da6cb91f7bf6af8b.js +1 -0
  45. package/assets/esri/core/workers/chunks/{cac060a187f3a27a19ba.js → 4d5abcf57a6ded4750ba.js} +1 -1
  46. package/assets/esri/core/workers/chunks/527557b603400189d49a.js +1 -0
  47. package/assets/esri/core/workers/chunks/{d0bf1fc6e3c198bc565d.js → 57486b18421a3c9690d0.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{4bd92232928b832dea76.js → 5900dde7a201a7d47469.js} +1 -1
  49. package/assets/esri/core/workers/chunks/5f518931a660b3c4f519.js +1 -0
  50. package/assets/esri/core/workers/chunks/63f3e46bfa820436161c.js +1 -0
  51. package/assets/esri/core/workers/chunks/66f3659ba18f92cd623e.js +1 -0
  52. package/assets/esri/core/workers/chunks/67355372ac5fd8a15d18.js +1 -0
  53. package/assets/esri/core/workers/chunks/{b0ee061747bef6729bb9.js → 6801b92bce7a918fda6f.js} +1 -1
  54. package/assets/esri/core/workers/chunks/6940bb6524938894a246.js +1 -0
  55. package/assets/esri/core/workers/chunks/6b11476b2004b4db576e.js +1 -0
  56. package/assets/esri/core/workers/chunks/{5691d504ffe5592bc40f.js → 6dc0009889f2b7cc8cff.js} +1 -1
  57. package/assets/esri/core/workers/chunks/71cac356874b36f9a383.js +1 -0
  58. package/assets/esri/core/workers/chunks/{69dc5a7abc1fda2474ad.js → 722931d1a60be461e521.js} +1 -1
  59. package/assets/esri/core/workers/chunks/79ab06fb4c91ac8da323.js +1 -0
  60. package/assets/esri/core/workers/chunks/{0a4357af5b8c0532b439.js → 7bdfc7c7ce1d94c00745.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{0ce671588de2858516d2.js → 83737d86584bf1b32368.js} +1 -1
  62. package/assets/esri/core/workers/chunks/853b9f29b4d62fa621b9.js +1 -0
  63. package/assets/esri/core/workers/chunks/855f25ce748aaef44b1a.js +1 -0
  64. package/assets/esri/core/workers/chunks/{71acded1b3c0057917a1.js → 862fe2f96d4b777ff5b8.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{98ea12c7a000a30f3dc0.js → 87f68c2b9361bd3f8cac.js} +1 -1
  66. package/assets/esri/core/workers/chunks/8fa50cac57b6e1ecec76.js +1 -0
  67. package/assets/esri/core/workers/chunks/9307108821d82c131654.js +1 -0
  68. package/assets/esri/core/workers/chunks/97ae2fdb6cb98249f5fa.js +1 -0
  69. package/assets/esri/core/workers/chunks/9a20390602126995f831.js +1 -0
  70. package/assets/esri/core/workers/chunks/9b10e70f28873cff44f5.js +1 -0
  71. package/assets/esri/core/workers/chunks/9cdeead9d444e8d95477.js +1 -0
  72. package/assets/esri/core/workers/chunks/a778a72456fefdf40115.js +1 -0
  73. package/assets/esri/core/workers/chunks/a999f804fc2f00b2e7ae.js +1 -0
  74. package/assets/esri/core/workers/chunks/adf11d31f95481f89a55.js +1 -0
  75. package/assets/esri/core/workers/chunks/ae73ac81bd10614c2b53.js +1 -0
  76. package/assets/esri/core/workers/chunks/af4412e79275c5a87539.js +1 -0
  77. package/assets/esri/core/workers/chunks/{7a8d740d1226719a578a.js → b457b7dd907f06278bee.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{81e518dd62bd95611d00.js → b47688e3263099540873.js} +1 -1
  79. package/assets/esri/core/workers/chunks/c7d4c296011c5393bcaa.js +1 -0
  80. package/assets/esri/core/workers/chunks/c86e339e45900c54c9f5.js +1 -0
  81. package/assets/esri/core/workers/chunks/c91217d977a6baaee74a.js +1 -0
  82. package/assets/esri/core/workers/chunks/{a1d3f1c221389eb6090c.js → c95e6bef8c97cf647869.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{e1b25b1ce3bd4f0f2cda.js → cb57cdff976d2d4b0b41.js} +1 -1
  84. package/assets/esri/core/workers/chunks/cbec768cd98caff212f2.js +1 -0
  85. package/assets/esri/core/workers/chunks/{9fef330b241f958b55df.js → d0124b0dd62b331afe58.js} +1 -1
  86. package/assets/esri/core/workers/chunks/d3a7747f23e91d1f1b5e.js +1 -0
  87. package/assets/esri/core/workers/chunks/d3ae88fcde2d7fb3e2e2.js +1 -0
  88. package/assets/esri/core/workers/chunks/{b6a201e86f9caef45ff0.js → d42fd0effc560eefb14b.js} +1 -1
  89. package/assets/esri/core/workers/chunks/d81c4afad4abe2d1d0b9.js +1 -0
  90. package/assets/esri/core/workers/chunks/{2da12a64d3baef4aaaa1.js → d87fdc64a5cc6be4bd69.js} +1 -1
  91. package/assets/esri/core/workers/chunks/db5d3feeb61ccb5ede98.js +1 -0
  92. package/assets/esri/core/workers/chunks/dfb12f42b8d319ffa5fc.js +1 -0
  93. package/assets/esri/core/workers/chunks/{aab349d4624b78ef429f.js → e6bf4f3f6868dc9028e3.js} +1 -1
  94. package/assets/esri/core/workers/chunks/e982cf44906eb26164f2.js +1 -0
  95. package/assets/esri/core/workers/chunks/{081b22fa73ef7b696409.js → ead1acf95c3385630da8.js} +2 -2
  96. package/assets/esri/core/workers/chunks/f1c50f37a81c672263a1.js +1 -0
  97. package/assets/esri/core/workers/chunks/f74b0cdc1c2b56bac5f0.js +1 -0
  98. package/assets/esri/core/workers/chunks/f807e7fc90e0e7ce6b67.js +1 -0
  99. package/assets/esri/core/workers/chunks/{fae6030a81cb91a91b69.js → faf4002f9547a0cc4e33.js} +1 -1
  100. package/assets/esri/core/workers/chunks/ff323db554c9e09749e8.js +1 -0
  101. package/assets/esri/core/workers/chunks/{fe55833c80cf59df9c2b.js → ff42b24b48019a03d841.js} +1 -1
  102. package/assets/esri/core/workers/chunks/{e10c5405f956b2cc59e4.js → ff4e15a872de94d2b438.js} +1 -1
  103. package/assets/esri/core/workers/chunks/{ff7962063d132c1ec814.js → ff8a4bf1bceb362d67ab.js} +1 -1
  104. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  105. package/chunks/Laserlines.glsl.js +1 -1
  106. package/chunks/LineSeries.js +1 -1
  107. package/chunks/Theme.js +1 -1
  108. package/chunks/boundedPlane.js +1 -1
  109. package/chunks/bundle.js +1 -1
  110. package/chunks/chartUtilsAm5.js +1 -1
  111. package/chunks/sphere.js +1 -1
  112. package/chunks/vec42.js +1 -1
  113. package/config.js +1 -1
  114. package/core/ArrayPool.js +1 -1
  115. package/core/Collection.js +1 -1
  116. package/core/ObjectPool.js +1 -1
  117. package/core/accessorSupport/Properties.js +1 -1
  118. package/core/accessorSupport/watch.js +1 -1
  119. package/core/arrayUtils.js +1 -1
  120. package/core/has.js +1 -1
  121. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  122. package/core/libs/gl-matrix-2/math/vec4.js +1 -1
  123. package/core/pbf.js +1 -1
  124. package/core/typedArrayUtil.js +1 -1
  125. package/geohash/GeohashCell.js +1 -1
  126. package/geohash/GeohashTree.js +1 -1
  127. package/geometry/Multipoint.js +1 -1
  128. package/geometry/support/DoubleArray.js +1 -1
  129. package/geometry/support/boundedPlane.js +1 -1
  130. package/geometry/support/coordsUtils.js +1 -1
  131. package/geometry/support/extentUtils.js +1 -1
  132. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  133. package/geometry/support/sphere.js +1 -1
  134. package/graphic/KMLGraphicOrigin.js +5 -0
  135. package/graphic/isKMLGraphicOrigin.js +5 -0
  136. package/interfaces.d.ts +147 -142
  137. package/kernel.js +1 -1
  138. package/layers/KMLLayer.js +1 -1
  139. package/layers/SceneLayer.js +1 -1
  140. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  141. package/layers/graphics/sources/ParquetSource.js +1 -1
  142. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  143. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  144. package/layers/support/ElevationQuery.js +1 -1
  145. package/layers/support/KMLSublayer.js +1 -1
  146. package/layers/support/featureReductionUtils.js +1 -1
  147. package/layers/support/kmlUtils.js +1 -1
  148. package/package.json +1 -1
  149. package/renderers/support/colorRampUtils.js +1 -1
  150. package/rest/knowledgeGraphService.js +1 -1
  151. package/support/requestUtils.js +1 -1
  152. package/support/revision.js +1 -1
  153. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  154. package/views/2d/engine/Container.js +1 -1
  155. package/views/2d/engine/DisplayObject.js +1 -1
  156. package/views/2d/engine/flow/dataUtils.js +1 -1
  157. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  158. package/views/2d/engine/webgl/DisplayEntity.js +1 -1
  159. package/views/2d/engine/webgl/DisplayRecord.js +1 -1
  160. package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
  161. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  162. package/views/2d/engine/webgl/PooledUint32Array.js +1 -1
  163. package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
  164. package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
  165. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  166. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  167. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  168. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  169. package/views/2d/layers/KMLLayerView2D.js +1 -1
  170. package/views/2d/layers/features/FeatureContainer.js +1 -1
  171. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  172. package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
  173. package/views/2d/layers/features/FeatureSpatialIndex.js +1 -1
  174. package/views/2d/layers/features/Processor.js +1 -1
  175. package/views/2d/layers/features/RenderState.js +1 -1
  176. package/views/2d/layers/features/aggregation/AccumulatedStatistics.js +1 -1
  177. package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
  178. package/views/2d/layers/features/aggregation/GridCell.js +1 -1
  179. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  180. package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
  181. package/views/2d/layers/features/schema/processor/LabelMatcherSchema.js +1 -1
  182. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  183. package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
  184. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  185. package/views/2d/layers/features/sources/strategies/chunks/ASourceChunk.js +1 -1
  186. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  187. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  188. package/views/2d/layers/features/support/DisplayIdGenerator.js +1 -1
  189. package/views/2d/layers/features/support/FeatureSetCache.js +1 -1
  190. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  191. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  192. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  193. package/views/2d/layers/features/support/StaticBitSet.js +1 -1
  194. package/views/2d/tiling/TileCoverage.js +1 -1
  195. package/views/2d/tiling/TileKey.js +1 -1
  196. package/views/3d/FocusAreasView.js +1 -1
  197. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
  198. package/views/3d/analysis/ElevationProfile/{HoveredPointVisualization.js → ElevationProfileHoveredPointVisualization.js} +1 -1
  199. package/views/3d/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +5 -0
  200. package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization.js +5 -0
  201. package/views/3d/analysis/ElevationProfile/ElevationProfileLinesVisualization.js +5 -0
  202. package/views/3d/analysis/ElevationProfile/ElevationProfileSceneLineComputation.js +5 -0
  203. package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization.js +5 -0
  204. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  205. package/views/3d/analysis/Slice/SliceController.js +1 -1
  206. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  207. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  208. package/views/3d/analysis/Viewshed/{ArrowManipulator.js → ViewshedArrowManipulator.js} +1 -1
  209. package/views/3d/analysis/Viewshed/{FieldOfViewManipulation.js → ViewshedFieldOfViewManipulation.js} +1 -1
  210. package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +5 -0
  211. package/views/3d/analysis/Viewshed/ViewshedShapeVisualElement.js +5 -0
  212. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  213. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +5 -0
  214. package/views/3d/analysis/Viewshed/ViewshedVisualization.js +1 -1
  215. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  216. package/views/3d/camera/constraintUtils/distance.js +1 -1
  217. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
  218. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  219. package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
  220. package/views/3d/layers/I3SMeshView3D.js +1 -1
  221. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  222. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  223. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  224. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  225. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  226. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  227. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  228. package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
  229. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  230. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  231. package/views/3d/layers/i3s/I3SNode.js +1 -1
  232. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  233. package/views/3d/state/ViewState.js +1 -1
  234. package/views/3d/state/ViewStateManager.js +1 -1
  235. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  236. package/views/3d/support/ViewSlice.js +1 -1
  237. package/views/3d/support/orientedBoundingBox.js +1 -1
  238. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  239. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  240. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  241. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  242. package/views/3d/terrain/ScaleRangeQueries.js +1 -1
  243. package/views/3d/terrain/SphericalPatch.js +1 -1
  244. package/views/3d/terrain/TerrainRenderer.js +1 -1
  245. package/views/3d/terrain/TerrainSurface.js +1 -1
  246. package/views/3d/terrain/Tile.js +1 -1
  247. package/views/3d/terrain/TilePerLayerInfo.js +1 -1
  248. package/views/3d/webgl-engine/core/material/MaterialBase.js +1 -1
  249. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  250. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  251. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  252. package/views/3d/webgl-engine/lib/SliceHelper.js +1 -1
  253. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  254. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  255. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  256. package/views/3d/webgl-engine/lib/lodRendering/InstanceOctree.js +1 -1
  257. package/views/3d/webgl-engine/lib/octreeUtils.js +1 -1
  258. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  259. package/views/analysis/ElevationProfile/ElevationProfileController.js +5 -0
  260. package/views/analysis/ElevationProfile/{ProfileGenerationError.js → ElevationProfileGenerationError.js} +1 -1
  261. package/views/analysis/ElevationProfile/ElevationProfileGroundLineComputation.js +5 -0
  262. package/views/analysis/ElevationProfile/ElevationProfileInputLineComputation.js +5 -0
  263. package/views/analysis/ElevationProfile/ElevationProfileLineComputation.js +5 -0
  264. package/views/analysis/ElevationProfile/ElevationProfileQueryLineComputation.js +5 -0
  265. package/views/analysis/ElevationProfile/ElevationProfileResult.d.ts +4 -0
  266. package/views/analysis/ElevationProfile/ElevationProfileResult.js +5 -0
  267. package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +5 -0
  268. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +5 -0
  269. package/views/draw/DrawOperation.js +1 -1
  270. package/views/draw/MultipointDrawAction.js +1 -1
  271. package/views/draw/PointDrawAction.js +1 -1
  272. package/views/draw/PolygonDrawAction.js +1 -1
  273. package/views/draw/PolylineDrawAction.js +1 -1
  274. package/views/draw/SegmentDrawAction.js +1 -1
  275. package/views/draw/support/Box.js +1 -1
  276. package/views/draw/support/GraphicMover.js +1 -1
  277. package/views/draw/support/Reshape.js +1 -1
  278. package/views/draw/support/drawUtils.js +1 -1
  279. package/views/draw/support/reshapeTooltipUtils.js +1 -1
  280. package/views/input/InputManager.js +1 -1
  281. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  282. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  283. package/views/interactive/editGeometry/operations/AppendVertex.js +1 -1
  284. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  285. package/views/interactive/sketch/constraints.js +1 -1
  286. package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
  287. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  288. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  289. package/views/interactive/tooltip/infos/SelectedVertexTooltipInfo.js +1 -1
  290. package/views/layers/FeatureLayerView.js +1 -1
  291. package/views/support/PropertiesPool.js +1 -1
  292. package/webscene/spec-certification/api.js +1 -1
  293. package/webscene/spec-certification/compare.js +1 -1
  294. package/webscene/spec-certification/spec.js +1 -1
  295. package/widgets/ElevationProfile/ElevationProfileLine.d.ts +2 -2
  296. package/widgets/ElevationProfile/support/profileUtils.js +1 -1
  297. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  298. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  299. package/widgets/OrientedImageryViewer.js +1 -1
  300. package/widgets/Sketch/SketchViewModel.js +1 -1
  301. package/widgets/Sketch/support/sketchUtils.js +1 -1
  302. package/analysis/ElevationProfile/GroundLine.d.ts +0 -4
  303. package/analysis/ElevationProfile/GroundLine.js +0 -5
  304. package/analysis/ElevationProfile/InputLine.d.ts +0 -4
  305. package/analysis/ElevationProfile/InputLine.js +0 -5
  306. package/analysis/ElevationProfile/Line.d.ts +0 -4
  307. package/analysis/ElevationProfile/Line.js +0 -5
  308. package/analysis/ElevationProfile/LineChartOptions.d.ts +0 -4
  309. package/analysis/ElevationProfile/LineViewOptions.d.ts +0 -4
  310. package/analysis/ElevationProfile/QueryLine.d.ts +0 -4
  311. package/analysis/ElevationProfile/QueryLine.js +0 -5
  312. package/analysis/ElevationProfile/SceneLine.d.ts +0 -4
  313. package/analysis/ElevationProfile/SceneLine.js +0 -5
  314. package/analysis/ElevationProfile/Units.d.ts +0 -4
  315. package/analysis/ElevationProfile/ViewOptions.d.ts +0 -4
  316. package/assets/esri/core/workers/chunks/02902303e5585a16ebea.js +0 -1
  317. package/assets/esri/core/workers/chunks/0445de3a8968c0734c91.js +0 -1
  318. package/assets/esri/core/workers/chunks/09268dc856c3d5ce178f.js +0 -1
  319. package/assets/esri/core/workers/chunks/0f51e51db83f303ce5a6.js +0 -1
  320. package/assets/esri/core/workers/chunks/14c6ae4feb4859cfa7c5.js +0 -1
  321. package/assets/esri/core/workers/chunks/17776d9d3558d45ea7b5.js +0 -1
  322. package/assets/esri/core/workers/chunks/1cbd59918c60a1a21494.js +0 -1
  323. package/assets/esri/core/workers/chunks/20a2b3d1f826e9059884.js +0 -1
  324. package/assets/esri/core/workers/chunks/250b1629becca0410f2a.js +0 -1
  325. package/assets/esri/core/workers/chunks/2efa4d8fe5454f8b2a05.js +0 -1
  326. package/assets/esri/core/workers/chunks/3149a86cd25684dcb0b3.js +0 -1
  327. package/assets/esri/core/workers/chunks/3800764932a1c32cb29f.js +0 -1
  328. package/assets/esri/core/workers/chunks/38f84294fb2fb4663ba5.js +0 -1
  329. package/assets/esri/core/workers/chunks/3c57b2e13628b5c1f6de.js +0 -1
  330. package/assets/esri/core/workers/chunks/3eb3af0b6cf3c2f28131.js +0 -1
  331. package/assets/esri/core/workers/chunks/43bd338bb0de375b9bb7.js +0 -1
  332. package/assets/esri/core/workers/chunks/4622a3e64d3c4aafa56b.js +0 -1
  333. package/assets/esri/core/workers/chunks/47f2e905ef42e36897aa.js +0 -1
  334. package/assets/esri/core/workers/chunks/50e9eafb118d2a221f10.js +0 -1
  335. package/assets/esri/core/workers/chunks/55588e668b6acb6aa390.js +0 -1
  336. package/assets/esri/core/workers/chunks/5b112471dca94b2e8462.js +0 -1
  337. package/assets/esri/core/workers/chunks/5dfe1aed10095385c066.js +0 -1
  338. package/assets/esri/core/workers/chunks/5fc414fc2cfc68828c5b.js +0 -1
  339. package/assets/esri/core/workers/chunks/7389841fabe0f319f1e5.js +0 -1
  340. package/assets/esri/core/workers/chunks/772e81e9162e2240a7a6.js +0 -1
  341. package/assets/esri/core/workers/chunks/8c81156b1605a16acc29.js +0 -1
  342. package/assets/esri/core/workers/chunks/8e0559cc6295008fcdf7.js +0 -1
  343. package/assets/esri/core/workers/chunks/8f6ff09e7d2f01b79faf.js +0 -1
  344. package/assets/esri/core/workers/chunks/944fa8261aad94ae0542.js +0 -1
  345. package/assets/esri/core/workers/chunks/9639a6f6fab52a501bf7.js +0 -1
  346. package/assets/esri/core/workers/chunks/998c38974372720b1c52.js +0 -1
  347. package/assets/esri/core/workers/chunks/9e479e7e2e51476c3d27.js +0 -1
  348. package/assets/esri/core/workers/chunks/a1e179dd6de9c8769b02.js +0 -1
  349. package/assets/esri/core/workers/chunks/a6493607b98783bf1ef2.js +0 -1
  350. package/assets/esri/core/workers/chunks/a7530dcb08b43e37bbb2.js +0 -1
  351. package/assets/esri/core/workers/chunks/a829969ed44cdb814f27.js +0 -1
  352. package/assets/esri/core/workers/chunks/b2a035befeeff1a55ad8.js +0 -1
  353. package/assets/esri/core/workers/chunks/b4251e10621fb3ad03a3.js +0 -1
  354. package/assets/esri/core/workers/chunks/b9f5672093727c6f92c9.js +0 -1
  355. package/assets/esri/core/workers/chunks/ba45dccb4dab5a74d224.js +0 -1
  356. package/assets/esri/core/workers/chunks/c51e2a048df152abd901.js +0 -1
  357. package/assets/esri/core/workers/chunks/cda27c0fafd687dfa72e.js +0 -1
  358. package/assets/esri/core/workers/chunks/d1842745a7699879a1e1.js +0 -1
  359. package/assets/esri/core/workers/chunks/d578c3880eaf2dd62324.js +0 -1
  360. package/assets/esri/core/workers/chunks/ddd6597a66ec6b972f9c.js +0 -1
  361. package/assets/esri/core/workers/chunks/de499e33035b56b6697d.js +0 -1
  362. package/assets/esri/core/workers/chunks/e28d3ed65c3a76a044c8.js +0 -1
  363. package/assets/esri/core/workers/chunks/e3f68f7b408a08d7cd5d.js +0 -1
  364. package/assets/esri/core/workers/chunks/e9716995ce0c3683eafc.js +0 -1
  365. package/assets/esri/core/workers/chunks/ed25bf087f52e5d3e71b.js +0 -1
  366. package/assets/esri/core/workers/chunks/ee0286b5f5475f2d853f.js +0 -1
  367. package/assets/esri/core/workers/chunks/f8505bf69795f5293a79.js +0 -1
  368. package/assets/esri/core/workers/chunks/f92e608931b1c168cb45.js +0 -1
  369. package/views/3d/analysis/ElevationProfile/HoveredPointsVisualization.js +0 -5
  370. package/views/3d/analysis/ElevationProfile/InputVisualization.js +0 -5
  371. package/views/3d/analysis/ElevationProfile/ProfileLinesVisualization.js +0 -5
  372. package/views/3d/analysis/ElevationProfile/SceneLineComputation.js +0 -5
  373. package/views/3d/analysis/ElevationProfile/Visualization.js +0 -5
  374. package/views/3d/analysis/Viewshed/ScaleOrientManipulation.js +0 -5
  375. package/views/3d/analysis/Viewshed/ViewshedAnalysisVisualization.js +0 -5
  376. package/views/3d/interactive/visualElements/ViewshedShapeVisualElement.js +0 -5
  377. package/views/analysis/ElevationProfile/Controller.js +0 -5
  378. package/views/analysis/ElevationProfile/GroundLineComputation.js +0 -5
  379. package/views/analysis/ElevationProfile/InputLineComputation.js +0 -5
  380. package/views/analysis/ElevationProfile/LineComputation.js +0 -5
  381. package/views/analysis/ElevationProfile/QueryLineComputation.js +0 -5
  382. package/views/analysis/ElevationProfile/Result.d.ts +0 -4
  383. package/views/analysis/ElevationProfile/Result.js +0 -5
  384. package/views/analysis/ElevationProfile/geometryUtils.js +0 -5
  385. package/views/analysis/ElevationProfile/profileGenerationUtils.js +0 -5
  386. /package/assets/esri/core/workers/chunks/{c9c109d43a1e5160955d.js.LICENSE.txt → 3490d47cac7c8dec70cd.js.LICENSE.txt} +0 -0
  387. /package/views/analysis/ElevationProfile/{elevationQuerySourceUtils.js → elevationProfileQuerySourceUtils.js} +0 -0
  388. /package/views/analysis/ElevationProfile/{statisticsUtils.js → elevationProfileStatisticsUtils.js} +0 -0
  389. /package/views/analysis/ElevationProfile/{traversalUtils.js → elevationProfileTraversalUtils.js} +0 -0
  390. /package/views/analysis/ElevationProfile/{unitUtils.js → elevationProfileUnitUtils.js} +0 -0
  391. /package/views/analysis/ElevationProfile/{visualizationUtils.js → elevationProfileVisualizationUtils.js} +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- class t{static{this.byteSizeHint=7*Uint32Array.BYTES_PER_ELEMENT}constructor(t,e,s,i,r,h,n){this.instanceId=t,this.textureKey=e,this.indexStart=s,this.indexCount=i,this.vertexStart=r,this.vertexCount=h,this.overlaps=n}updateBaseOffsets(t){this.vertexStart+=t.vertexFrom,this.indexStart+=t.indexFrom}clone(){return new t(this.instanceId,this.textureKey,this.indexStart,this.indexCount,this.vertexStart,this.vertexCount,this.overlaps)}static write(t,e,s,i,r,h,n,a){t.push(e),t.push(s),t.push(i),t.push(r),t.push(h),t.push(n),t.push(a)}serialize(t){return t.push(this.instanceId),t.push(this.textureKey),t.push(this.indexStart),t.push(this.indexCount),t.push(this.vertexStart),t.push(this.vertexCount),t.push(this.overlaps),t}static deserialize(e){const s=e.readInt32(),i=e.readInt32(),r=e.readInt32(),h=e.readInt32(),n=e.readInt32(),a=e.readInt32(),u=e.readInt32();return new t(s,i,r,h,n,a,u)}}export{t as default};
5
+ class t{static{this.byteSizeHint=7*Uint32Array.BYTES_PER_ELEMENT}static{this.estimatedMemory=40}constructor(t,e,s,i,r,h,n){this.instanceId=t,this.textureKey=e,this.indexStart=s,this.indexCount=i,this.vertexStart=r,this.vertexCount=h,this.overlaps=n}updateBaseOffsets(t){this.vertexStart+=t.vertexFrom,this.indexStart+=t.indexFrom}clone(){return new t(this.instanceId,this.textureKey,this.indexStart,this.indexCount,this.vertexStart,this.vertexCount,this.overlaps)}static write(t,e,s,i,r,h,n,a){t.push(e),t.push(s),t.push(i),t.push(r),t.push(h),t.push(n),t.push(a)}serialize(t){return t.push(this.instanceId),t.push(this.textureKey),t.push(this.indexStart),t.push(this.indexCount),t.push(this.vertexStart),t.push(this.vertexCount),t.push(this.overlaps),t}static deserialize(e){const s=e.readInt32(),i=e.readInt32(),r=e.readInt32(),h=e.readInt32(),n=e.readInt32(),a=e.readInt32(),u=e.readInt32();return new t(s,i,r,h,n,a,u)}}export{t as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import{List as t}from"./cpuMapped/FreeList.js";import{isHittest as e}from"./shaderGraph/techniques/featureTechniqueUtils.js";import{PrimitiveType as n,DataType as i}from"../../../webgl/enums.js";function a(t,e){return t<<16|255&e}function s(t){return 255&t}class r{constructor(t,e,n,i,a){this.instance=t,this.materialKey=e,this.target=n,this.start=i,this.count=a}get textureKey(){return s(this.materialKey)}get indexEnd(){return this.start+this.count}extend(t){this.count+=t}render(t){this.instance.techniqueRef.render(t,this)}getStencilReference(){return this.target.stencilRef}getAttributePrecisionPackFactors(){const t=this.instance.instanceId;return this.target.getMesh(t).getAttributePrecisionPackFactors()}draw(t,n){e(t)?this.drawCompute(t.context,n):this.drawGeometry(t.context,n)}drawCompute(t,e){const a=this.instance.instanceId,s=this.target.getMesh(a).getComputeVAO(t,e),r=this.start*Uint32Array.BYTES_PER_ELEMENT/3;t.bindVAO(s,e.locations),t.drawElements(n.POINTS,this.count/3,i.UNSIGNED_INT,r),t.bindVAO(null)}drawGeometry(t,e){const a=this.instance.instanceId,s=this.target.getMesh(a).getGeometryVAO(t,e),r=this.start*Uint32Array.BYTES_PER_ELEMENT;t.bindVAO(s,e.locations),t.drawElements(n.TRIANGLES,this.count,i.UNSIGNED_INT,r),t.bindVAO(null)}}class d{constructor(){this._length=0,this._minOrderedLength=0,this._materialKeys=new Set}static fromDisplayEntities(t,e,n,i){const s=new d;for(const r of t.values())for(const t of r.records){const r=n.getInstance(t.instanceId),d=a(r.instanceId,t.textureKey);s.addRecord(r,d,t.indexStart,t.indexCount,t.vertexStart,t.vertexCount,e,i)}return s}get length(){return this._length}get minOrderedLength(){return this._minOrderedLength}get minUnorderedLength(){return this._materialKeys.size}render(t,e){const{drawPhase:n}=t;for(const i of this.infos()){const a=i.instance.techniqueRef;a.drawPhase&n&&(null==e||a.type===e)&&i.render(t)}}addRecord(e,n,i,a,s,d,h,l){let o=i,c=a;if(c||(o=s,c=d),!c)return;if(null==this._head){const i=new r(e,n,h,o,c);return this._head=new t(i),this._tail=this._head,this._length++,void this._minOrderedLength++}if(1===l)return this._insert(e,n,h,o,c,this._tail,null);let u=null,_=this._head;const g=e.instanceId,m=e.techniqueRef.symbologyPlane;if(2===l&&(2===m||3===m))return this._insert(e,n,h,o,c,this._tail,null);for(;_;){const t=_.data.instance,i=t.instanceId,a=t.techniqueRef.symbologyPlane,s=u?.data.instance.instanceId;if(m<a||g===s&&g!==i)return this._insert(e,n,h,o,c,u,_);u=_,_=_.next}this._insert(e,n,h,o,c,u,null)}*infos(){if(null!=this._head)for(const t of this._head.values())yield t}_insert(e,n,i,a,s,d,h){if(null==d&&null==h){const d=new r(e,n,i,a,s);return this._head=new t(d),this._tail=this._head,this._length++,void this._minOrderedLength++}return n!==this._tail.data.materialKey&&this._minOrderedLength++,this._materialKeys.add(n),null==d&&null!=h?this._insertAtHead(e,n,i,a,s,h):null!=d&&null==h?this._insertAtEnd(e,n,i,a,s,d):null!=d&&null!=h?this._insertAtMiddle(e,n,i,a,s,d,h):void 0}_insertAtHead(e,n,i,a,s,d){const h=a+s;if(n===d.data.materialKey&&i===d.data.target&&h===d.data.start)d.data.start=a,d.data.count+=s;else{const h=new r(e,n,i,a,s);this._head=new t(h),this._head.next=d,this._length++}}_insertAtEnd(e,n,i,a,s,d){if(d.data.materialKey===n&&d.data.indexEnd===a)d.data.count+=s;else{const h=new r(e,n,i,a,s);this._tail=new t(h),d.next=this._tail,this._length++}}_insertAtMiddle(e,n,i,a,s,d,h){const l=a+s;if(d.data.materialKey===n&&d.data.target===i&&d.data.indexEnd===a)d.data.count+=s,d.data.materialKey===h.data.materialKey&&d.data.target===h.data.target&&d.data.indexEnd===h.data.start&&(d.data.count+=h.data.count,d.next=h.next,this._length--);else if(n===h.data.materialKey&&i===h.data.target&&l===h.data.start)h.data.start=a,h.data.count+=s;else{const l=new r(e,n,i,a,s),o=new t(l);d.next=o,o.next=h,this._length++}}}export{d as DisplayList,r as DisplayListInfo};
5
+ import"../../../../core/has.js";import{estimateNumberMemory as t}from"../../../../core/memoryEstimations.js";import{List as e}from"./cpuMapped/FreeList.js";import{isHittest as n}from"./shaderGraph/techniques/featureTechniqueUtils.js";import{PrimitiveType as i,DataType as s}from"../../../webgl/enums.js";function a(t,e){return t<<16|255&e}function r(t){return 255&t}class d{constructor(t,e,n,i,s){this.instance=t,this.materialKey=e,this.target=n,this.start=i,this.count=s}get textureKey(){return r(this.materialKey)}get indexEnd(){return this.start+this.count}extend(t){this.count+=t}render(t){this.instance.techniqueRef.render(t,this)}getStencilReference(){return this.target.stencilRef}getAttributePrecisionPackFactors(){const t=this.instance.instanceId;return this.target.getMesh(t).getAttributePrecisionPackFactors()}draw(t,e){n(t)?this.drawCompute(t.context,e):this.drawGeometry(t.context,e)}drawCompute(t,e){const n=this.instance.instanceId,a=this.target.getMesh(n).getComputeVAO(t,e),r=this.start*Uint32Array.BYTES_PER_ELEMENT/3;t.bindVAO(a,e.locations),t.drawElements(i.POINTS,this.count/3,s.UNSIGNED_INT,r),t.bindVAO(null)}drawGeometry(t,e){const n=this.instance.instanceId,a=this.target.getMesh(n).getGeometryVAO(t,e),r=this.start*Uint32Array.BYTES_PER_ELEMENT;t.bindVAO(a,e.locations),t.drawElements(i.TRIANGLES,this.count,s.UNSIGNED_INT,r),t.bindVAO(null)}}class h{constructor(){this._length=0,this._minOrderedLength=0,this._materialKeys=new Set}static fromDisplayEntities(t,e,n,i){const s=new h;for(const r of t.values())for(const t of r.records){const r=n.getInstance(t.instanceId),d=a(r.instanceId,t.textureKey);s.addRecord(r,d,t.indexStart,t.indexCount,t.vertexStart,t.vertexCount,e,i)}return s}get length(){return this._length}get minOrderedLength(){return this._minOrderedLength}get minUnorderedLength(){return this._materialKeys.size}get usedMemory(){return this._length?5*this._length*t:0}render(t,e){const{drawPhase:n}=t;for(const i of this.infos()){const s=i.instance.techniqueRef;s.drawPhase&n&&(null==e||s.type===e)&&i.render(t)}}addRecord(t,n,i,s,a,r,h,o){let l=i,c=s;if(c||(l=a,c=r),!c)return;if(null==this._head){const i=new d(t,n,h,l,c);return this._head=new e(i),this._tail=this._head,this._length++,void this._minOrderedLength++}if(1===o)return this._insert(t,n,h,l,c,this._tail,null);let u=null,_=this._head;const g=t.instanceId,m=t.techniqueRef.symbologyPlane;if(2===o&&(2===m||3===m))return this._insert(t,n,h,l,c,this._tail,null);for(;_;){const e=_.data.instance,i=e.instanceId,s=e.techniqueRef.symbologyPlane,a=u?.data.instance.instanceId;if(m<s||g===a&&g!==i)return this._insert(t,n,h,l,c,u,_);u=_,_=_.next}this._insert(t,n,h,l,c,u,null)}*infos(){if(null!=this._head)for(const t of this._head.values())yield t}_insert(t,n,i,s,a,r,h){if(null==r&&null==h){const r=new d(t,n,i,s,a);return this._head=new e(r),this._tail=this._head,this._length++,void this._minOrderedLength++}return n!==this._tail.data.materialKey&&this._minOrderedLength++,this._materialKeys.add(n),null==r&&null!=h?this._insertAtHead(t,n,i,s,a,h):null!=r&&null==h?this._insertAtEnd(t,n,i,s,a,r):null!=r&&null!=h?this._insertAtMiddle(t,n,i,s,a,r,h):void 0}_insertAtHead(t,n,i,s,a,r){const h=s+a;if(n===r.data.materialKey&&i===r.data.target&&h===r.data.start)r.data.start=s,r.data.count+=a;else{const h=new d(t,n,i,s,a);this._head=new e(h),this._head.next=r,this._length++}}_insertAtEnd(t,n,i,s,a,r){if(r.data.materialKey===n&&r.data.indexEnd===s)r.data.count+=a;else{const h=new d(t,n,i,s,a);this._tail=new e(h),r.next=this._tail,this._length++}}_insertAtMiddle(t,n,i,s,a,r,h){const o=s+a;if(r.data.materialKey===n&&r.data.target===i&&r.data.indexEnd===s)r.data.count+=a,r.data.materialKey===h.data.materialKey&&r.data.target===h.data.target&&r.data.indexEnd===h.data.start&&(r.data.count+=h.data.count,r.next=h.next,this._length--);else if(n===h.data.materialKey&&i===h.data.target&&o===h.data.start)h.data.start=s,h.data.count+=a;else{const o=new d(t,n,i,s,a),l=new e(o);r.next=l,l.next=h,this._length++}}}export{h as DisplayList,d as DisplayListInfo};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{AFeatureTile as i}from"./AFeatureTile.js";import{RESHUFFLING_EXEMPT_MEMORY_BYTES as r,RESHUFFLING_TARGET_MEMORY_EFFICIENCY as o,RESHUFFLING_EXEMPT_DRAW_CALLS as d,RESHUFFLING_TARGET_DRAW_EFFICIENCY as n,tileSize as h}from"./definitions.js";import a from"./DisplayEntity.js";import{DisplayList as l}from"./FeatureDisplayList.js";import{ReshufflePlan as c}from"./ReshufflePlan.js";import{LabelMetric as f}from"./collisions/LabelMetric.js";import{MappedMesh as _}from"./cpuMapped/MappedMesh.js";import{debugMeshDataInfo as u}from"./mesh/meshDebugUtils.js";import m from"./util/Reader.js";import{deserializeList as p}from"./util/serializationUtils.js";const y=()=>e.getLogger("esri.views.2d.engine.webgl.FeatureTile");let b=0;class g extends i{constructor(e,i,r,o,d,n,h=!1){super(e,i,r,o),this._fader=d,this._labelInstanceId=n,this._meshes=new Map,this._entities=[],this._entityIndex=new Map,this._invalidated=!1,this._nextUploadAllowed=!1,this.tileAge=b++,this._metrics=[],this._metricsVisibility=new Set,this._entityIds=new Set,this._entityIdsFromBuffer=new Set,this._attributeEpoch=0,this._encounteredEnd=!1,this.isCoverage=!1,this.rendering=!1,this._decluttered=!1,this._objectIdMap=null,this.visible=!0,this.transforms.labelMat2d=t(),this.transforms.tileUnitsToPixels=s(),this.enableDeferredUploads=h}destroy(){super.destroy(),this.clear()}clear(){for(const e of this._meshes.values())e.destroy();this._meshes.clear(),this._entities=[],this._fader?.removeFeatureTileMetrics(this,this._metrics),this._metrics=[],this._displayList=null,this._invalidated=!0,this._entityIds.clear(),this._nextUploadAllowed=!0}beforeRender(e){super.beforeRender(e),this._needsReshuffle&&e.reshuffleManager.schedule(this)}tryReady(e){const t=this._invalidated&&!this._uploadAllowed;return!(this.isReady||t||!this._encounteredEnd||!(e>=this._attributeEpoch))&&(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.ready [epoch=${e}]`),this.ready(),this.requestRender(),this.decluttered=!1,!0)}get symbols(){const e=new Map;for(const t of this._metrics)e.get(t.labelClassId)||e.set(t.labelClassId,[]),e.get(t.labelClassId).push(t);return e}get decluttered(){return this._decluttered}set decluttered(e){this._decluttered=e,this.requestRender()}get id(){return this.key.id}get hasData(){return!!this._meshes.size}get hasAnimations(){return!!this._objectIdMap}get needsUpload(){return this._invalidated}get _uploadAllowed(){return!this.enableDeferredUploads||this._nextUploadAllowed}get _hasMetrics(){return this._metrics.length>0}upload(){this._nextUploadAllowed=!0}getDisplayList(e,t){if(this._uploadAllowed&&this._invalidated){this._entities.sort((e,t)=>{const s=t.sortKey,i=e.sortKey;return i===s?e.id-t.id:i-s}),0===t&&this.reshuffle(!0),this._displayList=l.fromDisplayEntities(this._entities,this,e,t);for(const e of this._meshes.values())e.upload();this.debugInfo.display.length=this._displayList.length,this.debugInfo.display.minOrderedLength=this._displayList.minOrderedLength,this.debugInfo.display.minUnorderedLength=this._displayList.minUnorderedLength,this.requestRender(),this._invalidated=!1,this._nextUploadAllowed=!1}return this._displayList}getMesh(e){if(!this._meshes.has(e))throw new Error(`InternalError: Unable to find VAO for instance: ${e}`);return this._meshes.get(e)}getSortKeys(e){const t=new Map;for(const{id:s,sortKey:i}of this._entities)if(e.has(s)&&t.set(s,i),t.size===e.size)break;return t}onMessage(e){if(e.objectIdMap)for(const t in e.objectIdMap)this._objectIdMap||(this._objectIdMap={}),this._objectIdMap[t]=e.objectIdMap[t];switch(e.type){case"append":this._onAppendMessage(e);break;case"update":this._onUpdateMessage(e)}if(this._aggregateMemoryStats(),this.requestRender(),e.end){if(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.end [epoch=${e.attributeEpoch}]`),!e.attributeEpoch)throw new Error("InternalError: Attribute epoch not defined.");this._attributeEpoch=e.attributeEpoch,this._encounteredEnd=!0}this._writeLabelVisibilityToMesh()}_onAppendMessage(e){if(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.append`,{append:u(e?.append)}),e.clear&&this.clear(),!e.append)return;const t=p(new m(e.append.entities),a);this._insert(t,e.append.data,!1)}_onUpdateMessage(e){has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.update`,{isPixelBuffer:e.isPixelBuffer,modify:u(e.modify),remove:e.remove});const t=p(new m(e.modify.entities),a),s=t.map(e=>e.id),i=e.isPixelBuffer??!1,r=[...e.remove,...s];i?this._removeByIdsFromBuffer(r):this._removeByIds(r),this._insert(t,e.modify.data,i)}reshuffle(e=!1){if(this.destroyed)return;const t=new Map;for(const s of this._entities)for(const i of s.records){const s=this._meshes.get(i.instanceId);let r=t.get(s);r||(r=new c(e),t.set(s,r)),r.copyRecord(i)}for(const[s,i]of t)s.reshuffle(i);this._invalidated=!0,this._aggregateMemoryStats(),has("esri-2d-update-debug")&&y().info(`Tile ${this.key.id} was reshuffled.`)}copyPixelBufferedEntitesFrom(e,t,s,i){const r=s*h,o=i*h;for(const d of e._entities){let s=null;for(const i of d.records)if(i.overlaps&t){const t=e.getMesh(i.instanceId),n=this._ensureMesh(i.instanceId,t.layout,t.useVisibility).copyRecordFrom(t,i,r,o);s||(s=new a(d.id,d.sortKey),this._entityIdsFromBuffer.add(d.id),this._entityIndex.set(s.id,s),this._entities.push(s)),s.records.push(n)}}this._invalidated=!0}get metricsVisibility(){return this._metricsVisibility}copyMetricsVisibility(e){for(const t of e)this._metricsVisibility.add(t);this._writeLabelVisibilityToMesh()}updateLabelVisibility(){this._metricsVisibility.clear();for(const e of this._metrics){e.uniqueSymbol.show&&e.selectedForRendering&&this._metricsVisibility.add(e.hash)}this._writeLabelVisibilityToMesh()}_writeLabelVisibilityToMesh(){const e=this._meshes.get(this._labelInstanceId);if(e&&this._hasMetrics){for(const t of this._metrics){const s=this._entityIndex.get(t.id);if(!s)continue;const i=this._metricsVisibility.has(t.hash);e.setEntityRecordRangeVisibility(s.records,t.recordStart,t.recordCount,i?0:255)}this._invalidated=!0}}_ensureMesh(e,t,s){return this._meshes.has(e)||this._meshes.set(e,new _(this._stage.bufferPool,t,s)),this._meshes.get(e)}_insert(e,t,s){if(!e.length)return;this._removeDuplicatedBufferedEntites(e);const i=this._insertVertexData(t);for(const r of e){for(const e of r.records)e.updateBaseOffsets(i.get(e.instanceId));s?this._tryInsertBufferedEntity(r):this._insertEntity(r)}this._invalidated=!0}_insertMetrics(e){for(const t of e)t.tile=this;this._metrics.push(...e),this._fader?.insertFeatureTileMetrics(this,e)}_insertVertexData(e){const t=new Map;for(const s of e){const{instanceId:e,layout:i}=s,r=i.attributes.some(e=>"visibility"===e.name),o=this._ensureMesh(e,i,r).append(s);if(s.metrics){const e=p(new m(s.metrics),f)??[];this._insertMetrics(e)}t.set(e,o)}return t}_insertEntity(e){has("esri-2d-update-debug")&&this._entityIds.has(e.id)&&console.error(`Tile ${this.key.id} insertEntity: Already have entityId ${e.id}`),this._entityIds.add(e.id),this._entityIndex.set(e.id,e),this._entities.push(e)}_tryInsertBufferedEntity(e){this._entityIds.has(e.id)?this._removeRecordsFromMesh(e.records):(this._entityIdsFromBuffer.add(e.id),this._entityIndex.set(e.id,e),this._entities.push(e))}_removeDuplicatedBufferedEntites(e){if(!this._entityIdsFromBuffer.size)return;const t=[];for(const s of e)this._entityIdsFromBuffer.has(s.id)&&t.push(s.id);this._removeByIds(t)}_removeByIdsFromBuffer(e){this._removeByIds(e.filter(e=>this._entityIdsFromBuffer.has(e)))}_removeByIds(e){if(0===e.length)return;const t=new Set(e),s=[];for(const r of this._entities)t.has(r.id)?(this._remove(r),this._entityIndex.delete(r.id)):s.push(r);this._entities=s;const i=this._metrics.filter(e=>t.has(e.displayId));this._metrics=this._metrics.filter(e=>!t.has(e.displayId)),this._fader?.removeFeatureTileMetrics(this,i),this._invalidated=!0}_remove(e){this._removeRecordsFromMesh(e.records),this._entityIds.delete(e.id),this._entityIdsFromBuffer.delete(e.id)}_removeRecordsFromMesh(e){for(const t of e){const{instanceId:e,indexStart:s,indexCount:i,vertexStart:r,vertexCount:o}=t;this._meshes.get(e)?.remove(s,i,r,o)}}_aggregateMemoryStats(){this.debugInfo.memory.bytesUsed=0,this.debugInfo.memory.bytesReserved=0;for(const e of this._meshes.values())this.debugInfo.memory.bytesUsed+=e.memoryStats.bytesUsed,this.debugInfo.memory.bytesReserved+=e.memoryStats.bytesReserved}get _needsReshuffle(){if(this.destroyed)return!1;const{bytesUsed:e,bytesReserved:t}=this.debugInfo.memory,s=e/t,{minOrderedLength:i,length:h}=this.debugInfo.display;return t>r&&s<o||h>d&&i/h<n}get entityIds(){return this._objectIdMap?this._entities.map(({id:e})=>({objectId:this._objectIdMap[e],displayId:e})):[]}}export{g as FeatureTile};
5
+ import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{AFeatureTile as i}from"./AFeatureTile.js";import{RESHUFFLING_EXEMPT_MEMORY_BYTES as r,RESHUFFLING_TARGET_MEMORY_EFFICIENCY as o,RESHUFFLING_EXEMPT_DRAW_CALLS as n,RESHUFFLING_TARGET_DRAW_EFFICIENCY as d,tileSize as h}from"./definitions.js";import a from"./DisplayEntity.js";import{DisplayList as l}from"./FeatureDisplayList.js";import{ReshufflePlan as c}from"./ReshufflePlan.js";import{LabelMetric as f}from"./collisions/LabelMetric.js";import{MappedMesh as _}from"./cpuMapped/MappedMesh.js";import{debugMeshDataInfo as u}from"./mesh/meshDebugUtils.js";import m from"./util/Reader.js";import{deserializeList as y}from"./util/serializationUtils.js";const p=()=>e.getLogger("esri.views.2d.engine.webgl.FeatureTile");let g=0;class b extends i{constructor(e,i,r,o,n,d,h=!1){super(e,i,r,o),this._fader=n,this._labelInstanceId=d,this._meshes=new Map,this._entities=[],this._entityIndex=new Map,this._invalidated=!1,this._nextUploadAllowed=!1,this.tileAge=g++,this._metrics=[],this._metricsVisibility=new Set,this._entityIds=new Set,this._entityIdsFromBuffer=new Set,this._attributeEpoch=0,this._encounteredEnd=!1,this._decluttered=!1,this._objectIdMap=null,this.isCoverage=!1,this.rendering=!1,this.visible=!0,this.transforms.labelMat2d=t(),this.transforms.tileUnitsToPixels=s(),this.enableDeferredUploads=h}destroy(){super.destroy(),this.clear()}clear(){for(const e of this._meshes.values())e.destroy();this._meshes.clear(),this._entities=[],this._fader?.removeFeatureTileMetrics(this,this._metrics),this._metrics=[],this._displayList=null,this._invalidated=!0,this._entityIds.clear(),this._nextUploadAllowed=!0}beforeRender(e){super.beforeRender(e),this._needsReshuffle&&e.reshuffleManager.schedule(this)}tryReady(e){const t=this._invalidated&&!this._uploadAllowed;return!(this.isReady||t||!this._encounteredEnd||!(e>=this._attributeEpoch))&&(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.ready [epoch=${e}]`),this.ready(),this.requestRender(),this.decluttered=!1,!0)}get symbols(){const e=new Map;for(const t of this._metrics)e.get(t.labelClassId)||e.set(t.labelClassId,[]),e.get(t.labelClassId).push(t);return e}get decluttered(){return this._decluttered}set decluttered(e){this._decluttered=e,this.requestRender()}get id(){return this.key.id}get hasData(){return!!this._meshes.size}get hasAnimations(){return!!this._objectIdMap}get needsUpload(){return this._invalidated}get usedMemory(){let e=0;for(const t of this._meshes.values())e+=t.usedMemory;if(this._entities.length){let t=0;const s=Math.min(this._entities.length,10);for(let e=0;e<s;e++)t+=this._entities[0].records.length;const i=t/s;e+=a.estimateMemory(i)*this._entities.length,e+=4*this._entities.length}return e+=25*this._entityIndex.size,e+=18*this._entityIds.size,e+=25*this._entityIdsFromBuffer.size,this._displayList&&(e+=this._displayList.usedMemory),this._objectIdMap&&(e+=25*this._entities.length),e}get _uploadAllowed(){return!this.enableDeferredUploads||this._nextUploadAllowed}get _hasMetrics(){return this._metrics.length>0}upload(){this._nextUploadAllowed=!0}getDisplayList(e,t){if(this._uploadAllowed&&this._invalidated){this._entities.sort((e,t)=>{const s=t.sortKey,i=e.sortKey;return i===s?e.id-t.id:i-s}),0===t&&this.reshuffle(!0),this._displayList=l.fromDisplayEntities(this._entities,this,e,t);for(const e of this._meshes.values())e.upload();this.debugInfo.display.length=this._displayList.length,this.debugInfo.display.minOrderedLength=this._displayList.minOrderedLength,this.debugInfo.display.minUnorderedLength=this._displayList.minUnorderedLength,this.requestRender(),this._invalidated=!1,this._nextUploadAllowed=!1}return this._displayList}getMesh(e){if(!this._meshes.has(e))throw new Error(`InternalError: Unable to find VAO for instance: ${e}`);return this._meshes.get(e)}getSortKeys(e){const t=new Map;for(const{id:s,sortKey:i}of this._entities)if(e.has(s)&&t.set(s,i),t.size===e.size)break;return t}onMessage(e){if(e.objectIdMap)for(const t in e.objectIdMap)this._objectIdMap||(this._objectIdMap={}),this._objectIdMap[t]=e.objectIdMap[t];switch(e.type){case"append":this._onAppendMessage(e);break;case"update":this._onUpdateMessage(e)}if(this._aggregateMemoryStats(),this.requestRender(),e.end){if(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.end [epoch=${e.attributeEpoch}]`),!e.attributeEpoch)throw new Error("InternalError: Attribute epoch not defined.");this._attributeEpoch=e.attributeEpoch,this._encounteredEnd=!0}this._writeLabelVisibilityToMesh()}_onAppendMessage(e){if(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.append`,{append:u(e?.append)}),e.clear&&this.clear(),!e.append)return;const t=y(new m(e.append.entities),a);this._insert(t,e.append.data,!1)}_onUpdateMessage(e){has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.update`,{isPixelBuffer:e.isPixelBuffer,modify:u(e.modify),remove:e.remove});const t=y(new m(e.modify.entities),a),s=t.map(e=>e.id),i=e.isPixelBuffer??!1,r=[...e.remove,...s];i?this._removeByIdsFromBuffer(r):this._removeByIds(r),this._insert(t,e.modify.data,i)}reshuffle(e=!1){if(this.destroyed)return;const t=new Map;for(const s of this._entities)for(const i of s.records){const s=this._meshes.get(i.instanceId);let r=t.get(s);r||(r=new c(e),t.set(s,r)),r.copyRecord(i)}for(const[s,i]of t)s.reshuffle(i);this._invalidated=!0,this._aggregateMemoryStats(),has("esri-2d-update-debug")&&p().info(`Tile ${this.key.id} was reshuffled.`)}copyPixelBufferedEntitesFrom(e,t,s,i){const r=s*h,o=i*h;for(const n of e._entities){let s=null;for(const i of n.records)if(i.overlaps&t){const t=e.getMesh(i.instanceId),d=this._ensureMesh(i.instanceId,t.layout,t.useVisibility).copyRecordFrom(t,i,r,o);s||(s=new a(n.id,n.sortKey),this._entityIdsFromBuffer.add(n.id),this._entityIndex.set(s.id,s),this._entities.push(s)),s.records.push(d)}}this._invalidated=!0}get metricsVisibility(){return this._metricsVisibility}copyMetricsVisibility(e){for(const t of e)this._metricsVisibility.add(t);this._writeLabelVisibilityToMesh()}updateLabelVisibility(){this._metricsVisibility.clear();for(const e of this._metrics){e.uniqueSymbol.show&&e.selectedForRendering&&this._metricsVisibility.add(e.hash)}this._writeLabelVisibilityToMesh()}_writeLabelVisibilityToMesh(){const e=this._meshes.get(this._labelInstanceId);if(e&&this._hasMetrics){for(const t of this._metrics){const s=this._entityIndex.get(t.id);if(!s)continue;const i=this._metricsVisibility.has(t.hash);e.setEntityRecordRangeVisibility(s.records,t.recordStart,t.recordCount,i?0:255)}this._invalidated=!0}}_ensureMesh(e,t,s){return this._meshes.has(e)||this._meshes.set(e,new _(this._stage.bufferPool,t,s)),this._meshes.get(e)}_insert(e,t,s){if(!e.length)return;this._removeDuplicatedBufferedEntites(e);const i=this._insertVertexData(t);for(const r of e){for(const e of r.records)e.updateBaseOffsets(i.get(e.instanceId));s?this._tryInsertBufferedEntity(r):this._insertEntity(r)}this._invalidated=!0}_insertMetrics(e){for(const t of e)t.tile=this;this._metrics.push(...e),this._fader?.insertFeatureTileMetrics(this,e)}_insertVertexData(e){const t=new Map;for(const s of e){const{instanceId:e,layout:i}=s,r=i.attributes.some(e=>"visibility"===e.name),o=this._ensureMesh(e,i,r).append(s);if(s.metrics){const e=y(new m(s.metrics),f)??[];this._insertMetrics(e)}t.set(e,o)}return t}_insertEntity(e){has("esri-2d-update-debug")&&this._entityIds.has(e.id)&&console.error(`Tile ${this.key.id} insertEntity: Already have entityId ${e.id}`),this._entityIds.add(e.id),this._entityIndex.set(e.id,e),this._entities.push(e)}_tryInsertBufferedEntity(e){this._entityIds.has(e.id)?this._removeRecordsFromMesh(e.records):(this._entityIdsFromBuffer.add(e.id),this._entityIndex.set(e.id,e),this._entities.push(e))}_removeDuplicatedBufferedEntites(e){if(!this._entityIdsFromBuffer.size)return;const t=[];for(const s of e)this._entityIdsFromBuffer.has(s.id)&&t.push(s.id);this._removeByIds(t)}_removeByIdsFromBuffer(e){this._removeByIds(e.filter(e=>this._entityIdsFromBuffer.has(e)))}_removeByIds(e){if(0===e.length)return;const t=new Set(e),s=[];for(const r of this._entities)t.has(r.id)?(this._remove(r),this._entityIndex.delete(r.id)):s.push(r);this._entities=s;const i=this._metrics.filter(e=>t.has(e.displayId));this._metrics=this._metrics.filter(e=>!t.has(e.displayId)),this._fader?.removeFeatureTileMetrics(this,i),this._invalidated=!0}_remove(e){this._removeRecordsFromMesh(e.records),this._entityIds.delete(e.id),this._entityIdsFromBuffer.delete(e.id)}_removeRecordsFromMesh(e){for(const t of e){const{instanceId:e,indexStart:s,indexCount:i,vertexStart:r,vertexCount:o}=t;this._meshes.get(e)?.remove(s,i,r,o)}}_aggregateMemoryStats(){this.debugInfo.memory.bytesUsed=0,this.debugInfo.memory.bytesReserved=0;for(const e of this._meshes.values())this.debugInfo.memory.bytesUsed+=e.memoryStats.bytesUsed,this.debugInfo.memory.bytesReserved+=e.memoryStats.bytesReserved}get _needsReshuffle(){if(this.destroyed)return!1;const{bytesUsed:e,bytesReserved:t}=this.debugInfo.memory,s=e/t,{minOrderedLength:i,length:h}=this.debugInfo.display;return t>r&&s<o||h>n&&i/h<d}get entityIds(){return this._objectIdMap?this._entities.map(({id:e})=>({objectId:this._objectIdMap[e],displayId:e})):[]}}export{b as FeatureTile};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{assertIsSome as t}from"../../../../core/maybe.js";import{FreeList as e}from"./cpuMapped/FreeList.js";const r=has("esri-2d-log-allocations");class s{static create(t,e){const r=e.acquireUint32Array(t);return new s(r,e)}constructor(t,e){this._array=t,this._pool=e}get array(){return this._array}get length(){return this._array.length}getUint32View(t,e){return new Uint32Array(this._array.buffer,t+this._array.byteOffset,e)}expand(t){if(t<=this._array.byteLength)return;const e=this._pool.acquireUint32Array(t);e.set(this._array),this._pool.releaseUint32Array(this._array),this._array=e}destroy(){this._pool.releaseUint32Array(this._array)}}class a{constructor(){this._data=new ArrayBuffer(a.BYTE_LENGTH),this._freeList=new e({start:0,end:this._data.byteLength})}static get BYTE_LENGTH(){return 16e6}get buffer(){return this._data}acquireUint32Array(t){const e=this._freeList.firstFit(t);return null==e?null:new Uint32Array(this._data,e,t/Uint32Array.BYTES_PER_ELEMENT)}releaseUint32Array(t){this._freeList.free(t.byteOffset,t.byteLength)}}class i{constructor(){this._pages=[],this._pagesByBuffer=new Map,this._bytesAllocated=0}destroy(){this._pages=[],this._pagesByBuffer=null}get _bytesTotal(){return this._pages.length*a.BYTE_LENGTH}acquireUint32Array(e){if(this._bytesAllocated+=e,r&&console.log(`Allocating ${e}, (${this._bytesAllocated} / ${this._bytesTotal})`),e>=a.BYTE_LENGTH)return new Uint32Array(e/Uint32Array.BYTES_PER_ELEMENT);for(const t of this._pages){const r=t.acquireUint32Array(e);if(null!=r)return r}const s=this._addPage().acquireUint32Array(e);return t(s,"Expected to allocate page"),s}releaseUint32Array(t){this._bytesAllocated-=t.byteLength,r&&console.log(`Freeing ${t.byteLength}, (${this._bytesAllocated} / ${this._bytesTotal})`);const e=this._pagesByBuffer.get(t.buffer);e&&e.releaseUint32Array(t)}_addPage(){const t=new a;return this._pages.push(t),this._pagesByBuffer.set(t.buffer,t),t}}export{i as ArrayBufferPool,s as PooledUint32Array};
5
+ import has from"../../../../core/has.js";import{FreeList as t}from"./cpuMapped/FreeList.js";const e=has("esri-2d-log-allocations");class r{static create(t,e){const s=e.acquireUint32Array(t);return new r(s,e)}constructor(t,e){this._array=t,this._pool=e}get array(){return this._array}get length(){return this._array.length}getUint32View(t,e){return new Uint32Array(this._array.buffer,t+this._array.byteOffset,e)}expand(t){if(t<=this._array.byteLength)return;const e=this._pool.acquireUint32Array(t);e.set(this._array),this._pool.releaseUint32Array(this._array),this._array=e}destroy(){this._pool.releaseUint32Array(this._array)}}class s{constructor(){this._data=new ArrayBuffer(s.BYTE_LENGTH),this._freeList=new t({start:0,end:this._data.byteLength})}static get BYTE_LENGTH(){return 16e6}get buffer(){return this._data}acquireUint32Array(t){const e=this._freeList.firstFit(t);return null==e?null:new Uint32Array(this._data,e,t/Uint32Array.BYTES_PER_ELEMENT)}releaseUint32Array(t){this._freeList.free(t.byteOffset,t.byteLength)}}class a{constructor(){this._pages=[],this._pagesByBuffer=new Map,this._bytesAllocated=0}destroy(){this._pages=[],this._pagesByBuffer=null}get _bytesTotal(){return this._pages.length*s.BYTE_LENGTH}acquireUint32Array(t){return this._bytesAllocated+=t,e&&console.log(`Allocating ${t}, (${this._bytesAllocated} / ${this._bytesTotal})`),new Uint32Array(t/Uint32Array.BYTES_PER_ELEMENT)}releaseUint32Array(t){this._bytesAllocated-=t.byteLength,e&&console.log(`Freeing ${t.byteLength}, (${this._bytesAllocated} / ${this._bytesTotal})`)}_addPage(){const t=new s;return this._pages.push(t),this._pagesByBuffer.set(t.buffer,t),t}}export{a as ArrayBufferPool,r as PooledUint32Array};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../../core/has.js";import{assertIsSome as t}from"../../../../../core/maybe.js";import{toUint32 as i,toFloat32 as e}from"../number.js";import{PooledUint32Array as r}from"../PooledUint32Array.js";import{FreeList as s}from"./FreeList.js";import{BufferObject as n}from"../../../../webgl/BufferObject.js";import{VertexBuffer as h}from"../../../../webgl/VertexBuffer.js";const a=1.25,d=32767,u=d<<16|d;class f{constructor(t,i,e,s){this.bufferType=t,this.size=i,this.strideInt=e,this._pool=s,this._cpu=r.create(i*e*Uint32Array.BYTES_PER_ELEMENT,this._pool),this.dirty={start:1/0,end:0},this.memoryStats={bytesUsed:0,bytesReserved:i*e*Uint32Array.BYTES_PER_ELEMENT},this.clear()}get elementSize(){return this._cpu.length/this.strideInt}get intSize(){return this.fillPointer*this.strideInt}get byteSize(){return this.intSize*Uint32Array.BYTES_PER_ELEMENT}get invalidated(){return this.bufferSize>0&&!this._gpu}get invalidatedComputeBuffer(){return this.bufferSize>0&&!this._gpuComputeTriangles}invalidate(){this._invalidateTriangleBuffer(),this._gpu?.dispose(),this._gpu=null}_invalidateTriangleBuffer(){this._gpuComputeTriangles?.dispose(),this._gpuComputeTriangles=null}destroy(){this._gpu?.dispose(),this._gpuComputeTriangles?.dispose(),this._cpu?.destroy()}clear(){this.dirty.start=1/0,this.dirty.end=0,this.freeList=new s({start:0,end:this._cpu.length/this.strideInt}),this.fillPointer=0}ensure(t){if(this.maxAvailableSpace()>=t)return;if(t*this.strideInt>this._cpu.length-this.fillPointer){this.invalidate();const i=this._cpu.length/this.strideInt,e=Math.round((i+t)*a),r=e*this.strideInt;this._cpu.expand(r*Uint32Array.BYTES_PER_ELEMENT),this.freeList.free(i,e-i),this.memoryStats.bytesReserved+=(e-i)*this.strideInt*Uint32Array.BYTES_PER_ELEMENT}}setU32(t,i){this._cpu.array[t]!==i&&(this._cpu.array[t]=i,this.dirty.start=Math.min(t,this.dirty.start),this.dirty.end=Math.max(t+1,this.dirty.end))}setF32(t,e){this.setU32(t,i(e))}setF32Range(t,e,r){const s=i(r);this._cpu.array.fill(s,t,e),this.dirty.start=Math.min(t,this.dirty.start),this.dirty.end=Math.max(e,this.dirty.end)}getF32(t){return e(this._cpu.array[t])}getVertexBuffer(t,i){return"vertex"===this.bufferType?this._getGPUBuffer(t,i):null}getIndexBuffer(t,i){return"index"===this.bufferType?this._getGPUBuffer(t,null,i):null}_getGPUBuffer(t,i,e=!1){if(this.bufferSize){if(e){if("index"!==this.bufferType)throw new Error("Tried to get triangle buffer, but target is not an index buffer");return null==this._gpuComputeTriangles&&(this._gpuComputeTriangles=this._createComputeBuffer(t)),this._gpuComputeTriangles}return this._gpu??="index"===this.bufferType?n.createIndex(t,35048,this._cpu.array):i&&new h(t,i,this._cpu.array,35048),this._gpu}}getView(t,i){return this._cpu.getUint32View(t,i/Uint32Array.BYTES_PER_ELEMENT)}get bufferSize(){return this._cpu.length/this.strideInt}maxAvailableSpace(){return this.freeList.maxAvailableSpace()}insert(i,e,r,s){const n=r*this.strideInt;if(!n)return 0;const h=e*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,a=new Uint32Array(i,h,n),d=this.freeList.firstFit(r);t(d,"First fit region must be defined");const u=d*this.strideInt,f=n;if(this._cpu.array.set(a,u),0!==s)for(let t=0;t<a.length;t++)this._cpu.array[t+u]+=s;return this.dirty.start=Math.min(this.dirty.start,u),this.dirty.end=Math.max(this.dirty.end,u+f),this.fillPointer=Math.max(this.fillPointer,u+f),this.memoryStats.bytesUsed+=r*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,d}copyFrom(i,e,r,s,n){const h=r*this.strideInt;if(!h)return 0;const a=e*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,d=i._cpu.getUint32View(a,h),u=this.freeList.firstFit(r);t(u,"First fit region must be defined");const f=u*this.strideInt,o=h;if(this._cpu.array.set(d,f),0!==s)for(let t=0;t<h;t++)this._cpu.array[f+t*this.strideInt+n]+=s;return this.dirty.start=Math.min(this.dirty.start,f),this.dirty.end=Math.max(this.dirty.end,f+o),this.fillPointer=Math.max(this.fillPointer,f+o),this.memoryStats.bytesUsed+=r*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,u}free(t,i,e){const r=t*this.strideInt,s=(t+i)*this.strideInt;if(!0===e)for(let n=t;n!==t+i;n++)this._cpu.array[n*this.strideInt]=u;this.dirty.start=Math.min(this.dirty.start,r),this.dirty.end=Math.max(this.dirty.end,s),this.freeList.free(t,i),this.memoryStats.bytesUsed-=i*this.strideInt*Uint32Array.BYTES_PER_ELEMENT}upload(){if(this.dirty.end){if(this._invalidateTriangleBuffer(),null==this._gpu)return this.dirty.start=1/0,void(this.dirty.end=0);this._gpu.setSubData(this._cpu.array,this.dirty.start,this.dirty.start,this.dirty.end),this.dirty.start=1/0,this.dirty.end=0}}reshuffle(t,i){if(0===i.length)return;const e=this.byteSize,s=t*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,n=e>s,h=this._cpu,a=r.create(s,this._pool);n||a.array.set(this._cpu.getUint32View(0,this.intSize));for(const r of i)if(n||r.srcFrom!==r.dstFrom||0!==r.mutate){this.dirty.start=Math.min(this.dirty.start,r.dstFrom*this.strideInt),this.dirty.end=Math.max(this.dirty.end,(r.dstFrom+r.count)*this.strideInt);for(let t=0;t<r.count;t++){const i=(r.dstFrom+t)*this.strideInt,e=(r.srcFrom+t)*this.strideInt;for(let t=0;t<this.strideInt;t++)a.array[i+t]=h.array[e+t]+r.mutate}}this._cpu.destroy(),this._cpu=a,n&&this.invalidate(),this.freeList.clear(),this.memoryStats.bytesUsed=this.memoryStats.bytesReserved=s}_createComputeBuffer(t){const i=35048,e=new Uint32Array(this.fillPointer/3);for(let r=0;r<this.fillPointer;r+=3)e[r/3]=this._cpu.array[r];return n.createIndex(t,i,e)}}export{f as MappedBuffer};
5
+ import"../../../../../core/has.js";import{assertIsSome as t}from"../../../../../core/maybe.js";import{asArrayBuffer as i}from"../../../../../core/typedArrayUtil.js";import{toUint32 as r,toFloat32 as e}from"../number.js";import{PooledUint32Array as s}from"../PooledUint32Array.js";import{FreeList as n}from"./FreeList.js";import{BufferObject as h}from"../../../../webgl/BufferObject.js";import{VertexBuffer as a}from"../../../../webgl/VertexBuffer.js";const d=1.25,u=32767,f=u<<16|u;class o{constructor(t,i,r,e){this.bufferType=t,this.size=i,this.strideInt=r,this._pool=e,this._cpu=s.create(i*r*Uint32Array.BYTES_PER_ELEMENT,this._pool),this.dirty={start:1/0,end:0},this.memoryStats={bytesUsed:0,bytesReserved:i*r*Uint32Array.BYTES_PER_ELEMENT},this.clear()}get elementSize(){return this._cpu.length/this.strideInt}get intSize(){return this.fillPointer*this.strideInt}get byteSize(){return this.intSize*Uint32Array.BYTES_PER_ELEMENT}get invalidated(){return this.bufferSize>0&&!this._gpu}get invalidatedComputeBuffer(){return this.bufferSize>0&&!this._gpuComputeTriangles}get usedMemory(){return this._cpu.array.byteLength}invalidate(){this._invalidateTriangleBuffer(),this._gpu?.dispose(),this._gpu=null}_invalidateTriangleBuffer(){this._gpuComputeTriangles?.dispose(),this._gpuComputeTriangles=null}destroy(){this._gpu?.dispose(),this._gpuComputeTriangles?.dispose(),this._cpu?.destroy()}clear(){this.dirty.start=1/0,this.dirty.end=0,this.freeList=new n({start:0,end:this._cpu.length/this.strideInt}),this.fillPointer=0}ensure(t){if(this.maxAvailableSpace()>=t)return;if(t*this.strideInt>this._cpu.length-this.fillPointer){this.invalidate();const i=this._cpu.length/this.strideInt,r=Math.round((i+t)*d),e=r*this.strideInt;this._cpu.expand(e*Uint32Array.BYTES_PER_ELEMENT),this.freeList.free(i,r-i),this.memoryStats.bytesReserved+=(r-i)*this.strideInt*Uint32Array.BYTES_PER_ELEMENT}}setU32(t,i){this._cpu.array[t]!==i&&(this._cpu.array[t]=i,this.dirty.start=Math.min(t,this.dirty.start),this.dirty.end=Math.max(t+1,this.dirty.end))}setF32(t,i){this.setU32(t,r(i))}setF32Range(t,i,e){const s=r(e);this._cpu.array.fill(s,t,i),this.dirty.start=Math.min(t,this.dirty.start),this.dirty.end=Math.max(i,this.dirty.end)}getF32(t){return e(this._cpu.array[t])}getVertexBuffer(t,i){return"vertex"===this.bufferType?this._getGPUBuffer(t,i):null}getIndexBuffer(t,i){return"index"===this.bufferType?this._getGPUBuffer(t,null,i):null}_getGPUBuffer(t,i,r=!1){if(this.bufferSize){if(r){if("index"!==this.bufferType)throw new Error("Tried to get triangle buffer, but target is not an index buffer");return null==this._gpuComputeTriangles&&(this._gpuComputeTriangles=this._createComputeBuffer(t)),this._gpuComputeTriangles}return this._gpu??="index"===this.bufferType?h.createIndex(t,35048,this._cpu.array):i&&new a(t,i,this._cpu.array,35048),this._gpu}}getView(t,i){return this._cpu.getUint32View(t,i/Uint32Array.BYTES_PER_ELEMENT)}get bufferSize(){return this._cpu.length/this.strideInt}maxAvailableSpace(){return this.freeList.maxAvailableSpace()}insert(r,e,s,n){const h=s*this.strideInt;if(!h)return 0;const a=e*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,d=new Uint32Array(i(r),a,h),u=this.freeList.firstFit(s);t(u,"First fit region must be defined");const f=u*this.strideInt,o=h;if(this._cpu.array.set(d,f),0!==n)for(let t=0;t<d.length;t++)this._cpu.array[t+f]+=n;return this.dirty.start=Math.min(this.dirty.start,f),this.dirty.end=Math.max(this.dirty.end,f+o),this.fillPointer=Math.max(this.fillPointer,f+o),this.memoryStats.bytesUsed+=s*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,u}copyFrom(i,r,e,s,n){const h=e*this.strideInt;if(!h)return 0;const a=r*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,d=i._cpu.getUint32View(a,h),u=this.freeList.firstFit(e);t(u,"First fit region must be defined");const f=u*this.strideInt,o=h;if(this._cpu.array.set(d,f),0!==s)for(let t=0;t<h;t++)this._cpu.array[f+t*this.strideInt+n]+=s;return this.dirty.start=Math.min(this.dirty.start,f),this.dirty.end=Math.max(this.dirty.end,f+o),this.fillPointer=Math.max(this.fillPointer,f+o),this.memoryStats.bytesUsed+=e*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,u}free(t,i,r){const e=t*this.strideInt,s=(t+i)*this.strideInt;if(!0===r)for(let n=t;n!==t+i;n++)this._cpu.array[n*this.strideInt]=f;this.dirty.start=Math.min(this.dirty.start,e),this.dirty.end=Math.max(this.dirty.end,s),this.freeList.free(t,i),this.memoryStats.bytesUsed-=i*this.strideInt*Uint32Array.BYTES_PER_ELEMENT}upload(){if(this.dirty.end){if(this._invalidateTriangleBuffer(),null==this._gpu)return this.dirty.start=1/0,void(this.dirty.end=0);this._gpu.setSubData(this._cpu.array,this.dirty.start,this.dirty.start,this.dirty.end),this.dirty.start=1/0,this.dirty.end=0}}reshuffle(t,i){if(0===i.length)return;const r=this.byteSize,e=t*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,n=r>e,h=this._cpu,a=s.create(e,this._pool);n||a.array.set(this._cpu.getUint32View(0,this.intSize));for(const s of i)if(n||s.srcFrom!==s.dstFrom||0!==s.mutate){this.dirty.start=Math.min(this.dirty.start,s.dstFrom*this.strideInt),this.dirty.end=Math.max(this.dirty.end,(s.dstFrom+s.count)*this.strideInt);for(let t=0;t<s.count;t++){const i=(s.dstFrom+t)*this.strideInt,r=(s.srcFrom+t)*this.strideInt;for(let t=0;t<this.strideInt;t++)a.array[i+t]=h.array[r+t]+s.mutate}}this._cpu.destroy(),this._cpu=a,n&&this.invalidate(),this.freeList.clear(),this.memoryStats.bytesUsed=this.memoryStats.bytesReserved=e}_createComputeBuffer(t){const i=35048,r=new Uint32Array(this.fillPointer/3);for(let e=0;e<this.fillPointer;e+=3)r[e/3]=this._cpu.array[e];return h.createIndex(t,i,r)}}export{o as MappedBuffer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{unique as e}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{destroyMaybe as t}from"../../../../../core/maybe.js";import{i1616to32 as i}from"../number.js";import{MappedBuffer as r}from"./Buffer.js";import{unpackDataView as s}from"../shaderGraph/techniques/mesh/dataViewUtils.js";import{vertexLayoutHash as f}from"../shaderGraph/techniques/mesh/utils.js";import{PrimitiveType as o,DataType as n}from"../../../../webgl/enums.js";import{VertexArrayObject as u}from"../../../../webgl/VertexArrayObject.js";const a=1e3,h=4,l=[{name:"visibility",offset:0,type:n.FLOAT,count:1}],d={hash:f(l),attributes:l,stride:h};function _(t,i){return e(t.attributes,(e,t)=>e.name===t.name).filter(e=>i.locations.has(e.name)).map(e=>({name:e.name,type:e.type,count:e.count,divisor:0,normalized:e.normalized??!1,offset:e.offset,stride:t.stride})).sort((e,t)=>i.locations.get(e.name)-i.locations.get(t.name))}function m(t,i){const r=[],s=e(t.attributes,(e,t)=>e.name===t.name).filter(e=>i.locations.has(e.name));for(const e of s){r.push({name:e.name,type:e.type,count:e.count,divisor:0,normalized:e.normalized??!1,offset:e.offset,stride:t.stride});const s=i.computeAttributeMap[e.name];null!=s&&2===s.length&&(r.push({name:s[0],count:e.count,divisor:0,type:e.type,normalized:e.normalized??!1,offset:e.offset+t.stride,stride:t.stride}),r.push({name:s[1],count:e.count,divisor:0,type:e.type,normalized:e.normalized??!1,offset:e.offset+2*t.stride,stride:t.stride}))}return r.sort((e,t)=>i.locations.get(e.name)-i.locations.get(t.name))}class c{constructor(e,t,i){if(this._bufferPool=e,this._layout=t,this.useVisibility=i,this._invalidatedGeometry=!1,this._invalidatedCompute=!1,this._position=this._layout.attributes.find(e=>"pos"===e.name||"position"===e.name),!this._position)throw new Error("InternalError: Unable to find position attribute")}destroy(){this._indexBuffer=t(this._indexBuffer),this._vertexBuffer=t(this._vertexBuffer),this._visibilityBuffer=t(this._visibilityBuffer),this._computeVAO?.disposeVAOOnly(),this._geometryVAO?.disposeVAOOnly()}get layout(){return this._layout}getDrawArgs(e,t,i,r){return r?{primitive:o.POINTS,count:t/3,offset:i/3}:{primitive:e,count:t,offset:i}}getAttributePrecisionPackFactors(){const e={};for(const t of this.layout.attributes)t.packPrecisionFactor&&(e[t.name]=t.packPrecisionFactor);return e}getDebugVertexInfo(e=!1,t){if(!this._vertexBuffer)return null;const i=this._layout,r=i.stride,f=this._vertexBuffer.getView(0,this._vertexBuffer.byteSize),o=[];if(e)if(null==t)console.log("must provide location info to see compute attributes");else for(const s of i.attributes){const e=t.computeAttributeMap[s.name];null!=e&&2===e.length&&(o.push({...s,name:e[0],offset:s.offset+r}),o.push({...s,name:e[1],offset:s.offset+2*r}))}const n=new DataView(f.slice().buffer);let u=f.byteLength/r;e&&(u=this._indexBuffer.fillPointer/3);const a=this._indexBuffer.getView(0,this._indexBuffer.byteSize);let h=0;const l=[];for(let d=0;d<u;d++){if(e){h=a[3*d]*r}const t={};for(const e of[...i.attributes,...o]){let i=`${e.offset} ${e.name}`,r=s(n,e,h);if(e.packPrecisionFactor)if(i+=` (precision: ${e.packPrecisionFactor})`,"number"==typeof r)r/=e.packPrecisionFactor;else for(let t=0;t<r.length;t++)r[t]/=e.packPrecisionFactor;t[i]=r}h+=r,l.push(t)}return{vertices:l,layout:i}}_ensure(e,t){if(this._vertexBuffer&&this._indexBuffer)this._indexBuffer.ensure(Math.max(e,a)),this._vertexBuffer.ensure(Math.max(t,a)),this._visibilityBuffer&&this._visibilityBuffer.ensure(Math.max(t,a));else{const i=this._layout.stride/Uint32Array.BYTES_PER_ELEMENT;this._indexBuffer=new r("index",Math.max(e,a),1,this._bufferPool),this._vertexBuffer=new r("vertex",Math.max(t,a),i,this._bufferPool),this.useVisibility&&(this._visibilityBuffer=new r("vertex",Math.max(t,a),h/Uint32Array.BYTES_PER_ELEMENT,this._bufferPool))}}append(e){const t=e.layout.stride,i=e.indices.byteLength/Uint32Array.BYTES_PER_ELEMENT,r=e.vertices.byteLength/t;this._ensure(i,r);const{vertices:s,indices:f}=e,o=this._vertexBuffer.insert(s,0,s.byteLength/t,0),n=new Uint32Array(r);new Float32Array(n.buffer).fill(255),this._visibilityBuffer&&this._visibilityBuffer.insert(n,0,n.byteLength/h,0);return{vertexFrom:o,indexFrom:this._indexBuffer.insert(f,0,f.byteLength/4,o)}}setEntityRecordRangeVisibility(e,t,i,r){if(!(t+i>e.length))for(let s=t;s<t+i;s++){const{vertexStart:t,vertexCount:i}=e[s];this._visibilityBuffer.setF32Range(t,t+i,r)}}getEntityRecordVisibility(e,t){const i=e.records[t];return this._visibilityBuffer.getF32(i.vertexStart)}copyRecordFrom(e,t,r,s){const{indexStart:f,indexCount:o,vertexStart:n,vertexCount:u}=t;this._ensure(o,u);const a=e._position,h=r*(a.packPrecisionFactor??1),l=s*(a.packPrecisionFactor??1),d=a.offset,_=i(h,l),m=this._vertexBuffer.copyFrom(e._vertexBuffer,n,u,_,d);this._visibilityBuffer&&e._visibilityBuffer&&this._visibilityBuffer.copyFrom(e._visibilityBuffer,n,u,0,0);const c=this._indexBuffer.copyFrom(e._indexBuffer,f,o,m-n,0),y=t.clone();return y.vertexStart=m,y.indexStart=c,y.overlaps=0,y}remove(e,t,i,r){this._indexBuffer.free(e,t),this._vertexBuffer.free(i,r),this._visibilityBuffer&&this._visibilityBuffer.free(i,r)}upload(){this._invalidatedGeometry=!0,this._invalidatedCompute=!0}getGeometryVAO(e,t){if(!this._vertexBuffer||!this._indexBuffer||!this._vertexBuffer.bufferSize)return null;if(this._invalidatedGeometry){if((this._vertexBuffer.invalidated||this._indexBuffer.invalidated||this._visibilityBuffer?.invalidated)&&(this._vertexBuffer.invalidate(),this._indexBuffer.invalidate(),this._visibilityBuffer&&this._visibilityBuffer.invalidate(),this._geometryVAO?.disposeVAOOnly(),this._geometryVAO=null),this._vertexBuffer.upload(),this._indexBuffer.upload(),this._visibilityBuffer&&this._visibilityBuffer.upload(),!this._geometryVAO){const i=this._indexBuffer.getIndexBuffer(e,!1),r=new Map([["geometry",this._vertexBuffer.getVertexBuffer(e,_(this.layout,t))]]);this._visibilityBuffer&&r.set("visibility",this._visibilityBuffer.getVertexBuffer(e,_(d,t))),this._geometryVAO=new u(e,r,i)}this._invalidatedGeometry=!1}return this._geometryVAO}getComputeVAO(e,t){if(!this._vertexBuffer||!this._indexBuffer||!this._vertexBuffer.bufferSize)return null;if(this._invalidatedCompute&&((this._vertexBuffer.invalidated||this._indexBuffer.invalidatedComputeBuffer)&&(this._vertexBuffer.invalidate(),this._indexBuffer.invalidate(),this._visibilityBuffer?.invalidate(),this._computeVAO?.disposeVAOOnly(),this._computeVAO=null),this._vertexBuffer.upload(),this._indexBuffer.upload(),this._visibilityBuffer?.upload(),!this._computeVAO)){const i=this._indexBuffer.getIndexBuffer(e,!0),r=new Map([["geometry",this._vertexBuffer.getVertexBuffer(e,m(this.layout,t))]]);this._visibilityBuffer&&r.set("visibility",this._visibilityBuffer.getVertexBuffer(e,_(d,t))),this._computeVAO=new u(e,r,i),this._invalidatedCompute=!1}return this._computeVAO}get memoryStats(){return{bytesUsed:this._vertexBuffer.memoryStats.bytesUsed+this._indexBuffer.memoryStats.bytesUsed,bytesReserved:this._vertexBuffer.memoryStats.bytesReserved+this._indexBuffer.memoryStats.bytesReserved,vertex:this._vertexBuffer.memoryStats,index:this._indexBuffer.memoryStats}}reshuffle(e){this._vertexBuffer&&this._vertexBuffer.reshuffle(e.vertex.count,e.vertex.operations),this._indexBuffer&&this._indexBuffer.reshuffle(e.index.count,e.index.operations),this._visibilityBuffer&&this._visibilityBuffer.reshuffle(e.vertex.count,e.vertex.operations)}}export{c as MappedMesh};
5
+ import{unique as e}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{destroyMaybe as t}from"../../../../../core/maybe.js";import{i1616to32 as i}from"../number.js";import{MappedBuffer as r}from"./Buffer.js";import{unpackDataView as s}from"../shaderGraph/techniques/mesh/dataViewUtils.js";import{vertexLayoutHash as f}from"../shaderGraph/techniques/mesh/utils.js";import{PrimitiveType as o,DataType as n}from"../../../../webgl/enums.js";import{VertexArrayObject as u}from"../../../../webgl/VertexArrayObject.js";const a=1e3,h=4,l=[{name:"visibility",offset:0,type:n.FLOAT,count:1}],d={hash:f(l),attributes:l,stride:h};function _(t,i){return e(t.attributes,(e,t)=>e.name===t.name).filter(e=>i.locations.has(e.name)).map(e=>({name:e.name,type:e.type,count:e.count,divisor:0,normalized:e.normalized??!1,offset:e.offset,stride:t.stride})).sort((e,t)=>i.locations.get(e.name)-i.locations.get(t.name))}function m(t,i){const r=[],s=e(t.attributes,(e,t)=>e.name===t.name).filter(e=>i.locations.has(e.name));for(const e of s){r.push({name:e.name,type:e.type,count:e.count,divisor:0,normalized:e.normalized??!1,offset:e.offset,stride:t.stride});const s=i.computeAttributeMap[e.name];null!=s&&2===s.length&&(r.push({name:s[0],count:e.count,divisor:0,type:e.type,normalized:e.normalized??!1,offset:e.offset+t.stride,stride:t.stride}),r.push({name:s[1],count:e.count,divisor:0,type:e.type,normalized:e.normalized??!1,offset:e.offset+2*t.stride,stride:t.stride}))}return r.sort((e,t)=>i.locations.get(e.name)-i.locations.get(t.name))}class y{constructor(e,t,i){if(this._bufferPool=e,this._layout=t,this.useVisibility=i,this._invalidatedGeometry=!1,this._invalidatedCompute=!1,this._position=this._layout.attributes.find(e=>"pos"===e.name||"position"===e.name),!this._position)throw new Error("InternalError: Unable to find position attribute")}destroy(){this._indexBuffer=t(this._indexBuffer),this._vertexBuffer=t(this._vertexBuffer),this._visibilityBuffer=t(this._visibilityBuffer),this._computeVAO?.disposeVAOOnly(),this._geometryVAO?.disposeVAOOnly()}get layout(){return this._layout}get usedMemory(){let e=0;return e+=this._indexBuffer.usedMemory,e+=this._vertexBuffer.usedMemory,null!=this._visibilityBuffer&&(e+=this._visibilityBuffer.usedMemory),e}getDrawArgs(e,t,i,r){return r?{primitive:o.POINTS,count:t/3,offset:i/3}:{primitive:e,count:t,offset:i}}getAttributePrecisionPackFactors(){const e={};for(const t of this.layout.attributes)t.packPrecisionFactor&&(e[t.name]=t.packPrecisionFactor);return e}getDebugVertexInfo(e=!1,t){if(!this._vertexBuffer)return null;const i=this._layout,r=i.stride,f=this._vertexBuffer.getView(0,this._vertexBuffer.byteSize),o=[];if(e)if(null==t)console.log("must provide location info to see compute attributes");else for(const s of i.attributes){const e=t.computeAttributeMap[s.name];null!=e&&2===e.length&&(o.push({...s,name:e[0],offset:s.offset+r}),o.push({...s,name:e[1],offset:s.offset+2*r}))}const n=new DataView(f.slice().buffer);let u=f.byteLength/r;e&&(u=this._indexBuffer.fillPointer/3);const a=this._indexBuffer.getView(0,this._indexBuffer.byteSize);let h=0;const l=[];for(let d=0;d<u;d++){if(e){h=a[3*d]*r}const t={};for(const e of[...i.attributes,...o]){let i=`${e.offset} ${e.name}`,r=s(n,e,h);if(e.packPrecisionFactor)if(i+=` (precision: ${e.packPrecisionFactor})`,"number"==typeof r)r/=e.packPrecisionFactor;else for(let t=0;t<r.length;t++)r[t]/=e.packPrecisionFactor;t[i]=r}h+=r,l.push(t)}return{vertices:l,layout:i}}_ensure(e,t){if(this._vertexBuffer&&this._indexBuffer)this._indexBuffer.ensure(Math.max(e,a)),this._vertexBuffer.ensure(Math.max(t,a)),this._visibilityBuffer&&this._visibilityBuffer.ensure(Math.max(t,a));else{const i=this._layout.stride/Uint32Array.BYTES_PER_ELEMENT;this._indexBuffer=new r("index",Math.max(e,a),1,this._bufferPool),this._vertexBuffer=new r("vertex",Math.max(t,a),i,this._bufferPool),this.useVisibility&&(this._visibilityBuffer=new r("vertex",Math.max(t,a),h/Uint32Array.BYTES_PER_ELEMENT,this._bufferPool))}}append(e){const t=e.layout.stride,i=e.indices.byteLength/Uint32Array.BYTES_PER_ELEMENT,r=e.vertices.byteLength/t;this._ensure(i,r);const{vertices:s,indices:f}=e,o=this._vertexBuffer.insert(s,0,s.byteLength/t,0),n=new Uint32Array(r);new Float32Array(n.buffer).fill(255),this._visibilityBuffer&&this._visibilityBuffer.insert(n,0,n.byteLength/h,0);return{vertexFrom:o,indexFrom:this._indexBuffer.insert(f,0,f.byteLength/4,o)}}setEntityRecordRangeVisibility(e,t,i,r){if(null!=this._visibilityBuffer&&!(t+i>e.length))for(let s=t;s<t+i;s++){const{vertexStart:t,vertexCount:i}=e[s];this._visibilityBuffer.setF32Range(t,t+i,r)}}getEntityRecordVisibility(e,t){if(null==this._visibilityBuffer)return 0;const i=e.records[t];return this._visibilityBuffer.getF32(i.vertexStart)}copyRecordFrom(e,t,r,s){const{indexStart:f,indexCount:o,vertexStart:n,vertexCount:u}=t;this._ensure(o,u);const a=e._position,h=r*(a.packPrecisionFactor??1),l=s*(a.packPrecisionFactor??1),d=a.offset,_=i(h,l),m=this._vertexBuffer.copyFrom(e._vertexBuffer,n,u,_,d);this._visibilityBuffer&&e._visibilityBuffer&&this._visibilityBuffer.copyFrom(e._visibilityBuffer,n,u,0,0);const y=this._indexBuffer.copyFrom(e._indexBuffer,f,o,m-n,0),v=t.clone();return v.vertexStart=m,v.indexStart=y,v.overlaps=0,v}remove(e,t,i,r){this._indexBuffer.free(e,t),this._vertexBuffer.free(i,r),this._visibilityBuffer&&this._visibilityBuffer.free(i,r)}upload(){this._invalidatedGeometry=!0,this._invalidatedCompute=!0}getGeometryVAO(e,t){if(!this._vertexBuffer||!this._indexBuffer||!this._vertexBuffer.bufferSize)return null;if(this._invalidatedGeometry){if((this._vertexBuffer.invalidated||this._indexBuffer.invalidated||this._visibilityBuffer?.invalidated)&&(this._vertexBuffer.invalidate(),this._indexBuffer.invalidate(),this._visibilityBuffer&&this._visibilityBuffer.invalidate(),this._geometryVAO?.disposeVAOOnly(),this._geometryVAO=null),this._vertexBuffer.upload(),this._indexBuffer.upload(),this._visibilityBuffer&&this._visibilityBuffer.upload(),!this._geometryVAO){const i=this._indexBuffer.getIndexBuffer(e,!1),r=new Map([["geometry",this._vertexBuffer.getVertexBuffer(e,_(this.layout,t))]]);this._visibilityBuffer&&r.set("visibility",this._visibilityBuffer.getVertexBuffer(e,_(d,t))),this._geometryVAO=new u(e,r,i)}this._invalidatedGeometry=!1}return this._geometryVAO}getComputeVAO(e,t){if(!this._vertexBuffer||!this._indexBuffer||!this._vertexBuffer.bufferSize)return null;if(this._invalidatedCompute&&((this._vertexBuffer.invalidated||this._indexBuffer.invalidatedComputeBuffer)&&(this._vertexBuffer.invalidate(),this._indexBuffer.invalidate(),this._visibilityBuffer?.invalidate(),this._computeVAO?.disposeVAOOnly(),this._computeVAO=null),this._vertexBuffer.upload(),this._indexBuffer.upload(),this._visibilityBuffer?.upload(),!this._computeVAO)){const i=this._indexBuffer.getIndexBuffer(e,!0),r=new Map([["geometry",this._vertexBuffer.getVertexBuffer(e,m(this.layout,t))]]);this._visibilityBuffer&&r.set("visibility",this._visibilityBuffer.getVertexBuffer(e,_(d,t))),this._computeVAO=new u(e,r,i),this._invalidatedCompute=!1}return this._computeVAO}get memoryStats(){return{bytesUsed:this._vertexBuffer.memoryStats.bytesUsed+this._indexBuffer.memoryStats.bytesUsed,bytesReserved:this._vertexBuffer.memoryStats.bytesReserved+this._indexBuffer.memoryStats.bytesReserved,vertex:this._vertexBuffer.memoryStats,index:this._indexBuffer.memoryStats}}reshuffle(e){this._vertexBuffer&&this._vertexBuffer.reshuffle(e.vertex.count,e.vertex.operations),this._indexBuffer&&this._indexBuffer.reshuffle(e.index.count,e.index.operations),this._visibilityBuffer&&this._visibilityBuffer.reshuffle(e.vertex.count,e.vertex.operations)}}export{y as MappedMesh};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{numericHash as i}from"../../../../../../../core/string.js";import{fromRotation as r,translate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as n,set as a,sub as l,normalize as c,add as h,scale as m}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as d}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{GeometryCursor as f}from"../../../../../../../geometry/GeometryCursor.js";import{generalizeOptimizedGeometry as _,convertToGeometry as g}from"../../../../../../../layers/graphics/featureConversionUtils.js";import p from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as b,minMaxZoomPrecisionFactor as x}from"../../../definitions.js";import v from"../../../collisions/BoundingBox.js";import{LabelMetric as M}from"../../../collisions/LabelMetric.js";import{smoothPaths as P,pathDivide as y}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as w,processColorInput as L}from"../fill/meshWriterUtils.js";import{TextMeshWriter as I,maxLabelZoom as B}from"../text/TextMeshWriter.js";const S=1,z=0,D=128;function j(e,t){return i(`${e}${t}`)}function A(e,t,r){return i(`${e}${t}${r}`)}function G(e,t,r,s){return i(`${e}${t}${r*2**(B-s)}`)}function Z(e,t,r,s,o){return i(`${e}${o}${t}${r*2**(B-s)}`)}const k=e(e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t});class F extends I{constructor(){super(...arguments),this._zoomLevel=0}_write(e,t,i,r){if(this._zoomLevel=r||0,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),r=t.readYForDisplay();this._writePoint(e,i,r,0,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":{const i=t.readCentroidForDisplay();if(!i)return;const[r,s]=i.coords;this._writePoint(e,r,s,0,t);break}case"esriGeometryMultipoint":{let i=0;const r=f.fromFeatureSetReader(t);if(r?.nextPath())for(;r.nextPoint();)this._writePoint(e,r.x,r.y,i++,t);break}case"esriGeometryPolyline":this._writeLines(e,t)}}_getMetricDir(){const{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return["center"===e?0:"right"===e?-1:1,"middle"===t?0:"bottom"===t?-1:1]}_createLineLabelMetric(e,t,i,r,s,o){const[n,a]=this._getMetricDir(),l=this.evaluatedMeshParams.scaleInfo?.maxScale??0,c=this.evaluatedMeshParams.scaleInfo?.minScale??0,h=this.evaluatedMeshParams.labelClassId;return new M(e,h,t,i,r,s,n,a,l,c,o)}_writePoint(e,t,i,r,s){if(t<0||t>b||i<0||i>b)return;const o=this._getShaping();if(!o)return;const n=s.getDisplayId(),a=this.evaluatedMeshParams.labelClassId,l=j(s.getObjectId(),r),c=A(s.getObjectId(),a,r),[h,m]=this._getMetricDir(),u=this.evaluatedMeshParams.scaleInfo?.maxScale??0,d=this.evaluatedMeshParams.scaleInfo?.minScale??0,f=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};e.metricStart(new M(n,a,l,c,t,i,h,m,u,d,f)),this._writeGlyphs(e,n,t,i,o,0,f,void 0,!1),e.metricBoxWrite(o.boundsT),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t){const{scaleInfo:i,verticalAlignment:r}=this.evaluatedMeshParams,s=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,r)=>this._placeSubdivGlyphs(e,t,i,r),a=(o.bounds.width+s)/(1<<S);this._current={out:e,id:t.getDisplayId(),objId:t.getObjectId(),shaping:o,zoomRange:w(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null,pathIndex:0},this._verticalPlacement="bottom"===r?"above":"top"===r?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=s.bounds.halfHeight,n=e.readGeometryForDisplay();if(!n)return;const a=new p;_(a,n,!1,!1,"esriGeometryPolyline",1);const l=C(new p,a,o),c=C(new p,a,-o),h=g(c,"esriGeometryPolyline",!1,!1),m=g(l,"esriGeometryPolyline",!1,!1),u=P(m.paths,s.bounds.width),d=P(h.paths,s.bounds.width);this._current.offsetDirection="above";for(let f=0;f<u.length;f++)this._current.pathIndex=f,y(u[f],i,t,!!r);this._current.offsetDirection="below";for(let f=0;f<d.length;f++)this._current.pathIndex=f,y(d[f],i,t,!!r)}_writeCenterAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=P(e.readLegacyGeometryForDisplay().paths,s.bounds.width);for(let n=0;n<o.length;n++)this._current.pathIndex=n,y(o[n],i,t,!!r)}_placeSubdivGlyphs(e,t,i,r){const{allowOverrun:s,labelPosition:o,repeatLabelDistance:n}=this.evaluatedMeshParams,a=this._current.zoomRange[0],l=k(t),c=this._current.shaping.bounds.width/(1<<S),h=Math.sqrt(n||D)/(1<<S),m=Math.min(i,r-i),u=this._current.shaping.isMultiline?B:Math.log2(m/(h+c/2)),d=0===t?u:Math.min(l,u),f=Math.max(a,this._zoomLevel+S-d),_=this._zoomLevel-f,g=this._current.shaping.bounds.width/2*2**_,p=G(this._current.objId,this._current.pathIndex,t,this._zoomLevel),b=Z(this._current.objId,this._current.pathIndex,t,this._zoomLevel,this.evaluatedMeshParams.labelClassId);this._current.shaping.isMultiline?0===t&&this._placeStraight(e,f,p,b):s&&_<0?this._placeStraightAlong(e,a,p,b):"parallel"===o?this._placeStraightAlong(e,f,p,b):"curved"===o&&this._placeCurved(e,f,g,p,b)}_placeStraight(e,t,i,r){const{out:s,id:o,shaping:n,referenceBounds:a}=this._current,{x:l,y:c}=e;s.metricStart(this._createLineLabelMetric(o,i,r,l,c)),s.metricBoxWrite(n.boundsT);const h=e.angle*(180/Math.PI)%360,m=(e.angle*(180/Math.PI)+180)%360;if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const e={clipAngle:h,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const e={clipAngle:m,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}s.metricEnd()}_placeCurved(e,t,i,r,s){const{out:o,id:n}=this._current;o.metricStart(this._createLineLabelMetric(n,r,s,e.x,e.y));const a=e.clone(),l=e.angle*(180/Math.PI)%360,c=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(a,t,1,l),this._placeBack(e,a,t,i,1,l),this._placeForward(e,a,t,i,1,l)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(a,t,0,c),this._placeBack(e,a,t,i,0,c),this._placeForward(e,a,t,i,0,c)),o.metricEnd()}_placeStraightAlong(e,i,n,a){const{out:l,id:c,shaping:h,zoomRange:m,referenceBounds:d}=this._current,{boxBorderLineColor:f,boxBackgroundColor:_}=this.evaluatedMeshParams,g=e.clone(),p=e.angle*(180/Math.PI)%360,b=(e.angle*(180/Math.PI)+180)%360,x=h.glyphs.length>0&&!(!f&&!_);if(l.metricStart(this._createLineLabelMetric(c,n,a,e.x,e.y)),x){const n=Math.max(i,m[0],0),a=Math.min(B,m[1]),f=r(o(),-e.angle),_={minZoom:n,maxZoom:a,clipAngle:p,mapAligned:!0,isLineLabel:!0},g=t(this.evaluatedMeshParams.offsetX),x=t(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=u(g,-1*x),[i,r]=h.shapeBackground(s(o(),f,t));l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,d,_),l.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=u(g,x),[i,r]=h.shapeBackground(s(o(),f,t));_.clipAngle=b,l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,d,_),l.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(g,i,1,p,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(g,i,0,b,!0),l.metricEnd()}_placeBack(e,t,i,r,s,o){const n=e.clone();let a=e.backwardLength+z;for(;n.prev()&&!(a>=r);)this._placeOnSegment(n,t,a,i,-1,s,o),a+=n.length+z}_placeForward(e,t,i,r,s,o){const n=e.clone();let a=e.remainingLength+z;for(;n.next()&&!(a>=r);)this._placeOnSegment(n,t,a,i,1,s,o),a+=n.length+z}_placeFirst(e,i,s,a,l=!1){const{out:c,id:h,shaping:m,zoomRange:d,referenceBounds:f}=this._current,_=m.glyphs,g=t(this.evaluatedMeshParams.offsetX),p=t(this.evaluatedMeshParams.offsetY),b=u(g,p),x=r(o(),-e.angle);n(b,b,x);for(const t of _){const r=t.x>m.bounds.x?s:1-s,o=r*e.remainingLength+(1-r)*e.backwardLength,n=Math.abs(t.x+t.width/2-m.bounds.x),u=Math.max(0,this._zoomLevel+Math.log2(n/(o+z))),_=Math.max(i,l?0:u);if(t.maxZoom=Math.min(d[1],B),t.angle=e.angle+(1-s)*Math.PI,t.minZoom=Math.max(d[0],_),this._writeLineGlyph(c,h,e.x,e.y,t,a,f,!0),(s||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom)){const e=new v(t.bounds.x+b[0],t.bounds.y+b[1],t.bounds.width,t.bounds.height);c.metricBoxWrite(e)}}}_placeOnSegment(e,i,s,a,l,c,h){const{out:m,id:d,shaping:f,referenceBounds:_}=this._current,g=f.glyphs,p=e.dx/e.length,b=e.dy/e.length,x={x:e.x+s*-l*p,y:e.y+s*-l*b},M=t(this.evaluatedMeshParams.offsetX),P=t(this.evaluatedMeshParams.offsetY),y=u(M,P),w=r(o(),-e.angle);n(y,y,w);for(const t of g){const i=t.x>f.bounds.x?c:1-c;if(!(i&&1===l||!i&&-1===l))continue;const r=Math.abs(t.x+t.width/2-f.bounds.x),o=Math.max(0,this._zoomLevel+Math.log2(r/s)-.1),n=Math.max(a,this._zoomLevel+Math.log2(r/(s+e.length+z)));if(0!==o&&(t.angle=e.angle+(1-c)*Math.PI,t.minZoom=n,t.maxZoom=o,this._writeLineGlyph(m,d,x.x,x.y,t,h,_,!0),(c||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom))){const e=new v(t.bounds.x+y[0],t.bounds.y+y[1],t.bounds.width,t.bounds.height);m.metricBoxWrite(e)}}}_writeLineGlyph(e,t,i,r,s,o,n,a){if(i<0||i>b||r<0||r>b)return;e.recordStart(this.instanceId,this.attributeLayout,s.textureBinding);const{texcoords:l,offsets:c}=s,{fontSize:h,haloSize:m,outlineSize:u}=this._textMeshTransformProps;this._writeQuad(e,t,i,r,{texcoords:l,offsets:c,fontSize:h,haloSize:m,outlineSize:u,color:L(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:n,minZoom:Math.max(this._current.zoomRange[0],s.minZoom),maxZoom:Math.min(this._current.zoomRange[1],s.maxZoom),clipAngle:o,mapAligned:a,isLineLabel:!0}),e.recordEnd()}_packedZoom(e){return Math.floor(e*x)/x}_isVisible(e,t){let i=Math.max(this._current.zoomRange[0],e),r=Math.min(this._current.zoomRange[1],t);i=this._packedZoom(i),r=this._packedZoom(r);const s=this._packedZoom(this._zoomLevel);return i<=s&&s<=r}}function C(e,t,i){const{coords:r,lengths:s}=t,o=d(),n=d(),u=d(),f=d(),_=d(),g=d(),p=2;let b=0;for(let d=0;d<s.length;d++){const t=s[d];for(let s=0;s<t;s++){const d=p*(s+b-1),x=p*(s+b),v=p*(s+b+1);s>0?a(o,r[d],r[d+1]):a(o,0,0),a(n,r[x],r[x+1]),s<t-1?a(u,r[v],r[v+1]):a(u,0,0),0===s?a(f,0,0):(l(f,n,o),c(f,f),a(f,f[1],-f[0])),s===t-1?a(_,0,0):(l(_,u,n),c(_,_),a(_,_[1],-_[0])),h(g,f,_),c(g,g);const M=g[0]*_[0]+g[1]*_[1];0!==M&&m(g,g,M),m(g,g,i),e.coords.push(n[0]+g[0],n[1]+g[1])}e.lengths.push(t),b+=t}return e}export{F as LabelMeshWriter,j as labelIdHash,A as labelMetricHash,G as lineLabelIdHash,Z as lineLabelMetricHash};
5
+ import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{numericHash as i}from"../../../../../../../core/string.js";import{fromRotation as r,translate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as n,set as a,sub as l,normalize as c,add as h,scale as m}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as d}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as u}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{GeometryCursor as f}from"../../../../../../../geometry/GeometryCursor.js";import{generalizeOptimizedGeometry as g,convertToGeometry as _}from"../../../../../../../layers/graphics/featureConversionUtils.js";import p from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as b,minMaxZoomPrecisionFactor as x}from"../../../definitions.js";import v from"../../../collisions/BoundingBox.js";import{LabelMetric as M}from"../../../collisions/LabelMetric.js";import{smoothPaths as P,pathDivide as y}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as w,processColorInput as L}from"../fill/meshWriterUtils.js";import{TextMeshWriter as I,maxLabelZoom as B}from"../text/TextMeshWriter.js";const S=1,z=0,D=128;function A(e,t,r){return i(`${e}${t}${r}`)}function j(e,t,r,s,o){return i(`${e}${t}${r}${s*2**(B-o)}`)}function G(e,t,r){return i(`${e}${t}${r}`)}function Z(e,t,r,s,o){return i(`${e}${o}${t}${r*2**(B-s)}`)}const k=e(e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t});class F extends I{constructor(){super(...arguments),this._zoomLevel=0}_write(e,t,i,r){if(this._zoomLevel=r||0,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),r=t.readYForDisplay();this._writePoint(e,i,r,0,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":{const i=t.readCentroidForDisplay();if(!i)return;const[r,s]=i.coords;this._writePoint(e,r,s,0,t);break}case"esriGeometryMultipoint":{let i=0;const r=f.fromFeatureSetReader(t);if(r?.nextPath())for(;r.nextPoint();)this._writePoint(e,r.x,r.y,i++,t);break}case"esriGeometryPolyline":this._writeLines(e,t)}}_getMetricDir(){const{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return["center"===e?0:"right"===e?-1:1,"middle"===t?0:"bottom"===t?-1:1]}_createLineLabelMetric(e,t,i,r,s,o){const[n,a]=this._getMetricDir(),l=this.evaluatedMeshParams.scaleInfo?.maxScale??0,c=this.evaluatedMeshParams.scaleInfo?.minScale??0,h=this.evaluatedMeshParams.labelClassId;return new M(e,h,t,i,r,s,n,a,l,c,o)}_writePoint(e,t,i,r,s){if(t<0||t>b||i<0||i>b)return;const o=this._getShaping();if(!o)return;const n=s.getDisplayId(),a=this.evaluatedMeshParams.labelClassId,l=A(this.evaluatedMeshParams.layerId,s.getObjectId(),r),c=G(s.getObjectId(),a,r),[h,m]=this._getMetricDir(),d=this.evaluatedMeshParams.scaleInfo?.maxScale??0,u=this.evaluatedMeshParams.scaleInfo?.minScale??0,f=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};e.metricStart(new M(n,a,l,c,t,i,h,m,d,u,f)),this._writeGlyphs(e,n,t,i,o,0,f,void 0,!1),e.metricBoxWrite(o.boundsT),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t){const{scaleInfo:i,verticalAlignment:r}=this.evaluatedMeshParams,s=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,r)=>this._placeSubdivGlyphs(e,t,i,r),a=(o.bounds.width+s)/(1<<S);this._current={out:e,id:t.getDisplayId(),objId:t.getObjectId(),shaping:o,zoomRange:w(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null,pathIndex:0},this._verticalPlacement="bottom"===r?"above":"top"===r?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=s.bounds.halfHeight,n=e.readGeometryForDisplay();if(!n)return;const a=new p;g(a,n,!1,!1,"esriGeometryPolyline",1);const l=$(new p,a,o),c=$(new p,a,-o),h=_(c,"esriGeometryPolyline",!1,!1),m=_(l,"esriGeometryPolyline",!1,!1),d=P(m.paths,s.bounds.width),u=P(h.paths,s.bounds.width);this._current.offsetDirection="above";for(let f=0;f<d.length;f++)this._current.pathIndex=f,y(d[f],i,t,!!r);this._current.offsetDirection="below";for(let f=0;f<u.length;f++)this._current.pathIndex=f,y(u[f],i,t,!!r)}_writeCenterAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=P(e.readLegacyGeometryForDisplay().paths,s.bounds.width);for(let n=0;n<o.length;n++)this._current.pathIndex=n,y(o[n],i,t,!!r)}_placeSubdivGlyphs(e,t,i,r){const{allowOverrun:s,labelPosition:o,repeatLabelDistance:n,layerId:a,labelClassId:l}=this.evaluatedMeshParams,{objId:c,shaping:h,pathIndex:m}=this._current,d=this._current.zoomRange[0],u=k(t),f=this._current.shaping.bounds.width/(1<<S),g=Math.sqrt(n||D)/(1<<S),_=Math.min(i,r-i),p=h.isMultiline?B:Math.log2(_/(g+f/2)),b=0===t?p:Math.min(u,p),x=Math.max(d,this._zoomLevel+S-b),v=this._zoomLevel-x,M=h.bounds.width/2*2**v,P=j(a,c,m,t,this._zoomLevel),y=Z(c,m,t,this._zoomLevel,l);this._current.shaping.isMultiline?0===t&&this._placeStraight(e,x,P,y):s&&v<0?this._placeStraightAlong(e,d,P,y):"parallel"===o?this._placeStraightAlong(e,x,P,y):"curved"===o&&this._placeCurved(e,x,M,P,y)}_placeStraight(e,t,i,r){const{out:s,id:o,shaping:n,referenceBounds:a}=this._current,{x:l,y:c}=e;s.metricStart(this._createLineLabelMetric(o,i,r,l,c)),s.metricBoxWrite(n.boundsT);const h=e.angle*(180/Math.PI)%360,m=(e.angle*(180/Math.PI)+180)%360;if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const e={clipAngle:h,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const e={clipAngle:m,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}s.metricEnd()}_placeCurved(e,t,i,r,s){const{out:o,id:n}=this._current;o.metricStart(this._createLineLabelMetric(n,r,s,e.x,e.y));const a=e.clone(),l=e.angle*(180/Math.PI)%360,c=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(a,t,1,l),this._placeBack(e,a,t,i,1,l),this._placeForward(e,a,t,i,1,l)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(a,t,0,c),this._placeBack(e,a,t,i,0,c),this._placeForward(e,a,t,i,0,c)),o.metricEnd()}_placeStraightAlong(e,i,n,a){const{out:l,id:c,shaping:h,zoomRange:m,referenceBounds:u}=this._current,{boxBorderLineColor:f,boxBackgroundColor:g}=this.evaluatedMeshParams,_=e.clone(),p=e.angle*(180/Math.PI)%360,b=(e.angle*(180/Math.PI)+180)%360,x=h.glyphs.length>0&&!(!f&&!g);if(l.metricStart(this._createLineLabelMetric(c,n,a,e.x,e.y)),x){const n=Math.max(i,m[0],0),a=Math.min(B,m[1]),f=r(o(),-e.angle),g={minZoom:n,maxZoom:a,clipAngle:p,mapAligned:!0,isLineLabel:!0},_=t(this.evaluatedMeshParams.offsetX),x=t(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=d(_,-1*x),[i,r]=h.shapeBackground(s(o(),f,t));l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,u,g),l.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=d(_,x),[i,r]=h.shapeBackground(s(o(),f,t));g.clipAngle=b,l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,u,g),l.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(_,i,1,p,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(_,i,0,b,!0),l.metricEnd()}_placeBack(e,t,i,r,s,o){const n=e.clone();let a=e.backwardLength+z;for(;n.prev()&&!(a>=r);)this._placeOnSegment(n,t,a,i,-1,s,o),a+=n.length+z}_placeForward(e,t,i,r,s,o){const n=e.clone();let a=e.remainingLength+z;for(;n.next()&&!(a>=r);)this._placeOnSegment(n,t,a,i,1,s,o),a+=n.length+z}_placeFirst(e,i,s,a,l=!1){const{out:c,id:h,shaping:m,zoomRange:u,referenceBounds:f}=this._current,g=m.glyphs,_=t(this.evaluatedMeshParams.offsetX),p=t(this.evaluatedMeshParams.offsetY),b=d(_,p),x=r(o(),-e.angle);n(b,b,x);for(const t of g){const r=t.x>m.bounds.x?s:1-s,o=r*e.remainingLength+(1-r)*e.backwardLength,n=Math.abs(t.x+t.width/2-m.bounds.x),d=Math.max(0,this._zoomLevel+Math.log2(n/(o+z))),g=Math.max(i,l?0:d);if(t.maxZoom=Math.min(u[1],B),t.angle=e.angle+(1-s)*Math.PI,t.minZoom=Math.max(u[0],g),this._writeLineGlyph(c,h,e.x,e.y,t,a,f,!0),(s||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom)){const e=new v(t.bounds.x+b[0],t.bounds.y+b[1],t.bounds.width,t.bounds.height);c.metricBoxWrite(e)}}}_placeOnSegment(e,i,s,a,l,c,h){const{out:m,id:u,shaping:f,referenceBounds:g}=this._current,_=f.glyphs,p=e.dx/e.length,b=e.dy/e.length,x={x:e.x+s*-l*p,y:e.y+s*-l*b},M=t(this.evaluatedMeshParams.offsetX),P=t(this.evaluatedMeshParams.offsetY),y=d(M,P),w=r(o(),-e.angle);n(y,y,w);for(const t of _){const i=t.x>f.bounds.x?c:1-c;if(!(i&&1===l||!i&&-1===l))continue;const r=Math.abs(t.x+t.width/2-f.bounds.x),o=Math.max(0,this._zoomLevel+Math.log2(r/s)-.1),n=Math.max(a,this._zoomLevel+Math.log2(r/(s+e.length+z)));if(0!==o&&(t.angle=e.angle+(1-c)*Math.PI,t.minZoom=n,t.maxZoom=o,this._writeLineGlyph(m,u,x.x,x.y,t,h,g,!0),(c||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom))){const e=new v(t.bounds.x+y[0],t.bounds.y+y[1],t.bounds.width,t.bounds.height);m.metricBoxWrite(e)}}}_writeLineGlyph(e,t,i,r,s,o,n,a){if(i<0||i>b||r<0||r>b)return;e.recordStart(this.instanceId,this.attributeLayout,s.textureBinding);const{texcoords:l,offsets:c}=s,{fontSize:h,haloSize:m,outlineSize:d}=this._textMeshTransformProps;this._writeQuad(e,t,i,r,{texcoords:l,offsets:c,fontSize:h,haloSize:m,outlineSize:d,color:L(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:n,minZoom:Math.max(this._current.zoomRange[0],s.minZoom),maxZoom:Math.min(this._current.zoomRange[1],s.maxZoom),clipAngle:o,mapAligned:a,isLineLabel:!0}),e.recordEnd()}_packedZoom(e){return Math.floor(e*x)/x}_isVisible(e,t){let i=Math.max(this._current.zoomRange[0],e),r=Math.min(this._current.zoomRange[1],t);i=this._packedZoom(i),r=this._packedZoom(r);const s=this._packedZoom(this._zoomLevel);return i<=s&&s<=r}}function $(e,t,i){const{coords:r,lengths:s}=t,o=u(),n=u(),d=u(),f=u(),g=u(),_=u(),p=2;let b=0;for(let u=0;u<s.length;u++){const t=s[u];for(let s=0;s<t;s++){const u=p*(s+b-1),x=p*(s+b),v=p*(s+b+1);s>0?a(o,r[u],r[u+1]):a(o,0,0),a(n,r[x],r[x+1]),s<t-1?a(d,r[v],r[v+1]):a(d,0,0),0===s?a(f,0,0):(l(f,n,o),c(f,f),a(f,f[1],-f[0])),s===t-1?a(g,0,0):(l(g,d,n),c(g,g),a(g,g[1],-g[0])),h(_,f,g),c(_,_);const M=_[0]*g[0]+_[1]*g[1];0!==M&&m(_,_,M),m(_,_,i),e.coords.push(n[0]+_[0],n[1]+_[1])}e.lengths.push(t),b+=t}return e}export{F as LabelMeshWriter,A as labelIdHash,G as labelMetricHash,j as lineLabelIdHash,Z as lineLabelMetricHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import{getContrast as i}from"../../../../core/colorUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as r}from"../../../../core/unitUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{subtract as h,normalize as c}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l,UNIT_X as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{g as d,l as _,n as m,f as u,m as y,d as g}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import v from"../../../../geometry/Point.js";import G from"../../../../geometry/Polygon.js";import{project as w,initializeProjection as R}from"../../../../geometry/projectionUtils.js";import{a as b,c as C}from"../../../../chunks/boundedPlane.js";import{equals as j}from"../../../../geometry/support/spatialReferenceUtils.js";import k from"../../../../layers/GraphicsLayer.js";import T from"../../../../symbols/SimpleFillSymbol.js";import S from"../../../../symbols/SimpleMarkerSymbol.js";import{DragManipulation as A}from"./manipulations/DragManipulation.js";import{RotateManipulation as P}from"./manipulations/RotateManipulation.js";import{ScaleManipulation as M}from"./manipulations/ScaleManipulation.js";import{PreserveAspectRatio as x,SnapRotation as O}from"./manipulations/utils.js";import{InteractiveToolBase as D}from"../../../interactive/InteractiveToolBase.js";import{KeyBindings as U,mediaKeys as L}from"../../../interactive/keybindings.js";import{EditGeometry as B}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as E}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{calculateOrientedBounds as H}from"../../../interactive/editGeometry/support/editPlaneUtils.js";import{findFirstGraphicHit as I}from"../../../support/hitTestSelectUtils.js";import{createScreenPointFromEvent as z}from"../../../support/screenUtils.js";const V=80,q=10,F=30,N=[[1,1],[1,-1],[-1,-1],[-1,1],[1,0],[0,-1],[-1,0],[0,1]],J=1,K=10;let Q=class extends D{constructor(e){super(e),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._planeCache=b(),this._displayPlaneCache=b(),this._mainAxisCache=l(),this._rotationHandleCache=f(),this._cornerA=f(),this._cornerB=f(),this._cornerC=f(),this._cornerD=f(),this._avgAB=f(),this._avgBC=f(),this._avgCD=f(),this._avgDA=f(),this._preserveAspectRatio=new x,this._snapRotation=new O,this._graphicsLayer=new k({internal:!0,listMode:"hide",visible:!1,title:"TransformTool layer"}),this._sharedUndoStack=[],this._sharedRedoStack=[],this._isOpacityToggled=!1,this._factor=J,this.preserveAspectRatio=null,this.snapRotation=null,this.type="transform"}initialize(){this._initialize()}destroy(){const{map:e}=this.view;this._dragManipulation.destroy(),this._rotateManipulation.destroy(),this._scaleManipulations.forEach(e=>e.destroy()),this._editGeometryOperations.destroy(),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=s(this._graphicsLayer),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._preserveAspectRatio=null,this._snapRotation=null,this._planeCache=null,this._displayPlaneCache=null,this._rotationHandleCache=null,this._mainAxisCache=null,this._cornerA=null,this._cornerB=null,this._cornerC=null,this._cornerD=null,this._avgAB=null,this._avgBC=null,this._avgCD=null,this._avgDA=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _plane(){const e=this._graphic.geometry;if(null==e)return null;const t=this._editGeometryOperations.data,i=t.parts[0].segments[0],s=h(this._mainAxisCache,i.leftVertex.pos,i.rightVertex.pos);c(s,s);let o=V*this.view.resolution;const a=this.view.spatialReference;return j(a,e.spatialReference)&&(o*=r(a)/r(e.spatialReference)),H(s,t,o,this._planeCache)}get _displayPlane(){const e=this._plane;if(!e)return null;const t=this._displayPlaneCache;C(e,t);const i=q*this.view.resolution;return d(t.basis1,t.basis1,1+i/_(t.basis1)),d(t.basis2,t.basis2,1+i/_(t.basis2)),t}get _backgroundGraphicGeometry(){const e=this._displayPlane;if(!e)return null;const t=this.view.spatialReference;return this._updateDisplayPlaneConrers(e),new G({spatialReference:t,rings:[[this._cornerA,this._cornerB,this._cornerC,this._cornerD,this._cornerA]]})}get _rotateGraphicGeometry(){const e=this._plane;if(!e)return null;const t=this._rotationHandleCache;return m(t,e.basis1),d(t,t,F*this.view.resolution),u(t,t,e.origin),u(t,t,e.basis1),new v({x:t[0],y:t[1],spatialReference:this.view.spatialReference})}get _scaleGraphicGeometries(){const e=this._displayPlane;if(!e)return[];const t=this.view.spatialReference;this._updateDisplayPlaneConrers(e);const{_cornerA:i,_cornerB:s,_cornerC:o,_cornerD:r}=this,a=y(this._avgAB,i,s,.5),n=y(this._avgBC,s,o,.5),h=y(this._avgCD,o,r,.5),c=y(this._avgDA,r,i,.5);return[new v({x:i[0],y:i[1],spatialReference:t}),new v({x:s[0],y:s[1],spatialReference:t}),new v({x:o[0],y:o[1],spatialReference:t}),new v({x:r[0],y:r[1],spatialReference:t}),new v({x:a[0],y:a[1],spatialReference:t}),new v({x:n[0],y:n[1],spatialReference:t}),new v({x:h[0],y:h[1],spatialReference:t}),new v({x:c[0],y:c[1],spatialReference:t})]}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this._editGeometryOperations.undo(),this.updateGraphics()}redo(){this._editGeometryOperations.redo(),this.updateGraphics()}refresh(){const{view:e,target:t}=this,i="georeference"in t?t.georeference.coords:t.geometry,s=this._editGeometryOperations,o=s.data.parts[0].vertices,r=B.fromGeometry(w(i,e.spatialReference),2).parts[0].vertices;o.forEach((e,t)=>{s.setVertexPosition(e,r[t].pos)}),this.updateGraphics()}reset(){const{target:e}=this;if("georeference"in e){const t=e.georeference;"control-points"===t.type&&(t.controlPoints=this._initialControlPoints)}else e.geometry=this._initialGeometry;this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const e=this._editGeometryOperations.data.geometry;if("georeference"in this.target){this.target.georeference.coords=e}this._graphic.geometry=e,this._backgroundGraphic.geometry=this._backgroundGraphicGeometry,this._rotateGraphic.geometry=this._rotateGraphicGeometry,this._scaleGraphicGeometries.forEach((e,t)=>{this._scaleGraphics[t].geometry=e})}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}async _initialize(){const{view:e,target:s}=this;if("georeference"in s){const e=s.georeference;this._graphic=new t({geometry:e.coords}),this._initialControlPoints="control-points"===e.type?e.controlPoints:null}else this._graphic=s,this._initialGeometry=s.geometry;e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._editGeometryOperations=E.fromGeometry(w(this._graphic.geometry,e.spatialReference),2),this._backgroundGraphic=new t({symbol:new T({color:"transparent",outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:2}}),geometry:this._backgroundGraphicGeometry}),this._rotateGraphic=new t({symbol:new S({color:i(e.effectiveTheme.accentColor),outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:1}}),geometry:this._rotateGraphicGeometry}),this._scaleGraphics=this._scaleGraphicGeometries.map(s=>new t({symbol:new S({size:6,style:"square",color:i(e.effectiveTheme.accentColor),outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:1}}),geometry:s})),this._graphicsLayer.graphics.addMany([this._backgroundGraphic,this._rotateGraphic,...this._scaleGraphics]),this._dragManipulation=new A({tool:this,view:e,graphic:this._graphic}),this._rotateManipulation=new P({tool:this,view:e,graphic:this._rotateGraphic,snapRotation:this._snapRotation}),this._scaleManipulations=this._scaleGraphics.map((t,i)=>new M({tool:this,view:e,graphic:t,direction:N[i],preserveAspectRatio:this._preserveAspectRatio})),this.addHandles([this._dragManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),this._rotateManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),...this._scaleManipulations.map(e=>e.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this))),o(()=>this.view.scale,()=>this.active?this.updateGraphics():null),e.on("click",async t=>{if(null!=e.activeTool&&e.activeTool!==this)return;const i=z(t),o=[];e.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const r=await this.view.hitTest(i,{exclude:o}),a=r.results;if(0===a.length)e.activeTool=null;else{const t=I(r.results),i="georeference"in s,o=a.map(e=>"media"===e.type?e.element:null).filter(Boolean),n=new Set([...this._graphicsLayer.graphics,i?null:s].filter(Boolean));i&&o.includes(s)||null!=t&&n.has(t.graphic)?null==e.activeTool&&(e.activeTool=this):e.activeTool=null}})]);const r=e=>{this.addHandles(e.events.on("grab-changed",e=>{"georeference"in s&&("start"===e.action?s.opacity*=.5:"end"===e.action&&(s.opacity*=2))}))};this._dragManipulation.forEachManipulator(r),this._rotateManipulation.forEachManipulator(r),this._scaleManipulations.forEach(e=>e.forEachManipulator(r));const a=new U;a.addToggle(L.preserveAspectRatio,()=>{null==this.preserveAspectRatio&&(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled)}),a.addToggle(L.rotateIncrements,()=>{null==this.snapRotation&&(this._snapRotation.enabled=!this._snapRotation.enabled)}),a.add(L.toggleOpacity,()=>{"georeference"in s&&(s.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled)}),a.addToggle(L.factorModifier,e=>this._factor="key-down"===e.type?K:J),a.add(L.scaleUp,()=>this._scale(this._factor)),a.add(L.scaleDown,()=>this._scale(-this._factor)),a.add(L.moveUp,()=>this._move(0,this._factor)),a.add(L.moveDown,()=>this._move(0,-this._factor)),a.add(L.moveLeft,()=>this._move(-this._factor,0)),a.add(L.moveRight,()=>this._move(this._factor,0)),this.addHandles([e.on("key-down",t=>{e.activeTool===this&&a.dispatch(e.inputManager,t)}),e.on("key-up",t=>{e.activeTool===this&&a.dispatch(e.inputManager,t)})])}async _loadProjectionEngine(){const e=this._graphic.geometry;return R(e.spatialReference,this.view.spatialReference)}_updateDisplayPlaneConrers(e){const{basis1:t,basis2:i,origin:s}=e,o=this._cornerA;u(o,s,t),u(o,o,i);const r=this._cornerB;u(r,s,t),g(r,r,i);const a=this._cornerC;g(a,s,t),g(a,a,i);const n=this._cornerD;g(n,s,t),u(n,n,i)}_getInfo(){return{editGeometryOperations:this._editGeometryOperations,plane:this._plane,displayPlane:this._displayPlane}}_updateGraphics(e,t){"start"===e.action&&(this._sharedUndoStack.push({tool:this,operation:t}),this._sharedRedoStack.length=0),this.updateGraphics()}_scale(e){const t=this._editGeometryOperations,i=t.data.geometry.extent?.width,s=(i+e*this.view.resolution)/i,o=t.scale(this._plane.origin,p,s,s,0,1);this._sharedUndoStack.push({tool:this,operation:o}),this._sharedRedoStack.length=0,this.updateGraphics()}_move(e,t){const i=this._editGeometryOperations.move(e*this.view.resolution,t*this.view.resolution,0,0);this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0,this.updateGraphics()}};e([a()],Q.prototype,"_plane",null),e([a()],Q.prototype,"_backgroundGraphicGeometry",null),e([a()],Q.prototype,"_rotateGraphicGeometry",null),e([a()],Q.prototype,"_scaleGraphicGeometries",null),e([a()],Q.prototype,"preserveAspectRatio",void 0),e([a()],Q.prototype,"snapRotation",void 0),e([a({constructOnly:!0,nonNullable:!0})],Q.prototype,"target",void 0),e([a({readOnly:!0})],Q.prototype,"type",void 0),e([a({constructOnly:!0})],Q.prototype,"view",void 0),Q=e([n("esri.views.2d.interactive.editingTools.TransformTool")],Q);export{Q as TransformTool};
5
+ import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import{getContrast as i}from"../../../../core/colorUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as r}from"../../../../core/unitUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{subtract as h,normalize as c}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l,UNIT_X as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{g as d,l as _,n as m,f as u,m as y,d as g}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import v from"../../../../geometry/Point.js";import G from"../../../../geometry/Polygon.js";import{project as w,initializeProjection as R}from"../../../../geometry/projectionUtils.js";import{c as b,a as C}from"../../../../chunks/boundedPlane.js";import{equals as j}from"../../../../geometry/support/spatialReferenceUtils.js";import k from"../../../../layers/GraphicsLayer.js";import T from"../../../../symbols/SimpleFillSymbol.js";import S from"../../../../symbols/SimpleMarkerSymbol.js";import{DragManipulation as A}from"./manipulations/DragManipulation.js";import{RotateManipulation as P}from"./manipulations/RotateManipulation.js";import{ScaleManipulation as M}from"./manipulations/ScaleManipulation.js";import{PreserveAspectRatio as x,SnapRotation as O}from"./manipulations/utils.js";import{InteractiveToolBase as D}from"../../../interactive/InteractiveToolBase.js";import{KeyBindings as U,mediaKeys as L}from"../../../interactive/keybindings.js";import{EditGeometry as B}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as E}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{calculateOrientedBounds as H}from"../../../interactive/editGeometry/support/editPlaneUtils.js";import{findFirstGraphicHit as I}from"../../../support/hitTestSelectUtils.js";import{createScreenPointFromEvent as z}from"../../../support/screenUtils.js";const V=80,q=10,F=30,N=[[1,1],[1,-1],[-1,-1],[-1,1],[1,0],[0,-1],[-1,0],[0,1]],J=1,K=10;let Q=class extends D{constructor(e){super(e),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._planeCache=b(),this._displayPlaneCache=b(),this._mainAxisCache=l(),this._rotationHandleCache=f(),this._cornerA=f(),this._cornerB=f(),this._cornerC=f(),this._cornerD=f(),this._avgAB=f(),this._avgBC=f(),this._avgCD=f(),this._avgDA=f(),this._preserveAspectRatio=new x,this._snapRotation=new O,this._graphicsLayer=new k({internal:!0,listMode:"hide",visible:!1,title:"TransformTool layer"}),this._sharedUndoStack=[],this._sharedRedoStack=[],this._isOpacityToggled=!1,this._factor=J,this.preserveAspectRatio=null,this.snapRotation=null,this.type="transform"}initialize(){this._initialize()}destroy(){const{map:e}=this.view;this._dragManipulation.destroy(),this._rotateManipulation.destroy(),this._scaleManipulations.forEach(e=>e.destroy()),this._editGeometryOperations.destroy(),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=s(this._graphicsLayer),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._preserveAspectRatio=null,this._snapRotation=null,this._planeCache=null,this._displayPlaneCache=null,this._rotationHandleCache=null,this._mainAxisCache=null,this._cornerA=null,this._cornerB=null,this._cornerC=null,this._cornerD=null,this._avgAB=null,this._avgBC=null,this._avgCD=null,this._avgDA=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _plane(){const e=this._graphic.geometry;if(null==e)return null;const t=this._editGeometryOperations.data,i=t.parts[0].segments[0],s=h(this._mainAxisCache,i.leftVertex.pos,i.rightVertex.pos);c(s,s);let o=V*this.view.resolution;const a=this.view.spatialReference;return j(a,e.spatialReference)&&(o*=r(a)/r(e.spatialReference)),H(s,t,o,this._planeCache)}get _displayPlane(){const e=this._plane;if(!e)return null;const t=this._displayPlaneCache;C(e,t);const i=q*this.view.resolution;return d(t.basis1,t.basis1,1+i/_(t.basis1)),d(t.basis2,t.basis2,1+i/_(t.basis2)),t}get _backgroundGraphicGeometry(){const e=this._displayPlane;if(!e)return null;const t=this.view.spatialReference;return this._updateDisplayPlaneConrers(e),new G({spatialReference:t,rings:[[this._cornerA,this._cornerB,this._cornerC,this._cornerD,this._cornerA]]})}get _rotateGraphicGeometry(){const e=this._plane;if(!e)return null;const t=this._rotationHandleCache;return m(t,e.basis1),d(t,t,F*this.view.resolution),u(t,t,e.origin),u(t,t,e.basis1),new v({x:t[0],y:t[1],spatialReference:this.view.spatialReference})}get _scaleGraphicGeometries(){const e=this._displayPlane;if(!e)return[];const t=this.view.spatialReference;this._updateDisplayPlaneConrers(e);const{_cornerA:i,_cornerB:s,_cornerC:o,_cornerD:r}=this,a=y(this._avgAB,i,s,.5),n=y(this._avgBC,s,o,.5),h=y(this._avgCD,o,r,.5),c=y(this._avgDA,r,i,.5);return[new v({x:i[0],y:i[1],spatialReference:t}),new v({x:s[0],y:s[1],spatialReference:t}),new v({x:o[0],y:o[1],spatialReference:t}),new v({x:r[0],y:r[1],spatialReference:t}),new v({x:a[0],y:a[1],spatialReference:t}),new v({x:n[0],y:n[1],spatialReference:t}),new v({x:h[0],y:h[1],spatialReference:t}),new v({x:c[0],y:c[1],spatialReference:t})]}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this._editGeometryOperations.undo(),this.updateGraphics()}redo(){this._editGeometryOperations.redo(),this.updateGraphics()}refresh(){const{view:e,target:t}=this,i="georeference"in t?t.georeference.coords:t.geometry,s=this._editGeometryOperations,o=s.data.parts[0].vertices,r=B.fromGeometry(w(i,e.spatialReference),2).parts[0].vertices;o.forEach((e,t)=>{s.setVertexPosition(e,r[t].pos)}),this.updateGraphics()}reset(){const{target:e}=this;if("georeference"in e){const t=e.georeference;"control-points"===t.type&&(t.controlPoints=this._initialControlPoints)}else e.geometry=this._initialGeometry;this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const e=this._editGeometryOperations.data.geometry;if("georeference"in this.target){this.target.georeference.coords=e}this._graphic.geometry=e,this._backgroundGraphic.geometry=this._backgroundGraphicGeometry,this._rotateGraphic.geometry=this._rotateGraphicGeometry,this._scaleGraphicGeometries.forEach((e,t)=>{this._scaleGraphics[t].geometry=e})}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}async _initialize(){const{view:e,target:s}=this;if("georeference"in s){const e=s.georeference;this._graphic=new t({geometry:e.coords}),this._initialControlPoints="control-points"===e.type?e.controlPoints:null}else this._graphic=s,this._initialGeometry=s.geometry;e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._editGeometryOperations=E.fromGeometry(w(this._graphic.geometry,e.spatialReference),2),this._backgroundGraphic=new t({symbol:new T({color:"transparent",outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:2}}),geometry:this._backgroundGraphicGeometry}),this._rotateGraphic=new t({symbol:new S({color:i(e.effectiveTheme.accentColor),outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:1}}),geometry:this._rotateGraphicGeometry}),this._scaleGraphics=this._scaleGraphicGeometries.map(s=>new t({symbol:new S({size:6,style:"square",color:i(e.effectiveTheme.accentColor),outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:1}}),geometry:s})),this._graphicsLayer.graphics.addMany([this._backgroundGraphic,this._rotateGraphic,...this._scaleGraphics]),this._dragManipulation=new A({tool:this,view:e,graphic:this._graphic}),this._rotateManipulation=new P({tool:this,view:e,graphic:this._rotateGraphic,snapRotation:this._snapRotation}),this._scaleManipulations=this._scaleGraphics.map((t,i)=>new M({tool:this,view:e,graphic:t,direction:N[i],preserveAspectRatio:this._preserveAspectRatio})),this.addHandles([this._dragManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),this._rotateManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),...this._scaleManipulations.map(e=>e.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this))),o(()=>this.view.scale,()=>this.active?this.updateGraphics():null),e.on("click",async t=>{if(null!=e.activeTool&&e.activeTool!==this)return;const i=z(t),o=[];e.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const r=await this.view.hitTest(i,{exclude:o}),a=r.results;if(0===a.length)e.activeTool=null;else{const t=I(r.results),i="georeference"in s,o=a.map(e=>"media"===e.type?e.element:null).filter(Boolean),n=new Set([...this._graphicsLayer.graphics,i?null:s].filter(Boolean));i&&o.includes(s)||null!=t&&n.has(t.graphic)?null==e.activeTool&&(e.activeTool=this):e.activeTool=null}})]);const r=e=>{this.addHandles(e.events.on("grab-changed",e=>{"georeference"in s&&("start"===e.action?s.opacity*=.5:"end"===e.action&&(s.opacity*=2))}))};this._dragManipulation.forEachManipulator(r),this._rotateManipulation.forEachManipulator(r),this._scaleManipulations.forEach(e=>e.forEachManipulator(r));const a=new U;a.addToggle(L.preserveAspectRatio,()=>{null==this.preserveAspectRatio&&(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled)}),a.addToggle(L.rotateIncrements,()=>{null==this.snapRotation&&(this._snapRotation.enabled=!this._snapRotation.enabled)}),a.add(L.toggleOpacity,()=>{"georeference"in s&&(s.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled)}),a.addToggle(L.factorModifier,e=>this._factor="key-down"===e.type?K:J),a.add(L.scaleUp,()=>this._scale(this._factor)),a.add(L.scaleDown,()=>this._scale(-this._factor)),a.add(L.moveUp,()=>this._move(0,this._factor)),a.add(L.moveDown,()=>this._move(0,-this._factor)),a.add(L.moveLeft,()=>this._move(-this._factor,0)),a.add(L.moveRight,()=>this._move(this._factor,0)),this.addHandles([e.on("key-down",t=>{e.activeTool===this&&a.dispatch(e.inputManager,t)}),e.on("key-up",t=>{e.activeTool===this&&a.dispatch(e.inputManager,t)})])}async _loadProjectionEngine(){const e=this._graphic.geometry;return R(e.spatialReference,this.view.spatialReference)}_updateDisplayPlaneConrers(e){const{basis1:t,basis2:i,origin:s}=e,o=this._cornerA;u(o,s,t),u(o,o,i);const r=this._cornerB;u(r,s,t),g(r,r,i);const a=this._cornerC;g(a,s,t),g(a,a,i);const n=this._cornerD;g(n,s,t),u(n,n,i)}_getInfo(){return{editGeometryOperations:this._editGeometryOperations,plane:this._plane,displayPlane:this._displayPlane}}_updateGraphics(e,t){"start"===e.action&&(this._sharedUndoStack.push({tool:this,operation:t}),this._sharedRedoStack.length=0),this.updateGraphics()}_scale(e){const t=this._editGeometryOperations,i=t.data.geometry.extent?.width,s=(i+e*this.view.resolution)/i,o=t.scale(this._plane.origin,p,s,s,0,1);this._sharedUndoStack.push({tool:this,operation:o}),this._sharedRedoStack.length=0,this.updateGraphics()}_move(e,t){const i=this._editGeometryOperations.move(e*this.view.resolution,t*this.view.resolution,0,0);this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0,this.updateGraphics()}};e([a()],Q.prototype,"_plane",null),e([a()],Q.prototype,"_backgroundGraphicGeometry",null),e([a()],Q.prototype,"_rotateGraphicGeometry",null),e([a()],Q.prototype,"_scaleGraphicGeometries",null),e([a()],Q.prototype,"preserveAspectRatio",void 0),e([a()],Q.prototype,"snapRotation",void 0),e([a({constructOnly:!0,nonNullable:!0})],Q.prototype,"target",void 0),e([a({readOnly:!0})],Q.prototype,"type",void 0),e([a({constructOnly:!0})],Q.prototype,"view",void 0),Q=e([n("esri.views.2d.interactive.editingTools.TransformTool")],Q);export{Q as TransformTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../core/Handles.js";import{set as i,normalize as e}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c as a,b as s,d as n,l as o,e as l}from"../../../../../chunks/vec32.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as h,c as p}from"../../../../../chunks/boundedPlane.js";import{getInfo as u}from"../../../../../geometry/support/spatialReferenceUtils.js";import{Manipulation as _}from"./Manipulation.js";import{onGrabChangedHandle as d}from"./utils.js";import{createManipulatorDragEventPipeline as m,screenToMap as f}from"../../../../interactive/dragEventPipeline.js";import{GraphicManipulator as g}from"../../../../interactive/GraphicManipulator.js";import{apply as v}from"../../../../interactive/editGeometry/support/editPlaneUtils.js";const b=10,x=1e-6,C=.3;function y(t){const i=o(t.basis1),e=o(t.basis2);return C*Math.min(i,e)}class j extends _{constructor(i){super(),this._handles=new t,this._planeStart=h(),this._displayPlaneStart=h(),this._originCache=c(),this._axisCache=r(),this._renderStartCache=c(),this._renderEndCache=c(),this._resizeOriginCache=c(),this._view=i.view,this._tool=i.tool,this._graphic=i.graphic,this._direction=i.direction,this._preserveAspectRatio=i.preserveAspectRatio,this._manipulator=this._createManipulator(),this._handles.add([this._manipulator.events.on("grab-changed",t=>d(t,this._manipulator))]),this.forEachManipulator(t=>this._tool.manipulators.add(t))}destroy(){this._handles.destroy(),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._graphic=null,this._manipulator=null,this._direction=null,this._handles=null,this._planeStart=null,this._displayPlaneStart=null,this._originCache=null,this._axisCache=null,this._renderStartCache=null,this._renderEndCache=null,this._resizeOriginCache=null,this._preserveAspectRatio=null}forEachManipulator(t){t(this._manipulator,1)}createDragPipeline(t,r){let c=null,h=null,_=null,d=0,g=null,C=null;const j=this._planeStart,w=this._displayPlaneStart,S=this._direction;return m(this._manipulator,(m,E)=>{E.next(i=>{if("start"===i.action){m.cursor="grabbing";const i=t();c=i.plane,h=i.displayPlane,_=i.editGeometryOperations,d=b*this._view.resolution,p(c,j),p(h,w);const e=u(_.data.spatialReference);g=e?e.valid[1]-e.valid[0]-3*b*this._view.resolution:null}return i}).next(f(this._view)).next(t=>{const i=a(this._renderStartCache,[t.mapStart.x,t.mapStart.y,0]),e=a(this._renderEndCache,[t.mapEnd.x,t.mapEnd.y,0]),r=a(this._resizeOriginCache,w.origin);s(r,r,w.basis1,-S[0]),s(r,r,w.basis2,-S[1]),n(e,e,r),n(i,i,r);const c=0!==S[0]&&0!==S[1],p=y(w),u=y(h)/p,_=(t,r)=>{if(0===t)return 1;let a=o(r),s=.5*t*l(r,e)/a;const n=s<0?-1:1;if(c){s+=(a-.5*t*l(r,i)/a)*n*u}const h=a<1.5*d?1:x;return a=Math.max(a-d,x),n>0&&(s-=b*this._view.resolution),n*Math.max(n*(s/a),h)},m=_(S[0],w.basis1),f=_(S[1],w.basis2);return{...t,direction:S,factor1:m,factor2:f}}).next(this._preserveAspectRatio.createDragEventPipelineStep(),this._preserveAspectRatio.next).next(t=>{const n=a(this._originCache,j.origin);s(n,n,j.basis1,-S[0]),s(n,n,j.basis2,-S[1]);const o=i(this._axisCache,j.basis1[0],j.basis1[1]);e(o,o);const l=_.data.allVerticesUnordered,h="start"===t.action?0:1,u=_.scaleVertices(l,n,o,t.factor1,t.factor2,h,1);return g&&g<_.data.geometry.extent.width&&C?_.updateVertices(l,C):(p(j,c),v(u,c),C=u.operation,r(t,u)),t}).next(t=>("end"===t.action&&(m.cursor="grab"),t))})}_createManipulator(){return new g({view:this._view,graphic:this._graphic,selectable:!0,cursor:"grab"})}}export{j as ScaleManipulation,y as calculateDiagonalResizeHandleScale};
5
+ import t from"../../../../../core/Handles.js";import{set as i,normalize as e}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c as a,b as s,d as n,l as o,e as l}from"../../../../../chunks/vec32.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as h,a as p}from"../../../../../chunks/boundedPlane.js";import{getInfo as u}from"../../../../../geometry/support/spatialReferenceUtils.js";import{Manipulation as _}from"./Manipulation.js";import{onGrabChangedHandle as d}from"./utils.js";import{createManipulatorDragEventPipeline as m,screenToMap as f}from"../../../../interactive/dragEventPipeline.js";import{GraphicManipulator as g}from"../../../../interactive/GraphicManipulator.js";import{apply as v}from"../../../../interactive/editGeometry/support/editPlaneUtils.js";const b=10,x=1e-6,C=.3;function y(t){const i=o(t.basis1),e=o(t.basis2);return C*Math.min(i,e)}class j extends _{constructor(i){super(),this._handles=new t,this._planeStart=h(),this._displayPlaneStart=h(),this._originCache=c(),this._axisCache=r(),this._renderStartCache=c(),this._renderEndCache=c(),this._resizeOriginCache=c(),this._view=i.view,this._tool=i.tool,this._graphic=i.graphic,this._direction=i.direction,this._preserveAspectRatio=i.preserveAspectRatio,this._manipulator=this._createManipulator(),this._handles.add([this._manipulator.events.on("grab-changed",t=>d(t,this._manipulator))]),this.forEachManipulator(t=>this._tool.manipulators.add(t))}destroy(){this._handles.destroy(),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._graphic=null,this._manipulator=null,this._direction=null,this._handles=null,this._planeStart=null,this._displayPlaneStart=null,this._originCache=null,this._axisCache=null,this._renderStartCache=null,this._renderEndCache=null,this._resizeOriginCache=null,this._preserveAspectRatio=null}forEachManipulator(t){t(this._manipulator,1)}createDragPipeline(t,r){let c=null,h=null,_=null,d=0,g=null,C=null;const j=this._planeStart,w=this._displayPlaneStart,S=this._direction;return m(this._manipulator,(m,E)=>{E.next(i=>{if("start"===i.action){m.cursor="grabbing";const i=t();c=i.plane,h=i.displayPlane,_=i.editGeometryOperations,d=b*this._view.resolution,p(c,j),p(h,w);const e=u(_.data.spatialReference);g=e?e.valid[1]-e.valid[0]-3*b*this._view.resolution:null}return i}).next(f(this._view)).next(t=>{const i=a(this._renderStartCache,[t.mapStart.x,t.mapStart.y,0]),e=a(this._renderEndCache,[t.mapEnd.x,t.mapEnd.y,0]),r=a(this._resizeOriginCache,w.origin);s(r,r,w.basis1,-S[0]),s(r,r,w.basis2,-S[1]),n(e,e,r),n(i,i,r);const c=0!==S[0]&&0!==S[1],p=y(w),u=y(h)/p,_=(t,r)=>{if(0===t)return 1;let a=o(r),s=.5*t*l(r,e)/a;const n=s<0?-1:1;if(c){s+=(a-.5*t*l(r,i)/a)*n*u}const h=a<1.5*d?1:x;return a=Math.max(a-d,x),n>0&&(s-=b*this._view.resolution),n*Math.max(n*(s/a),h)},m=_(S[0],w.basis1),f=_(S[1],w.basis2);return{...t,direction:S,factor1:m,factor2:f}}).next(this._preserveAspectRatio.createDragEventPipelineStep(),this._preserveAspectRatio.next).next(t=>{const n=a(this._originCache,j.origin);s(n,n,j.basis1,-S[0]),s(n,n,j.basis2,-S[1]);const o=i(this._axisCache,j.basis1[0],j.basis1[1]);e(o,o);const l=_.data.allVerticesUnordered,h="start"===t.action?0:1,u=_.scaleVertices(l,n,o,t.factor1,t.factor2,h,1);return g&&g<_.data.geometry.extent.width&&C?_.updateVertices(l,C):(p(j,c),v(u,c),C=u.operation,r(t,u)),t}).next(t=>("end"===t.action&&(m.cursor="grab"),t))})}_createManipulator(){return new g({view:this._view,graphic:this._graphic,selectable:!0,cursor:"grab"})}}export{j as ScaleManipulation,y as calculateDiagonalResizeHandleScale};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- 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{neverReached as o}from"../../../core/compilerUtils.js";import n from"../../../core/Error.js";import{makeHandle as u,handlesGroup as l}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import h from"../../../core/Logger.js";import{destroyMaybe as c}from"../../../core/maybe.js";import{notDeepEqual as p}from"../../../core/object.js";import{createAbortError as d,createResolver as y,ignoreAbortErrors as f,throwIfNotAbortError as g,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as w}from"../../../core/reactiveUtils.js";import{sqlAnd as v}from"../../../core/sql.js";import{property as _}from"../../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as S}from"../../../core/support/UpdatingHandles.js";import F from"../../../geometry/Extent.js";import A from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as j}from"../../../layers/graphics/featureConversionUtils.js";import U from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as x}from"../../../layers/support/featureLayerUtils.js";import{packFields as I}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as E}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as k}from"../../../layers/support/timeSupport.js";import C from"../../../rest/support/AggregateFeatureSet.js";import V from"../../../rest/support/AttributeBinsFeatureSet.js";import q from"../../../rest/support/AttributeBinsQuery.js";import R from"../../../rest/support/FeatureSet.js";import Q from"../../../rest/support/Query.js";import{LayerView2DMixin as O}from"./LayerView2D.js";import{FeatureContainer as L}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as T}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as W}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as M}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as P}from"./features/layerAdapters/FeatureLayerAdapter.js";import{createFeatureIdInfo as D}from"./features/layerAdapters/featureServiceUtils.js";import{InMemoryLayerAdapter as H}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as N}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as J}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as G}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as $}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as B}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as z}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as Z}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import{DebouncedFeatureOverride as K}from"./support/DebouncedFeatureOverride.js";import{FeatureCommandQueue as X}from"./support/FeatureCommandQueue.js";import{handleNoEngineError as Y}from"./support/handleNoEngineError.js";import{toJSONGeometryType as ee}from"./support/util.js";import{FeatureTileSubscriptionManager as te}from"../tiling/FeatureTileSubscriptionManager.js";import{FeatureLayerView as re}from"../../layers/FeatureLayerView.js";import se from"../../layers/LayerView.js";import{RefreshableLayerView as ie}from"../../layers/RefreshableLayerView.js";import{getHighlightName as ae}from"../../support/highlightOptionsUtils.js";function oe(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 ne=4294967294;function ue(e,t){return l(e.map(e=>w(()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t},t)))}let le=class extends(re(ie(O(se)))){constructor(){super(...arguments),this._commandsQueue=new X({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 W,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new S,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new A,this._lastUpdate=0}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(d()),this._commandsQueue.destroy()}initialize(){this._workerAttached=y(),f(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 n("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===E(e)?.operations.supportsQuery)throw new n("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 T(t)}async _attachProxy(){const e={service:await this.layerAdapter.createServiceOptions(this.view),tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON()};let t=[];Array.isArray(e.service.source)&&(t=e.service.source);try{await this._workerProxy.pipeline.onAttach(e,{transferList:t}),this._workerAttached.resolve()}catch(r){this._workerAttached.reject(d()),g(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 labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map(({vvEvaluators:e,deconflictionEnabled:s,labelingInfo:i})=>({labelingInfo:i,container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:s,geometryType:t,visible:r}))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new H(this.layer):new P(this.layer);case"geojson":case"csv":case"wfs":return new H(this.layer);case"parquet":return new $(this.layer);case"subtype-group":return new z(this.layer);case"ogc-feature":return new J(this.layer);case"stream":return new B(this.layer);case"oriented-imagery":return new G(this.layer);case"knowledge-graph-sublayer":return new N(this.layer);case"catalog-footprint":return new M(this.layer);default:o(this.layer)}return null}get timeExtent(){return k(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}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 u();const n=ae(t);return this._addHighlights(o,n),u(()=>!this.destroyed&&this._removeHighlights(o,n))}async hitTest(e,i){const a=await this.featureContainer.hitTest(i);if(0===a.length)return null;const o=await this.getWorker(),{features:n,aggregates:u,tracks:l}=await o.pipeline.getDisplayFeatures(a),h=this.featureContainer.getSortKeys(a),c=({displayId:e},{displayId:t})=>h.has(e)&&h.has(t)?h.get(e)-h.get(t):e-t;return n.sort(c).reverse(),u.sort(c).reverse(),[...u.map(r=>this._createGraphicHit(e,t.fromJSON(r))),...l.map(t=>this._createGraphicHit(e,s.fromJSON(t))),...n.map(t=>this._createGraphicHit(e,r.fromJSON(t)))]}async queryStatistics(){const e=await this.getWorker();return Y(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 Y(a,{})}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r);return Y(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 Y(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 Y(a,{uniqueValueInfos:[]})}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 Y(a,{classBreakInfos:[]})}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 Y(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 Y(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}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 Y(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then(e=>{const t=R.fromJSON(e);return t.features.forEach(e=>this._setLayersForFeature(e)),t})}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await Y(r,{features:[]}),i=R.fromJSON(s);return i.features.forEach(e=>this._setLayersForFeature(e)),i}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await Y(r,{features:[]}),i=C.fromJSON(s);return i.features.forEach(e=>this._setLayersForFeature(e)),i}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return Y(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return Y(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return Y(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return Y(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return Y(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return Y(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await Y(r,{count:0,extent:null});return{count:s.count,extent:F.fromJSON(s.extent)}}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),s=await Y(r,{features:[]});return V.fromJSON(s)}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){const t=performance.now();if(t-this._lastUpdate<200)return;if(this._lastUpdate=t,!this.subscriptionManager)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const r=this.subscriptionManager.update(e.targetState,this._lastTargetState),s=new Set(this.subscriptionManager.coverage?.target.keys());for(const i of this.featureContainer.tiles||[])i.isCoverage=s.has(i.id);this.featureContainer.setVisibleTiles(r)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),f(this._updatingHandles.addPromise(this._workerAttached.promise)),f(this._attachProxy()),this.featureContainer=new L(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this.subscriptionManager=new te({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),f(this._updatingHandles.addPromise(this.getWorker().then(t=>t.pipeline.updateSubscriptions(e))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([ue([()=>this._displayRefreshVersion,()=>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()),w(()=>this.updateSuspended,e=>{e||(this.subscriptionManager.resume(),this.view.labelManager.requestUpdate())}),w(()=>this.visible,e=>{this.view.labelManager.requestUpdate()})]),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.view.labelManager.removeContainer(this.featureContainer),this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this.subscriptionManager=c(this.subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=y(),f(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 n("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})}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,s=this.featureContainer.updatingHandles.updating,i=this.updateRequested||e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${i}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${s}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return i}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.emit(e.name,e.event)},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)))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const 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=ee(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 Z({...o.data,hasTextStringTemplates:!0},{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=Q.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=q.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=Q.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)%ne+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%ne+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?h.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 h.getLogger(this).error(new n("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=ee(this.layer.geometryType),i=D(this.layer),a=[];for(const o of e.added){const e=j(o,s,t,r,i);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.updated){const e=j(o,s,t,r,i);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.removed)if(null==o)throw new n("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:o});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),u=await this._resolveIdenifiers(n);return this._resolveOverrides({added:e,updated:o,removed:u,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 _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await Promise.allSettled([this._handleChange(),x(this.layer)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this.subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads();const t=this._lastSchema?.processor.mesh.factory.symbology?.type;let r=!0;"subtype-group"!==this.layer.type&&"dictionary"===this.layer.renderer?.type&&"dictionary"===t&&(r=!1),e.updateStart(r);const s=this.featureEffect,i={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},a=await this._createViewSchemaConfig(),o={source:this.layerAdapter.createSourceSchema(a,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(i,a,this._displayRefreshVersion)},n=o.processor.mesh.factory.labels;n&&this.view.labelManager.setLabelSchemaStyles(n,this.featureContainer);const u=p(this._lastSchema?.source.mutable,o.source.mutable)||p(this._lastSchema?.processor,o.processor);if(!u)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(r),void(this.featureEffectView.featureEffect=s);this._lastSchema=o,this._fields=null;const l=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${l}] FeatureLayerView2D._doUpdate`,{changes:u});const h=await this.getWorker();await h.pipeline.updateSchema(o,l),e.updateEnd(r),this.featureEffectView.featureEffect=s,this.featureEffectView.endTransition(),this.featureContainer.restartAllAnimations(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.trySwapRenderState(),this.featureContainer.requestRender();const c=o.processor.mesh.strategy,d="cluster"===c.type||"binning"===c.type,y="heatmap"===o.processor.mesh.factory.symbology.type,f=d||y?"target-defer":"eager";this.subscriptionManager.setVisibilityStrategy(f),has("esri-2d-update-debug")&&console.debug(`Version[${l}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doOverride(e){const t=await this.getWorker();try{for(const r of e.messages)switch(r.type){case"edit":{const e=new K;e.add(await this._resolveEdit(r.event)),await t.pipeline.onOverride(e.toMessage());break}case"override":{const e=new K;e.add(this._resolveOverrides(r.options)),await t.pipeline.onOverride(e.toMessage());break}}}catch(r){m(r),0}}_getEffectiveAvailableFields(e){const t=oe(this._lastAvailableFields,e);return this._lastAvailableFields=t,I(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[he(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}}_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)||h.getLogger(this).error(e)});this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function he(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 u=i?.toJSON()??null;return s.size&&(u??=(new U).toJSON(),u.hiddenIds=Array.from(s)),u}e([_()],le.prototype,"_commandsQueue",void 0),e([_()],le.prototype,"_sourceRefreshVersion",void 0),e([_()],le.prototype,"_displayRefreshVersion",void 0),e([_({readOnly:!0})],le.prototype,"_pipelineUpdating",void 0),e([_()],le.prototype,"_sourceUpdating",void 0),e([_({readOnly:!0})],le.prototype,"dataUpdating",null),e([_({readOnly:!0})],le.prototype,"hasAllFeatures",null),e([_({readOnly:!0})],le.prototype,"hasAllFeaturesInView",null),e([_({readOnly:!0})],le.prototype,"hasFullGeometries",null),e([_()],le.prototype,"featureEffectView",void 0),e([_()],le.prototype,"labelingCollisionInfos",null),e([_()],le.prototype,"layerAdapter",null),e([_({readOnly:!0})],le.prototype,"timeExtent",null),le=e([b("esri.views.2d.layers.FeatureLayerView2D")],le);export{le as default};
5
+ 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{neverReached as o}from"../../../core/compilerUtils.js";import n from"../../../core/Error.js";import{makeHandle as u,handlesGroup as l}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import h from"../../../core/Logger.js";import{destroyMaybe as c}from"../../../core/maybe.js";import{notDeepEqual as p}from"../../../core/object.js";import{createAbortError as d,createResolver as y,ignoreAbortErrors as f,throwIfNotAbortError as g,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as w}from"../../../core/reactiveUtils.js";import{sqlAnd as v}from"../../../core/sql.js";import{property as _}from"../../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as S}from"../../../core/support/UpdatingHandles.js";import F from"../../../geometry/Extent.js";import A from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as j}from"../../../layers/graphics/featureConversionUtils.js";import U from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as x}from"../../../layers/support/featureLayerUtils.js";import{packFields as I}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as E}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as k}from"../../../layers/support/timeSupport.js";import C from"../../../rest/support/AggregateFeatureSet.js";import V from"../../../rest/support/AttributeBinsFeatureSet.js";import q from"../../../rest/support/AttributeBinsQuery.js";import R from"../../../rest/support/FeatureSet.js";import Q from"../../../rest/support/Query.js";import{LayerView2DMixin as O}from"./LayerView2D.js";import{FeatureContainer as L}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as T}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as M}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as W}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as P}from"./features/layerAdapters/FeatureLayerAdapter.js";import{createFeatureIdInfo as D}from"./features/layerAdapters/featureServiceUtils.js";import{InMemoryLayerAdapter as H}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as N}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as J}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as G}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as $}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as B}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as z}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as Z}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import{DebouncedFeatureOverride as K}from"./support/DebouncedFeatureOverride.js";import{FeatureCommandQueue as X}from"./support/FeatureCommandQueue.js";import{handleNoEngineError as Y}from"./support/handleNoEngineError.js";import{toJSONGeometryType as ee}from"./support/util.js";import{FeatureTileSubscriptionManager as te}from"../tiling/FeatureTileSubscriptionManager.js";import{FeatureLayerView as re}from"../../layers/FeatureLayerView.js";import se from"../../layers/LayerView.js";import{RefreshableLayerView as ie}from"../../layers/RefreshableLayerView.js";import{getHighlightName as ae}from"../../support/highlightOptionsUtils.js";function oe(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 ne=4294967294;function ue(e,t){return l(e.map(e=>w(()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t},t)))}let le=class extends(re(ie(O(se)))){constructor(){super(...arguments),this._commandsQueue=new X({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 M,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new S,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new A,this._lastUpdate=0}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(d()),this._commandsQueue.destroy()}initialize(){this._workerAttached=y(),f(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 n("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===E(e)?.operations.supportsQuery)throw new n("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 T(t)}async _attachProxy(){const e={service:await this.layerAdapter.createServiceOptions(this.view),tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON()};let t=[];Array.isArray(e.service.source)&&(t=e.service.source);try{await this._workerProxy.pipeline.onAttach(e,{transferList:t}),this._workerAttached.resolve()}catch(r){this._workerAttached.reject(d()),g(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 labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map(({vvEvaluators:e,deconflictionEnabled:s,labelingInfo:i})=>({labelingInfo:i,container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:s,geometryType:t,visible:r}))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new H(this.layer):new P(this.layer);case"geojson":case"csv":case"wfs":return new H(this.layer);case"parquet":return new $(this.layer);case"subtype-group":return new z(this.layer);case"ogc-feature":return new J(this.layer);case"stream":return new B(this.layer);case"oriented-imagery":return new G(this.layer);case"knowledge-graph-sublayer":return new N(this.layer);case"catalog-footprint":return new W(this.layer);default:o(this.layer)}return null}get timeExtent(){return k(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)}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}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 u();const n=ae(t);return this._addHighlights(o,n),u(()=>!this.destroyed&&this._removeHighlights(o,n))}async hitTest(e,i){const a=await this.featureContainer.hitTest(i);if(0===a.length)return null;const o=await this.getWorker(),{features:n,aggregates:u,tracks:l}=await o.pipeline.getDisplayFeatures(a),h=this.featureContainer.getSortKeys(a),c=({displayId:e},{displayId:t})=>h.has(e)&&h.has(t)?h.get(e)-h.get(t):e-t;return n.sort(c).reverse(),u.sort(c).reverse(),[...u.map(r=>this._createGraphicHit(e,t.fromJSON(r))),...l.map(t=>this._createGraphicHit(e,s.fromJSON(t))),...n.map(t=>this._createGraphicHit(e,r.fromJSON(t)))]}async queryStatistics(){const e=await this.getWorker();return Y(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 Y(a,{})}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r);return Y(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 Y(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 Y(a,{uniqueValueInfos:[]})}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 Y(a,{classBreakInfos:[]})}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 Y(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 Y(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}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 Y(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then(e=>{const t=R.fromJSON(e);return t.features.forEach(e=>this._setLayersForFeature(e)),t})}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await Y(r,{features:[]}),i=R.fromJSON(s);return i.features.forEach(e=>this._setLayersForFeature(e)),i}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await Y(r,{features:[]}),i=C.fromJSON(s);return i.features.forEach(e=>this._setLayersForFeature(e)),i}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return Y(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return Y(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return Y(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return Y(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return Y(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return Y(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await Y(r,{count:0,extent:null});return{count:s.count,extent:F.fromJSON(s.extent)}}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),s=await Y(r,{features:[]});return V.fromJSON(s)}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){const t=performance.now();if(t-this._lastUpdate<200)return;if(this._lastUpdate=t,!this.subscriptionManager)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const r=this.subscriptionManager.update(e.targetState,this._lastTargetState),s=new Set(this.subscriptionManager.coverage?.target.keys());for(const i of this.featureContainer.tiles||[])i.isCoverage=s.has(i.id);this.featureContainer.setVisibleTiles(r)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),f(this._updatingHandles.addPromise(this._workerAttached.promise)),f(this._attachProxy()),this.featureContainer=new L(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this.subscriptionManager=new te({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),f(this._updatingHandles.addPromise(this.getWorker().then(t=>t.pipeline.updateSubscriptions(e))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([ue([()=>this._displayRefreshVersion,()=>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()),w(()=>this.updateSuspended,e=>{e||(this.subscriptionManager.resume(),this.view.labelManager.requestUpdate())}),w(()=>this.visible,e=>{this.view.labelManager.requestUpdate()})]),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.view.labelManager.removeContainer(this.featureContainer),this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this.subscriptionManager=c(this.subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=y(),f(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 n("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})}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,s=this.featureContainer.updatingHandles.updating,i=this.updateRequested||e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${i}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${s}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return i}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.emit(e.name,e.event)},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)))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const 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=ee(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 Z({...o.data,hasTextStringTemplates:!0},{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=Q.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=q.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=Q.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)%ne+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%ne+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?h.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 h.getLogger(this).error(new n("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=ee(this.layer.geometryType),i=D(this.layer),a=[];for(const o of e.added){const e=j(o,s,t,r,i);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.updated){const e=j(o,s,t,r,i);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.removed)if(null==o)throw new n("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:o});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),u=await this._resolveIdenifiers(n);return this._resolveOverrides({added:e,updated:o,removed:u,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 _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await Promise.allSettled([this._handleChange(),x(this.layer)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this.subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads();const t=this._lastSchema?.processor.mesh.factory.symbology?.type;let r=!0;"subtype-group"!==this.layer.type&&"dictionary"===this.layer.renderer?.type&&"dictionary"===t&&(r=!1),e.updateStart(r);const s=this.featureEffect,i={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},a=await this._createViewSchemaConfig(),o={source:this.layerAdapter.createSourceSchema(a,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(i,a,this._displayRefreshVersion)},n=o.processor.mesh.factory.labels;n&&this.view.labelManager.setLabelSchemaStyles(n,this.featureContainer);const u=p(this._lastSchema?.source.mutable,o.source.mutable)||p(this._lastSchema?.processor,o.processor);if(!u)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(r),void(this.featureEffectView.featureEffect=s);this._lastSchema=o,this._fields=null;const l=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${l}] FeatureLayerView2D._doUpdate`,{changes:u});const h=await this.getWorker();await h.pipeline.updateSchema(o,l),e.updateEnd(r),this.featureEffectView.featureEffect=s,this.featureEffectView.endTransition(),this.featureContainer.restartAllAnimations(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.trySwapRenderState(),this.featureContainer.requestRender();const c=o.processor.mesh.strategy,d="cluster"===c.type||"binning"===c.type,y="heatmap"===o.processor.mesh.factory.symbology.type,f=d||y?"target-defer":"eager";this.subscriptionManager.setVisibilityStrategy(f),has("esri-2d-update-debug")&&console.debug(`Version[${l}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doOverride(e){const t=await this.getWorker();try{for(const r of e.messages)switch(r.type){case"edit":{const e=new K;e.add(await this._resolveEdit(r.event)),await t.pipeline.onOverride(e.toMessage());break}case"override":{const e=new K;e.add(this._resolveOverrides(r.options)),await t.pipeline.onOverride(e.toMessage());break}}}catch(r){m(r),0}}_getEffectiveAvailableFields(e){const t=oe(this._lastAvailableFields,e);return this._lastAvailableFields=t,I(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[he(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}}_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)||h.getLogger(this).error(e)});this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function he(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 u=i?.toJSON()??null;return s.size&&(u??=(new U).toJSON(),u.hiddenIds=Array.from(s)),u}e([_()],le.prototype,"_commandsQueue",void 0),e([_()],le.prototype,"_sourceRefreshVersion",void 0),e([_()],le.prototype,"_displayRefreshVersion",void 0),e([_({readOnly:!0})],le.prototype,"_pipelineUpdating",void 0),e([_()],le.prototype,"_sourceUpdating",void 0),e([_({readOnly:!0})],le.prototype,"dataUpdating",null),e([_({readOnly:!0})],le.prototype,"hasAllFeatures",null),e([_({readOnly:!0})],le.prototype,"hasAllFeaturesInView",null),e([_({readOnly:!0})],le.prototype,"hasFullGeometries",null),e([_()],le.prototype,"featureEffectView",void 0),e([_()],le.prototype,"labelingCollisionInfos",null),e([_()],le.prototype,"layerAdapter",null),e([_({readOnly:!0})],le.prototype,"timeExtent",null),le=e([b("esri.views.2d.layers.FeatureLayerView2D")],le);export{le as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{version as i}from"../../../kernel.js";import t from"../../../core/Collection.js";import{abortMaybe as s,destroyMaybe as a}from"../../../core/maybe.js";import{watch as o}from"../../../core/reactiveUtils.js";import{queryToObject as l,objectToQuery as r}from"../../../core/urlUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../geometry/Extent.js";import{load as m,project as c}from"../../../geometry/projectionUtils.js";import d from"../../../geometry/SpatialReference.js";import{KMLMapImage as y}from"../../../layers/support/KMLMapImage.js";import{getGraphics as g,fetchService as w,parseKML as u}from"../../../layers/support/kmlUtils.js";import{parseUrl as _}from"../../../rest/utils.js";import{GraphicsCollection as b}from"../../../support/GraphicsCollection.js";import{Bitmap as V}from"../engine/Bitmap.js";import{BitmapContainer as f}from"../engine/BitmapContainer.js";import{LayerView2DMixin as v}from"./LayerView2D.js";import S from"./graphics/GraphicContainer.js";import I from"./graphics/GraphicsView2D.js";import x from"../../layers/LayerView.js";import{ImageReprojector as C}from"../../support/imageReprojection.js";class j{constructor(){this.allSublayers=new Map,this.allPoints=[],this.allPolylines=[],this.allPolygons=[],this.allMapImages=[]}}let k=class extends(v(x)){constructor(){super(...arguments),this._bitmapIndex=new Map,this._mapImageContainer=new f,this._kmlVisualData=new j,this._fetchController=null,this.allVisiblePoints=new b,this.allVisiblePolylines=new b,this.allVisiblePolygons=new b,this.allVisibleMapImages=new t}async hitTest(e,i){const t=this.layer;return[this._pointsView?.hitTest(e),this._polylinesView?.hitTest(e),this._polygonsView?.hitTest(e)].flat().filter(Boolean).map(i=>(i.layer=t,i.sourceLayer=t,{type:"graphic",graphic:i,layer:t,mapPoint:e}))}update(e){this._polygonsView&&this._polygonsView.processUpdate(e),this._polylinesView&&this._polylinesView.processUpdate(e),this._pointsView&&this._pointsView.processUpdate(e)}attach(){this._fetchController=new AbortController,this.container.addChild(this._mapImageContainer),this._polygonsView=new I({view:this.view,graphics:this.allVisiblePolygons,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._polygonsView.container),this._polylinesView=new I({view:this.view,graphics:this.allVisiblePolylines,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._polylinesView.container),this._pointsView=new I({view:this.view,graphics:this.allVisiblePoints,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._pointsView.container),this.addAttachHandles([this.allVisibleMapImages.on("change",e=>{e.added.forEach(e=>this._addMapImage(e)),e.removed.forEach(e=>this._removeMapImage(e))}),o(()=>this.layer.visibleSublayers,e=>{for(const i of this._kmlVisualData.allSublayers.values())i.visibility=0;for(const i of e){const e=this._kmlVisualData.allSublayers.get(i.id);e&&(e.visibility=1)}this._refreshCollections()})]),this._updatingHandles.addPromise(this._fetchService(this._fetchController.signal)),this._imageReprojector=new C}detach(){this._fetchController=s(this._fetchController),this._mapImageContainer.removeAllChildren(),this.container.removeAllChildren(),this._bitmapIndex.clear(),this._polygonsView=a(this._polygonsView),this._polylinesView=a(this._polylinesView),this._pointsView=a(this._pointsView),this._imageReprojector=a(this._imageReprojector)}viewChange(){this._polygonsView.viewChange(),this._polylinesView.viewChange(),this._pointsView.viewChange()}moveEnd(){}isUpdating(){return this._pointsView.updating||this._polygonsView.updating||this._polylinesView.updating}_addMapImage(e){(this.view.spatialReference?.isWGS84||this.view.spatialReference?.isWebMercator)&&this._imageReprojector.loadAndReprojectBitmapData(e.href,e.extent,this.view.spatialReference).then(i=>{const t=new V(i.bitmapData);t.x=i.extent.xmin,t.y=i.extent.ymax,t.resolution=i.extent.width/i.bitmapData.width,t.rotation=e.rotation,this._mapImageContainer.addChild(t),this._bitmapIndex.set(e,t)})}async _getViewDependentUrl(e,t){const{viewFormat:s,viewBoundScale:a,httpQuery:o}=e;if(null!=s){if(null==t)throw new Error("Loading this network link requires a view state.");let n;if(await m(),null!=a&&1!==a){const e=new p(t.extent);e.expand(a),n=e}else n=t.extent;n=c(n,d.WGS84);const h=c(n,d.WebMercator),y=n.xmin,g=n.xmax,w=n.ymin,u=n.ymax,b=t.size[0]*t.pixelRatio,V=t.size[1]*t.pixelRatio,f=Math.max(h.width,h.height),v={"[bboxWest]":y.toString(),"[bboxEast]":g.toString(),"[bboxSouth]":w.toString(),"[bboxNorth]":u.toString(),"[lookatLon]":n.center.x.toString(),"[lookatLat]":n.center.y.toString(),"[lookatRange]":f.toString(),"[lookatTilt]":"0","[lookatHeading]":t.rotation.toString(),"[lookatTerrainLon]":n.center.x.toString(),"[lookatTerrainLat]":n.center.y.toString(),"[lookatTerrainAlt]":"0","[cameraLon]":n.center.x.toString(),"[cameraLat]":n.center.y.toString(),"[cameraAlt]":f.toString(),"[horizFov]":"60","[vertFov]":"60","[horizPixels]":b.toString(),"[vertPixels]":V.toString(),"[terrainEnabled]":"0","[clientVersion]":i,"[kmlVersion]":"2.2","[clientName]":"ArcGIS API for JavaScript","[language]":"en-US"},S=e=>{for(const i in e){let t;for(t in v)e[i]=e[i].replace(t,v[t])}},I=l(s);S(I);let x={};null!=o&&(x=l(o),S(x));const C=_(e.href);C.query={...C.query,...I,...x};return`${C.path}?${r(I)}`}return e.href}async _fetchService(e){const i=new j;await this._loadVisualData(this.layer.url,i,e),this._kmlVisualData=i,this._refreshCollections()}_refreshCollections(){this.allVisiblePoints.removeAll(),this.allVisiblePolylines.removeAll(),this.allVisiblePolygons.removeAll(),this.allVisibleMapImages.removeAll(),this.allVisiblePoints.addMany(this._kmlVisualData.allPoints.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e)),this.allVisiblePolylines.addMany(this._kmlVisualData.allPolylines.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e)),this.allVisiblePolygons.addMany(this._kmlVisualData.allPolygons.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e)),this.allVisibleMapImages.addMany(this._kmlVisualData.allMapImages.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e))}_isSublayerVisible(e){const i=this._kmlVisualData.allSublayers.get(e);return!!i?.visibility&&(-1===i.parentFolderId||this._isSublayerVisible(i.parentFolderId))}_loadVisualData(e,i,t){return this._fetchParsedKML(e,t).then(async e=>{for(const s of e.sublayers){i.allSublayers.set(s.id,s);const e=s.points?await g(s.points):[],a=s.polylines?await g(s.polylines):[],o=s.polygons?await g(s.polygons):[],l=s.mapImages?.map(e=>y.fromJSON(e))??[];if(i.allPoints.push(...e.map(e=>({item:e,sublayerId:s.id}))),i.allPolylines.push(...a.map(e=>({item:e,sublayerId:s.id}))),i.allPolygons.push(...o.map(e=>({item:e,sublayerId:s.id}))),i.allMapImages.push(...l.map(e=>({item:e,sublayerId:s.id}))),s.networkLink){const e=await this._getViewDependentUrl(s.networkLink,this.view.state);await this._loadVisualData(e,i,t)}}})}_fetchParsedKML(e,i){return w(e,this.layer.spatialReference,this.layer.refreshInterval,i).then(e=>u(e.data))}_removeMapImage(e){const i=this._bitmapIndex.get(e);i&&(this._mapImageContainer.removeChild(i),this._bitmapIndex.delete(e))}};e([n()],k.prototype,"_pointsView",void 0),e([n()],k.prototype,"_polylinesView",void 0),e([n()],k.prototype,"_polygonsView",void 0),k=e([h("esri.views.2d.layers.KMLLayerView2D")],k);const P=k;export{P as default};
5
+ import{__decorate as e}from"tslib";import{version as i}from"../../../kernel.js";import t from"../../../core/Collection.js";import{abortMaybe as s,destroyMaybe as a}from"../../../core/maybe.js";import{watch as o}from"../../../core/reactiveUtils.js";import{queryToObject as l,objectToQuery as r}from"../../../core/urlUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../geometry/Extent.js";import{load as m,project as c}from"../../../geometry/projectionUtils.js";import d from"../../../geometry/SpatialReference.js";import{KMLMapImage as y}from"../../../layers/support/KMLMapImage.js";import{getGraphics as g,fetchService as w,parseKML as u}from"../../../layers/support/kmlUtils.js";import{parseUrl as _}from"../../../rest/utils.js";import{GraphicsCollection as V}from"../../../support/GraphicsCollection.js";import{Bitmap as f}from"../engine/Bitmap.js";import{BitmapContainer as b}from"../engine/BitmapContainer.js";import{LayerView2DMixin as v}from"./LayerView2D.js";import S from"./graphics/GraphicContainer.js";import x from"./graphics/GraphicsView2D.js";import C from"../../layers/LayerView.js";import{ImageReprojector as I}from"../../support/imageReprojection.js";class j{constructor(){this.allSublayers=new Map,this.allPoints=[],this.allPolylines=[],this.allPolygons=[],this.allMapImages=[]}}let k=class extends(v(C)){constructor(){super(...arguments),this._bitmapIndex=new Map,this._mapImageContainer=new b,this._kmlVisualData=new j,this._fetchController=null,this.allVisiblePoints=new V,this.allVisiblePolylines=new V,this.allVisiblePolygons=new V,this.allVisibleMapImages=new t}async hitTest(e,i){const t=this.layer;return[this._pointsView?.hitTest(e),this._polylinesView?.hitTest(e),this._polygonsView?.hitTest(e)].flat().filter(Boolean).map(i=>(i.layer=t,i.sourceLayer=t,{type:"graphic",graphic:i,layer:t,mapPoint:e}))}update(e){this._polygonsView&&this._polygonsView.processUpdate(e),this._polylinesView&&this._polylinesView.processUpdate(e),this._pointsView&&this._pointsView.processUpdate(e)}attach(){this._fetchController=new AbortController,this.container.addChild(this._mapImageContainer),this._polygonsView=new x({view:this.view,graphics:this.allVisiblePolygons,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._polygonsView.container),this._polylinesView=new x({view:this.view,graphics:this.allVisiblePolylines,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._polylinesView.container),this._pointsView=new x({view:this.view,graphics:this.allVisiblePoints,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._pointsView.container),this.addAttachHandles([this.allVisibleMapImages.on("change",e=>{e.added.forEach(e=>this._addMapImage(e)),e.removed.forEach(e=>this._removeMapImage(e))}),o(()=>this.layer.visibleSublayers,e=>{for(const i of this._kmlVisualData.allSublayers.values())i.visibility=0;for(const i of e){const e=this._kmlVisualData.allSublayers.get(i.id);e&&(e.visibility=1)}this._refreshCollections()})]),this._updatingHandles.addPromise(this._fetchService(this._fetchController.signal)),this._imageReprojector=new I}detach(){this._fetchController=s(this._fetchController),this._mapImageContainer.removeAllChildren(),this.container.removeAllChildren(),this._bitmapIndex.clear(),this._polygonsView=a(this._polygonsView),this._polylinesView=a(this._polylinesView),this._pointsView=a(this._pointsView),this._imageReprojector=a(this._imageReprojector)}viewChange(){this._polygonsView.viewChange(),this._polylinesView.viewChange(),this._pointsView.viewChange()}moveEnd(){}isUpdating(){return this._pointsView.updating||this._polygonsView.updating||this._polylinesView.updating}_addMapImage(e){(this.view.spatialReference?.isWGS84||this.view.spatialReference?.isWebMercator)&&this._imageReprojector.loadAndReprojectBitmapData(e.href,e.extent,this.view.spatialReference).then(i=>{const t=new f(i.bitmapData);t.x=i.extent.xmin,t.y=i.extent.ymax,t.resolution=i.extent.width/i.bitmapData.width,t.rotation=e.rotation,this._mapImageContainer.addChild(t),this._bitmapIndex.set(e,t)})}async _getViewDependentUrl(e,t){const{viewFormat:s,viewBoundScale:a,httpQuery:o}=e;if(null!=s){if(null==t)throw new Error("Loading this network link requires a view state.");let n;if(await m(),null!=a&&1!==a){const e=new p(t.extent);e.expand(a),n=e}else n=t.extent;n=c(n,d.WGS84);const h=c(n,d.WebMercator),y=n.xmin,g=n.xmax,w=n.ymin,u=n.ymax,V=t.size[0]*t.pixelRatio,f=t.size[1]*t.pixelRatio,b=Math.max(h.width,h.height),v={"[bboxWest]":y.toString(),"[bboxEast]":g.toString(),"[bboxSouth]":w.toString(),"[bboxNorth]":u.toString(),"[lookatLon]":n.center.x.toString(),"[lookatLat]":n.center.y.toString(),"[lookatRange]":b.toString(),"[lookatTilt]":"0","[lookatHeading]":t.rotation.toString(),"[lookatTerrainLon]":n.center.x.toString(),"[lookatTerrainLat]":n.center.y.toString(),"[lookatTerrainAlt]":"0","[cameraLon]":n.center.x.toString(),"[cameraLat]":n.center.y.toString(),"[cameraAlt]":b.toString(),"[horizFov]":"60","[vertFov]":"60","[horizPixels]":V.toString(),"[vertPixels]":f.toString(),"[terrainEnabled]":"0","[clientVersion]":i,"[kmlVersion]":"2.2","[clientName]":"ArcGIS API for JavaScript","[language]":"en-US"},S=e=>{for(const i in e){let t;for(t in v)e[i]=e[i].replace(t,v[t])}},x=l(s);S(x);let C={};null!=o&&(C=l(o),S(C));const I=_(e.href);I.query={...I.query,...x,...C};return`${I.path}?${r(x)}`}return e.href}async _fetchService(e){const i=new j;await this._loadVisualData(this.layer.url,i,e),this._kmlVisualData=i,this._refreshCollections()}_refreshCollections(){this.allVisiblePoints.removeAll(),this.allVisiblePolylines.removeAll(),this.allVisiblePolygons.removeAll(),this.allVisibleMapImages.removeAll();const e=(e,i)=>{e.addMany(i.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e))};e(this.allVisiblePoints,this._kmlVisualData.allPoints),e(this.allVisiblePolylines,this._kmlVisualData.allPolylines),e(this.allVisiblePolygons,this._kmlVisualData.allPolygons),this.allVisibleMapImages.addMany(this._kmlVisualData.allMapImages.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e))}_isSublayerVisible(e){const i=this._kmlVisualData.allSublayers.get(e);return!!i?.visibility&&(-1===i.parentFolderId||this._isSublayerVisible(i.parentFolderId))}_loadVisualData(e,i,t){return this._fetchParsedKML(e,t).then(async e=>{for(const s of e.sublayers){i.allSublayers.set(s.id,s);const e=await g(s,"points",this.layer,s.id),a=await g(s,"polylines",this.layer,s.id),o=await g(s,"polygons",this.layer,s.id),l=s.mapImages?.map(e=>y.fromJSON(e))??[];if(i.allPoints.push(...e.map(e=>({item:e,sublayerId:s.id}))),i.allPolylines.push(...a.map(e=>({item:e,sublayerId:s.id}))),i.allPolygons.push(...o.map(e=>({item:e,sublayerId:s.id}))),i.allMapImages.push(...l.map(e=>({item:e,sublayerId:s.id}))),s.networkLink){const e=await this._getViewDependentUrl(s.networkLink,this.view.state);await this._loadVisualData(e,i,t)}}})}_fetchParsedKML(e,i){return w(e,this.layer.spatialReference,this.layer.refreshInterval,i).then(e=>u(e.data))}_removeMapImage(e){const i=this._bitmapIndex.get(e);i&&(this._mapImageContainer.removeChild(i),this._bitmapIndex.delete(e))}};e([n()],k.prototype,"_pointsView",void 0),e([n()],k.prototype,"_polylinesView",void 0),e([n()],k.prototype,"_polygonsView",void 0),k=e([h("esri.views.2d.layers.KMLLayerView2D")],k);const P=k;export{P as default};