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

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 (289) hide show
  1. package/analysis/ElevationProfile/ElevationProfileGroundLine.d.ts +4 -0
  2. package/analysis/ElevationProfile/ElevationProfileGroundLine.js +5 -0
  3. package/analysis/ElevationProfile/ElevationProfileInputLine.d.ts +4 -0
  4. package/analysis/ElevationProfile/ElevationProfileInputLine.js +5 -0
  5. package/analysis/ElevationProfile/ElevationProfileLine.d.ts +4 -0
  6. package/analysis/ElevationProfile/ElevationProfileLine.js +5 -0
  7. package/analysis/ElevationProfile/ElevationProfileLineChartOptions.d.ts +4 -0
  8. package/analysis/ElevationProfile/{LineChartOptions.js → ElevationProfileLineChartOptions.js} +1 -1
  9. package/analysis/ElevationProfile/ElevationProfileLineViewOptions.d.ts +4 -0
  10. package/analysis/ElevationProfile/{LineViewOptions.js → ElevationProfileLineViewOptions.js} +1 -1
  11. package/analysis/ElevationProfile/ElevationProfileQueryLine.d.ts +4 -0
  12. package/analysis/ElevationProfile/ElevationProfileQueryLine.js +5 -0
  13. package/analysis/ElevationProfile/ElevationProfileSceneLine.d.ts +4 -0
  14. package/analysis/ElevationProfile/ElevationProfileSceneLine.js +5 -0
  15. package/analysis/ElevationProfile/ElevationProfileUnits.d.ts +4 -0
  16. package/analysis/ElevationProfile/{Units.js → ElevationProfileUnits.js} +1 -1
  17. package/analysis/ElevationProfile/ElevationProfileViewOptions.d.ts +4 -0
  18. package/analysis/ElevationProfile/{ViewOptions.js → ElevationProfileViewOptions.js} +1 -1
  19. package/analysis/ElevationProfile/elevationProfileLineTypes.js +1 -1
  20. package/analysis/ElevationProfileAnalysis.js +1 -1
  21. package/applications/KnowledgeStudio/resourceSerializationUtils.js +1 -1
  22. package/assets/esri/core/workers/RemoteClient.js +1 -1
  23. package/assets/esri/core/workers/chunks/01e8b9dc77a57d1c2a52.js +1 -0
  24. package/assets/esri/core/workers/chunks/027cfcde29fe87aa2ffe.js +1 -0
  25. package/assets/esri/core/workers/chunks/18ceea59e469a0f2721b.js +1 -0
  26. package/assets/esri/core/workers/chunks/199a17b0a0f75cbaed16.js +1 -0
  27. package/assets/esri/core/workers/chunks/1eee7cf11df01a52c1bf.js +1 -0
  28. package/assets/esri/core/workers/chunks/{ac41b882f9cbf8d56f0c.js → 222f981e876f60ae282f.js} +1 -1
  29. package/assets/esri/core/workers/chunks/22334a464f798b5279b2.js +1 -0
  30. package/assets/esri/core/workers/chunks/{99b9392946d776a62997.js → 23e600e368ac829680b5.js} +1 -1
  31. package/assets/esri/core/workers/chunks/24ac204d8a045aa821be.js +1 -0
  32. package/assets/esri/core/workers/chunks/252ee00fd6c4ae0ee7fa.js +1 -0
  33. package/assets/esri/core/workers/chunks/27197b0a2ffb2b6104ea.js +1 -0
  34. package/assets/esri/core/workers/chunks/{93af38d29d066f27ed28.js → 2cb14d040e67a261b31c.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{0021118bafefd1e47ff7.js → 31c088966ccfff2ea1db.js} +1 -1
  36. package/assets/esri/core/workers/chunks/3b51b61a7b8a1ef87c9b.js +1 -0
  37. package/assets/esri/core/workers/chunks/3d800fbc449bea18b1cd.js +1 -0
  38. package/assets/esri/core/workers/chunks/4874aabdb5c60ca66216.js +1 -0
  39. package/assets/esri/core/workers/chunks/4d2473e680324dc17cfa.js +1 -0
  40. package/assets/esri/core/workers/chunks/{2da12a64d3baef4aaaa1.js → 4f8dab492331c9a2d67a.js} +1 -1
  41. package/assets/esri/core/workers/chunks/527557b603400189d49a.js +1 -0
  42. package/assets/esri/core/workers/chunks/{4bd92232928b832dea76.js → 5900dde7a201a7d47469.js} +1 -1
  43. package/assets/esri/core/workers/chunks/62ade6f18b375795ddfd.js +1 -0
  44. package/assets/esri/core/workers/chunks/63f3e46bfa820436161c.js +1 -0
  45. package/assets/esri/core/workers/chunks/{b0ee061747bef6729bb9.js → 6801b92bce7a918fda6f.js} +1 -1
  46. package/assets/esri/core/workers/chunks/6940bb6524938894a246.js +1 -0
  47. package/assets/esri/core/workers/chunks/6b11476b2004b4db576e.js +1 -0
  48. package/assets/esri/core/workers/chunks/71cac356874b36f9a383.js +1 -0
  49. package/assets/esri/core/workers/chunks/{69dc5a7abc1fda2474ad.js → 722931d1a60be461e521.js} +1 -1
  50. package/assets/esri/core/workers/chunks/79ab06fb4c91ac8da323.js +1 -0
  51. package/assets/esri/core/workers/chunks/{0a4357af5b8c0532b439.js → 7bdfc7c7ce1d94c00745.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{0ce671588de2858516d2.js → 83737d86584bf1b32368.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{98ea12c7a000a30f3dc0.js → 87f68c2b9361bd3f8cac.js} +1 -1
  54. package/assets/esri/core/workers/chunks/97ae2fdb6cb98249f5fa.js +1 -0
  55. package/assets/esri/core/workers/chunks/9a20390602126995f831.js +1 -0
  56. package/assets/esri/core/workers/chunks/9cdeead9d444e8d95477.js +1 -0
  57. package/assets/esri/core/workers/chunks/a778a72456fefdf40115.js +1 -0
  58. package/assets/esri/core/workers/chunks/a999f804fc2f00b2e7ae.js +1 -0
  59. package/assets/esri/core/workers/chunks/ae73ac81bd10614c2b53.js +1 -0
  60. package/assets/esri/core/workers/chunks/c7d4c296011c5393bcaa.js +1 -0
  61. package/assets/esri/core/workers/chunks/c86e339e45900c54c9f5.js +1 -0
  62. package/assets/esri/core/workers/chunks/{a1d3f1c221389eb6090c.js → c95e6bef8c97cf647869.js} +1 -1
  63. package/assets/esri/core/workers/chunks/cbec768cd98caff212f2.js +1 -0
  64. package/assets/esri/core/workers/chunks/d81c4afad4abe2d1d0b9.js +1 -0
  65. package/assets/esri/core/workers/chunks/dfb12f42b8d319ffa5fc.js +1 -0
  66. package/assets/esri/core/workers/chunks/e04951ee32f041faaeca.js +1 -0
  67. package/assets/esri/core/workers/chunks/e982cf44906eb26164f2.js +1 -0
  68. package/assets/esri/core/workers/chunks/{081b22fa73ef7b696409.js → ead1acf95c3385630da8.js} +2 -2
  69. package/assets/esri/core/workers/chunks/f1c50f37a81c672263a1.js +1 -0
  70. package/assets/esri/core/workers/chunks/fe5c37c69da3ec1e56ac.js +1 -0
  71. package/assets/esri/core/workers/chunks/ff323db554c9e09749e8.js +1 -0
  72. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  73. package/chunks/Laserlines.glsl.js +1 -1
  74. package/chunks/LineSeries.js +1 -1
  75. package/chunks/Theme.js +1 -1
  76. package/chunks/boundedPlane.js +1 -1
  77. package/chunks/bundle.js +1 -1
  78. package/chunks/chartUtilsAm5.js +1 -1
  79. package/chunks/sphere.js +1 -1
  80. package/chunks/vec42.js +1 -1
  81. package/config.js +1 -1
  82. package/core/ArrayPool.js +1 -1
  83. package/core/Collection.js +1 -1
  84. package/core/ObjectPool.js +1 -1
  85. package/core/accessorSupport/Properties.js +1 -1
  86. package/core/accessorSupport/watch.js +1 -1
  87. package/core/arrayUtils.js +1 -1
  88. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  89. package/core/libs/gl-matrix-2/math/vec4.js +1 -1
  90. package/core/pbf.js +1 -1
  91. package/core/typedArrayUtil.js +1 -1
  92. package/geohash/GeohashCell.js +1 -1
  93. package/geohash/GeohashTree.js +1 -1
  94. package/geometry/support/DoubleArray.js +1 -1
  95. package/geometry/support/boundedPlane.js +1 -1
  96. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  97. package/geometry/support/sphere.js +1 -1
  98. package/interfaces.d.ts +141 -139
  99. package/kernel.js +1 -1
  100. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  101. package/layers/graphics/sources/ParquetSource.js +1 -1
  102. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  103. package/package.json +1 -1
  104. package/rest/knowledgeGraphService.js +1 -1
  105. package/support/revision.js +1 -1
  106. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  107. package/views/2d/engine/Container.js +1 -1
  108. package/views/2d/engine/DisplayObject.js +1 -1
  109. package/views/2d/engine/flow/dataUtils.js +1 -1
  110. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  111. package/views/2d/engine/webgl/DisplayEntity.js +1 -1
  112. package/views/2d/engine/webgl/DisplayRecord.js +1 -1
  113. package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
  114. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  115. package/views/2d/engine/webgl/PooledUint32Array.js +1 -1
  116. package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
  117. package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
  118. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  119. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  120. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  121. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  122. package/views/2d/layers/features/FeatureContainer.js +1 -1
  123. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  124. package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
  125. package/views/2d/layers/features/FeatureSpatialIndex.js +1 -1
  126. package/views/2d/layers/features/Processor.js +1 -1
  127. package/views/2d/layers/features/RenderState.js +1 -1
  128. package/views/2d/layers/features/aggregation/AccumulatedStatistics.js +1 -1
  129. package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
  130. package/views/2d/layers/features/aggregation/GridCell.js +1 -1
  131. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  132. package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
  133. package/views/2d/layers/features/schema/processor/LabelMatcherSchema.js +1 -1
  134. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  135. package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
  136. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  137. package/views/2d/layers/features/sources/strategies/chunks/ASourceChunk.js +1 -1
  138. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  139. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  140. package/views/2d/layers/features/support/DisplayIdGenerator.js +1 -1
  141. package/views/2d/layers/features/support/FeatureSetCache.js +1 -1
  142. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  143. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  144. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  145. package/views/2d/layers/features/support/StaticBitSet.js +1 -1
  146. package/views/2d/tiling/TileCoverage.js +1 -1
  147. package/views/2d/tiling/TileKey.js +1 -1
  148. package/views/3d/FocusAreasView.js +1 -1
  149. package/views/3d/analysis/ElevationProfile/{HoveredPointVisualization.js → ElevationProfileHoveredPointVisualization.js} +1 -1
  150. package/views/3d/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +5 -0
  151. package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization.js +5 -0
  152. package/views/3d/analysis/ElevationProfile/ElevationProfileLinesVisualization.js +5 -0
  153. package/views/3d/analysis/ElevationProfile/ElevationProfileSceneLineComputation.js +5 -0
  154. package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization.js +5 -0
  155. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  156. package/views/3d/analysis/Slice/SliceController.js +1 -1
  157. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  158. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  159. package/views/3d/camera/constraintUtils/distance.js +1 -1
  160. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
  161. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  162. package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
  163. package/views/3d/layers/I3SMeshView3D.js +1 -1
  164. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  165. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  166. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  167. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  168. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  169. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  170. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  171. package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
  172. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  173. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  174. package/views/3d/layers/i3s/I3SNode.js +1 -1
  175. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  176. package/views/3d/state/ViewState.js +1 -1
  177. package/views/3d/state/ViewStateManager.js +1 -1
  178. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  179. package/views/3d/support/ViewSlice.js +1 -1
  180. package/views/3d/support/orientedBoundingBox.js +1 -1
  181. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  182. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  183. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  184. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  185. package/views/3d/terrain/ScaleRangeQueries.js +1 -1
  186. package/views/3d/terrain/SphericalPatch.js +1 -1
  187. package/views/3d/terrain/TerrainRenderer.js +1 -1
  188. package/views/3d/terrain/TerrainSurface.js +1 -1
  189. package/views/3d/terrain/Tile.js +1 -1
  190. package/views/3d/terrain/TilePerLayerInfo.js +1 -1
  191. package/views/3d/webgl-engine/core/material/MaterialBase.js +1 -1
  192. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  193. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  194. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  195. package/views/3d/webgl-engine/lib/SliceHelper.js +1 -1
  196. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  197. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  198. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  199. package/views/3d/webgl-engine/lib/lodRendering/InstanceOctree.js +1 -1
  200. package/views/3d/webgl-engine/lib/octreeUtils.js +1 -1
  201. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  202. package/views/analysis/ElevationProfile/ElevationProfileController.js +5 -0
  203. package/views/analysis/ElevationProfile/{ProfileGenerationError.js → ElevationProfileGenerationError.js} +1 -1
  204. package/views/analysis/ElevationProfile/ElevationProfileGroundLineComputation.js +5 -0
  205. package/views/analysis/ElevationProfile/ElevationProfileInputLineComputation.js +5 -0
  206. package/views/analysis/ElevationProfile/ElevationProfileLineComputation.js +5 -0
  207. package/views/analysis/ElevationProfile/ElevationProfileQueryLineComputation.js +5 -0
  208. package/views/analysis/ElevationProfile/ElevationProfileResult.d.ts +4 -0
  209. package/views/analysis/ElevationProfile/ElevationProfileResult.js +5 -0
  210. package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +5 -0
  211. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +5 -0
  212. package/views/input/InputManager.js +1 -1
  213. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  214. package/views/interactive/sketch/constraints.js +1 -1
  215. package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
  216. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  217. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  218. package/views/layers/FeatureLayerView.js +1 -1
  219. package/views/support/PropertiesPool.js +1 -1
  220. package/widgets/ElevationProfile/ElevationProfileLine.d.ts +2 -2
  221. package/analysis/ElevationProfile/GroundLine.d.ts +0 -4
  222. package/analysis/ElevationProfile/GroundLine.js +0 -5
  223. package/analysis/ElevationProfile/InputLine.d.ts +0 -4
  224. package/analysis/ElevationProfile/InputLine.js +0 -5
  225. package/analysis/ElevationProfile/Line.d.ts +0 -4
  226. package/analysis/ElevationProfile/Line.js +0 -5
  227. package/analysis/ElevationProfile/LineChartOptions.d.ts +0 -4
  228. package/analysis/ElevationProfile/LineViewOptions.d.ts +0 -4
  229. package/analysis/ElevationProfile/QueryLine.d.ts +0 -4
  230. package/analysis/ElevationProfile/QueryLine.js +0 -5
  231. package/analysis/ElevationProfile/SceneLine.d.ts +0 -4
  232. package/analysis/ElevationProfile/SceneLine.js +0 -5
  233. package/analysis/ElevationProfile/Units.d.ts +0 -4
  234. package/analysis/ElevationProfile/ViewOptions.d.ts +0 -4
  235. package/assets/esri/core/workers/chunks/14c6ae4feb4859cfa7c5.js +0 -1
  236. package/assets/esri/core/workers/chunks/20a2b3d1f826e9059884.js +0 -1
  237. package/assets/esri/core/workers/chunks/250b1629becca0410f2a.js +0 -1
  238. package/assets/esri/core/workers/chunks/2efa4d8fe5454f8b2a05.js +0 -1
  239. package/assets/esri/core/workers/chunks/3149a86cd25684dcb0b3.js +0 -1
  240. package/assets/esri/core/workers/chunks/38f84294fb2fb4663ba5.js +0 -1
  241. package/assets/esri/core/workers/chunks/3eb3af0b6cf3c2f28131.js +0 -1
  242. package/assets/esri/core/workers/chunks/43bd338bb0de375b9bb7.js +0 -1
  243. package/assets/esri/core/workers/chunks/4622a3e64d3c4aafa56b.js +0 -1
  244. package/assets/esri/core/workers/chunks/47f2e905ef42e36897aa.js +0 -1
  245. package/assets/esri/core/workers/chunks/50e9eafb118d2a221f10.js +0 -1
  246. package/assets/esri/core/workers/chunks/55588e668b6acb6aa390.js +0 -1
  247. package/assets/esri/core/workers/chunks/5b112471dca94b2e8462.js +0 -1
  248. package/assets/esri/core/workers/chunks/5dfe1aed10095385c066.js +0 -1
  249. package/assets/esri/core/workers/chunks/5fc414fc2cfc68828c5b.js +0 -1
  250. package/assets/esri/core/workers/chunks/7389841fabe0f319f1e5.js +0 -1
  251. package/assets/esri/core/workers/chunks/8e0559cc6295008fcdf7.js +0 -1
  252. package/assets/esri/core/workers/chunks/944fa8261aad94ae0542.js +0 -1
  253. package/assets/esri/core/workers/chunks/9639a6f6fab52a501bf7.js +0 -1
  254. package/assets/esri/core/workers/chunks/9e479e7e2e51476c3d27.js +0 -1
  255. package/assets/esri/core/workers/chunks/a1e179dd6de9c8769b02.js +0 -1
  256. package/assets/esri/core/workers/chunks/a6493607b98783bf1ef2.js +0 -1
  257. package/assets/esri/core/workers/chunks/a829969ed44cdb814f27.js +0 -1
  258. package/assets/esri/core/workers/chunks/b2a035befeeff1a55ad8.js +0 -1
  259. package/assets/esri/core/workers/chunks/b4251e10621fb3ad03a3.js +0 -1
  260. package/assets/esri/core/workers/chunks/b9f5672093727c6f92c9.js +0 -1
  261. package/assets/esri/core/workers/chunks/ba45dccb4dab5a74d224.js +0 -1
  262. package/assets/esri/core/workers/chunks/cda27c0fafd687dfa72e.js +0 -1
  263. package/assets/esri/core/workers/chunks/ddd6597a66ec6b972f9c.js +0 -1
  264. package/assets/esri/core/workers/chunks/e28d3ed65c3a76a044c8.js +0 -1
  265. package/assets/esri/core/workers/chunks/e3f68f7b408a08d7cd5d.js +0 -1
  266. package/assets/esri/core/workers/chunks/e9716995ce0c3683eafc.js +0 -1
  267. package/assets/esri/core/workers/chunks/ed25bf087f52e5d3e71b.js +0 -1
  268. package/assets/esri/core/workers/chunks/ee0286b5f5475f2d853f.js +0 -1
  269. package/assets/esri/core/workers/chunks/f8505bf69795f5293a79.js +0 -1
  270. package/assets/esri/core/workers/chunks/f92e608931b1c168cb45.js +0 -1
  271. package/views/3d/analysis/ElevationProfile/HoveredPointsVisualization.js +0 -5
  272. package/views/3d/analysis/ElevationProfile/InputVisualization.js +0 -5
  273. package/views/3d/analysis/ElevationProfile/ProfileLinesVisualization.js +0 -5
  274. package/views/3d/analysis/ElevationProfile/SceneLineComputation.js +0 -5
  275. package/views/3d/analysis/ElevationProfile/Visualization.js +0 -5
  276. package/views/analysis/ElevationProfile/Controller.js +0 -5
  277. package/views/analysis/ElevationProfile/GroundLineComputation.js +0 -5
  278. package/views/analysis/ElevationProfile/InputLineComputation.js +0 -5
  279. package/views/analysis/ElevationProfile/LineComputation.js +0 -5
  280. package/views/analysis/ElevationProfile/QueryLineComputation.js +0 -5
  281. package/views/analysis/ElevationProfile/Result.d.ts +0 -4
  282. package/views/analysis/ElevationProfile/Result.js +0 -5
  283. package/views/analysis/ElevationProfile/geometryUtils.js +0 -5
  284. package/views/analysis/ElevationProfile/profileGenerationUtils.js +0 -5
  285. /package/views/analysis/ElevationProfile/{elevationQuerySourceUtils.js → elevationProfileQuerySourceUtils.js} +0 -0
  286. /package/views/analysis/ElevationProfile/{statisticsUtils.js → elevationProfileStatisticsUtils.js} +0 -0
  287. /package/views/analysis/ElevationProfile/{traversalUtils.js → elevationProfileTraversalUtils.js} +0 -0
  288. /package/views/analysis/ElevationProfile/{unitUtils.js → elevationProfileUnitUtils.js} +0 -0
  289. /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
- import has from"../../../../core/has.js";import t from"../../../../core/Logger.js";import{deg2rad as e}from"../../../../core/mathUtils.js";import{throwIfAborted as n}from"../../../../core/promiseUtils.js";import r from"../../../../core/RandomLCG.js";import o from"../../../../geometry/Extent.js";import{getInfo as l}from"../../../../geometry/support/spatialReferenceUtils.js";const i=()=>t.getLogger("esri.views.2d.engine.flow.dataUtils"),a=10;async function s(t,e,r,o){const l=performance.now(),s=c(e,r),f=performance.now(),h=u(e,s,r.width,r.height),p=performance.now(),g=m(h,!0),y=performance.now(),x="Streamlines"===t?d(g,a):w(g),M=performance.now();return has("esri-2d-profiler")&&(i().info("I.1","_createFlowFieldFromData (ms)",Math.round(f-l)),i().info("I.2","_getStreamlines (ms)",Math.round(p-f)),i().info("I.3","createAnimatedLinesData (ms)",Math.round(y-p)),i().info("I.4","create{Streamlines|Particles}Mesh (ms)",Math.round(M-y)),i().info("I.5","createFlowMesh (ms)",Math.round(M-l)),i().info("I.6","Mesh size (bytes)",x.vertexData.buffer.byteLength+x.indexData.buffer.byteLength)),await Promise.resolve(),n(o),x}function c(t,e){const n=h(e.data,e.width,e.height,t.smoothing);if(t.interpolate){return(t,r)=>{const o=Math.floor(t),l=Math.floor(r);if(o<0||o>=e.width)return[0,0];if(l<0||l>=e.height)return[0,0];const i=t-o,a=r-l,s=o,c=l,f=o<e.width-1?o+1:o,u=l<e.height-1?l+1:l,h=n[2*(c*e.width+s)],m=n[2*(c*e.width+f)],d=n[2*(u*e.width+s)],w=n[2*(u*e.width+f)],p=n[2*(c*e.width+s)+1],g=n[2*(c*e.width+f)+1];return[(h*(1-a)+d*a)*(1-i)+(m*(1-a)+w*a)*i,(p*(1-a)+n[2*(u*e.width+s)+1]*a)*(1-i)+(g*(1-a)+n[2*(u*e.width+f)+1]*a)*i]}}return(t,r)=>{const o=Math.round(t),l=Math.round(r);return o<0||o>=e.width||l<0||l>=e.height?[0,0]:[n[2*(l*e.width+o)],n[2*(l*e.width+o)+1]]}}function f(t,e,n,r,o,l,i,a,s){const c=[];let f=n,u=r,h=0,[m,d]=e(f,u);m*=t.velocityScale,d*=t.velocityScale;const w=Math.sqrt(m*m+d*d);let p,g;c.push({x:f,y:u,t:h,speed:w});for(let y=0;y<t.verticesPerLine;y++){let[n,r]=e(f,u);n*=t.velocityScale,r*=t.velocityScale;const m=Math.sqrt(n*n+r*r);if(m<t.minSpeedThreshold)return c;const d=n/m,w=r/m;f+=d*t.segmentLength,u+=w*t.segmentLength;if(h+=t.segmentLength/m,Math.acos(d*p+w*g)>t.maxTurnAngle)return c;if(t.collisions){const t=Math.round(f*s),e=Math.round(u*s);if(t<0||t>i-1||e<0||e>a-1)return c;const n=l[e*i+t];if(-1!==n&&n!==o)return c;l[e*i+t]=o}c.push({x:f,y:u,t:h,speed:m}),p=d,g=w}return c}function u(t,e,n,o){const l=[],i=new r,a=1/Math.max(t.lineCollisionWidth,1),s=Math.round(n*a),c=Math.round(o*a),u=new Int32Array(s*c);for(let r=0;r<u.length;r++)u[r]=-1;const h=[];for(let r=0;r<o;r+=t.lineSpacing)for(let e=0;e<n;e+=t.lineSpacing)h.push({x:e,y:r,sort:i.getFloat()});h.sort((t,e)=>t.sort-e.sort);for(const{x:r,y:m}of h)if(i.getFloat()<t.density){const n=f(t,e,r,m,l.length,u,s,c,a);if(n.length<2)continue;l.push(n)}return l}function h(t,e,n,r){if(0===r)return t;const o=Math.round(3*r),l=new Array(2*o+1);let i=0;for(let c=-o;c<=o;c++){const t=Math.exp(-c*c/(r*r));l[c+o]=t,i+=t}for(let c=-o;c<=o;c++)l[c+o]/=i;const a=new Float32Array(t.length);for(let c=0;c<n;c++)for(let n=0;n<e;n++){let r=0,i=0;for(let a=-o;a<=o;a++){if(n+a<0||n+a>=e)continue;const s=l[a+o];r+=s*t[2*(c*e+(n+a))],i+=s*t[2*(c*e+(n+a))+1]}a[2*(c*e+n)]=r,a[2*(c*e+n)+1]=i}const s=new Float32Array(t.length);for(let c=0;c<e;c++)for(let t=0;t<n;t++){let r=0,i=0;for(let s=-o;s<=o;s++){if(t+s<0||t+s>=n)continue;const f=l[s+o];r+=f*a[2*((t+s)*e+c)],i+=f*a[2*((t+s)*e+c)+1]}s[2*(t*e+c)]=r,s[2*(t*e+c)+1]=i}return s}function m(t,e){const n=new r,o=t.reduce((t,e)=>t+e.length,0),l=new Float32Array(4*o),i=new Array(t.length);let a=0,s=0;for(const r of t){const t=a;for(const e of r)l[4*a]=e.x,l[4*a+1]=e.y,l[4*a+2]=e.t,l[4*a+3]=e.speed,a++;i[s++]={startVertex:t,numberOfVertices:r.length,totalTime:r[r.length-1].t,timeSeed:e?n.getFloat():0}}return{lineVertices:l,lineDescriptors:i}}function d(t,e){const n=9,{lineVertices:r,lineDescriptors:o}=t;let l=0,i=0;for(const m of o){l+=2*m.numberOfVertices;i+=6*(m.numberOfVertices-1)}const a=new Float32Array(l*n),s=new Uint32Array(i);let c=0,f=0;function u(){s[f++]=c-2,s[f++]=c,s[f++]=c-1,s[f++]=c,s[f++]=c+1,s[f++]=c-1}function h(t,e,r,o,l,i,s,f){const u=c*n;let h=0;a[u+h++]=t,a[u+h++]=e,a[u+h++]=1,a[u+h++]=r,a[u+h++]=i,a[u+h++]=s,a[u+h++]=o/2,a[u+h++]=l/2,a[u+h++]=f,c++,a[u+h++]=t,a[u+h++]=e,a[u+h++]=-1,a[u+h++]=r,a[u+h++]=i,a[u+h++]=s,a[u+h++]=-o/2,a[u+h++]=-l/2,a[u+h++]=f,c++}for(const m of o){const{totalTime:t,timeSeed:n}=m;let o=null,l=null,i=null,a=null,s=null,c=null;for(let f=0;f<m.numberOfVertices;f++){const d=r[4*(m.startVertex+f)],w=r[4*(m.startVertex+f)+1],p=r[4*(m.startVertex+f)+2],g=r[4*(m.startVertex+f)+3];let y=null,x=null,M=null,A=null;if(f>0){y=d-o,x=w-l;const r=Math.sqrt(y*y+x*x);if(y/=r,x/=r,f>1){let t=y+s,n=x+c;const r=Math.sqrt(t*t+n*n);t/=r,n/=r;const o=Math.min(1/(t*y+n*x),e);t*=o,n*=o,M=-n,A=t}else M=-x,A=y;null!==M&&null!==A&&(h(o,l,i,M,A,t,n,g),u())}o=d,l=w,i=p,s=y,c=x,a=g}h(o,l,i,-c,s,t,n,a)}return{vertexData:a,indexData:s}}function w(t){const e=16,n=1,r=2,{lineVertices:o,lineDescriptors:l}=t;let i=0,a=0;for(const U of l){const t=U.numberOfVertices-1;i+=4*t*2,a+=6*t*2}const s=new Float32Array(i*e),c=new Uint32Array(a);let f,u,h,m,d,w,p,g,y,x,M,A,I,V,F=0,v=0;function D(){c[v++]=F-8,c[v++]=F-7,c[v++]=F-6,c[v++]=F-7,c[v++]=F-5,c[v++]=F-6,c[v++]=F-4,c[v++]=F-3,c[v++]=F-2,c[v++]=F-3,c[v++]=F-1,c[v++]=F-2}function b(t,o,l,i,a,c,f,u,h,m,d,w,p,g){const y=F*e;let x=0;for(const e of[n,r])for(const n of[1,2,3,4])s[y+x++]=t,s[y+x++]=o,s[y+x++]=l,s[y+x++]=i,s[y+x++]=f,s[y+x++]=u,s[y+x++]=h,s[y+x++]=m,s[y+x++]=e,s[y+x++]=n,s[y+x++]=p,s[y+x++]=g,s[y+x++]=a/2,s[y+x++]=c/2,s[y+x++]=d/2,s[y+x++]=w/2,F++}function S(t,e){let n=y+M,r=x+A;const o=Math.sqrt(n*n+r*r);n/=o,r/=o;const l=y*n+x*r;n/=l,r/=l;let i=M+I,a=A+V;const s=Math.sqrt(i*i+a*a);i/=s,a/=s;const c=M*i+A*a;i/=c,a/=c,b(f,u,h,m,-r,n,d,w,p,g,-a,i,t,e),D()}function k(t,e,n,r,o,l){if(y=M,x=A,M=I,A=V,null==y&&null==x&&(y=M,x=A),null!=d&&null!=w){I=t-d,V=e-w;const n=Math.sqrt(I*I+V*V);I/=n,V/=n}null!=y&&null!=x&&S(o,l),f=d,u=w,h=p,m=g,d=t,w=e,p=n,g=r}function L(t,e){y=M,x=A,M=I,A=V,null==y&&null==x&&(y=M,x=A),null!=y&&null!=x&&S(t,e)}for(const U of l){f=null,u=null,h=null,m=null,d=null,w=null,p=null,g=null,y=null,x=null,M=null,A=null,I=null,V=null;const{totalTime:t,timeSeed:e}=U;for(let n=0;n<U.numberOfVertices;n++){k(o[4*(U.startVertex+n)],o[4*(U.startVertex+n)+1],o[4*(U.startVertex+n)+2],o[4*(U.startVertex+n)+3],t,e)}L(t,e)}return{vertexData:s,indexData:c}}function p(t,n){const r=n.pixels,{width:o,height:l}=n,i=new Float32Array(o*l*2),a=n.mask||new Uint8Array(o*l*2);if(n.mask||a.fill(255),"vector-uv"===t)for(let e=0;e<o*l;e++)i[2*e]=r[0][e],i[2*e+1]=-r[1][e];else if("vector-magdir"===t)for(let s=0;s<o*l;s++){const t=r[0][s],n=e(r[1][s]),o=Math.cos(n-Math.PI/2),l=Math.sin(n-Math.PI/2);i[2*s]=o*t,i[2*s+1]=l*t}return{data:i,mask:a,width:o,height:l}}async function g(t,e,n,r,a,s){const c=performance.now(),f=l(e.spatialReference);if(!f){const o=await y(t,e,n,r,a,s);return has("esri-2d-profiler")&&i().info("I.7","loadImagery, early exit (ms)",Math.round(performance.now()-c)),has("esri-2d-profiler")&&i().info("I.9","Number of parts",1),o}const[u,h]=f.valid,m=h-u,d=Math.ceil(e.width/m),w=e.width/d,p=Math.round(n/d);let g=e.xmin;const x=[],M=performance.now();for(let l=0;l<d;l++){const n=new o({xmin:g,xmax:g+w,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference});x.push(y(t,n,p,r,a,s)),g+=w}const A=await Promise.all(x);has("esri-2d-profiler")&&i().info("I.8","All calls to _fetchPart (ms)",Math.round(performance.now()-M)),has("esri-2d-profiler")&&i().info("I.9","Number of parts",A.length);const I={data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};let V=0;for(const o of A){for(let t=0;t<o.height;t++)for(let e=0;e<o.width;e++)V+e>=n||(I.data[2*(t*n+V+e)]=o.data[2*(t*o.width+e)],I.data[2*(t*n+V+e)+1]=o.data[2*(t*o.width+e)+1],I.mask[t*n+V+e]=o.mask[t*o.width+e]);V+=o.width}return has("esri-2d-profiler")&&i().info("I.10","loadImagery, general exit (ms)",Math.round(performance.now()-c)),I}async function y(t,e,n,r,o,l){const i={requestProjectedLocalDirections:!0,signal:l};if(null!=o&&(i.timeExtent=o),"imagery"===t.type){await t.load({signal:l});const o=await t.internalFetchImage(e,n,r,i);if(null==o?.pixelData?.pixelBlock)return{data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};return p(t.rasterInfo.dataType,o.pixelData.pixelBlock)}await t.load({signal:l});const a=await t.fetchPixels(e,n,r,i);if(null==a?.pixelBlock)return{data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};return p(t.serviceRasterInfo.dataType,a.pixelBlock)}export{m as createAnimatedLinesData,c as createFlowFieldFromData,s as createFlowMesh,w as createParticlesMesh,d as createStreamlinesMesh,u as getStreamlines,g as loadImagery,p as toFlowData};
5
+ import has from"../../../../core/has.js";import t from"../../../../core/Logger.js";import{deg2rad as e}from"../../../../core/mathUtils.js";import{throwIfAborted as n}from"../../../../core/promiseUtils.js";import r from"../../../../core/RandomLCG.js";import o from"../../../../geometry/Extent.js";import{getInfo as l}from"../../../../geometry/support/spatialReferenceUtils.js";const i=()=>t.getLogger("esri.views.2d.engine.flow.dataUtils"),a=10;async function s(t,e,r,o){const l=performance.now(),s=c(e,r),f=performance.now(),h=u(e,s,r.width,r.height),p=performance.now(),g=m(h,!0),y=performance.now(),x="Streamlines"===t?d(g,a):w(g),M=performance.now();return has("esri-2d-profiler")&&(i().info("I.1","_createFlowFieldFromData (ms)",Math.round(f-l)),i().info("I.2","_getStreamlines (ms)",Math.round(p-f)),i().info("I.3","createAnimatedLinesData (ms)",Math.round(y-p)),i().info("I.4","create{Streamlines|Particles}Mesh (ms)",Math.round(M-y)),i().info("I.5","createFlowMesh (ms)",Math.round(M-l)),i().info("I.6","Mesh size (bytes)",x.vertexData.buffer.byteLength+x.indexData.buffer.byteLength)),await Promise.resolve(),n(o),x}function c(t,e){const n=h(e.data,e.width,e.height,t.smoothing);if(t.interpolate){return(t,r)=>{const o=Math.floor(t),l=Math.floor(r);if(o<0||o>=e.width)return[0,0];if(l<0||l>=e.height)return[0,0];const i=t-o,a=r-l,s=o,c=l,f=o<e.width-1?o+1:o,u=l<e.height-1?l+1:l,h=n[2*(c*e.width+s)],m=n[2*(c*e.width+f)],d=n[2*(u*e.width+s)],w=n[2*(u*e.width+f)],p=n[2*(c*e.width+s)+1],g=n[2*(c*e.width+f)+1];return[(h*(1-a)+d*a)*(1-i)+(m*(1-a)+w*a)*i,(p*(1-a)+n[2*(u*e.width+s)+1]*a)*(1-i)+(g*(1-a)+n[2*(u*e.width+f)+1]*a)*i]}}return(t,r)=>{const o=Math.round(t),l=Math.round(r);return o<0||o>=e.width||l<0||l>=e.height?[0,0]:[n[2*(l*e.width+o)],n[2*(l*e.width+o)+1]]}}function f(t,e,n,r,o,l,i,a,s){const c=[];let f=n,u=r,h=0,[m,d]=e(f,u);m*=t.velocityScale,d*=t.velocityScale;const w=Math.sqrt(m*m+d*d);let p,g;c.push({x:f,y:u,t:h,speed:w});for(let y=0;y<t.verticesPerLine;y++){let[n,r]=e(f,u);n*=t.velocityScale,r*=t.velocityScale;const m=Math.sqrt(n*n+r*r);if(m<t.minSpeedThreshold)return c;const d=n/m,w=r/m;f+=d*t.segmentLength,u+=w*t.segmentLength;if(h+=t.segmentLength/m,Math.acos(d*p+w*g)>t.maxTurnAngle)return c;if(t.collisions){const t=Math.round(f*s),e=Math.round(u*s);if(t<0||t>i-1||e<0||e>a-1)return c;const n=l[e*i+t];if(-1!==n&&n!==o)return c;l[e*i+t]=o}c.push({x:f,y:u,t:h,speed:m}),p=d,g=w}return c}function u(t,e,n,o){const l=[],i=new r,a=1/Math.max(t.lineCollisionWidth,1),s=Math.round(n*a),c=Math.round(o*a),u=new Int32Array(s*c);for(let r=0;r<u.length;r++)u[r]=-1;const h=[];for(let r=0;r<o;r+=t.lineSpacing)for(let e=0;e<n;e+=t.lineSpacing)h.push({x:e,y:r,sort:i.getFloat()});h.sort((t,e)=>t.sort-e.sort);for(const{x:r,y:m}of h)if(i.getFloat()<t.density){const n=f(t,e,r,m,l.length,u,s,c,a);if(n.length<2)continue;l.push(n)}return l}function h(t,e,n,r){if(0===r)return t;const o=Math.round(3*r),l=new Array(2*o+1);let i=0;for(let c=-o;c<=o;c++){const t=Math.exp(-c*c/(r*r));l[c+o]=t,i+=t}for(let c=-o;c<=o;c++)l[c+o]/=i;const a=new Float32Array(t.length);for(let c=0;c<n;c++)for(let n=0;n<e;n++){let r=0,i=0;for(let a=-o;a<=o;a++){if(n+a<0||n+a>=e)continue;const s=l[a+o];r+=s*t[2*(c*e+(n+a))],i+=s*t[2*(c*e+(n+a))+1]}a[2*(c*e+n)]=r,a[2*(c*e+n)+1]=i}const s=new Float32Array(t.length);for(let c=0;c<e;c++)for(let t=0;t<n;t++){let r=0,i=0;for(let s=-o;s<=o;s++){if(t+s<0||t+s>=n)continue;const f=l[s+o];r+=f*a[2*((t+s)*e+c)],i+=f*a[2*((t+s)*e+c)+1]}s[2*(t*e+c)]=r,s[2*(t*e+c)+1]=i}return s}function m(t,e){const n=new r,o=t.reduce((t,e)=>t+e.length,0),l=new Float32Array(4*o),i=new Array(t.length);let a=0,s=0;for(const r of t){const t=a;for(const e of r)l[4*a]=e.x,l[4*a+1]=e.y,l[4*a+2]=e.t,l[4*a+3]=e.speed,a++;i[s++]={startVertex:t,numberOfVertices:r.length,totalTime:r[r.length-1].t,timeSeed:e?n.getFloat():0}}return{lineVertices:l,lineDescriptors:i}}function d(t,e){const n=9,{lineVertices:r,lineDescriptors:o}=t;let l=0,i=0;for(const m of o){l+=2*m.numberOfVertices;i+=6*(m.numberOfVertices-1)}const a=new Float32Array(l*n),s=new Uint32Array(i);let c=0,f=0;function u(){s[f++]=c-2,s[f++]=c,s[f++]=c-1,s[f++]=c,s[f++]=c+1,s[f++]=c-1}function h(t,e,r,o,l,i,s,f){const u=c*n;let h=0;a[u+h++]=t,a[u+h++]=e,a[u+h++]=1,a[u+h++]=r,a[u+h++]=i,a[u+h++]=s,a[u+h++]=o/2,a[u+h++]=l/2,a[u+h++]=f,c++,a[u+h++]=t,a[u+h++]=e,a[u+h++]=-1,a[u+h++]=r,a[u+h++]=i,a[u+h++]=s,a[u+h++]=-o/2,a[u+h++]=-l/2,a[u+h++]=f,c++}for(const m of o){const{totalTime:t,timeSeed:n}=m;let o=null,l=null,i=null,a=null,s=null,c=null;for(let f=0;f<m.numberOfVertices;f++){const d=r[4*(m.startVertex+f)],w=r[4*(m.startVertex+f)+1],p=r[4*(m.startVertex+f)+2],g=r[4*(m.startVertex+f)+3];let y=null,x=null,M=null,A=null;if(f>0){y=d-o,x=w-l;const r=Math.sqrt(y*y+x*x);if(y/=r,x/=r,f>1){let t=y+s,n=x+c;const r=Math.sqrt(t*t+n*n);t/=r,n/=r;const o=Math.min(1/(t*y+n*x),e);t*=o,n*=o,M=-n,A=t}else M=-x,A=y;null!==M&&null!==A&&(h(o,l,i,M,A,t,n,g),u())}o=d,l=w,i=p,s=y,c=x,a=g}h(o,l,i,-c,s,t,n,a)}return{vertexData:a,indexData:s}}function w(t){const e=16,n=1,r=2,{lineVertices:o,lineDescriptors:l}=t;let i=0,a=0;for(const U of l){const t=U.numberOfVertices-1;i+=4*t*2,a+=6*t*2}const s=new Float32Array(i*e),c=new Uint32Array(a);let f,u,h,m,d,w,p,g,y,x,M,A,I,V,F=0,v=0;function D(){c[v++]=F-8,c[v++]=F-7,c[v++]=F-6,c[v++]=F-7,c[v++]=F-5,c[v++]=F-6,c[v++]=F-4,c[v++]=F-3,c[v++]=F-2,c[v++]=F-3,c[v++]=F-1,c[v++]=F-2}function b(t,o,l,i,a,c,f,u,h,m,d,w,p,g){const y=F*e;let x=0;for(const e of[n,r])for(const n of[1,2,3,4])s[y+x++]=t,s[y+x++]=o,s[y+x++]=l,s[y+x++]=i,s[y+x++]=f,s[y+x++]=u,s[y+x++]=h,s[y+x++]=m,s[y+x++]=e,s[y+x++]=n,s[y+x++]=p,s[y+x++]=g,s[y+x++]=a/2,s[y+x++]=c/2,s[y+x++]=d/2,s[y+x++]=w/2,F++}function S(t,e){let n=y+M,r=x+A;const o=Math.sqrt(n*n+r*r);n/=o,r/=o;const l=y*n+x*r;n/=l,r/=l;let i=M+I,a=A+V;const s=Math.sqrt(i*i+a*a);i/=s,a/=s;const c=M*i+A*a;i/=c,a/=c,b(f,u,h,m,-r,n,d,w,p,g,-a,i,t,e),D()}function k(t,e,n,r,o,l){if(y=M,x=A,M=I,A=V,null==y&&null==x&&(y=M,x=A),null!=d&&null!=w){I=t-d,V=e-w;const n=Math.sqrt(I*I+V*V);I/=n,V/=n}null!=y&&null!=x&&S(o,l),f=d,u=w,h=p,m=g,d=t,w=e,p=n,g=r}function L(t,e){y=M,x=A,M=I,A=V,null==y&&null==x&&(y=M,x=A),null!=y&&null!=x&&S(t,e)}for(const U of l){f=null,u=null,h=null,m=null,d=null,w=null,p=null,g=null,y=null,x=null,M=null,A=null,I=null,V=null;const{totalTime:t,timeSeed:e}=U;for(let n=0;n<U.numberOfVertices;n++){k(o[4*(U.startVertex+n)],o[4*(U.startVertex+n)+1],o[4*(U.startVertex+n)+2],o[4*(U.startVertex+n)+3],t,e)}L(t,e)}return{vertexData:s,indexData:c}}function p(t,n){const r=n.pixels,{width:o,height:l}=n,i=new Float32Array(o*l*2),a=n.mask??new Uint8Array(o*l*2);if(n.mask||a.fill(255),"vector-uv"===t)for(let e=0;e<o*l;e++)i[2*e]=r[0][e],i[2*e+1]=-r[1][e];else if("vector-magdir"===t)for(let s=0;s<o*l;s++){const t=r[0][s],n=e(r[1][s]),o=Math.cos(n-Math.PI/2),l=Math.sin(n-Math.PI/2);i[2*s]=o*t,i[2*s+1]=l*t}return{data:i,mask:a,width:o,height:l}}async function g(t,e,n,r,a,s){const c=performance.now(),f=l(e.spatialReference);if(!f){const o=await y(t,e,n,r,a,s);return has("esri-2d-profiler")&&i().info("I.7","loadImagery, early exit (ms)",Math.round(performance.now()-c)),has("esri-2d-profiler")&&i().info("I.9","Number of parts",1),o}const[u,h]=f.valid,m=h-u,d=Math.ceil(e.width/m),w=e.width/d,p=Math.round(n/d);let g=e.xmin;const x=[],M=performance.now();for(let l=0;l<d;l++){const n=new o({xmin:g,xmax:g+w,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference});x.push(y(t,n,p,r,a,s)),g+=w}const A=await Promise.all(x);has("esri-2d-profiler")&&i().info("I.8","All calls to _fetchPart (ms)",Math.round(performance.now()-M)),has("esri-2d-profiler")&&i().info("I.9","Number of parts",A.length);const I={data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};let V=0;for(const o of A){for(let t=0;t<o.height;t++)for(let e=0;e<o.width;e++)V+e>=n||(I.data[2*(t*n+V+e)]=o.data[2*(t*o.width+e)],I.data[2*(t*n+V+e)+1]=o.data[2*(t*o.width+e)+1],I.mask[t*n+V+e]=o.mask[t*o.width+e]);V+=o.width}return has("esri-2d-profiler")&&i().info("I.10","loadImagery, general exit (ms)",Math.round(performance.now()-c)),I}async function y(t,e,n,r,o,l){const i={requestProjectedLocalDirections:!0,signal:l};if(null!=o&&(i.timeExtent=o),"imagery"===t.type){await t.load({signal:l});const o=await t.internalFetchImage(e,n,r,i);if(null==o?.pixelData?.pixelBlock)return{data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};return p(t.rasterInfo.dataType,o.pixelData.pixelBlock)}await t.load({signal:l});const a=await t.fetchPixels(e,n,r,i);if(null==a?.pixelBlock)return{data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};return p(t.serviceRasterInfo.dataType,a.pixelBlock)}export{m as createAnimatedLinesData,c as createFlowFieldFromData,s as createFlowMesh,w as createParticlesMesh,d as createStreamlinesMesh,u as getStreamlines,g as loadImagery,p as toFlowData};
@@ -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/Error.js";import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{dataDrivenUnit2 as i,dataDrivenUnit1 as s,dataDrivenUnit0 as r,visualVariableUnit as a,localTimeOriginUnit as n,gpgpuUnit as u,animationUnit as h,filterFlagsUnit as o}from"./definitions.js";import{getDisplayIdTexel as d}from"./DisplayId.js";import{getPixelArrayCtor as l,getPixelBytes as p}from"./Utils.js";import{FramebufferObject as g}from"../../../webgl/FramebufferObject.js";import{Texture as _}from"../../../webgl/Texture.js";import{TextureDescriptor as c}from"../../../webgl/TextureDescriptor.js";const x=()=>e.getLogger("esri.views.2d.engine.webgl.AttributeStoreView");class f{constructor(t,e,i){this._texture=null,this._lastTexture=null,this._fbos={},this.texelSize=4;const{buffer:s,pixelType:r,textureOnly:a}=t,n=l(r);this.blockIndex=i,this.pixelType=r,this.size=e,this.textureOnly=a,a||(this.data=new n(s)),this._resetRange()}destroy(){this._texture?.dispose();for(const t in this._fbos){const e=this._fbos[t];e&&("0"===t&&e.detachColorTexture(),e.dispose()),this._fbos[t]=null}this._texture=null}get _textureDesc(){const t=new c(this.size);return t.wrapMode=33071,t.samplingMode=9728,t.dataType=this.pixelType,t}setData(t,e,i){const s=d(t),r=this.data,a=s*this.texelSize+e;!r||a>=r.length||(r[a]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s))}getData(t,e){if(null==this.data)return null;const i=d(t)*this.texelSize+e;return!this.data||i>=this.data.length?null:this.data[i]}getTexture(t){return this._texture??this._initTexture(t)}getFBO(t,e=0){if(!this._fbos[e]){const i=0===e?this.getTexture(t):this._textureDesc;this._fbos[e]=new g(t,i)}return this._fbos[e]}get hasDirty(){const t=this.dirtyStart;return this.dirtyEnd>=t}updateTexture(e,i){try{const s=this.dirtyStart,r=this.dirtyEnd;if(!this.hasDirty)return;has("esri-2d-update-debug")&&console.debug(`Version[${i}] AttributeStoreView.updateTexture`,{start:s,end:r,firstBytes:new Uint8Array(this.data.buffer.slice(0,16)),block:this}),this._resetRange();const a=this.data.buffer,n=this.getTexture(e),u=4,h=(s-s%this.size)/this.size,o=(r-r%this.size)/this.size,d=h,p=this.size,g=o,_=h*this.size*u,c=(p+g*this.size)*u-_,f=l(this.pixelType),b=new f(a,_*f.BYTES_PER_ELEMENT,c),T=this.size,m=g-d+1;if(m>this.size)return void x().error(new t("mapview-webgl","Out-of-bounds index when updating AttributeData"));n.updateData(0,0,d,T,m,b)}catch(s){}}update(t){const{data:e,start:i,end:s}=t;if(null!=e&&null!=this.data){const s=this.data,r=i*this.texelSize;for(let i=0;i<e.length;i++){const a=1<<i%this.texelSize;t.layout&a&&(s[r+i]=e[i])}}this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,s)}resize(t,e){const i=this.size;if(this.size=e,this.textureOnly)return void(i!==this.size&&(this._lastTexture=this._texture,this._texture=null));const s=l(this.pixelType);this.destroy(),this.data=new s(t.buffer)}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}_initTexture(t){const e=new _(t,this._textureDesc,this.data??void 0);if(null!=this._lastTexture&&this._fbos[0]){const i=this._lastTexture.descriptor.width,s=this._lastTexture.descriptor.height,r=this._lastTexture.descriptor.dataType,a=this._lastTexture.descriptor.pixelFormat,n=this.getFBO(t),u=p(r),h=new(l(r))(new ArrayBuffer(i*s*u*this.texelSize)),o=t.getBoundFramebufferObject(),{x:d,y:g,width:_,height:c}=t.getViewport();t.bindFramebuffer(n),n.readPixels(0,0,i,s,a,r,h),e.updateData(0,0,0,2*i,s/2,h),t.setViewport(d,g,_,c),t.bindFramebuffer(o)}return this.destroy(),this._texture=e,this._texture}}class b{constructor(){this.size=0,this._pendingAttributeUpdates=[],this._version=0,this._epoch=0,this._locked=!1}get locked(){return this._locked}_initialize(t){if(!t)throw new Error("InternalError: initArgs must be defined");const e=t.blockDescriptors;if(this.size=t.blockSize,has("esri-2d-update-debug")&&console.debug("AttributeStoreView.initialize",{message:t}),null==this._data)this._data=e.map((t,e)=>null!=t?new f(t,this.size,e):null);else for(let i=0;i<this._data.length;i++){const t=this._data[i],s=e[i];null!=s&&(null==t?this._data[i]=new f(s,this.size,i):t.resize(s,this.size))}}destroy(){for(const t of this._data??[])t?.destroy();this._defaultTexture?.dispose(),this._defaultTexture=null,this._pendingAttributeUpdates=[]}isEmpty(){return null==this._data}getBlock(t){if(null==this._data)return null;return this._data[t]}setLabelMinZoom(t,e){this.setData(t,0,1,e)}setLocalTimeOrigin(t,e){this.setData(t,7,0,e)}getLabelMinZoom(t){return this.getData(t,0,1,255)}getFilterFlags(t){return this.getData(t,0,0,0)}getVisualVariableData(t,e){return this.getData(t,3,e,0)}getData(t,e,i,s){if(!this._data)return 0;const r=this._data[e];if(null==r)return 0;const a=r.getData(t,i);return null!=a?a:s}setData(t,e,i,s){this._data[e].setData(t,i,s)}lockTextureUploads(){this._locked=!0}unlockTextureUploads(){this._locked=!1,this.update()}requestUpdate(t){this._version=t.version,this._pendingAttributeUpdates.push(t),has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] AttributeStoreView.requestUpdate`,{message:t})}get currentEpoch(){return this._epoch}get hasPendingUpdates(){return this._pendingAttributeUpdates.length>0}update(){if(this._locked)return;const t=this._pendingAttributeUpdates;this._pendingAttributeUpdates=[];for(const e of t){const{blockData:t,initArgs:i,sendUpdateEpoch:s,version:r}=e;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] Epoch[${s}] AttributeStoreView.applyUpdate`),this._version=r,this._epoch=s,null!=i&&this._initialize(i);const a=this._data;for(let e=0;e<t.length;e++){const i=t[e],s=a[e];null!=s&&null!=i&&(has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] CpuBlock[${e}] AttributeStoreView.update`,{block:i}),s.update(i))}}}getUniforms(t){return{filterFlags:{texture:this._getTexture(t,0),unit:o},animation:{texture:this._getTexture(t,1),unit:h},gpgpu:{texture:this._getTexture(t,2),unit:u},localTimeOrigin:{texture:this._getTexture(t,7),unit:n},visualVariableData:{texture:this._getTexture(t,3),unit:a},dataDriven0:{texture:this._getTexture(t,4),unit:r},dataDriven1:{texture:this._getTexture(t,5),unit:s},dataDriven2:{texture:this._getTexture(t,6),unit:i},size:this.size}}_getTexture(t,e){const i=this._data?.[e];return i?(i.updateTexture(t,this._version),i.getTexture(t)):this._getDefaultTexture(t)}_getDefaultTexture(t){if(null==this._defaultTexture){const e=new c(1);e.wrapMode=33071,e.samplingMode=9728,this._defaultTexture=new _(t,e,new Uint8Array(4))}return this._defaultTexture}}export{b as AttributeStoreView};
5
+ import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{estimateNumberArrayMemory as i}from"../../../../core/memoryEstimations.js";import{dataDrivenUnit2 as s,dataDrivenUnit1 as r,dataDrivenUnit0 as a,visualVariableUnit as n,localTimeOriginUnit as u,gpgpuUnit as h,animationUnit as o,filterFlagsUnit as d}from"./definitions.js";import{getDisplayIdTexel as l}from"./DisplayId.js";import{getPixelArrayCtor as p,getPixelBytes as g}from"./Utils.js";import{FramebufferObject as _}from"../../../webgl/FramebufferObject.js";import{Texture as c}from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";const f=()=>e.getLogger("esri.views.2d.engine.webgl.AttributeStoreView");class b{constructor(t,e,i){this._texture=null,this._lastTexture=null,this._fbos={},this.texelSize=4;const{buffer:s,pixelType:r,textureOnly:a}=t,n=p(r);this.blockIndex=i,this.pixelType=r,this.size=e,this.textureOnly=a,a||(this.data=new n(s)),this._resetRange()}destroy(){this._texture?.dispose();for(const t in this._fbos){const e=this._fbos[t];e&&("0"===t&&e.detachColorTexture(),e.dispose()),this._fbos[t]=null}this._texture=null}get _textureDesc(){const t=new x(this.size);return t.wrapMode=33071,t.samplingMode=9728,t.dataType=this.pixelType,t}get usedMemory(){return null!=this.data?i(this.data):0}setData(t,e,i){const s=l(t),r=this.data,a=s*this.texelSize+e;!r||a>=r.length||(r[a]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s))}getData(t,e){if(null==this.data)return null;const i=l(t)*this.texelSize+e;return!this.data||i>=this.data.length?null:this.data[i]}getTexture(t){return this._texture??this._initTexture(t)}getFBO(t,e=0){if(!this._fbos[e]){const i=0===e?this.getTexture(t):this._textureDesc;this._fbos[e]=new _(t,i)}return this._fbos[e]}get hasDirty(){const t=this.dirtyStart;return this.dirtyEnd>=t}updateTexture(e,i){try{const s=this.dirtyStart,r=this.dirtyEnd;if(!this.hasDirty)return;has("esri-2d-update-debug")&&console.debug(`Version[${i}] AttributeStoreView.updateTexture`,{start:s,end:r,firstBytes:new Uint8Array(this.data.buffer.slice(0,16)),block:this}),this._resetRange();const a=this.data.buffer,n=this.getTexture(e),u=4,h=(s-s%this.size)/this.size,o=(r-r%this.size)/this.size,d=h,l=this.size,g=o,_=h*this.size*u,c=(l+g*this.size)*u-_,x=p(this.pixelType),b=new x(a,_*x.BYTES_PER_ELEMENT,c),m=this.size,T=g-d+1;if(T>this.size)return void f().error(new t("mapview-webgl","Out-of-bounds index when updating AttributeData"));n.updateData(0,0,d,m,T,b)}catch(s){}}update(t){const{data:e,start:i,end:s}=t;if(null!=e&&null!=this.data){const s=this.data,r=i*this.texelSize;for(let i=0;i<e.length;i++){const a=1<<i%this.texelSize;t.layout&a&&(s[r+i]=e[i])}}this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,s)}resize(t,e){const i=this.size;if(this.size=e,this.textureOnly)return void(i!==this.size&&(this._lastTexture=this._texture,this._texture=null));const s=p(this.pixelType);this.destroy(),this.data=new s(t.buffer)}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}_initTexture(t){const e=new c(t,this._textureDesc,this.data??void 0);if(null!=this._lastTexture&&this._fbos[0]){const i=this._lastTexture.descriptor.width,s=this._lastTexture.descriptor.height,r=this._lastTexture.descriptor.dataType,a=this._lastTexture.descriptor.pixelFormat,n=this.getFBO(t),u=g(r),h=new(p(r))(new ArrayBuffer(i*s*u*this.texelSize)),o=t.getBoundFramebufferObject(),{x:d,y:l,width:_,height:c}=t.getViewport();t.bindFramebuffer(n),n.readPixels(0,0,i,s,a,r,h),e.updateData(0,0,0,2*i,s/2,h),t.setViewport(d,l,_,c),t.bindFramebuffer(o)}return this.destroy(),this._texture=e,this._texture}}class m{constructor(){this.size=0,this._pendingAttributeUpdates=[],this._version=0,this._epoch=0,this._locked=!1}get locked(){return this._locked}get usedMemory(){let t=0;for(const e of this._data??[])null!=e&&(t+=e.usedMemory);return t}_initialize(t){if(!t)throw new Error("InternalError: initArgs must be defined");const e=t.blockDescriptors;if(this.size=t.blockSize,has("esri-2d-update-debug")&&console.debug("AttributeStoreView.initialize",{message:t}),null==this._data)this._data=e.map((t,e)=>null!=t?new b(t,this.size,e):null);else for(let i=0;i<this._data.length;i++){const t=this._data[i],s=e[i];null!=s&&(null==t?this._data[i]=new b(s,this.size,i):t.resize(s,this.size))}}destroy(){for(const t of this._data??[])t?.destroy();this._defaultTexture?.dispose(),this._defaultTexture=null,this._pendingAttributeUpdates=[]}isEmpty(){return null==this._data}getBlock(t){if(null==this._data)return null;return this._data[t]}setLabelMinZoom(t,e){this.setData(t,0,1,e)}setLocalTimeOrigin(t,e){this.setData(t,7,0,e)}getLabelMinZoom(t){return this.getData(t,0,1,255)}getFilterFlags(t){return this.getData(t,0,0,0)}getVisualVariableData(t,e){return this.getData(t,3,e,0)}getData(t,e,i,s){if(!this._data)return 0;const r=this._data[e];if(null==r)return 0;const a=r.getData(t,i);return null!=a?a:s}setData(t,e,i,s){this._data[e].setData(t,i,s)}lockTextureUploads(){this._locked=!0}unlockTextureUploads(){this._locked=!1,this.update()}requestUpdate(t){this._version=t.version,this._pendingAttributeUpdates.push(t),has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] AttributeStoreView.requestUpdate`,{message:t})}get currentEpoch(){return this._epoch}get hasPendingUpdates(){return this._pendingAttributeUpdates.length>0}update(){if(this._locked)return;const t=this._pendingAttributeUpdates;this._pendingAttributeUpdates=[];for(const e of t){const{blockData:t,initArgs:i,sendUpdateEpoch:s,version:r}=e;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] Epoch[${s}] AttributeStoreView.applyUpdate`),this._version=r,this._epoch=s,null!=i&&this._initialize(i);const a=this._data;for(let e=0;e<t.length;e++){const i=t[e],s=a[e];null!=s&&null!=i&&(has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] CpuBlock[${e}] AttributeStoreView.update`,{block:i}),s.update(i))}}}getUniforms(t){return{filterFlags:{texture:this._getTexture(t,0),unit:d},animation:{texture:this._getTexture(t,1),unit:o},gpgpu:{texture:this._getTexture(t,2),unit:h},localTimeOrigin:{texture:this._getTexture(t,7),unit:u},visualVariableData:{texture:this._getTexture(t,3),unit:n},dataDriven0:{texture:this._getTexture(t,4),unit:a},dataDriven1:{texture:this._getTexture(t,5),unit:r},dataDriven2:{texture:this._getTexture(t,6),unit:s},size:this.size}}_getTexture(t,e){const i=this._data?.[e];return i?(i.updateTexture(t,this._version),i.getTexture(t)):this._getDefaultTexture(t)}_getDefaultTexture(t){if(null==this._defaultTexture){const e=new x(1);e.wrapMode=33071,e.samplingMode=9728,this._defaultTexture=new c(t,e,new Uint8Array(4))}return this._defaultTexture}}export{m as AttributeStoreView};
@@ -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"./DisplayRecord.js";import{serializeList as i,deserializeList as r}from"./util/serializationUtils.js";class s{static{this.byteSizeHint=2*Uint32Array.BYTES_PER_ELEMENT+t.byteSizeHint}constructor(t,i){this.id=t,this.sortKey=i,this.records=[]}serialize(t){return t.push(this.id),t.writeF32(this.sortKey),i(t,this.records),t}static deserialize(i){const e=i.readInt32(),o=i.readF32(),a=new s(e,o);return a.records=r(i,t)??[],a}}export{s as default};
5
+ import t from"./DisplayRecord.js";import{serializeList as i,deserializeList as r}from"./util/serializationUtils.js";class e{static{this.byteSizeHint=2*Uint32Array.BYTES_PER_ELEMENT+t.byteSizeHint}static estimateMemory(i){return 24+t.estimatedMemory*i}constructor(t,i){this.id=t,this.sortKey=i,this.records=[]}serialize(t){return t.push(this.id),t.writeF32(this.sortKey),i(t,this.records),t}static deserialize(i){const s=i.readInt32(),o=i.readF32(),a=new e(s,o);return a.records=r(i,t)??[],a}}export{e 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
- 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};