@arcgis/core 6.0.0-next.25 → 6.0.0-next.27

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 (238) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{6f1d6453184e0a1530ad.js → 00580a68835aac653038.js} +22 -22
  3. package/assets/esri/core/workers/chunks/0363d29fc665d169ebc4.js +1 -0
  4. package/assets/esri/core/workers/chunks/037c67ef5c4398d5954d.js +1 -0
  5. package/assets/esri/core/workers/chunks/07b726a46864501b90a0.js +1 -0
  6. package/assets/esri/core/workers/chunks/0864da8f8f147016cf1c.js +1 -0
  7. package/assets/esri/core/workers/chunks/0bd04bcd4b2710838d48.js +1 -0
  8. package/assets/esri/core/workers/chunks/{768389f7f8dba6080df7.js → 0cc7fba402a93e6d2455.js} +2 -2
  9. package/assets/esri/core/workers/chunks/0cfdeb53fb7d5532cf01.js +1 -0
  10. package/assets/esri/core/workers/chunks/112ed86f812e4400a7e0.js +1 -0
  11. package/assets/esri/core/workers/chunks/177f353ce72133e2eeed.js +1 -0
  12. package/assets/esri/core/workers/chunks/1dc6f093028530a492e6.js +1 -0
  13. package/assets/esri/core/workers/chunks/2294254af2c6afb560ee.js +1 -0
  14. package/assets/esri/core/workers/chunks/23a4806b4cdf7cc32e4d.js +1 -0
  15. package/assets/esri/core/workers/chunks/2447d2e2a4a3ab8fcf94.js +1 -0
  16. package/assets/esri/core/workers/chunks/271ae7deccb94112c2df.js +1 -0
  17. package/assets/esri/core/workers/chunks/2df37a9a95ceebb87a5f.js +1 -0
  18. package/assets/esri/core/workers/chunks/2e00c155e447e4930442.js +1 -0
  19. package/assets/esri/core/workers/chunks/2e9a1673b1d51aa082b6.js +1 -0
  20. package/assets/esri/core/workers/chunks/344f5334ad95c7974349.js +1 -0
  21. package/assets/esri/core/workers/chunks/348f1def9cd2ddf92e87.js +1 -0
  22. package/assets/esri/core/workers/chunks/{8e4206068c6953bb7df2.js → 3a47fc97c400fca2c736.js} +1 -1
  23. package/assets/esri/core/workers/chunks/47c97640ec525676918b.js +1 -0
  24. package/assets/esri/core/workers/chunks/50763ea061d5fb3f2e49.js +1 -0
  25. package/assets/esri/core/workers/chunks/518ab22f80c3300bcfff.js +1 -0
  26. package/assets/esri/core/workers/chunks/58609bf94f72bc4f1952.js +1 -0
  27. package/assets/esri/core/workers/chunks/586a929bc037e23857af.js +1 -0
  28. package/assets/esri/core/workers/chunks/58d10e0b35968680fd9f.js +1 -0
  29. package/assets/esri/core/workers/chunks/59bc55880e6fd8ce20c0.js +1 -0
  30. package/assets/esri/core/workers/chunks/62a0abcf45a2bd14ecbe.js +1 -0
  31. package/assets/esri/core/workers/chunks/63c4412c16d8a44a5668.js +1 -0
  32. package/assets/esri/core/workers/chunks/6b4c3411f63a9ad9354c.js +1 -0
  33. package/assets/esri/core/workers/chunks/{f528ac5c648ca6a98582.js → 711cfb84659cb4437679.js} +1 -1
  34. package/assets/esri/core/workers/chunks/77463141652bf1ca6fb2.js +1 -0
  35. package/assets/esri/core/workers/chunks/7d3f7940815fa5dc244e.js +1 -0
  36. package/assets/esri/core/workers/chunks/914a0b5d9fef683cdf9c.js +1 -0
  37. package/assets/esri/core/workers/chunks/96f87c8efd4b11b37686.js +1 -0
  38. package/assets/esri/core/workers/chunks/97ec46605f16333144b7.js +1 -0
  39. package/assets/esri/core/workers/chunks/{7b482afb9fd1229f5707.js → 9934e8e19f94e9169eea.js} +1 -1
  40. package/assets/esri/core/workers/chunks/99f51d5d9da6e9bfc430.js +1 -0
  41. package/assets/esri/core/workers/chunks/9aebe876b1a2fb075f9c.js +1 -0
  42. package/assets/esri/core/workers/chunks/9c3db7a7c05fa0e81f0a.js +1 -0
  43. package/assets/esri/core/workers/chunks/a2cc53ad1a514167e4b8.js +1 -0
  44. package/assets/esri/core/workers/chunks/a33ba23aee3f8f40200f.js +1 -0
  45. package/assets/esri/core/workers/chunks/{45ba4aa87a4732198596.js → b13d8f4e4e80ef00b1bd.js} +1 -1
  46. package/assets/esri/core/workers/chunks/b3801d58c024224917df.js +1 -0
  47. package/assets/esri/core/workers/chunks/b3aa29589dcfb5b93106.js +1 -0
  48. package/assets/esri/core/workers/chunks/b3dbcf43f136ba2dadc5.js +1 -0
  49. package/assets/esri/core/workers/chunks/b9596d862da1ec342cd3.js +1 -0
  50. package/assets/esri/core/workers/chunks/bc1fcc9c897461e68e29.js +1 -0
  51. package/assets/esri/core/workers/chunks/{8b4e9fd88c0c313416d4.js → be04f40f8b403befd0ef.js} +1 -1
  52. package/assets/esri/core/workers/chunks/c29091fe157564cffcf7.js +1 -0
  53. package/assets/esri/core/workers/chunks/{150e7a7bd5df25693da7.js → c90388932a7825d9d933.js} +1 -1
  54. package/assets/esri/core/workers/chunks/ca21786e519c914fc9e1.js +1 -0
  55. package/assets/esri/core/workers/chunks/cdb5c26fed7d9a97db49.js +1 -0
  56. package/assets/esri/core/workers/chunks/cdf0c7706d3e1221f49b.js +1 -0
  57. package/assets/esri/core/workers/chunks/d63e181f0e48bde73395.js +1 -0
  58. package/assets/esri/core/workers/chunks/d77888c84a8b49478807.js +1 -0
  59. package/assets/esri/core/workers/chunks/d7f2f1708d2a2668676c.js +1 -0
  60. package/assets/esri/core/workers/chunks/ec1c4d66142b6efb0e8b.js +1 -0
  61. package/assets/esri/core/workers/chunks/ef2c3febcceedc44b3ac.js +1 -0
  62. package/assets/esri/core/workers/chunks/f08a2a262a3b55149396.js +1 -0
  63. package/assets/esri/core/workers/chunks/f2d56f5c15d5977e1d19.js +1 -0
  64. package/assets/esri/core/workers/chunks/ffe2077a9df7c838ea27.js +1 -0
  65. package/assets/esri/layers/raster/formats/lerc-wasm.wasm +0 -0
  66. package/chunks/GlobalIllumination.glsl.js +15 -30
  67. package/chunks/RibbonLine.glsl.js +2 -2
  68. package/config.js +1 -1
  69. package/core/ReentrantObjectPool.js +1 -1
  70. package/core/memoryEstimations.js +1 -1
  71. package/core/workers/workers.js +2 -2
  72. package/core/workers.d.ts +1 -1
  73. package/form/elements/inputs.d.ts +126 -25
  74. package/form/elements/inputs.js +1 -1
  75. package/form/elements.d.ts +1 -0
  76. package/geometry/support/Indices.js +1 -1
  77. package/graphic/MapNotesGraphicOrigin.d.ts +1 -0
  78. package/kernel.js +1 -1
  79. package/layers/GeospatialPDFLayer.js +1 -1
  80. package/layers/MapNotesLayer.d.ts +3 -2
  81. package/layers/VectorTileLayer.d.ts +10 -1
  82. package/layers/buildingSublayers/BuildingGroupSublayer.d.ts +2 -1
  83. package/layers/geospatialPDF/CIM2DLayerview.js +2 -0
  84. package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
  85. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  86. package/layers/mixins/SublayersOwner.js +1 -1
  87. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  88. package/layers/orientedImagery/transformations/rectifyMapPoint.js +1 -1
  89. package/layers/support/Sublayer.d.ts +2 -2
  90. package/layers/support/Sublayer.js +1 -1
  91. package/layers/support/SubtypeSublayer.js +1 -1
  92. package/layers/support/layerUtils.js +1 -1
  93. package/package.json +3 -3
  94. package/rest/support/AttributeBinsQuery.d.ts +3 -2
  95. package/rest/support/ImageGPSInfoParameters.d.ts +2 -1
  96. package/rest/support/OutDistance.d.ts +2 -1
  97. package/rest/support/Query.d.ts +3 -2
  98. package/rest/support/TopFeaturesQuery.d.ts +2 -1
  99. package/rest/support/types.d.ts +10 -1
  100. package/smartMapping/raster/renderers/flow.d.ts +2 -1
  101. package/smartMapping/renderers/color.d.ts +11 -8
  102. package/smartMapping/renderers/location.d.ts +7 -4
  103. package/smartMapping/renderers/predominance.d.ts +7 -4
  104. package/smartMapping/renderers/relationship.d.ts +7 -4
  105. package/smartMapping/renderers/size.d.ts +6 -4
  106. package/smartMapping/renderers/type.d.ts +7 -4
  107. package/smartMapping/renderers/types.d.ts +15 -0
  108. package/smartMapping/renderers/univariateColorSize.d.ts +4 -2
  109. package/smartMapping/symbology/flow.d.ts +2 -1
  110. package/smartMapping/symbology/types.d.ts +2 -1
  111. package/symbols/cim/CIMCursor.js +1 -1
  112. package/tables/elements.d.ts +1 -0
  113. package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
  114. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  115. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterVertexPack.js +1 -1
  116. package/views/2d/engine/webgl/textureUtils.js +1 -1
  117. package/views/2d/layers/GeospatialPDFLayerView2D.js +1 -1
  118. package/views/2d/layers/MediaLayerView2D.js +1 -1
  119. package/views/2d/layers/TileLayerView2D.js +1 -1
  120. package/views/3d/layers/GeospatialPDFLayerView3D.js +1 -1
  121. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  122. package/views/3d/layers/graphics/Graphics3DBufferGraphicLayer.js +1 -1
  123. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  124. package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayerBase.js +1 -1
  125. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  126. package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
  127. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  128. package/views/3d/layers/graphics/Graphics3DGraphicCreationContext.js +1 -1
  129. package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
  130. package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +1 -1
  131. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  132. package/views/3d/layers/graphics/Graphics3DStageObjectGraphicLayer.js +1 -1
  133. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  134. package/views/3d/layers/graphics/Labeler.js +1 -1
  135. package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
  136. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  137. package/views/3d/layers/support/featureReference.js +1 -1
  138. package/views/3d/terrain/PatchRenderData.js +1 -1
  139. package/views/3d/terrain/TerrainData.js +1 -1
  140. package/views/3d/terrain/TerrainRenderer.js +1 -1
  141. package/views/3d/terrain/TerrainSurface.js +1 -1
  142. package/views/3d/terrain/TextureFader.js +1 -1
  143. package/views/3d/terrain/TextureReference.js +1 -1
  144. package/views/3d/terrain/TileCompositor.js +1 -1
  145. package/views/3d/terrain/TileRenderInfo.js +1 -1
  146. package/views/3d/terrain/TileRenderer.js +1 -1
  147. package/views/3d/terrain/terrainUtils.js +1 -1
  148. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +25 -25
  149. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  150. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  151. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +1 -1
  152. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  153. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  154. package/views/3d/webgl-engine/lib/BufferGeometry.js +1 -1
  155. package/views/3d/webgl-engine/lib/BufferObject3D.js +1 -1
  156. package/views/3d/webgl-engine/lib/DirtyEvents.js +1 -1
  157. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  158. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  159. package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
  160. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  161. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  162. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  163. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +1 -1
  164. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  165. package/views/3d/webgl-engine/lib/geometryMemoryUtils.js +2 -0
  166. package/views/VideoView.js +1 -1
  167. package/views/selection/SelectionOperation.js +1 -1
  168. package/views/selection/types.d.ts +43 -3
  169. package/views/support/layerViewUtils.js +1 -1
  170. package/views/support/selectionUtils.js +1 -1
  171. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  172. package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
  173. package/widgets/OrientedImageryViewer.js +2 -2
  174. package/widgets/Print.js +1 -1
  175. package/widgets/support/SelectionList/GroupLayerItem.d.ts +6 -0
  176. package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
  177. package/widgets/support/SelectionList/ItemBase.js +1 -1
  178. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.d.ts +6 -1
  179. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  180. package/widgets/support/SelectionToolbar.d.ts +8 -1
  181. package/widgets/support/SelectionToolbar.js +1 -1
  182. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  183. package/assets/esri/core/workers/chunks/0320cbd825f9a4222042.js +0 -1
  184. package/assets/esri/core/workers/chunks/067de1910190da228291.js +0 -1
  185. package/assets/esri/core/workers/chunks/09bd5df07eab80ae7b15.js +0 -1
  186. package/assets/esri/core/workers/chunks/164e74d586297946a717.js +0 -1
  187. package/assets/esri/core/workers/chunks/1c0c5cb13c2590aae906.js +0 -1
  188. package/assets/esri/core/workers/chunks/1c77de1e79860f8d2228.js +0 -1
  189. package/assets/esri/core/workers/chunks/24dac4970526a4e0ae63.js +0 -1
  190. package/assets/esri/core/workers/chunks/2acf2952cef69e382a35.js +0 -1
  191. package/assets/esri/core/workers/chunks/30dcf2cfb31cb70de7df.js +0 -1
  192. package/assets/esri/core/workers/chunks/371e2ddb88cc6b9a41e8.js +0 -1
  193. package/assets/esri/core/workers/chunks/42f6194633c2d879c8da.js +0 -1
  194. package/assets/esri/core/workers/chunks/44f90e75c1dc3d726a95.js +0 -1
  195. package/assets/esri/core/workers/chunks/4abd3753cd9b80e4d937.js +0 -1
  196. package/assets/esri/core/workers/chunks/4bb9a5f4ca944d3fc206.js +0 -1
  197. package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +0 -1
  198. package/assets/esri/core/workers/chunks/4d93bed14945e3d34d5c.js +0 -1
  199. package/assets/esri/core/workers/chunks/4e3f651ac76fcd53df2b.js +0 -1
  200. package/assets/esri/core/workers/chunks/505227797bcf2a1d908d.js +0 -1
  201. package/assets/esri/core/workers/chunks/58da3f8cf0f7f6a7e4fa.js +0 -1
  202. package/assets/esri/core/workers/chunks/5a19a9c3e01d3d415188.js +0 -1
  203. package/assets/esri/core/workers/chunks/5a830bc35adbedd33783.js +0 -1
  204. package/assets/esri/core/workers/chunks/6db0f8fe1402643fbe1a.js +0 -1
  205. package/assets/esri/core/workers/chunks/7124ad8dc5ad40dc66f3.js +0 -1
  206. package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +0 -1
  207. package/assets/esri/core/workers/chunks/7c631e2947243e2c9bde.js +0 -1
  208. package/assets/esri/core/workers/chunks/7f0f9dddc44b1f1600f0.js +0 -1
  209. package/assets/esri/core/workers/chunks/7fb7493f483cd9878bfa.js +0 -1
  210. package/assets/esri/core/workers/chunks/8e310e9cb9d84ac3ca2f.js +0 -1
  211. package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +0 -1
  212. package/assets/esri/core/workers/chunks/99a0a434ea2162166754.js +0 -1
  213. package/assets/esri/core/workers/chunks/9afc87474cef1fc4fe4a.js +0 -1
  214. package/assets/esri/core/workers/chunks/9cbde13e536676767900.js +0 -1
  215. package/assets/esri/core/workers/chunks/9cd3fcb5fca6f9dbbcd8.js +0 -1
  216. package/assets/esri/core/workers/chunks/a025ee38d402504193df.js +0 -1
  217. package/assets/esri/core/workers/chunks/a4b822ee45810c4c292a.js +0 -1
  218. package/assets/esri/core/workers/chunks/a51576d84edca88e41dd.js +0 -1
  219. package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +0 -1
  220. package/assets/esri/core/workers/chunks/ace41659a5ca0e5abfc3.js +0 -1
  221. package/assets/esri/core/workers/chunks/b01804aa6c47a220a603.js +0 -1
  222. package/assets/esri/core/workers/chunks/b3273f847405799e3362.js +0 -1
  223. package/assets/esri/core/workers/chunks/ba3d5abff65aefcb8dee.js +0 -1
  224. package/assets/esri/core/workers/chunks/bca6b469940b7b954123.js +0 -1
  225. package/assets/esri/core/workers/chunks/c0d7ae314ebfad1e3791.js +0 -1
  226. package/assets/esri/core/workers/chunks/c337fc0e6dc69c233e6d.js +0 -1
  227. package/assets/esri/core/workers/chunks/cd9aa950cb74b09008fe.js +0 -1
  228. package/assets/esri/core/workers/chunks/e0d9dc97985561320bd4.js +0 -1
  229. package/assets/esri/core/workers/chunks/e2775b4b753306dc8477.js +0 -1
  230. package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +0 -1
  231. package/assets/esri/core/workers/chunks/ebbf425af348e6ede814.js +0 -1
  232. package/assets/esri/core/workers/chunks/efc53007cd2e4991d7d4.js +0 -1
  233. package/assets/esri/core/workers/chunks/f46e92c67986c8c09bdd.js +0 -1
  234. package/assets/esri/core/workers/chunks/f8bc474434fd365ab174.js +0 -1
  235. package/assets/esri/core/workers/chunks/f8d2225f333524ce1d88.js +0 -1
  236. package/assets/esri/core/workers/chunks/f95a1f878c9c1146180e.js +0 -1
  237. package/assets/esri/core/workers/chunks/fb37f0848196c28b7fd7.js +0 -1
  238. /package/assets/esri/core/workers/chunks/{768389f7f8dba6080df7.js.LICENSE.txt → 0cc7fba402a93e6d2455.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{EventEmitter as n}from"../../../../core/Evented.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{projectPoint as a}from"../../../../geometry/projectionUtils.js";import{create as o}from"../../../../geometry/support/aaBoundingBox.js";import{getObjectId as s}from"../../../../layers/graphics/dehydratedFeatures.js";import{OptimizedFeature as c}from"../../../../layers/graphics/OptimizedFeature.js";import l from"../../../../layers/graphics/OptimizedGeometry.js";import{optimizedFeatureQueryEngineAdapter as u}from"../../../../layers/graphics/data/optimizedFeatureQueryEngineAdapter.js";const d=o();let f=class extends t{constructor(e){super(e),this.events=new n,this.hasZ=null,this.hasM=null,this.objectIdField=null,this.featureAdapter={getAttribute(e,t){return`graphic`in e?e.graphic.attributes[t]:u.getAttribute(e,t)},getAttributeAsTimestamp(e,t){let n=this.getAttribute(e,t);return typeof n==`number`?n:new Date(n).getTime()},getAttributes(e){return`graphic`in e?e.graphic.attributes:u.getAttributes(e)},getObjectId:e=>`graphic`in e?s(e.graphic,this.objectIdField)??void 0:u.getObjectId(e),getGeometry:e=>{if(`graphic`in e){let t=e.hasCachedOptimizedGeometry,n=e.getAsOptimizedGeometry(this.hasZ,this.hasM);return!t&&n!=null&&this.usedMemoryInvalidated(e),n}return u.getGeometry(e)},getCentroid:(e,t)=>{if(`graphic`in e){let n=null;e.centroid==null?e.graphic.geometry.type===`point`&&a(e.graphic.geometry,p,this.viewSpatialReference)&&(n=p):n=e.centroid;let r=Array(2+ +!!t.hasZ+ +!!t.hasM);return n==null?(r[0]=0,r[1]=0,r[2]=0,r[3]=0):(r[0]=n.x,r[1]=n.y,t.hasZ&&(r[2]=n.hasZ?n.z:0),t.hasM&&(r[t.hasZ?3:2]=n.hasM?n.m:0)),new l([],r,t.hasZ,t.hasM)}return u.getCentroid(e,t)},cloneWithGeometry:(e,t,n)=>`graphic`in e?new c(t,this.featureAdapter.getAttributes(e),null,this.featureAdapter.getObjectId(e)):u.cloneWithGeometry(e,t,n)}}forEachInBounds(e,t){this.getSpatialIndex().forEachInBounds(e,t)}forEachBounds(e,t){let n=this.getSpatialIndex();for(let r of e){let e=this.featureAdapter.getObjectId(r);n.getBounds(e,d)!=null&&t(d)}}};e([r({constructOnly:!0})],f.prototype,`getSpatialIndex`,void 0),e([r({constructOnly:!0})],f.prototype,`forEach`,void 0),e([r({constructOnly:!0})],f.prototype,`usedMemoryInvalidated`,void 0),e([r({constructOnly:!0})],f.prototype,`hasZ`,void 0),e([r({constructOnly:!0})],f.prototype,`hasM`,void 0),e([r({constructOnly:!0})],f.prototype,`objectIdField`,void 0),e([r({constructOnly:!0})],f.prototype,`viewSpatialReference`,void 0),e([r({constructOnly:!0})],f.prototype,`featureSpatialReference`,void 0),f=e([i(`esri.views.3d.layers.graphics.Graphics3DFeatureStore`)],f);const p={type:`point`,x:0,y:0,hasZ:!1,hasM:!1,spatialReference:null};export{f as Graphics3DFeatureStore};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{EventEmitter as n}from"../../../../core/Evented.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{projectPoint as a}from"../../../../geometry/projectionUtils.js";import{create as o}from"../../../../geometry/support/aaBoundingBox.js";import{getObjectId as s}from"../../../../layers/graphics/dehydratedFeatures.js";import{OptimizedFeature as c}from"../../../../layers/graphics/OptimizedFeature.js";import l from"../../../../layers/graphics/OptimizedGeometry.js";import{optimizedFeatureQueryEngineAdapter as u}from"../../../../layers/graphics/data/optimizedFeatureQueryEngineAdapter.js";const d=o();let f=class extends t{constructor(e){super(e),this.events=new n,this.hasZ=null,this.hasM=null,this.objectIdField=null,this.featureAdapter={getAttribute(e,t){return`graphic`in e?e.graphic.attributes[t]:u.getAttribute(e,t)},getAttributeAsTimestamp(e,t){let n=this.getAttribute(e,t);return typeof n==`number`?n:new Date(n).getTime()},getAttributes(e){return`graphic`in e?e.graphic.attributes:u.getAttributes(e)},getObjectId:e=>`graphic`in e?s(e.graphic,this.objectIdField)??void 0:u.getObjectId(e),getGeometry:e=>`graphic`in e?e.getAsOptimizedGeometry(this.hasZ,this.hasM):u.getGeometry(e),getCentroid:(e,t)=>{if(`graphic`in e){let n=null;e.centroid==null?e.graphic.geometry.type===`point`&&a(e.graphic.geometry,p,this.viewSpatialReference)&&(n=p):n=e.centroid;let r=Array(2+ +!!t.hasZ+ +!!t.hasM);return n==null?(r[0]=0,r[1]=0,r[2]=0,r[3]=0):(r[0]=n.x,r[1]=n.y,t.hasZ&&(r[2]=n.hasZ?n.z:0),t.hasM&&(r[t.hasZ?3:2]=n.hasM?n.m:0)),new l([],r,t.hasZ,t.hasM)}return u.getCentroid(e,t)},cloneWithGeometry:(e,t,n)=>`graphic`in e?new c(t,this.featureAdapter.getAttributes(e),null,this.featureAdapter.getObjectId(e)):u.cloneWithGeometry(e,t,n)}}forEachInBounds(e,t){this.getSpatialIndex().forEachInBounds(e,t)}forEachBounds(e,t){let n=this.getSpatialIndex();for(let r of e){let e=this.featureAdapter.getObjectId(r);n.getBounds(e,d)!=null&&t(d)}}};e([r({constructOnly:!0})],f.prototype,`getSpatialIndex`,void 0),e([r({constructOnly:!0})],f.prototype,`forEach`,void 0),e([r({constructOnly:!0})],f.prototype,`hasZ`,void 0),e([r({constructOnly:!0})],f.prototype,`hasM`,void 0),e([r({constructOnly:!0})],f.prototype,`objectIdField`,void 0),e([r({constructOnly:!0})],f.prototype,`viewSpatialReference`,void 0),e([r({constructOnly:!0})],f.prototype,`featureSpatialReference`,void 0),f=e([i(`esri.views.3d.layers.graphics.Graphics3DFeatureStore`)],f);const p={type:`point`,x:0,y:0,hasZ:!1,hasM:!1,spatialReference:null};export{f as Graphics3DFeatureStore};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{emptyArray as e}from"../../../../core/arrayUtils.js";import{forEach as t}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import n from"../../../../core/ObjectPool.js";import{scale as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scale as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../../../../geometry/Polygon.js";import{projectBoundingRect as c}from"../../../../geometry/projection/projectBoundingRect.js";import{empty as l,expandWithAABB as u,allFinite as d,toRect as f,create as p,set as m,zero as h}from"../../../../geometry/support/aaBoundingBox.js";import{create as g,allFinite as _}from"../../../../geometry/support/aaBoundingRect.js";import{equals as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{computeAABR as y,estimateSize as b}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromGeometry as x}from"../../../../layers/graphics/featureConversionUtils.js";const S=new n(()=>p(),e=>m(e,h),null,10,5),C=g();class w{get labelLayers(){return this._labelLayers||e}get usedMemory(){return this._usedMemory}get extent(){return this._extent}get isElevationSource(){return this.layers.some(e=>e?.isElevationSource)}constructor(e,t,n){this.graphic=e,this.graphics3DSymbol=t,this.layers=n,this._visibleFlags=255,this._usedMemory=0,++t.referenced,n.every(e=>e&&`hiddenIfDeconflicted`in e&&e.hiddenIfDeconflicted)&&(this._visibleFlags|=256)}initialize(e){this._layer=e,this._forEachSymbolLayerGraphic(t=>{t.initialize(e),T(this._visibleFlags,1,t)})}destroy(){this._forEachSymbolLayerGraphic(e=>e.destroy()),this._calloutLayer=null,--this.graphics3DSymbol.referenced,this.graphics3DSymbol=null}get destroyed(){return this.layers==null}clearLabelGraphics(){this._forEachLabelGraphic(e=>e.destroy()),this._labelLayers=null}addLabelGraphic(e,t){this._labelLayers||=[],this._labelLayers.push(e),e.initialize(t),T(this._visibleFlags,16,e)}setCalloutGraphic(e){this._calloutLayer=e,this._layer&&(e.initialize(this._layer),T(this._visibleFlags,1,e))}get calloutLayer(){return this._calloutLayer}get isDraped(){let e=!1;return this._forEachSymbolLayerGraphic(t=>{(t.type===`draped`||t.type===`draped-buffer`)&&(e=!0)}),e}isVisible(e=1,t=0){let n=this._visibleFlags;return E(n,e,t|t*16|(n&256?0:8))}setVisibilityFlag(e,t,n){let r=e*t;return n!==((this._visibleFlags&r)===r)&&(n?this._visibleFlags|=r:this._visibleFlags&=~r,e===1&&this._forEachSymbolLayerGraphic(e=>T(this._visibleFlags,1,e)),this._forEachLabelGraphic(e=>T(this._visibleFlags,16,e)),!0)}getVisibilityFlag(e,t){return(this._visibleFlags&e*t)!==0}computeExtent(e){if(!this._extent){let t=this.graphic.geometry;if(t==null)return!1;this._extent=g(),y(t,this._extent);let n=t.spatialReference;if(!v(n,e)&&!c(this._extent,n,this._extent,e))return this._extent=null,!1}return!0}get hasCachedOptimizedGeometry(){return this._optimizedGeometry!=null}getAsOptimizedGeometry(e,t){return this._optimizedGeometry||=this._convertGraphicToOptimizedGeometry(this.graphic,e,t),this._optimizedGeometry}updateUsedMemory(e){let t=(e?b(this.graphic):0)+(this._optimizedGeometry?.usedMemory??0);this._forEachSymbolLayerGraphic(e=>t+=e.usedMemory);let n=t-this._usedMemory;return this._usedMemory=t,n}_convertGraphicToOptimizedGeometry(e,t,n){let r=e.geometry;return(r.type===`mesh`||r.type===`extent`)&&(r=s.fromExtent(r.type===`mesh`?r.extent:r)),x(r,t,n)}computeAttachmentOrigin(){let e={render:{origin:o(),num:0},draped:{origin:i(),num:0}};for(let t of this.layers)t?.computeAttachmentOrigin(e);return e.render.num>1&&a(e.render.origin,e.render.origin,1/e.render.num),e.draped.num>1&&r(e.draped.origin,e.draped.origin,1/e.draped.num),e}async getProjectedBoundingBox(e,n,r,i,a){return a||={boundingBox:null,requiresDrapedElevation:!1,screenSpaceObjects:[]},a.boundingBox?l(a.boundingBox):a.boundingBox=l(),a.requiresDrapedElevation=!1,await t(this.layers,async t=>{if(t==null)return;let o=t.type===`draped`||t.type===`draped-buffer`?n:e,s=S.acquire(),c=await t.getProjectedBoundingBox(o,r,a.screenSpaceObjects,i,s);isFinite(c[2])&&isFinite(c[5])||(a.requiresDrapedElevation=!0),c&&u(a.boundingBox,s),S.release(s)}),d(a.boundingBox)||_(f(a.boundingBox,C))?a:null}needsElevationUpdates(){for(let e of this.layers)if(e!=null&&(e.type===`object3d`||e.type===`buffer`||e.type===`lod-instance`)&&e.needsElevationUpdates)return!0;return this._labelLayers?.some(e=>e?.needsElevationUpdates??!1)??!1}alignWithElevation(e,t,n){this._forEachRenderedGraphic(r=>{(r.type===`object3d`||r.type===`buffer`||r.type===`lod-instance`)&&r.alignWithElevation(e,t,n)})}alignWithAbsoluteElevation(e,t,n){this._forEachRenderedGraphic(r=>{(r.type===`object3d`||r.type===`buffer`)&&r.alignWithAbsoluteElevation(e,t,n)})}addObjectStateSet(e){this._forEachSymbolLayerGraphic(t=>t.addObjectState(e))}removeObjectState(e){this._forEachSymbolLayerGraphic(t=>t.removeObjectState(e))}updateHighlights(e){this._forEachSymbolLayerGraphic(t=>t.updateHighlights(e))}_forEachGraphicList(e,t){e?.forEach(e=>e&&t(e))}_forEachSymbolLayerGraphic(e){this._forEachGraphicList(this.layers,e),this._calloutLayer&&e(this._calloutLayer)}_forEachLabelGraphic(e){this._forEachGraphicList(this.labelLayers,e)}_forEachRenderedGraphic(e){this._forEachSymbolLayerGraphic(e),this._forEachLabelGraphic(e)}get test(){}}function T(e,t,n){let r=t===1?`hiddenIfDeconflicted`in n&&n.hiddenIfDeconflicted?0:8:e&256?0:8;n.setVisibility(E(e,t,r))}function E(e,t,n=0){let r=(t===1?15:255)&~n;return(e&r)===r}export{w as Graphics3DGraphic};
2
+ import{emptyArray as e}from"../../../../core/arrayUtils.js";import{forEach as t}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import n from"../../../../core/ObjectPool.js";import{scale as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scale as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../../../../geometry/Polygon.js";import{projectBoundingRect as c}from"../../../../geometry/projection/projectBoundingRect.js";import{empty as l,expandWithAABB as u,allFinite as d,toRect as f,create as p,set as m,zero as h}from"../../../../geometry/support/aaBoundingBox.js";import{create as g,allFinite as _}from"../../../../geometry/support/aaBoundingRect.js";import{equals as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{computeAABR as y,estimateSize as b}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromGeometry as x}from"../../../../layers/graphics/featureConversionUtils.js";const S=new n(()=>p(),e=>m(e,h),null,10,5),C=g();class w{get labelLayers(){return this._labelLayers||e}get usedMemory(){return this._usedMemory}get extent(){return this._extent}get isElevationSource(){return this.layers.some(e=>e?.isElevationSource)}constructor(e,t,n,r=!0){this.graphic=e,this.graphics3DSymbol=t,this.layers=n,this._reportGraphicSourceMemory=r,this._visibleFlags=255,this._usedMemory=0,this._notifyMemoryChange=e=>{this._usedMemory+=e,this.notifyMemoryChange?.(e)},++t.referenced,n.every(e=>e&&`hiddenIfDeconflicted`in e&&e.hiddenIfDeconflicted)&&(this._visibleFlags|=256),this._forEachSymbolLayerGraphic(e=>e.setNotifyMemoryChange(this._notifyMemoryChange)),this._updateUsedMemory()}initialize(e){this._layer=e,this._forEachSymbolLayerGraphic(t=>{t.initialize(e),T(this._visibleFlags,1,t)})}destroy(){this.notifyMemoryChange=void 0,this._forEachSymbolLayerGraphic(e=>{e.setNotifyMemoryChange(void 0),e.destroy()}),this._calloutLayer=null,this._updateUsedMemory(),--this.graphics3DSymbol.referenced,this.graphics3DSymbol=null}get destroyed(){return this.layers==null}clearLabelGraphics(){this._forEachLabelGraphic(e=>e.destroy()),this._labelLayers=null}addLabelGraphic(e,t){this._labelLayers||=[],this._labelLayers.push(e),e.initialize(t),T(this._visibleFlags,16,e)}setCalloutGraphic(e){this._calloutLayer&&this._calloutLayer.setNotifyMemoryChange(void 0);let t=e.usedMemory-(this._calloutLayer?.usedMemory??0);this._calloutLayer=e,e.setNotifyMemoryChange(this._notifyMemoryChange),t&&this._notifyMemoryChange(t),this._layer&&(e.initialize(this._layer),T(this._visibleFlags,1,e))}get calloutLayer(){return this._calloutLayer}get isDraped(){let e=!1;return this._forEachSymbolLayerGraphic(t=>{(t.type===`draped`||t.type===`draped-buffer`)&&(e=!0)}),e}isVisible(e=1,t=0){let n=this._visibleFlags;return E(n,e,t|t*16|(n&256?0:8))}setVisibilityFlag(e,t,n){let r=e*t;return n!==((this._visibleFlags&r)===r)&&(n?this._visibleFlags|=r:this._visibleFlags&=~r,e===1&&this._forEachSymbolLayerGraphic(e=>T(this._visibleFlags,1,e)),this._forEachLabelGraphic(e=>T(this._visibleFlags,16,e)),!0)}getVisibilityFlag(e,t){return(this._visibleFlags&e*t)!==0}computeExtent(e){if(!this._extent){let t=this.graphic.geometry;if(t==null)return!1;this._extent=g(),y(t,this._extent);let n=t.spatialReference;if(!v(n,e)&&!c(this._extent,n,this._extent,e))return this._extent=null,!1}return!0}get hasCachedOptimizedGeometry(){return this._optimizedGeometry!=null}getAsOptimizedGeometry(e,t){return this._optimizedGeometry||(this._optimizedGeometry=this._convertGraphicToOptimizedGeometry(this.graphic,e,t),this._optimizedGeometry&&this._notifyMemoryChange(this._optimizedGeometry.usedMemory)),this._optimizedGeometry}updateAttributes(){this._updateUsedMemory()}updateGeometry(){return this.graphics3DSymbol.updateGeometry(this)?(this._updateUsedMemory(),!0):!1}_updateUsedMemory(){let e=(this._reportGraphicSourceMemory?b(this.graphic):0)+(this._optimizedGeometry?.usedMemory??0);this._forEachSymbolLayerGraphic(t=>e+=t.usedMemory);let t=e-this._usedMemory;t&&this._notifyMemoryChange(t)}_convertGraphicToOptimizedGeometry(e,t,n){let r=e.geometry;return(r.type===`mesh`||r.type===`extent`)&&(r=s.fromExtent(r.type===`mesh`?r.extent:r)),x(r,t,n)}computeAttachmentOrigin(){let e={render:{origin:o(),num:0},draped:{origin:i(),num:0}};for(let t of this.layers)t?.computeAttachmentOrigin(e);return e.render.num>1&&a(e.render.origin,e.render.origin,1/e.render.num),e.draped.num>1&&r(e.draped.origin,e.draped.origin,1/e.draped.num),e}async getProjectedBoundingBox(e,n,r,i,a){return a||={boundingBox:null,requiresDrapedElevation:!1,screenSpaceObjects:[]},a.boundingBox?l(a.boundingBox):a.boundingBox=l(),a.requiresDrapedElevation=!1,await t(this.layers,async t=>{if(t==null)return;let o=t.type===`draped`||t.type===`draped-buffer`?n:e,s=S.acquire(),c=await t.getProjectedBoundingBox(o,r,a.screenSpaceObjects,i,s);isFinite(c[2])&&isFinite(c[5])||(a.requiresDrapedElevation=!0),c&&u(a.boundingBox,s),S.release(s)}),d(a.boundingBox)||_(f(a.boundingBox,C))?a:null}needsElevationUpdates(){for(let e of this.layers)if(e!=null&&(e.type===`object3d`||e.type===`buffer`||e.type===`lod-instance`)&&e.needsElevationUpdates)return!0;return this._labelLayers?.some(e=>e?.needsElevationUpdates??!1)??!1}alignWithElevation(e,t,n){this._forEachRenderedGraphic(r=>{(r.type===`object3d`||r.type===`buffer`||r.type===`lod-instance`)&&r.alignWithElevation(e,t,n)})}alignWithAbsoluteElevation(e,t,n){this._forEachRenderedGraphic(r=>{(r.type===`object3d`||r.type===`buffer`)&&r.alignWithAbsoluteElevation(e,t,n)})}addObjectStateSet(e){this._forEachSymbolLayerGraphic(t=>t.addObjectState(e))}removeObjectState(e){this._forEachSymbolLayerGraphic(t=>t.removeObjectState(e))}updateHighlights(e){this._forEachSymbolLayerGraphic(t=>t.updateHighlights(e))}_forEachGraphicList(e,t){e?.forEach(e=>e&&t(e))}_forEachSymbolLayerGraphic(e){this._forEachGraphicList(this.layers,e),this._calloutLayer&&e(this._calloutLayer)}_forEachLabelGraphic(e){this._forEachGraphicList(this.labelLayers,e)}_forEachRenderedGraphic(e){this._forEachSymbolLayerGraphic(e),this._forEachLabelGraphic(e)}get test(){}}function T(e,t,n){let r=t===1?`hiddenIfDeconflicted`in n&&n.hiddenIfDeconflicted?0:8:e&256?0:8;n.setVisibility(E(e,t,r))}function E(e,t,n=0){let r=(t===1?15:255)&~n;return(e&r)===r}export{w as Graphics3DGraphic};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- class e{constructor(e,t,n){this.graphic=e,this.renderingInfo=t,this.layer=n}}export{e as Graphics3DGraphicCreationContext};
2
+ class e{constructor(e,t,n,r){this.graphic=e,this.renderingInfo=t,this.layer=n,this.reportGraphicSourceMemory=r}}export{e as Graphics3DGraphicCreationContext};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as t,set as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as i,expandWithVec3 as a,create as o,isPoint as s,center as c,offset as l}from"../../../../geometry/support/aaBoundingBox.js";import{evaluateElevationInfoAtPoint as u}from"./elevationAlignmentUtils.js";import{demResolutionForBoundingBox as d}from"./graphicUtils.js";import{Object3DHighlightStateID as f}from"../../webgl-engine/lib/Object3DStateID.js";class p{constructor(e,t,n,r,i){this.graphics3DSymbolLayer=e,this.instanceIndex=t,this.elevationAligner=n,this.elevationContext=r,this._highlightOrderMap=i,this.type=`lod-instance`,this._highlights=new Set,this.alignedSampledElevation=0,this.isElevationSource=!1,this.needsElevationUpdates=!1,this._highlightName=null}initialize(){}setVisibility(e){let{instanceData:t}=this;e!==t.getVisible(this.instanceIndex)&&t.setVisible(this.instanceIndex,e)}destroy(){this.instanceIndex!=null&&(this.instanceData.removeInstance(this.instanceIndex),this.graphics3DSymbolLayer.notifyDestroyGraphicLayer(this))}get usedMemory(){return this.graphics3DSymbolLayer.usedMemory}alignWithElevation(e,t){if(this.elevationAligner){let n=this.elevationAligner(this,this.elevationContext,e.spatialReference,(n,r)=>u(n,e,this.elevationContext,t,r),t);n!=null&&(this.alignedSampledElevation=n)}}getCenterObjectSpace(e=r()){return this.instanceData.getCombinedLocalTransform(this.instanceIndex,v),t(e,this._lodRenderer.baseBoundingSphere.center,v)}getBoundingBoxObjectSpace(e=o()){this.instanceData.getCombinedLocalTransform(this.instanceIndex,v);let r=this._lodRenderer.baseBoundingBox;i(e);for(let i=0;i<8;++i)n(h,i&1?r[3]:r[0],i&2?r[4]:r[1],i&4?r[5]:r[2]),t(h,h,v),a(e,h);return e}computeAttachmentOrigin(e){this.instanceData.getGlobalTransform(this.instanceIndex,v),e.render.origin[0]+=v[12],e.render.origin[1]+=v[13],e.render.origin[2]+=v[14],e.render.num++}async getProjectedBoundingBox(e,n,r,a,o){let u=this.getBoundingBoxObjectSpace(o),f=_,p=s(u)?1:f.length;this.instanceData.getGlobalTransform(this.instanceIndex,v);for(let e=0;e<p;e++){let n=f[e];h[0]=u[n[0]],h[1]=u[n[1]],h[2]=u[n[2]],t(h,h,v),m[e*3]=h[0],m[e*3+1]=h[1],m[e*3+2]=h[2]}if(!e(m,0,p))return null;i(u);let y=null;this.calculateRelativeScreenBounds&&(y=this.calculateRelativeScreenBounds());for(let e=0;e<p*3;e+=3){for(let t=0;t<3;t++)u[t]=Math.min(u[t],m[e+t]),u[t+3]=Math.max(u[t+3],m[e+t]);y&&r.push({location:m.slice(e,e+3),screenSpaceBoundingRect:y})}if(n&&(c(u,g),this.elevationContext.mode!==`absolute-height`)){let e,t=d(u,n.service.spatialReference,n);try{e=await n.service.queryElevation(g[0],g[1],a,t,`ground`)}catch{}e!=null&&l(u,0,0,-this.alignedSampledElevation+e)}return u}addObjectState(e){e.stateType===0&&this.addObjectHighlightState(e)}addObjectHighlightState(e){let t=new f(e.highlightName);this._addHighlightId(t),e.addExternal(e=>{this._removeHighlightId(e)},t)}removeObjectState(e){this._highlights.forEach(t=>e.remove(t))}updateHighlights(e){this._highlightOrderMap=e,this._updateHighlightOptions()}_calculateHighlightOptions(){let e=-1,t=null;return this._highlights.forEach(({highlightName:n})=>{let r=this._highlightOrderMap.get(n);r!==void 0&&r>e&&(e=r,t=n)}),t}_addHighlightId(e){this._highlights.add(e),this._updateHighlightOptions()}_removeHighlightId(e){this._highlights.delete(e),this._updateHighlightOptions()}_updateHighlightOptions(){let e=this._calculateHighlightOptions();e!==this._highlightName&&(this._highlightName=e,this.instanceData.setHighlight(this.instanceIndex,e))}get _lodRenderer(){return this.graphics3DSymbolLayer.lodRenderer}get instanceData(){return this._lodRenderer.instanceData}}const m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],h=r(),g=r(),_=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]],v=e();export{p as Graphics3DLodInstanceGraphicLayer};
2
+ import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as t,set as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as i,expandWithVec3 as a,create as o,isPoint as s,center as c,offset as l}from"../../../../geometry/support/aaBoundingBox.js";import{evaluateElevationInfoAtPoint as u}from"./elevationAlignmentUtils.js";import{demResolutionForBoundingBox as d}from"./graphicUtils.js";import{Object3DHighlightStateID as f}from"../../webgl-engine/lib/Object3DStateID.js";class p{constructor(e,t,n,r,i){this.graphics3DSymbolLayer=e,this.instanceIndex=t,this.elevationAligner=n,this.elevationContext=r,this._highlightOrderMap=i,this.type=`lod-instance`,this._highlights=new Set,this.alignedSampledElevation=0,this.isElevationSource=!1,this.needsElevationUpdates=!1,this._highlightName=null}initialize(){}setVisibility(e){let{instanceData:t}=this;e!==t.getVisible(this.instanceIndex)&&t.setVisible(this.instanceIndex,e)}destroy(){this.instanceIndex!=null&&(this.instanceData.removeInstance(this.instanceIndex),this.graphics3DSymbolLayer.notifyDestroyGraphicLayer(this))}get usedMemory(){return this.graphics3DSymbolLayer.usedMemory}setNotifyMemoryChange(e){}alignWithElevation(e,t){if(this.elevationAligner){let n=this.elevationAligner(this,this.elevationContext,e.spatialReference,(n,r)=>u(n,e,this.elevationContext,t,r),t);n!=null&&(this.alignedSampledElevation=n)}}getCenterObjectSpace(e=r()){return this.instanceData.getCombinedLocalTransform(this.instanceIndex,v),t(e,this._lodRenderer.baseBoundingSphere.center,v)}getBoundingBoxObjectSpace(e=o()){this.instanceData.getCombinedLocalTransform(this.instanceIndex,v);let r=this._lodRenderer.baseBoundingBox;i(e);for(let i=0;i<8;++i)n(h,i&1?r[3]:r[0],i&2?r[4]:r[1],i&4?r[5]:r[2]),t(h,h,v),a(e,h);return e}computeAttachmentOrigin(e){this.instanceData.getGlobalTransform(this.instanceIndex,v),e.render.origin[0]+=v[12],e.render.origin[1]+=v[13],e.render.origin[2]+=v[14],e.render.num++}async getProjectedBoundingBox(e,n,r,a,o){let u=this.getBoundingBoxObjectSpace(o),f=_,p=s(u)?1:f.length;this.instanceData.getGlobalTransform(this.instanceIndex,v);for(let e=0;e<p;e++){let n=f[e];h[0]=u[n[0]],h[1]=u[n[1]],h[2]=u[n[2]],t(h,h,v),m[e*3]=h[0],m[e*3+1]=h[1],m[e*3+2]=h[2]}if(!e(m,0,p))return null;i(u);let y=null;this.calculateRelativeScreenBounds&&(y=this.calculateRelativeScreenBounds());for(let e=0;e<p*3;e+=3){for(let t=0;t<3;t++)u[t]=Math.min(u[t],m[e+t]),u[t+3]=Math.max(u[t+3],m[e+t]);y&&r.push({location:m.slice(e,e+3),screenSpaceBoundingRect:y})}if(n&&(c(u,g),this.elevationContext.mode!==`absolute-height`)){let e,t=d(u,n.service.spatialReference,n);try{e=await n.service.queryElevation(g[0],g[1],a,t,`ground`)}catch{}e!=null&&l(u,0,0,-this.alignedSampledElevation+e)}return u}addObjectState(e){e.stateType===0&&this.addObjectHighlightState(e)}addObjectHighlightState(e){let t=new f(e.highlightName);this._addHighlightId(t),e.addExternal(e=>{this._removeHighlightId(e)},t)}removeObjectState(e){this._highlights.forEach(t=>e.remove(t))}updateHighlights(e){this._highlightOrderMap=e,this._updateHighlightOptions()}_calculateHighlightOptions(){let e=-1,t=null;return this._highlights.forEach(({highlightName:n})=>{let r=this._highlightOrderMap.get(n);r!==void 0&&r>e&&(e=r,t=n)}),t}_addHighlightId(e){this._highlights.add(e),this._updateHighlightOptions()}_removeHighlightId(e){this._highlights.delete(e),this._updateHighlightOptions()}_updateHighlightOptions(){let e=this._calculateHighlightOptions();e!==this._highlightName&&(this._highlightName=e,this.instanceData.setHighlight(this.instanceIndex,e))}get _lodRenderer(){return this.graphics3DSymbolLayer.lodRenderer}get instanceData(){return this._lodRenderer.instanceData}}const m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],h=r(),g=r(),_=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]],v=e();export{p as Graphics3DLodInstanceGraphicLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{getTranslation as e,multiply as t,invert as n,copy as r,fromTranslation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as a,create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{perObjectElevationAligner as l}from"./ElevationAligners.js";import{evaluateElevationInfoAtPoint as u}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as d}from"./Graphics3DObject3DGraphicLayer.js";import{meshAutoFastUpdateConstants as f}from"./meshAutoFastUpdateConstants.js";class p extends d{constructor(){super(...arguments),this.fastTransformUpdatesAllowed=!1,this._originalGeometries=[],this._fastTransformUpdatesEnabled=!1,this._autoDisableFastUpdatesTimeoutId=0}get fastTransformUpdatesEnabled(){return this._fastTransformUpdatesEnabled}destroy(){super.destroy(),this._cancelAutoDisableFastUpdates()}enableFastTransformUpdates(t,n){if(!this.fastTransformUpdatesAllowed||this._fastTransformUpdatesEnabled)return;this._cancelAutoDisableFastUpdates(),this._fastTransformUpdatesEnabled=!0;let{stageObject:r}=this,i=r.geometries.slice();r.removeAllGeometries();let a=e(m,r.transformation),o=n.getOrigin(a);for(let e of i){let n=t(e.material),i=e.instantiate({material:n});i.localOrigin=o,r.addGeometry(i)}this._originalGeometries=i}autoDisableFastTransformUpdates(e){this._cancelAutoDisableFastUpdates(),this._autoDisableFastUpdatesTimeoutId=setTimeout(()=>{this._autoDisableFastUpdatesTimeoutId=0,e()},f.disableDelayMs)}updateAutoDisableFastTransformUpdates(e){this._autoDisableFastUpdatesTimeoutId&&this.autoDisableFastTransformUpdates(e)}_cancelAutoDisableFastUpdates(){clearTimeout(this._autoDisableFastUpdatesTimeoutId),this._autoDisableFastUpdatesTimeoutId=0}disableFastTransformUpdates(e){if(!this._fastTransformUpdatesEnabled)return;this._cancelAutoDisableFastUpdates(),this._fastTransformUpdatesEnabled=!1;let{stageObject:t}=this,n=t.geometries.length>0?t.geometries[0].localOrigin:void 0,r=t.geometries.map(t=>e(t.material));t.removeAllGeometries();for(let e=0;e<this._originalGeometries.length;e++){let i=this._originalGeometries[e],a=r[e];a.setParameters({modelTransformation:null}),i.localOrigin!=null&&(i.localOrigin=n),a===i.material?t.addGeometry(i):t.addGeometry(i.instantiate({material:a}))}this._originalGeometries.length=0}updateFastLocalOrigin(t,n,r,i=!0){if(!this._fastTransformUpdatesEnabled)return;let{stageObject:o}=this;if(o.geometries.length===0)return;let s=o.geometries[0].localOrigin,c=e(m,t);if(s&&!i&&!r.needsOriginUpdate(s,c,o.boundingVolumeWorldSpace.sphere.radius*2))return;let l=r.getOrigin(c);if(l===s)return;let u=n?.localMatrix??a;o.shaderTransformation=null,o.transformation=t,o.geometries.forEach(e=>{e.transformation=u,e.localOrigin=l})}updateTransform(e,r,i){let{stageObject:o}=this,s=r?.localMatrix??a;if(!this._fastTransformUpdatesEnabled){o.shaderTransformation=null,o.transformation=e,o.geometries.forEach(e=>e.transformation=s),this._updateEdgeTransform(i);return}let c=o.transformation,l=o.geometries[0].transformation,u=e,d=s,f=t(h,c,l),p=t(g,u,d);o.shaderTransformation=t(v,p,n(v,l)),this._setFastMaterialTransformation({matA:f,matB:p}),this._updateEdgeTransform(i)}alignWithElevation(e,n,i){if(!this._fastTransformUpdatesEnabled){super.alignWithElevation(e,n,i);return}let a=(t,r)=>u(t,e,this.elevationContext,n,r),{stageObject:o}=this;if(!o.geometries[0].material.parameters.modelTransformation)return;let s=o.transformation,c=o.geometries[0].transformation,d=t(h,s,c),f=o.effectiveTransformation,p=r(_,f);this.alignedSampledElevation=l(this,this.elevationContext,e.spatialReference,a,n,p),o.shaderTransformation=p;let m=o.geometries[0].transformation,v=t(g,p,m);this._setFastMaterialTransformation({matA:d,matB:v}),this._updateEdgeTransform(i)}_setFastMaterialTransformation({matA:e,matB:r}){let{stageObject:a}=this;if(a.geometries.length===0)return;let o=a.geometries[0].localOrigin,c=i(x,s(m,o.vec3,-1)),l=t(y,c,e),u=t(b,c,r),d=n(y,l),f=t(b,u,d);for(let e of a.geometries)e.material.setParameters({modelTransformation:f})}_updateEdgeTransform(e){let{stageObject:t,_stageLayer:n}=this;n.stage.renderer.withEdgeView(n=>{n.fastUpdateObject3DEdgesTransform(t)||this.resetEdgeObject(e)})}}const m=c(),h=o(),g=o(),_=o(),v=o(),y=o(),b=o(),x=o();export{p as Graphics3DMeshObject3DGraphicLayer};
2
+ import{getTranslation as e,multiply as t,invert as n,copy as r,fromTranslation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as a,create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{perObjectElevationAligner as l}from"./ElevationAligners.js";import{evaluateElevationInfoAtPoint as u}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as d}from"./Graphics3DObject3DGraphicLayer.js";import{meshAutoFastUpdateConstants as f}from"./meshAutoFastUpdateConstants.js";class p extends d{constructor(){super(...arguments),this.fastTransformUpdatesAllowed=!1,this._originalGeometries=[],this._fastTransformUpdatesEnabled=!1,this._autoDisableFastUpdatesTimeoutId=0}get fastTransformUpdatesEnabled(){return this._fastTransformUpdatesEnabled}destroy(){super.destroy(),this._cancelAutoDisableFastUpdates()}enableFastTransformUpdates(t,n){if(!this.fastTransformUpdatesAllowed||this._fastTransformUpdatesEnabled)return;this._cancelAutoDisableFastUpdates(),this._fastTransformUpdatesEnabled=!0;let{stageObject:r}=this,i=r.geometries.slice(),a=e(m,r.transformation),o=n.getOrigin(a),s=i.map(e=>{let n=t(e.material),r=e.instantiate({material:n});return r.localOrigin=o,r});r.replaceGeometries(s),this._originalGeometries=i}autoDisableFastTransformUpdates(e){this._cancelAutoDisableFastUpdates(),this._autoDisableFastUpdatesTimeoutId=setTimeout(()=>{this._autoDisableFastUpdatesTimeoutId=0,e()},f.disableDelayMs)}updateAutoDisableFastTransformUpdates(e){this._autoDisableFastUpdatesTimeoutId&&this.autoDisableFastTransformUpdates(e)}_cancelAutoDisableFastUpdates(){clearTimeout(this._autoDisableFastUpdatesTimeoutId),this._autoDisableFastUpdatesTimeoutId=0}disableFastTransformUpdates(e){if(!this._fastTransformUpdatesEnabled)return;this._cancelAutoDisableFastUpdates(),this._fastTransformUpdatesEnabled=!1;let{stageObject:t}=this,n=t.geometries.length>0?t.geometries[0].localOrigin:void 0,r=t.geometries.map(t=>e(t.material)),i=this._originalGeometries.map((e,t)=>{let i=r[t];return i.setParameters({modelTransformation:null}),e.localOrigin!=null&&(e.localOrigin=n),i===e.material?e:e.instantiate({material:i})});t.replaceGeometries(i),this._originalGeometries.length=0}updateFastLocalOrigin(t,n,r,i=!0){if(!this._fastTransformUpdatesEnabled)return;let{stageObject:o}=this;if(o.geometries.length===0)return;let s=o.geometries[0].localOrigin,c=e(m,t);if(s&&!i&&!r.needsOriginUpdate(s,c,o.boundingVolumeWorldSpace.sphere.radius*2))return;let l=r.getOrigin(c);if(l===s)return;let u=n?.localMatrix??a;o.shaderTransformation=null,o.transformation=t,o.geometries.forEach(e=>{e.transformation=u,e.localOrigin=l})}updateTransform(e,r,i){let{stageObject:o}=this,s=r?.localMatrix??a;if(!this._fastTransformUpdatesEnabled){o.shaderTransformation=null,o.transformation=e,o.geometries.forEach(e=>e.transformation=s),this._updateEdgeTransform(i);return}let c=o.transformation,l=o.geometries[0].transformation,u=e,d=s,f=t(h,c,l),p=t(g,u,d);o.shaderTransformation=t(v,p,n(v,l)),this._setFastMaterialTransformation({matA:f,matB:p}),this._updateEdgeTransform(i)}alignWithElevation(e,n,i){if(!this._fastTransformUpdatesEnabled){super.alignWithElevation(e,n,i);return}let a=(t,r)=>u(t,e,this.elevationContext,n,r),{stageObject:o}=this;if(!o.geometries[0].material.parameters.modelTransformation)return;let s=o.transformation,c=o.geometries[0].transformation,d=t(h,s,c),f=o.effectiveTransformation,p=r(_,f);this.alignedSampledElevation=l(this,this.elevationContext,e.spatialReference,a,n,p),o.shaderTransformation=p;let m=o.geometries[0].transformation,v=t(g,p,m);this._setFastMaterialTransformation({matA:d,matB:v}),this._updateEdgeTransform(i)}_setFastMaterialTransformation({matA:e,matB:r}){let{stageObject:a}=this;if(a.geometries.length===0)return;let o=a.geometries[0].localOrigin,c=i(x,s(m,o.vec3,-1)),l=t(y,c,e),u=t(b,c,r),d=n(y,l),f=t(b,u,d);for(let e of a.geometries)e.material.setParameters({modelTransformation:f})}_updateEdgeTransform(e){let{stageObject:t,_stageLayer:n}=this;n.stage.renderer.withEdgeView(n=>{n.fastUpdateObject3DEdgesTransform(t)||this.resetEdgeObject(e)})}}const m=c(),h=o(),g=o(),_=o(),v=o(),y=o(),b=o(),x=o();export{p as Graphics3DMeshObject3DGraphicLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{Graphics3DStageObjectGraphicLayer as e}from"./Graphics3DStageObjectGraphicLayer.js";class t{constructor(e,t,n){this.baseMaterial=e,this.edgeMaterial=t,this.hasSlicePlane=n}}class n extends e{get useObjectOriginAsAttachmentOrigin(){return this._getFlag(4)}set useObjectOriginAsAttachmentOrigin(e){this._setFlag(4,e)}constructor(e,t,n,r,i,a=null){super(e,t,n,i),this.elevationAligner=r,this._edgeState=a,this.type=`object3d`}_disposeStageObject(){this._stageLayer?.stage.renderer.edgeView?.removeObject(this.stageObject),super._disposeStageObject()}layerOpacityChanged(e,t){let{stageObject:n,_edgeState:i,_stageLayer:a}=this;if(i==null)return;let o=r(i.baseMaterial);i.edgeMaterial.objectTransparency!==o&&(i.edgeMaterial.objectTransparency=o,this.resetEdgeObject(t)),a.stage.renderer.withEdgeView(t=>t.updateAllComponentOpacities(n,[e]))}updateMaterial(e){this.stageObject.geometries.map(t=>t.instantiate({material:e})).forEach(e=>{this.stageObject.addGeometry(e),this.stageObject.removeGeometry(0)})}slicePlaneEnabledChanged(e,t){let{stageObject:n,_edgeState:r,_stageLayer:i}=this;r!=null&&i.stage.renderer.withEdgeView(i=>{i.updateAllComponentMaterials(n,r.edgeMaterial,e,!t),r.hasSlicePlane=e})}setVisibility(e){let{_edgeState:t,stageObject:n,_stageLayer:r}=this;r!=null&&this.visible!==e&&(super.setVisibility(e),t!=null&&r.stage.renderer.withEdgeView(r=>{r.hasObject(n)?r.updateObjectVisibility(n,e):e&&this._addOrUpdateEdgeObject(t,r,!1)}))}_alignWithElevation(e,t,n,r){this.elevationAligner!=null&&(this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,e,t,n),this.resetEdgeObject(r))}computeAttachmentOrigin(e){let t=this.stageObject.effectiveTransformation;this.useObjectOriginAsAttachmentOrigin?(e.render.origin[0]+=t[12],e.render.origin[1]+=t[13],e.render.origin[2]+=t[14],e.render.num++):super.computeAttachmentOrigin(e)}resetEdgeObject(e){let{_edgeState:t,stageObject:n,_stageLayer:r,visible:i}=this;t!=null&&r.stage.renderer.withEdgeView(r=>{i?this._addOrUpdateEdgeObject(t,r,e):r.removeObject(n)})}_addOrUpdateEdgeObject(e,t,n){let i=r(e.baseMaterial);e.edgeMaterial.objectTransparency=i,t.addOrUpdateObject3D(this.stageObject,e.edgeMaterial,e.hasSlicePlane,!n).then(()=>this._stageLayer?.sync())}}function r(e){return+!e.transparent}export{n as Graphics3DObject3DGraphicLayer,t as Object3DEdgeState};
2
+ import{Graphics3DStageObjectGraphicLayer as e}from"./Graphics3DStageObjectGraphicLayer.js";class t{constructor(e,t,n){this.baseMaterial=e,this.edgeMaterial=t,this.hasSlicePlane=n}}class n extends e{get useObjectOriginAsAttachmentOrigin(){return this._getFlag(4)}set useObjectOriginAsAttachmentOrigin(e){this._setFlag(4,e)}constructor(e,t,n,r,i,a=null,o=0){super(e,t,n,i,o),this.elevationAligner=r,this._edgeState=a,this.type=`object3d`}_disposeStageObject(){this._stageLayer?.stage.renderer.edgeView?.removeObject(this.stageObject),super._disposeStageObject()}layerOpacityChanged(e,t){let{stageObject:n,_edgeState:i,_stageLayer:a}=this;if(i==null)return;let o=r(i.baseMaterial);i.edgeMaterial.objectTransparency!==o&&(i.edgeMaterial.objectTransparency=o,this.resetEdgeObject(t)),a.stage.renderer.withEdgeView(t=>t.updateAllComponentOpacities(n,[e]))}updateMaterial(e){let t=this.usedMemory;this._detachGeometryMemoryCallbacks(),this.stageObject.geometries.map(t=>t.instantiate({material:e})).forEach(e=>{this.stageObject.addGeometry(e),this.stageObject.removeGeometry(0)}),this._updateGeometryBufferMemory(t)}slicePlaneEnabledChanged(e,t){let{stageObject:n,_edgeState:r,_stageLayer:i}=this;r!=null&&i.stage.renderer.withEdgeView(i=>{i.updateAllComponentMaterials(n,r.edgeMaterial,e,!t),r.hasSlicePlane=e})}setVisibility(e){let{_edgeState:t,stageObject:n,_stageLayer:r}=this;r!=null&&this.visible!==e&&(super.setVisibility(e),t!=null&&r.stage.renderer.withEdgeView(r=>{r.hasObject(n)?r.updateObjectVisibility(n,e):e&&this._addOrUpdateEdgeObject(t,r,!1)}))}_alignWithElevation(e,t,n,r){this.elevationAligner!=null&&(this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,e,t,n),this.resetEdgeObject(r))}computeAttachmentOrigin(e){let t=this.stageObject.effectiveTransformation;this.useObjectOriginAsAttachmentOrigin?(e.render.origin[0]+=t[12],e.render.origin[1]+=t[13],e.render.origin[2]+=t[14],e.render.num++):super.computeAttachmentOrigin(e)}resetEdgeObject(e){let{_edgeState:t,stageObject:n,_stageLayer:r,visible:i}=this;t!=null&&r.stage.renderer.withEdgeView(r=>{i?this._addOrUpdateEdgeObject(t,r,e):r.removeObject(n)})}_addOrUpdateEdgeObject(e,t,n){let i=r(e.baseMaterial);e.edgeMaterial.objectTransparency=i,t.addOrUpdateObject3D(this.stageObject,e.edgeMaterial,e.hasSlicePlane,!n).then(()=>this._stageLayer?.sync())}}function r(e){return+!e.transparent}export{n as Graphics3DObject3DGraphicLayer,t as Object3DEdgeState};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{transformMat4 as e,add as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as r,create as i,isPoint as a,empty as o,center as s,offset as c}from"../../../../geometry/support/aaBoundingBox.js";import{evaluateElevationInfoAtPoint as l}from"./elevationAlignmentUtils.js";import{demResolutionForBoundingBox as u}from"./graphicUtils.js";class d{_getFlag(e){return(this._flags&e)===e}_setFlag(e,t){t?this._flags|=e:this._flags&=~e}get needsElevationUpdates(){return this._getFlag(2)}set needsElevationUpdates(e){this._setFlag(2,e)}get hiddenIfDeconflicted(){return this._getFlag(8)}set hiddenIfDeconflicted(e){this._setFlag(8,e)}get occlusionCheck(){return this._getFlag(16)}get adaptiveOcclusion(){return this._getFlag(32)}setOccludedVisibilityMode(e=`hidden`){this._setFlag(16,e!==`visible`),this._setFlag(32,e===`adaptive`)}get isElevationSource(){return!!this.stageObject.lastValidElevationBB}constructor(e,t,n,r){this.graphics3DSymbolLayer=e,this.stageObject=t,this._sharedResource=n,this.elevationContext=r,this._stageLayer=null,this._flags=0,this.alignedSampledElevation=0}initialize(e){this._stageLayer=e,this.hiddenIfDeconflicted&&(e.add(this.stageObject),this._setFlag(1,!0))}destroy(){this._getFlag(64)||(this._setFlag(64,!0),this._getFlag(1)&&(this._stageLayer.remove(this.stageObject),this._setFlag(1,!1)),this._disposeStageObject(),this._sharedResource?.release(),this._stageLayer=null)}_disposeStageObject(){this.stageObject.dispose()}get usedMemory(){return this.graphics3DSymbolLayer.usedMemory}updateHighlights(e){}setVisibility(e){let{stageObject:t,_stageLayer:n}=this;n!=null&&this.visible!==e&&(t.visible=e,e&&!this._getFlag(1)&&(n.add(t),this._setFlag(1,!0)))}get visible(){return this._getFlag(1)&&this.stageObject.visible}alignWithElevation(e,t,n){this._alignWithElevation(e.spatialReference,(n,r)=>l(n,e,this.elevationContext,t,r),t,n)}alignWithAbsoluteElevation(e,t,n){this._alignWithElevation(this.graphics3DSymbolLayer.view.spatialReference,(t,n)=>{n.sampledElevation=e,n.verticalDistanceToGround=0,n.z=e},t,n)}getCenterObjectSpace(){return this.stageObject.boundingVolumeObjectSpace.sphere.center}getBoundingBoxObjectSpace(e=i()){let t=this.stageObject.boundingVolumeObjectSpace;return r(e,t.box),e}computeAttachmentOrigin(n){let r=this.stageObject.effectiveTransformation;for(let i of this.stageObject.geometries)i.computeAttachmentOrigin(m)&&(e(m,m,r),t(n.render.origin,n.render.origin,m),n.render.num++)}async getProjectedBoundingBox(t,n,r,i,l){let d=this.getBoundingBoxObjectSpace(l),g=h,_=a(d)?1:g.length;for(let t=0;t<_;t++){let n=g[t];p[0]=d[n[0]],p[1]=d[n[1]],p[2]=d[n[2]],e(p,p,this.stageObject.transformation),f[t*3]=p[0],f[t*3+1]=p[1],f[t*3+2]=p[2]}if(!t(f,0,_))return null;o(d);let v=null;this.calculateRelativeScreenBounds&&(v=this.calculateRelativeScreenBounds());for(let e=0;e<_*3;e+=3){for(let t=0;t<3;t++)d[t]=Math.min(d[t],f[e+t]),d[t+3]=Math.max(d[t+3],f[e+t]);v&&r.push({location:f.slice(e,e+3),screenSpaceBoundingRect:v})}if(n?.service&&this.elevationContext.mode!==`absolute-height`){s(d,m);let e=this.elevationContext.mode===`relative-to-scene`?`scene`:`ground`,t=0;if(n.useViewElevation)t=n.service.getElevation(m[0],m[1],e)??0;else try{let r=u(d,n.service.spatialReference,n);t=await n.service.queryElevation(m[0],m[1],i,r,e)??0}catch{}c(d,0,0,-this.alignedSampledElevation+t)}return d}addObjectState(e){e.stateType===0&&e.addObject(this.stageObject,this.stageObject.highlight(e.highlightName)),e.stateType===1&&e.addObject(this.stageObject,this.stageObject.maskOccludee())}removeObjectState(e){e.removeByObject(this.stageObject)}}const f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],p=n(),m=n(),h=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];export{d as Graphics3DStageObjectGraphicLayer};
2
+ import{transformMat4 as e,add as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as r,create as i,isPoint as a,empty as o,center as s,offset as c}from"../../../../geometry/support/aaBoundingBox.js";import{evaluateElevationInfoAtPoint as l}from"./elevationAlignmentUtils.js";import{demResolutionForBoundingBox as u}from"./graphicUtils.js";import{computeGeometryBufferMemory as d}from"../../webgl-engine/lib/geometryMemoryUtils.js";class f{setNotifyMemoryChange(e){this._notifyMemoryChange=e;for(let t of this.stageObject.geometries)t.notifyMemoryChange=e}_getFlag(e){return(this._flags&e)===e}_setFlag(e,t){t?this._flags|=e:this._flags&=~e}get needsElevationUpdates(){return this._getFlag(2)}set needsElevationUpdates(e){this._setFlag(2,e)}get hiddenIfDeconflicted(){return this._getFlag(8)}set hiddenIfDeconflicted(e){this._setFlag(8,e)}get occlusionCheck(){return this._getFlag(16)}get adaptiveOcclusion(){return this._getFlag(32)}setOccludedVisibilityMode(e=`hidden`){this._setFlag(16,e!==`visible`),this._setFlag(32,e===`adaptive`)}get isElevationSource(){return!!this.stageObject.lastValidElevationBB}constructor(e,t,n,r,i=0){this.graphics3DSymbolLayer=e,this.stageObject=t,this._resourceToReleaseOnDestroy=n,this.elevationContext=r,this._additionalMemory=i,this._stageLayer=null,this._flags=0,this._geometryBufferMemory=0,this.alignedSampledElevation=0,this._updateGeometryBufferMemory()}initialize(e){this._stageLayer=e,this.hiddenIfDeconflicted&&(e.add(this.stageObject),this._setFlag(1,!0))}destroy(){this._getFlag(64)||(this._setFlag(64,!0),this.setNotifyMemoryChange(void 0),this._getFlag(1)&&(this._stageLayer.remove(this.stageObject),this._setFlag(1,!1)),this._disposeStageObject(),this._resourceToReleaseOnDestroy?.release(),this._stageLayer=null)}_disposeStageObject(){this.stageObject.dispose()}get usedMemory(){let e=this.graphics3DSymbolLayer.usedMemory+this._geometryBufferMemory+this._additionalMemory;for(let t of this.stageObject.geometries)e+=t.usedMemoryExcludingBuffers;return e}_detachGeometryMemoryCallbacks(){for(let e of this.stageObject.geometries)e.notifyMemoryChange=void 0}_updateGeometryBufferMemory(e){if(this._geometryBufferMemory=d(this.stageObject.geometries),this.setNotifyMemoryChange(this._notifyMemoryChange),e!==void 0){let t=this.usedMemory-e;t&&this._notifyMemoryChange?.(t)}}updateHighlights(e){}setVisibility(e){let{stageObject:t,_stageLayer:n}=this;n!=null&&this.visible!==e&&(t.visible=e,e&&!this._getFlag(1)&&(n.add(t),this._setFlag(1,!0)))}get visible(){return this._getFlag(1)&&this.stageObject.visible}alignWithElevation(e,t,n){this._alignWithElevation(e.spatialReference,(n,r)=>l(n,e,this.elevationContext,t,r),t,n)}alignWithAbsoluteElevation(e,t,n){this._alignWithElevation(this.graphics3DSymbolLayer.view.spatialReference,(t,n)=>{n.sampledElevation=e,n.verticalDistanceToGround=0,n.z=e},t,n)}getCenterObjectSpace(){return this.stageObject.boundingVolumeObjectSpace.sphere.center}getBoundingBoxObjectSpace(e=i()){let t=this.stageObject.boundingVolumeObjectSpace;return r(e,t.box),e}computeAttachmentOrigin(n){let r=this.stageObject.effectiveTransformation;for(let i of this.stageObject.geometries)i.computeAttachmentOrigin(h)&&(e(h,h,r),t(n.render.origin,n.render.origin,h),n.render.num++)}async getProjectedBoundingBox(t,n,r,i,l){let d=this.getBoundingBoxObjectSpace(l),f=g,_=a(d)?1:f.length;for(let t=0;t<_;t++){let n=f[t];m[0]=d[n[0]],m[1]=d[n[1]],m[2]=d[n[2]],e(m,m,this.stageObject.transformation),p[t*3]=m[0],p[t*3+1]=m[1],p[t*3+2]=m[2]}if(!t(p,0,_))return null;o(d);let v=null;this.calculateRelativeScreenBounds&&(v=this.calculateRelativeScreenBounds());for(let e=0;e<_*3;e+=3){for(let t=0;t<3;t++)d[t]=Math.min(d[t],p[e+t]),d[t+3]=Math.max(d[t+3],p[e+t]);v&&r.push({location:p.slice(e,e+3),screenSpaceBoundingRect:v})}if(n?.service&&this.elevationContext.mode!==`absolute-height`){s(d,h);let e=this.elevationContext.mode===`relative-to-scene`?`scene`:`ground`,t=0;if(n.useViewElevation)t=n.service.getElevation(h[0],h[1],e)??0;else try{let r=u(d,n.service.spatialReference,n);t=await n.service.queryElevation(h[0],h[1],i,r,e)??0}catch{}c(d,0,0,-this.alignedSampledElevation+t)}return d}addObjectState(e){e.stateType===0&&e.addObject(this.stageObject,this.stageObject.highlight(e.highlightName)),e.stateType===1&&e.addObject(this.stageObject,this.stageObject.maskOccludee())}removeObjectState(e){e.removeByObject(this.stageObject)}}const p=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],m=n(),h=n(),g=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];export{f as Graphics3DStageObjectGraphicLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isSome as e}from"../../../../core/arrayUtils.js";import{forEach as t}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{onAbortOrThrow as n,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{aggregateSymbolComplexity as i}from"./defaultSymbolComplexity.js";import{Graphics3DGraphic as a}from"./Graphics3DGraphic.js";import{Graphics3DSymbolLayerCreationContext as o}from"./Graphics3DSymbolCreationContext.js";import{Loadable as s}from"./Loadable.js";import{AggregateSymbolComplexity as c}from"./SymbolComplexity.js";import{getSymbolMemorySize as l}from"./symbolMemory.js";class u extends s{set symbol(e){this._symbol=e,e.symbolLayers.forEach((t,n)=>{let r=this.symbolLayers[n];r!=null&&(r.symbol=e,r.symbolLayer=t)})}get symbol(){return this._symbol}constructor(e,t,n){super(t.schedule),this._symbol=e,this._context=t,this._backgroundLayers=n,this._destroyed=!1,this.symbolLayers=[],this.referenced=0,this._extentPadding=0}async doLoad(e){let i=this._symbol.symbolLayers;this._extentPadding=0,this._backgroundLayers&&(i=this._backgroundLayers.concat(i));let a=i.length;for(;this.symbolLayers.length<i.length;)this.symbolLayers.push(null);this.symbolLayers.length=i.length;let o=[];if(!d){let{make:e}=await import(`./Graphics3DSymbolLayerFactory.js`);d=e}for(let t=0;t<a;t++){let r=i.at(t);if(r.enabled===!1)continue;f.renderPriority=1-(1+t)/a,f.renderPriorityStep=1/a,f.ignoreDrivers=r.ignoreDrivers;let s=d(this.symbol,r,this._context,f),c=n(e,()=>{this.symbolLayers[t]=null,s.destroy()});c&&o.push(c),this.symbolLayers[t]=s}if(await t(this.symbolLayers,async(e,t)=>{if(e!=null)try{await e.load(),this._extentPadding+=Math.max(this._extentPadding,e.extentPadding)}catch{this.symbolLayers[t]=null}}),o.forEach(e=>e.remove()),r(e),this.symbolLayers.length&&!this.symbolLayers.some(e=>!!e))throw Error()}getSymbolLayerSize(e){let t=this.symbolLayers[e];return t==null?null:t.getCachedSize()}get extentPadding(){return this._extentPadding}get symbologySnappingSupported(){return this.symbolLayers.some(e=>e?.queryForSnapping)}get needsUpdateFocus(){return this.symbolLayers.some(e=>e?.needsUpdateFocus===!0)}createGraphics3DGraphic(e,t){let{graphic:n}=e,r=this.symbolLayers.map(t=>t?.createGraphics3DGraphic(e)??null);return new a(n,t||this,r)}get complexity(){let e=new c;return this.symbolLayers.forEach(t=>i(t?.complexity,e)),e}globalPropertyChanged(e,t){let n=this.symbolLayers.length;for(let r=0;r<n;r++){let n=this.symbolLayers[r];if(n!=null&&!n.globalPropertyChanged(e,t,e=>{let t=e.layers[r];return t?.type===`object3d`||t?.type===`buffer`?t:null}))return!1}return!0}applyRendererDiff(e,t){return this.loadStatus===1?this.symbolLayers.reduce((n,r)=>n!==0&&r!=null?Math.min(n,r.applyRendererDiff(e,t)):n,2):0}prepareSymbolPatch(e){if(this.loadStatus===2||e.diff.type!==`partial`)return;let t=e.diff.diff;if(!t.symbolLayers||t.symbolLayers.type!==`partial`)return;let n=t.symbolLayers.diff;this.symbolLayers.forEach((t,r)=>{if(t==null)return;let i=n[r];if(i){let n={diff:i,graphics3DGraphicPatches:[],symbolLayerStatePatches:[]};t.prepareSymbolLayerPatch(n),e.symbolStatePatches.push(...n.symbolLayerStatePatches),n.graphics3DGraphicPatches.length&&e.graphics3DGraphicPatches.push((e,t)=>{let i=e.layers[r];i!=null&&n.graphics3DGraphicPatches.forEach(e=>e(i,t))})}})}updateGeometry(e){return this._updateGeometryOrTransform(e,(t,n)=>t.updateGeometry?t.updateGeometry(e.graphic,n):!1)}updateTransform(e,t,n,r){return this._updateGeometryOrTransform(e,(e,i)=>e.updateTransform?e.updateTransform(i,t,n,r):!1)}_updateGeometryOrTransform(e,t){for(let n=0;n<this.symbolLayers.length;n++){let r=this.symbolLayers[n];if(r==null)continue;let i=e.layers[n];if(!i||!t(r,i))return!1}return!0}onRemoveGraphic(e){for(let t=0;t<this.symbolLayers.length;t++){let n=this.symbolLayers[t];if(n==null)continue;let r=e.layers[t];r!=null&&n.onRemoveGraphic(r)}}getFastUpdateStatus(){let e=!1,t=!1;for(let n of this.symbolLayers)if(n!=null){if(n.loadStatus===0)return 3;n.isFastUpdatesEnabled()?t=!0:e=!0}return t?e?2:1:e?0:4}async queryForSnapping(t,n,i,a){let o=this.symbolLayers.filter(e).filter(e=>e.queryForSnapping!=null).map(e=>e.queryForSnapping(t,n,i,a)),s=await Promise.all(o);return r(a),s.flat()}destroy(){if(!this.destroyed){super.destroy();for(let e of this.symbolLayers)e?.destroy();this.symbolLayers.length=0,this._destroyed=!0}}get destroyed(){return this._destroyed}get usedMemory(){return l(this)}}let d=null;const f=new o;export{u as Graphics3DSymbol};
2
+ import{isSome as e}from"../../../../core/arrayUtils.js";import{forEach as t}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{onAbortOrThrow as n,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{aggregateSymbolComplexity as i}from"./defaultSymbolComplexity.js";import{Graphics3DGraphic as a}from"./Graphics3DGraphic.js";import{Graphics3DSymbolLayerCreationContext as o}from"./Graphics3DSymbolCreationContext.js";import{Loadable as s}from"./Loadable.js";import{AggregateSymbolComplexity as c}from"./SymbolComplexity.js";import{getSymbolMemorySize as l}from"./symbolMemory.js";class u extends s{set symbol(e){this._symbol=e,e.symbolLayers.forEach((t,n)=>{let r=this.symbolLayers[n];r!=null&&(r.symbol=e,r.symbolLayer=t)})}get symbol(){return this._symbol}constructor(e,t,n){super(t.schedule),this._symbol=e,this._context=t,this._backgroundLayers=n,this._destroyed=!1,this.symbolLayers=[],this.referenced=0,this._extentPadding=0}async doLoad(e){let i=this._symbol.symbolLayers;this._extentPadding=0,this._backgroundLayers&&(i=this._backgroundLayers.concat(i));let a=i.length;for(;this.symbolLayers.length<i.length;)this.symbolLayers.push(null);this.symbolLayers.length=i.length;let o=[];if(!d){let{make:e}=await import(`./Graphics3DSymbolLayerFactory.js`);d=e}for(let t=0;t<a;t++){let r=i.at(t);if(r.enabled===!1)continue;f.renderPriority=1-(1+t)/a,f.renderPriorityStep=1/a,f.ignoreDrivers=r.ignoreDrivers;let s=d(this.symbol,r,this._context,f),c=n(e,()=>{this.symbolLayers[t]=null,s.destroy()});c&&o.push(c),this.symbolLayers[t]=s}if(await t(this.symbolLayers,async(e,t)=>{if(e!=null)try{await e.load(),this._extentPadding+=Math.max(this._extentPadding,e.extentPadding)}catch{this.symbolLayers[t]=null}}),o.forEach(e=>e.remove()),r(e),this.symbolLayers.length&&!this.symbolLayers.some(e=>!!e))throw Error()}getSymbolLayerSize(e){let t=this.symbolLayers[e];return t==null?null:t.getCachedSize()}get extentPadding(){return this._extentPadding}get symbologySnappingSupported(){return this.symbolLayers.some(e=>e?.queryForSnapping)}get needsUpdateFocus(){return this.symbolLayers.some(e=>e?.needsUpdateFocus===!0)}createGraphics3DGraphic(e,t){let{graphic:n}=e,r=this.symbolLayers.map(t=>t?.createGraphics3DGraphic(e)??null);return new a(n,t||this,r,e.reportGraphicSourceMemory)}get complexity(){let e=new c;return this.symbolLayers.forEach(t=>i(t?.complexity,e)),e}globalPropertyChanged(e,t){let n=this.symbolLayers.length;for(let r=0;r<n;r++){let n=this.symbolLayers[r];if(n!=null&&!n.globalPropertyChanged(e,t,e=>{let t=e.layers[r];return t?.type===`object3d`||t?.type===`buffer`?t:null}))return!1}return!0}applyRendererDiff(e,t){return this.loadStatus===1?this.symbolLayers.reduce((n,r)=>n!==0&&r!=null?Math.min(n,r.applyRendererDiff(e,t)):n,2):0}prepareSymbolPatch(e){if(this.loadStatus===2||e.diff.type!==`partial`)return;let t=e.diff.diff;if(!t.symbolLayers||t.symbolLayers.type!==`partial`)return;let n=t.symbolLayers.diff;this.symbolLayers.forEach((t,r)=>{if(t==null)return;let i=n[r];if(i){let n={diff:i,graphics3DGraphicPatches:[],symbolLayerStatePatches:[]};t.prepareSymbolLayerPatch(n),e.symbolStatePatches.push(...n.symbolLayerStatePatches),n.graphics3DGraphicPatches.length&&e.graphics3DGraphicPatches.push((e,t)=>{let i=e.layers[r];i!=null&&n.graphics3DGraphicPatches.forEach(e=>e(i,t))})}})}updateGeometry(e){return this._updateGeometryOrTransform(e,(t,n)=>t.updateGeometry?t.updateGeometry(e.graphic,n):!1)}updateTransform(e,t,n,r){return this._updateGeometryOrTransform(e,(e,i)=>e.updateTransform?e.updateTransform(i,t,n,r):!1)}_updateGeometryOrTransform(e,t){for(let n=0;n<this.symbolLayers.length;n++){let r=this.symbolLayers[n];if(r==null)continue;let i=e.layers[n];if(!i||!t(r,i))return!1}return!0}onRemoveGraphic(e){for(let t=0;t<this.symbolLayers.length;t++){let n=this.symbolLayers[t];if(n==null)continue;let r=e.layers[t];r!=null&&n.onRemoveGraphic(r)}}getFastUpdateStatus(){let e=!1,t=!1;for(let n of this.symbolLayers)if(n!=null){if(n.loadStatus===0)return 3;n.isFastUpdatesEnabled()?t=!0:e=!0}return t?e?2:1:e?0:4}async queryForSnapping(t,n,i,a){let o=this.symbolLayers.filter(e).filter(e=>e.queryForSnapping!=null).map(e=>e.queryForSnapping(t,n,i,a)),s=await Promise.all(o);return r(a),s.flat()}destroy(){if(!this.destroyed){super.destroy();for(let e of this.symbolLayers)e?.destroy();this.symbolLayers.length=0,this._destroyed=!0}}get destroyed(){return this._destroyed}get usedMemory(){return l(this)}}let d=null;const f=new o;export{u as Graphics3DSymbol};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{forEach as n,result as r}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{disposeMaybe as a,abortMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as s,isAbortError as c}from"../../../../core/promiseUtils.js";import l from"../../../../core/Queue.js";import{watch as u}from"../../../../core/reactiveUtils.js";import{property as d,subclass as f}from"../../../../core/accessorSupport/decorators.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isInEffectiveScaleRange as m}from"../../../../geometry/support/scaleUtils.js";import{BufferViewVec4i16 as h,BufferViewVec2f as g}from"../../../../geometry/support/buffer/BufferView.js";import{hydrateGraphic as _}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as v}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as y}from"../../../../symbols/callouts/calloutUtils.js";import{make as b}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutCreationContext as x,LineCalloutSymbolLayerRenderingInfo as S}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as C}from"./graphicSymbolUtils.js";import{LabelInfo as w}from"./LabelInfo.js";import{LabelParameters as T}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as E,verticalPlacementFromAnchor as D,textRenderAlignmentFromHorizontalPlacement as O}from"./placementUtils.js";import{placePointOnGeometry as k}from"./pointUtils.js";import{TextRenderer as A}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as j}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as M}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as N}from"../../webgl-engine/lib/WebGLLayer.js";import{hasLayerBasedScaleVisibility as P}from"../../../support/layerViewUtils.js";import{TaskPriority as F}from"../../../support/Scheduler.js";import{Yield as I}from"../../../support/Yield.js";class L{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=[],this.textLabelPlacements=[]}}class R{constructor(e,t,n,r,i){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=n,this.textRenderParameters=r,this.labelFunction=i,this.calloutSymbolLayerIndex=0,this.graphics=new Map,this.scaleVisibility=null}}class z{constructor(e,t,n,r,i,a,o,s){this.layer=t,this.graphics3DCore=n,this.scaleVisibility=r,this.emptySymbolLabelSupported=i,this.elevationInfoOverride=a,this.disablePlacement=o,this.active=s,this.labelClassAbortController=new AbortController,this._labelClassContexts=[],this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new N(e,{pickable:!0},n.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}get labelClassContexts(){return this._labelClassContexts}setLabelClassContext(e,t){this._labelClassContexts[e]=t}resetLabelClassContext(){this._labelClassContexts.length=0}}let B=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._focusAreasLabelsQueue=new l,this._labels=new Map,this._labelingContexts=[]}setup(){this.dispose(),this.addHandles([u(()=>this.view.state?.camera,()=>this.setDirty()),u(()=>this.view.state?.rasterPixelRatio,()=>this._resetAllLabels()),u(()=>this.view.timeZone,()=>this._resetArcadeLabels()),u(()=>this.view.focusAreasView?.polygons,()=>this._updateFocus()),this.view.resourceController.scheduler.registerTask(F.LABELER,this)]),P()&&this.addHandles(u(()=>this.view.scale,()=>this._updateScaleVisibility())),this._textTextureAtlas=new M({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=a(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),q.graphic=null,q.renderingInfo=null,q.layer=null}_updateFocus(){this._focusAreasLabelsQueue.clear(),this._labelingContexts.forEach(e=>{e.graphics.forEach(t=>{this._focusAreasLabelsQueue.push({graphic3DGraphic:t,labelingContext:e})})})}_activateLabelingContext(e){e.graphics.forEach((t,n)=>{let r=new L(e,t);this._labels.set(n,r),e.labelsToInitialize.set(n,r),t.setVisibilityFlag(16,1,!0)}),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach((e,t)=>{e.setVisibilityFlag(16,1,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)}),e.active=!1}_addLabelTextureToAtlas(e){if(this._textTextureAtlas)for(let t of e.graphics3DGraphic.labelLayers){if(!t.labelClass||t.type!==`buffer`)continue;let n=e.textRenderers[t.labelClassContextIndex];n&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(n,e=>H(t.stageObject,e))),V(t.stageObject,n))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach(e=>e.remove()),e.textureAtlasHandles.length=0}get readyToRun(){return this.view.ready&&(this._dirty||this.deconflictor.readyToRun||this._focusAreasLabelsQueue.length>0)}runTask(e){return this._updateLabels(e),this._applyFocusAreasUpdates(e),!this._dirty&&this.deconflictor.readyToRun&&this.deconflictor.runTask(e),I}_updateLabels(e){if(this._dirty){this._dirty=!1;for(let t of this._labelingContexts)if(t.active){if(U(t))this._dirty=!0;else if(W(t.labelClassContexts)){if(t.labelClassContexts===null){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(let[n,r]of t.labelsToInitialize)if(this._ensureGraphics3DResources(r)&&(this._labels.set(n,r),this.deconflictor.setDirty(),e.madeProgress()),(r.visible&&r.textInitialized||!r.visible&&r.hasGraphics3DResources)&&(t.labelsToInitialize.delete(n),e.madeProgress()),e.done){this._dirty=!0;break}}this._dirty||this.notifyChange(`updating`)}}_applyFocusAreasUpdates(e){for(;this._focusAreasLabelsQueue.length>0&&!e.done;){e.madeProgress();let{graphic3DGraphic:t,labelingContext:n}=this._focusAreasLabelsQueue.pop();if(t.labelLayers.length===0||!n.active)continue;let r=k(t.graphic.geometry);if(r==null)continue;let i=this.view.focusAreasView?.containsGeometry(r)??!0;t.labelLayers.forEach(e=>{e.stageObject.geometries.some(e=>e.material.parameters.focusAreaStyle==null!==i)&&(this._removeGraphic(n,t),this._addGraphic(n,t),this.setDirty())})}this._focusAreasLabelsQueue.length===0&&(this.notifyChange(`readyToRun`),this.notifyChange(`updating`))}async _createLabelClassContextAsync(e){let t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),s(t),e.scaleVisibility?.updateScaleRangeActive();let a=e.graphics3DCore,o=a.layer.labelingInfo?.filter(e=>!!e.symbol);o&&o.length!==0&&(await n(o,async(n,o)=>{let c=n.symbol,l=C(a.getOrCreateGraphics3DSymbol(c));if(l==null){i.getLogger(this).error(`Failed to create Graphics3DSymbol for label`);return}await l.load(),s(t);let u=null;y(c)&&c.hasVisibleCallout()&&(u=b(c,a.symbolCreationContext),await u.load(),s(t));let d=await r(v(n,e.layer.fieldsIndex,this.view.spatialReference));if(s(t),d.ok===!0){let r=await this._createTextRenderParameters(l.symbol);s(t);let i=new R(n,l,u,r,d.value);this._updateLabelClassContextVisibility(i),e.setLabelClassContext(o,i)}else i.getLogger(this).error(`Label expression failed to evaluate: ${d.error}`)}),s(t))}async _createLabelClassContext(e){return e.labelClassPromise??(e.labelClassPromise=this._createLabelClassContextAsync(e).catch(t=>{if(c(t))throw t;e.resetLabelClassContext()}).then(()=>{e.labelClassAbortController=null,this.notifyChange(`updating`)}).catch(()=>{}),this.notifyChange(`updating`)),e.labelClassPromise}async _createTextRenderParameters(e){let t=e.symbolLayers.at(0);return t?.type===`text`?j.fromSymbol(t,this.view.state.rasterPixelRatio):null}_destroyLabelClassContext(e){for(let t of e.labelClassContexts)t&&--t.graphics3DSymbol.referenced;let t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,o(t),e.resetLabelClassContext(),e.labelClassPromise=null,this.notifyChange(`updating`)}_createTextSymbolGraphic(e,t,n,r,i,a){if(!this._textTextureAtlas)return null;let o=new T(n,E(n.anchor),D(n.anchor),e.text,p(e.displayWidth,e.displayHeight));return q.graphic=t,q.layer=r,q.renderingInfo=null,i.createLabel(q,o,this._hudMaterials,this._textTextureAtlas,()=>a.placement?.elevationOffset??null)}_createLineCalloutGraphic(e,t,n,r,i){q.graphic=e,q.layer=i;let a=r.screenOffset[0];return q.renderingInfo=new S(null,t,r.translation,r.centerOffset,r.groundDistance,a,r.centerOffsetUnits,r.elevationOffset),n.createGraphics3DGraphic(q,this._calloutMaterials)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;let t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);let n=e.labelingContext,r=n.labelClassContexts;if(W(r)||!n.emptySymbolLabelSupported&&t.layers.length===0)return!1;let i=!1,a=t.graphic,o=n.layer,s=K(n.layer);for(let c=0;c<r.length;c++){let l=e.textRenderers[c],u=e.textLabelPlacements[c],d=r[c];if(l==null||u==null||d==null)continue;let f=d.graphics3DSymbol,p=G(f),m=f.symbolLayers[0];if(!m)continue;m.setElevationInfoOverride(n.elevationInfoOverride);let h=new w(t,p,d.labelClass),g=this._createTextSymbolGraphic(l,a,u,o,m,h);if(g==null)return!1;g.labelClass=d.labelClass,g.labelClassContextIndex=c,t.addLabelGraphic(g,n.stageLayer),this.deconflictor.setPriority(t,d.textRenderParameters?.definition.size??0),t.setVisibilityFlag(16,1,s),t.setVisibilityFlag(16,2,d.scaleVisibility??!0),t.setVisibilityFlag(16,8,!1),P()&&d.graphics.set(a.uid,t),i=!0;let _=d.graphics3DCalloutSymbolLayer;if(_&&u.hasLabelVerticalOffset){_.setElevationInfoOverride(n.elevationInfoOverride);let e=this._createLineCalloutGraphic(a,p,_,u,o);e!=null&&(d.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,n.stageLayer))}break}return i&&n.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){let t=e.labelingContext.labelClassContexts;for(let n of e.graphics3DGraphic.labelLayers)n.labelClass!=null&&t[n.labelClassContextIndex].graphics3DSymbol.symbolLayers[0]?.onRemoveGraphic(n);e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;let t=e.labelingContext,n=t.labelClassContexts;if(W(n))return;let r=e.graphics3DGraphic.graphic;for(let i=0;i<n.length;i++){let a=n[i];if(e.textRenderers[i]=null,e.textLabelPlacements[i]=null,a?.textRenderParameters==null)continue;let o=a.labelFunction,s;if(o.type===`arcade`)try{let e=o.needsHydrationToEvaluate()?_(r,t.layer,null):r;s=o.evaluate(e,this.view.timeZone)}catch{s=null}else s=o.evaluate(r);if(s==null||s===``||/^\s+$/.test(s))continue;let c=a.graphics3DSymbol;if(!c.symbolLayers[0])continue;let l=e.graphics3DGraphic,u=c.symbol?.type===`label-3d`?c.symbol:null,d=a.labelClass,f=t.disablePlacement,p=new w(l,u,d,f).placement;if(p==null)continue;let m=E(p.anchor),h=O(m);e.textRenderers[i]=new A(s,h,a.textRenderParameters,M.maxSize),e.textLabelPlacements[i]=p}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){let n=t.graphic.uid;if(e.graphics.set(n,t),e.active){let r=new L(e,t);this._labels.set(n,r),e.labelsToInitialize.set(n,r)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){let n=t.graphic.uid,r=this._labels.get(n);if(!r)return!0;for(let n of r.graphics3DGraphic.labelLayers){if(n.labelClass==null)continue;let i=e.labelClassContexts[n.labelClassContextIndex].graphics3DSymbol.symbolLayers[0],a=r.textLabelPlacements[n.labelClassContextIndex];if(n.type!==`buffer`||!i.updateGeometry(t.graphic,n,a))return!1}return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){let n=t.graphic.uid,r=this._labels.get(n);e.graphics.delete(n),e.labelClassContexts.forEach(e=>e?.graphics.delete(n)),r&&(this._destroyGraphic(r,n),e.labelsToInitialize.delete(n),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(t)for(let n of t){let t=e.graphics.get(n);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}else return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e)}_globalPropertyChanged(e,t){for(let n of t.labelClassContexts){if(!n)continue;let r=new Map;t.graphics.forEach(e=>r.set(e.graphic.uid,e)),n.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,r,e=>e.labelLayers[0]),n.graphics3DCalloutSymbolLayer&&n.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,r,e=>e.labelLayers[n.calloutSymbolLayerIndex])}}_visibilityInfoChange(e){let t=K(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(let e of this._labelingContexts)this._resetLabels(e)}_resetArcadeLabels(){for(let e of this._labelingContexts)e.labelClassContexts.some(e=>e?.labelFunction.type===`arcade`)&&this._resetLabels(e)}_resetLabels(e){e.graphics.forEach((t,n)=>{let r=this._labels.get(n);r&&(this._destroyGraphic(r,n),r.visible=!1,e.labelsToInitialize.set(n,r))}),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(let t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,n){let r=n?.emptySymbolLabelSupported||!1,i=n?.elevationInfoOverride||null,a=n?.disablePlacement||null;if(this._findLabelingContext(e))return;let o=e.layer,s=new z(this.view.stage,o,e,t,r,i,a,K(o));return this._labelingContexts.push(s),this.setDirty(),{addGraphic:e=>this._addGraphic(s,e),removeGraphic:e=>this._removeGraphic(s,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(s,e),layerLabelsEnabled:()=>K(s.layer),labelingInfoChange:e=>this._labelingInfoChange(s,e),elevationInfoChange:()=>this._globalPropertyChanged(`elevationInfo`,s),screenSizePerspectiveEnabledChanged:()=>this._globalPropertyChanged(`screenSizePerspectiveEnabled`,s),slicePlaneEnabledChange:()=>this._globalPropertyChanged(`slicePlaneEnabled`,s),visibilityInfoChange:()=>this._visibilityInfoChange(s),reset:()=>this._resetLabels(s),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){let t=this._findLabelingContext(e);if(!t)return;let n=this._labelingContexts.indexOf(t);this._labelingContexts.splice(n,1),t.graphics.forEach(e=>this._removeGraphic(t,e)),t.destroy(),this.setDirty()}_updateScaleVisibility(){for(let e of this._labelingContexts)if(e.active&&!U(e))for(let t of e.labelClassContexts)this._updateLabelClassContextVisibility(t)}_updateLabelClassContextVisibility(e){if(!e||!P())return;let{labelClass:t,graphics:n}=e,r={minScale:t.minScale,maxScale:t.maxScale},i=m(r,this.view.scale),a=e.scaleVisibility==null||e.scaleVisibility!==i;e.scaleVisibility=i,a&&n.size&&(n.forEach(e=>e.setVisibilityFlag(16,2,i)),this.deconflictor.setDirty(),this.setDirty())}setLabelGraphicVisibility(e,t){let n=e.graphic.uid,r=this._labels.get(n);r&&r.visible!==t&&(t&&!r.textureAtlasHandles.length?(this._addLabelTextureToAtlas(r),r.textInitialized||r.labelingContext.labelsToInitialize.set(n,r)):!t&&r.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(r),r.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange(`updating`))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some(e=>U(e))||this._focusAreasLabelsQueue.length>0}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;let e=this._labelingContexts.length>0?this._labelingContexts.reduce((e,t)=>e+ +!U(t),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+e*.1+this.deconflictor.updatingProgress*.5}get usedMemory(){return this._textTextureAtlas?.usedMemory??0}get test(){}};e([d({constructOnly:!0})],B.prototype,`view`,void 0),e([d({constructOnly:!0})],B.prototype,`deconflictor`,void 0),e([d()],B.prototype,`_textTextureAtlas`,void 0),e([d({type:Boolean,readOnly:!0})],B.prototype,`updating`,null),B=e([f(`esri.views.3d.layers.graphics.Labeler`)],B);function V(e,t){let{displayWidth:n,displayHeight:r}=t,i=e.geometries[0];i.getMutableVertexField(`size`,g).setValues(0,n,r),e.geometryVertexAttributeUpdated(i,`size`)}function H(e,t){let n=e.geometries[0];n.getMutableVertexField(`uvi`,h).setVec(0,t),e.geometryVertexAttributeUpdated(n,`uvi`,!0)}function U(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function W(e){return(e?.length??0)===0}function G(e){return e.symbol?.type===`label-3d`?e.symbol:null}function K(e){return!!e.labelsVisible&&!!e.labelingInfo?.some(e=>!!e.symbol)}const q=new x(null,null,null);export{B as Labeler,K as areLabelsVisible};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{forEach as n,result as r}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{disposeMaybe as a,abortMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as s,isAbortError as c}from"../../../../core/promiseUtils.js";import l from"../../../../core/Queue.js";import{watch as u}from"../../../../core/reactiveUtils.js";import{property as d,subclass as f}from"../../../../core/accessorSupport/decorators.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isInEffectiveScaleRange as m}from"../../../../geometry/support/scaleUtils.js";import{BufferViewVec4i16 as h,BufferViewVec2f as g}from"../../../../geometry/support/buffer/BufferView.js";import{hydrateGraphic as _}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as v}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as y}from"../../../../symbols/callouts/calloutUtils.js";import{make as b}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutCreationContext as x,LineCalloutSymbolLayerRenderingInfo as S}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as C}from"./graphicSymbolUtils.js";import{LabelInfo as w}from"./LabelInfo.js";import{LabelParameters as T}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as E,verticalPlacementFromAnchor as D,textRenderAlignmentFromHorizontalPlacement as O}from"./placementUtils.js";import{placePointOnGeometry as k}from"./pointUtils.js";import{TextRenderer as A}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as j}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as M}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as N}from"../../webgl-engine/lib/WebGLLayer.js";import{hasLayerBasedScaleVisibility as P}from"../../../support/layerViewUtils.js";import{TaskPriority as F}from"../../../support/Scheduler.js";import{Yield as I}from"../../../support/Yield.js";class L{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=[],this.textLabelPlacements=[]}}class R{constructor(e,t,n,r,i){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=n,this.textRenderParameters=r,this.labelFunction=i,this.calloutSymbolLayerIndex=0,this.graphics=new Map,this.scaleVisibility=null}}class z{constructor(e,t,n,r,i,a,o,s){this.layer=t,this.graphics3DCore=n,this.scaleVisibility=r,this.emptySymbolLabelSupported=i,this.elevationInfoOverride=a,this.disablePlacement=o,this.active=s,this.labelClassAbortController=new AbortController,this._labelClassContexts=[],this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new N(e,{pickable:!0},n.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}get labelClassContexts(){return this._labelClassContexts}setLabelClassContext(e,t){this._labelClassContexts[e]=t}resetLabelClassContext(){this._labelClassContexts.length=0}}let B=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._focusAreasLabelsQueue=new l,this._labels=new Map,this._labelingContexts=[]}setup(){this.dispose(),this.addHandles([u(()=>this.view.state?.camera,()=>this.setDirty()),u(()=>this.view.state?.rasterPixelRatio,()=>this._resetAllLabels()),u(()=>this.view.timeZone,()=>this._resetArcadeLabels()),u(()=>this.view.focusAreasView?.polygons,()=>this._updateFocus()),this.view.resourceController.scheduler.registerTask(F.LABELER,this)]),P()&&this.addHandles(u(()=>this.view.scale,()=>this._updateScaleVisibility())),this._textTextureAtlas=new M({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=a(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),q.graphic=null,q.renderingInfo=null,q.layer=null}_updateFocus(){this._focusAreasLabelsQueue.clear(),this._labelingContexts.forEach(e=>{e.graphics.forEach(t=>{this._focusAreasLabelsQueue.push({graphic3DGraphic:t,labelingContext:e})})})}_activateLabelingContext(e){e.graphics.forEach((t,n)=>{let r=new L(e,t);this._labels.set(n,r),e.labelsToInitialize.set(n,r),t.setVisibilityFlag(16,1,!0)}),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach((e,t)=>{e.setVisibilityFlag(16,1,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)}),e.active=!1}_addLabelTextureToAtlas(e){if(this._textTextureAtlas)for(let t of e.graphics3DGraphic.labelLayers){if(!t.labelClass||t.type!==`buffer`)continue;let n=e.textRenderers[t.labelClassContextIndex];n&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(n,e=>H(t.stageObject,e))),V(t.stageObject,n))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach(e=>e.remove()),e.textureAtlasHandles.length=0}get readyToRun(){return this.view.ready&&(this._dirty||this.deconflictor.readyToRun||this._focusAreasLabelsQueue.length>0)}runTask(e){return this._updateLabels(e),this._applyFocusAreasUpdates(e),!this._dirty&&this.deconflictor.readyToRun&&this.deconflictor.runTask(e),I}_updateLabels(e){if(this._dirty){this._dirty=!1;for(let t of this._labelingContexts)if(t.active){if(U(t))this._dirty=!0;else if(W(t.labelClassContexts)){if(t.labelClassContexts===null){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(let[n,r]of t.labelsToInitialize)if(this._ensureGraphics3DResources(r)&&(this._labels.set(n,r),this.deconflictor.setDirty(),e.madeProgress()),(r.visible&&r.textInitialized||!r.visible&&r.hasGraphics3DResources)&&(t.labelsToInitialize.delete(n),e.madeProgress()),e.done){this._dirty=!0;break}}this._dirty||this.notifyChange(`updating`)}}_applyFocusAreasUpdates(e){for(;this._focusAreasLabelsQueue.length>0&&!e.done;){e.madeProgress();let{graphic3DGraphic:t,labelingContext:n}=this._focusAreasLabelsQueue.pop();if(t.labelLayers.length===0||!n.active)continue;let r=k(t.graphic.geometry);if(r==null)continue;let i=this.view.focusAreasView?.containsGeometry(r)??!0;t.labelLayers.forEach(e=>{e.stageObject.geometries.some(e=>e.material.parameters.focusAreaStyle==null!==i)&&(this._removeGraphic(n,t),this._addGraphic(n,t),this.setDirty())})}this._focusAreasLabelsQueue.length===0&&(this.notifyChange(`readyToRun`),this.notifyChange(`updating`))}async _createLabelClassContextAsync(e){let t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),s(t),e.scaleVisibility?.updateScaleRangeActive();let a=e.graphics3DCore,o=a.layer.labelingInfo?.filter(e=>!!e.symbol);o&&o.length!==0&&(await n(o,async(n,o)=>{let c=n.symbol,l=C(a.getOrCreateGraphics3DSymbol(c));if(l==null){i.getLogger(this).error(`Failed to create Graphics3DSymbol for label`);return}await l.load(),s(t);let u=null;y(c)&&c.hasVisibleCallout()&&(u=b(c,a.symbolCreationContext),await u.load(),s(t));let d=await r(v(n,e.layer.fieldsIndex,this.view.spatialReference));if(s(t),d.ok===!0){let r=await this._createTextRenderParameters(l.symbol);s(t);let i=new R(n,l,u,r,d.value);this._updateLabelClassContextVisibility(i),e.setLabelClassContext(o,i)}else i.getLogger(this).error(`Label expression failed to evaluate: ${d.error}`)}),s(t))}async _createLabelClassContext(e){return e.labelClassPromise??(e.labelClassPromise=this._createLabelClassContextAsync(e).catch(t=>{if(c(t))throw t;e.resetLabelClassContext()}).then(()=>{e.labelClassAbortController=null,this.notifyChange(`updating`)}).catch(()=>{}),this.notifyChange(`updating`)),e.labelClassPromise}async _createTextRenderParameters(e){let t=e.symbolLayers.at(0);return t?.type===`text`?j.fromSymbol(t,this.view.state.rasterPixelRatio):null}_destroyLabelClassContext(e){for(let t of e.labelClassContexts)t&&--t.graphics3DSymbol.referenced;let t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,o(t),e.resetLabelClassContext(),e.labelClassPromise=null,this.notifyChange(`updating`)}_createTextSymbolGraphic(e,t,n,r,i,a){if(!this._textTextureAtlas)return null;let o=new T(n,E(n.anchor),D(n.anchor),e.text,p(e.displayWidth,e.displayHeight));return q.graphic=t,q.layer=r,q.renderingInfo=null,i.createLabel(q,o,this._hudMaterials,this._textTextureAtlas,()=>a.placement?.elevationOffset??null)}_createLineCalloutGraphic(e,t,n,r,i){q.graphic=e,q.layer=i;let a=r.screenOffset[0];return q.renderingInfo=new S(null,t,r.translation,r.centerOffset,r.groundDistance,a,r.centerOffsetUnits,r.elevationOffset),n.createGraphics3DGraphic(q,this._calloutMaterials)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;let t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);let n=e.labelingContext,r=n.labelClassContexts;if(W(r)||!n.emptySymbolLabelSupported&&t.layers.length===0)return!1;let i=!1,a=t.graphic,o=n.layer,s=K(n.layer);for(let c=0;c<r.length;c++){let l=e.textRenderers[c],u=e.textLabelPlacements[c],d=r[c];if(l==null||u==null||d==null)continue;let f=d.graphics3DSymbol,p=G(f),m=f.symbolLayers[0];if(!m)continue;m.setElevationInfoOverride(n.elevationInfoOverride);let h=new w(t,p,d.labelClass),g=this._createTextSymbolGraphic(l,a,u,o,m,h);if(g==null)return!1;g.labelClass=d.labelClass,g.labelClassContextIndex=c,t.addLabelGraphic(g,n.stageLayer),this.deconflictor.setPriority(t,d.textRenderParameters?.definition.size??0),t.setVisibilityFlag(16,1,s),t.setVisibilityFlag(16,2,d.scaleVisibility??!0),t.setVisibilityFlag(16,8,!1),P()&&d.graphics.set(a.uid,t),i=!0;let _=d.graphics3DCalloutSymbolLayer;if(_&&u.hasLabelVerticalOffset){_.setElevationInfoOverride(n.elevationInfoOverride);let e=this._createLineCalloutGraphic(a,p,_,u,o);e!=null&&(d.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,n.stageLayer))}break}return i&&n.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){let t=e.labelingContext.labelClassContexts;for(let n of e.graphics3DGraphic.labelLayers)n.labelClass!=null&&t[n.labelClassContextIndex].graphics3DSymbol.symbolLayers[0]?.onRemoveGraphic(n);e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;let t=e.labelingContext,n=t.labelClassContexts;if(W(n))return;let r=e.graphics3DGraphic.graphic;for(let i=0;i<n.length;i++){let a=n[i];if(e.textRenderers[i]=null,e.textLabelPlacements[i]=null,a?.textRenderParameters==null)continue;let o=a.labelFunction,s;if(o.type===`arcade`)try{let e=o.needsHydrationToEvaluate()?_(r,t.layer,null):r;s=o.evaluate(e,this.view.timeZone)}catch{s=null}else s=o.evaluate(r);if(s==null||s===``||/^\s+$/.test(s))continue;let c=a.graphics3DSymbol;if(!c.symbolLayers[0])continue;let l=e.graphics3DGraphic,u=c.symbol?.type===`label-3d`?c.symbol:null,d=a.labelClass,f=t.disablePlacement,p=new w(l,u,d,f).placement;if(p==null)continue;let m=E(p.anchor),h=O(m);e.textRenderers[i]=new A(s,h,a.textRenderParameters,M.maxSize),e.textLabelPlacements[i]=p}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){let n=t.graphic.uid;if(e.graphics.set(n,t),e.active){let r=new L(e,t);this._labels.set(n,r),e.labelsToInitialize.set(n,r)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){let n=t.graphic.uid,r=this._labels.get(n);if(!r)return!0;for(let n of r.graphics3DGraphic.labelLayers){if(n.labelClass==null)continue;let i=e.labelClassContexts[n.labelClassContextIndex].graphics3DSymbol.symbolLayers[0],a=r.textLabelPlacements[n.labelClassContextIndex];if(n.type!==`buffer`||!i.updateGeometry(t.graphic,n,a))return!1}return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){let n=t.graphic.uid,r=this._labels.get(n);e.graphics.delete(n),e.labelClassContexts.forEach(e=>e?.graphics.delete(n)),r&&(this._destroyGraphic(r,n),e.labelsToInitialize.delete(n),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(t)for(let n of t){let t=e.graphics.get(n);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}else return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e)}_globalPropertyChanged(e,t){for(let n of t.labelClassContexts){if(!n)continue;let r=new Map;t.graphics.forEach(e=>r.set(e.graphic.uid,e)),n.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,r,e=>e.labelLayers[0]),n.graphics3DCalloutSymbolLayer&&n.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,r,e=>e.labelLayers[n.calloutSymbolLayerIndex])}}_visibilityInfoChange(e){let t=K(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(let e of this._labelingContexts)this._resetLabels(e)}_resetArcadeLabels(){for(let e of this._labelingContexts)e.labelClassContexts.some(e=>e?.labelFunction.type===`arcade`)&&this._resetLabels(e)}_resetLabels(e){e.graphics.forEach((t,n)=>{let r=this._labels.get(n);r&&(this._destroyGraphic(r,n),r.visible=!1,e.labelsToInitialize.set(n,r))}),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(let t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,n){let r=n?.emptySymbolLabelSupported||!1,i=n?.elevationInfoOverride||null,a=n?.disablePlacement||null;if(this._findLabelingContext(e))return;let o=e.layer,s=new z(this.view.stage,o,e,t,r,i,a,K(o));return this._labelingContexts.push(s),this.setDirty(),{addGraphic:e=>this._addGraphic(s,e),removeGraphic:e=>this._removeGraphic(s,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(s,e),layerLabelsEnabled:()=>K(s.layer),labelingInfoChange:e=>this._labelingInfoChange(s,e),elevationInfoChange:()=>this._globalPropertyChanged(`elevationInfo`,s),screenSizePerspectiveEnabledChanged:()=>this._globalPropertyChanged(`screenSizePerspectiveEnabled`,s),slicePlaneEnabledChange:()=>this._globalPropertyChanged(`slicePlaneEnabled`,s),visibilityInfoChange:()=>this._visibilityInfoChange(s),reset:()=>this._resetLabels(s),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){let t=this._findLabelingContext(e);if(!t)return;let n=this._labelingContexts.indexOf(t);this._labelingContexts.splice(n,1),t.graphics.forEach(e=>this._removeGraphic(t,e)),t.destroy(),this.setDirty()}_updateScaleVisibility(){for(let e of this._labelingContexts)if(e.active&&!U(e))for(let t of e.labelClassContexts)this._updateLabelClassContextVisibility(t)}_updateLabelClassContextVisibility(e){if(!e||!P())return;let{labelClass:t,graphics:n}=e,r={minScale:t.minScale,maxScale:t.maxScale},i=m(r,this.view.scale),a=e.scaleVisibility==null||e.scaleVisibility!==i;e.scaleVisibility=i,a&&n.size&&(n.forEach(e=>e.setVisibilityFlag(16,2,i)),this.deconflictor.setDirty(),this.setDirty())}setLabelGraphicVisibility(e,t){let n=e.graphic.uid,r=this._labels.get(n);r&&r.visible!==t&&(t&&!r.textureAtlasHandles.length?(this._addLabelTextureToAtlas(r),r.textInitialized||r.labelingContext.labelsToInitialize.set(n,r)):!t&&r.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(r),r.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange(`updating`))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some(e=>U(e))||this._focusAreasLabelsQueue.length>0}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;let e=this._labelingContexts.length>0?this._labelingContexts.reduce((e,t)=>e+ +!U(t),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+e*.1+this.deconflictor.updatingProgress*.5}get usedMemory(){return this._textTextureAtlas?.usedMemory??0}get test(){}};e([d({constructOnly:!0})],B.prototype,`view`,void 0),e([d({constructOnly:!0})],B.prototype,`deconflictor`,void 0),e([d()],B.prototype,`_textTextureAtlas`,void 0),e([d({type:Boolean,readOnly:!0})],B.prototype,`updating`,null),B=e([f(`esri.views.3d.layers.graphics.Labeler`)],B);function V(e,t){let{displayWidth:n,displayHeight:r}=t,i=e.geometries[0];i.getMutableVertexField(`size`,g).setValues(0,n,r),e.geometryVertexAttributeUpdated(i,`size`)}function H(e,t){let n=e.geometries[0];n.getMutableVertexField(`uvi`,h).setVec(0,t),e.geometryVertexAttributeUpdated(n,`uvi`,!0)}function U(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function W(e){return(e?.length??0)===0}function G(e){return e.symbol?.type===`label-3d`?e.symbol:null}function K(e){return!!e.labelsVisible&&!!e.labelingInfo?.some(e=>!!e.symbol)}const q=new x(null,null,null,!1);export{B as Labeler,K as areLabelsVisible};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{defaultObjectPrimitive as e}from"../../../../symbols/support/primitives.js";import{pathNumJoinSubdivisions as t,pathNumCircleProfileSubdivisions as n,pathNumRoundCapExtrusionSubdivisions as r}from"./Graphics3DPathSymbolLayerConstants.js";import{primitiveLodResources as i}from"./primitiveObjectSymbolUtils.js";import{EstimatedSymbolComplexity as a,AggregateSymbolComplexity as o,SymbolComplexity as s}from"./SymbolComplexity.js";import{hasEdges as c}from"../support/edgeUtils.js";import{DefaultMaterial as l}from"../../webgl-engine/materials/DefaultMaterial.js";const u=new a({});function d(e){if(e.type===`web-style`)return u;let t=new o;return e.symbolLayers.forEach(n=>f(m(e,n),t)),t}function f(e,t){e&&(t.verticesPerFeature+=e.verticesPerFeature,t.verticesPerCoordinate+=e.verticesPerCoordinate,t.drawCallsPerFeature+=e.drawCallsPerFeature,t.memory.bytesPerFeature+=e.memory.bytesPerFeature,t.memory.bytesPerFeatureLabel+=e.memory.bytesPerFeatureLabel,t.memory.resourceBytes+=e.memory.resourceBytes,t.memory.draped.bytesPerFeature+=e.memory.bytesPerFeature,t.memory.draped.bytesPerFeatureLabel+=e.memory.bytesPerFeatureLabel,t.estimated||=e.estimated,t.numComplexities++)}const p={};function m(i,o){let l=h(i,o),u=c(o)?2:0;switch(o.type){case`extrude`:return new s({verticesPerFeature:-12,verticesPerCoordinate:12,drawCallsPerFeature:u,memory:l});case`fill`:if(i.type===`mesh-3d`)return new s({drawCallsPerFeature:u,memory:l});if(o.outline!=null&&o.outline.size>0)return new s({verticesPerFeature:-12,verticesPerCoordinate:9,memory:l});case`water`:return new s({verticesPerFeature:-6,verticesPerCoordinate:3,memory:l});case`line`:return new s({verticesPerFeature:-6,verticesPerCoordinate:6,memory:l});case`object`:return o.resource?.href?new a({verticesPerFeature:100,memory:l}):{...g(o.resource?.primitive??e),memory:l};case`path`:{let e=0;switch(o.profile){case`circle`:e=n;break;case`quad`:e=4;break;default:o.profile;return}let i=e*2,a=e*t*2,c=a+i,u=-2*a-i;switch(o.cap){case`none`:break;case`butt`:case`square`:u+=2*(e-1);break;case`round`:u+=2*(e*(r-1)*2+e);break;default:return}return new s({verticesPerFeature:u,verticesPerCoordinate:c,memory:l})}case`text`:{let e=i.type===`label-3d`?0:2;return new s({verticesPerFeature:6,memory:l,drawCallsPerFeature:e})}case`icon`:return new s({verticesPerFeature:6,memory:l});default:return}}function h(e,t){let n=e.type===`point-3d`;switch(t.type){case`extrude`:return t.edges&&t.edges.size>0?v.EXTRUDE_EDGES:v.EXTRUDE;case`fill`:return t.outline!=null&&t.outline.size>0?v.FILL_OUTLINE:v.FILL;case`water`:return v.FILL;case`line`:return t.join===`round`?v.LINE_ROUND:v.LINE_MITER;case`path`:switch(t.join){case`round`:switch(t.profile){case`circle`:return v.PATH_ROUND_CIRCLE;case`quad`:return v.PATH_ROUND_QUAD;default:t.profile;return}case`miter`:case`bevel`:switch(t.profile){case`circle`:return v.PATH_MITER_CIRCLE;case`quad`:return v.PATH_MITER_QUAD;default:t.profile;return}default:return}case`object`:return n?v.OBJECT_POINT:v.OBJECT_POLYGON;case`icon`:case`text`:return n?v.ICON_POINT:v.ICON_POLYGON;default:return}}function g(e){let t=p[e];if(t)return t;let n=_(i(e,new l({},{spherical:!0})).levels);return p[e]=new s({verticesPerFeature:n}),p[e]}function _(e){return e.reduce((e,t,n)=>e+t.numVertices*(1/10**n),0)/e.reduce((e,t,n)=>e+1/10**n,0)}const v={ICON_POINT:{bytesPerFeature:2604,bytesPerFeatureLabel:3465,resourceBytes:0,draped:{bytesPerFeature:1781,bytesPerFeatureLabel:3456}},ICON_POLYGON:{bytesPerFeature:3198,bytesPerFeatureLabel:2941,resourceBytes:0,draped:{bytesPerFeature:2308,bytesPerFeatureLabel:3006}},OBJECT_POINT:{bytesPerFeature:877,bytesPerFeatureLabel:2952,resourceBytes:0,draped:{bytesPerFeature:877,bytesPerFeatureLabel:2952}},OBJECT_POLYGON:{bytesPerFeature:1307,bytesPerFeatureLabel:2520,resourceBytes:0,draped:{bytesPerFeature:1307,bytesPerFeatureLabel:2520}},LINE_MITER:{bytesPerFeature:2544,bytesPerFeatureLabel:2677,resourceBytes:0,draped:{bytesPerFeature:1924,bytesPerFeatureLabel:2664}},LINE_ROUND:{bytesPerFeature:2564,bytesPerFeatureLabel:2679,resourceBytes:0,draped:{bytesPerFeature:1928,bytesPerFeatureLabel:2673}},PATH_MITER_CIRCLE:{bytesPerFeature:13378,bytesPerFeatureLabel:2656,resourceBytes:0,draped:{bytesPerFeature:13378,bytesPerFeatureLabel:2656}},PATH_ROUND_CIRCLE:{bytesPerFeature:13524,bytesPerFeatureLabel:2686,resourceBytes:0,draped:{bytesPerFeature:13524,bytesPerFeatureLabel:2686}},PATH_MITER_QUAD:{bytesPerFeature:15185,bytesPerFeatureLabel:2993,resourceBytes:0,draped:{bytesPerFeature:15185,bytesPerFeatureLabel:2993}},PATH_ROUND_QUAD:{bytesPerFeature:13151,bytesPerFeatureLabel:2986,resourceBytes:0,draped:{bytesPerFeature:13151,bytesPerFeatureLabel:2986}},FILL:{bytesPerFeature:3514,bytesPerFeatureLabel:2845,resourceBytes:0,draped:{bytesPerFeature:2733,bytesPerFeatureLabel:2837}},FILL_OUTLINE:{bytesPerFeature:3618,bytesPerFeatureLabel:2593,resourceBytes:0,draped:{bytesPerFeature:2828,bytesPerFeatureLabel:2583}},EXTRUDE:{bytesPerFeature:5657,bytesPerFeatureLabel:2569,resourceBytes:0,draped:{bytesPerFeature:5657,bytesPerFeatureLabel:2569}},EXTRUDE_EDGES:{bytesPerFeature:3074,bytesPerFeatureLabel:2172,resourceBytes:0,draped:{bytesPerFeature:3074,bytesPerFeatureLabel:2172}}};if(has(`esri-tests-disable-symbol-memory-estimators`))for(let e in v){let t=v[e];t.bytesPerFeature=0,t.bytesPerFeatureLabel=0,t.draped.bytesPerFeature=0,t.draped.bytesPerFeatureLabel=0}export{f as aggregateSymbolComplexity,d as defaultSymbolComplexity,m as defaultSymbolLayerComplexity,h as defaultSymbolLayerMemoryComplexity,u as emptySymbolComplexity,_ as estimateNumVerticesForLods,v as memoryEstimators};
2
+ import has from"../../../../core/has.js";import{defaultObjectPrimitive as e}from"../../../../symbols/support/primitives.js";import{pathNumJoinSubdivisions as t,pathNumCircleProfileSubdivisions as n,pathNumRoundCapExtrusionSubdivisions as r}from"./Graphics3DPathSymbolLayerConstants.js";import{primitiveLodResources as i}from"./primitiveObjectSymbolUtils.js";import{EstimatedSymbolComplexity as a,AggregateSymbolComplexity as o,SymbolComplexity as s}from"./SymbolComplexity.js";import{hasEdges as c}from"../support/edgeUtils.js";import{DefaultMaterial as l}from"../../webgl-engine/materials/DefaultMaterial.js";const u=new a({});function d(e){if(e.type===`web-style`)return u;let t=new o;return e.symbolLayers.forEach(n=>f(m(e,n),t)),t}function f(e,t){e&&(t.verticesPerFeature+=e.verticesPerFeature,t.verticesPerCoordinate+=e.verticesPerCoordinate,t.drawCallsPerFeature+=e.drawCallsPerFeature,t.memory.bytesPerFeature+=e.memory.bytesPerFeature,t.memory.bytesPerFeatureLabel+=e.memory.bytesPerFeatureLabel,t.memory.resourceBytes+=e.memory.resourceBytes,t.memory.draped.bytesPerFeature+=e.memory.bytesPerFeature,t.memory.draped.bytesPerFeatureLabel+=e.memory.bytesPerFeatureLabel,t.estimated||=e.estimated,t.numComplexities++)}const p={};function m(i,o){let l=h(i,o),u=c(o)?2:0;switch(o.type){case`extrude`:return new s({verticesPerFeature:-12,verticesPerCoordinate:12,drawCallsPerFeature:u,memory:l});case`fill`:if(i.type===`mesh-3d`)return new s({drawCallsPerFeature:u,memory:l});if(o.outline!=null&&o.outline.size>0)return new s({verticesPerFeature:-12,verticesPerCoordinate:9,memory:l});case`water`:return new s({verticesPerFeature:-6,verticesPerCoordinate:3,memory:l});case`line`:return new s({verticesPerFeature:-6,verticesPerCoordinate:6,memory:l});case`object`:return o.resource?.href?new a({verticesPerFeature:100,memory:l}):{...g(o.resource?.primitive??e),memory:l};case`path`:{let e=0;switch(o.profile){case`circle`:e=n;break;case`quad`:e=4;break;default:o.profile;return}let i=e*2,a=e*t*2,c=a+i,u=-2*a-i;switch(o.cap){case`none`:break;case`butt`:case`square`:u+=2*(e-1);break;case`round`:u+=2*(e*(r-1)*2+e);break;default:return}return new s({verticesPerFeature:u,verticesPerCoordinate:c,memory:l})}case`text`:{let e=i.type===`label-3d`?0:2;return new s({verticesPerFeature:6,memory:l,drawCallsPerFeature:e})}case`icon`:return new s({verticesPerFeature:6,memory:l});default:return}}function h(e,t){let n=e.type===`point-3d`;switch(t.type){case`extrude`:return t.edges&&t.edges.size>0?v.EXTRUDE_EDGES:v.EXTRUDE;case`fill`:return t.outline!=null&&t.outline.size>0?v.FILL_OUTLINE:v.FILL;case`water`:return v.FILL;case`line`:return t.join===`round`?v.LINE_ROUND:v.LINE_MITER;case`path`:switch(t.join){case`round`:switch(t.profile){case`circle`:return v.PATH_ROUND_CIRCLE;case`quad`:return v.PATH_ROUND_QUAD;default:t.profile;return}case`miter`:case`bevel`:switch(t.profile){case`circle`:return v.PATH_MITER_CIRCLE;case`quad`:return v.PATH_MITER_QUAD;default:t.profile;return}default:return}case`object`:return n?v.OBJECT_POINT:v.OBJECT_POLYGON;case`icon`:case`text`:return n?v.ICON_POINT:v.ICON_POLYGON;default:return}}function g(e){let t=p[e];if(t)return t;let n=_(i(e,new l({},{spherical:!0})).levels);return p[e]=new s({verticesPerFeature:n}),p[e]}function _(e){return e.reduce((e,t,n)=>e+t.numVertices*(1/10**n),0)/e.reduce((e,t,n)=>e+1/10**n,0)}const v={ICON_POINT:{bytesPerFeature:2395,bytesPerFeatureLabel:4343,resourceBytes:0,draped:{bytesPerFeature:1662,bytesPerFeatureLabel:4409}},ICON_POLYGON:{bytesPerFeature:2750,bytesPerFeatureLabel:4219,resourceBytes:0,draped:{bytesPerFeature:2007,bytesPerFeatureLabel:4289}},OBJECT_POINT:{bytesPerFeature:1315,bytesPerFeatureLabel:4378,resourceBytes:0,draped:{bytesPerFeature:1315,bytesPerFeatureLabel:4378}},OBJECT_POLYGON:{bytesPerFeature:1642,bytesPerFeatureLabel:4239,resourceBytes:0,draped:{bytesPerFeature:1642,bytesPerFeatureLabel:4239}},LINE_MITER:{bytesPerFeature:2443,bytesPerFeatureLabel:4282,resourceBytes:0,draped:{bytesPerFeature:1906,bytesPerFeatureLabel:4210}},LINE_ROUND:{bytesPerFeature:2449,bytesPerFeatureLabel:4246,resourceBytes:0,draped:{bytesPerFeature:1911,bytesPerFeatureLabel:4290}},PATH_MITER_CIRCLE:{bytesPerFeature:3335,bytesPerFeatureLabel:4343,resourceBytes:0,draped:{bytesPerFeature:3335,bytesPerFeatureLabel:4343}},PATH_ROUND_CIRCLE:{bytesPerFeature:3365,bytesPerFeatureLabel:4326,resourceBytes:0,draped:{bytesPerFeature:3365,bytesPerFeatureLabel:4326}},PATH_MITER_QUAD:{bytesPerFeature:3373,bytesPerFeatureLabel:4406,resourceBytes:0,draped:{bytesPerFeature:3373,bytesPerFeatureLabel:4406}},PATH_ROUND_QUAD:{bytesPerFeature:3309,bytesPerFeatureLabel:4426,resourceBytes:0,draped:{bytesPerFeature:3309,bytesPerFeatureLabel:4426}},FILL:{bytesPerFeature:2416,bytesPerFeatureLabel:4281,resourceBytes:0,draped:{bytesPerFeature:1894,bytesPerFeatureLabel:4238}},FILL_OUTLINE:{bytesPerFeature:3286,bytesPerFeatureLabel:4281,resourceBytes:0,draped:{bytesPerFeature:2826,bytesPerFeatureLabel:4205}},EXTRUDE:{bytesPerFeature:3657,bytesPerFeatureLabel:4222,resourceBytes:0,draped:{bytesPerFeature:3657,bytesPerFeatureLabel:4222}},EXTRUDE_EDGES:{bytesPerFeature:4505,bytesPerFeatureLabel:4364,resourceBytes:0,draped:{bytesPerFeature:4505,bytesPerFeatureLabel:4364}}};if(has(`esri-tests-disable-symbol-memory-estimators`))for(let e in v){let t=v[e];t.bytesPerFeature=0,t.bytesPerFeatureLabel=0,t.draped.bytesPerFeature=0,t.draped.bytesPerFeatureLabel=0}export{f as aggregateSymbolComplexity,d as defaultSymbolComplexity,m as defaultSymbolLayerComplexity,h as defaultSymbolLayerMemoryComplexity,u as emptySymbolComplexity,_ as estimateNumVerticesForLods,v as memoryEstimators};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import n from"../../../../core/Logger.js";import{getMetersPerVerticalUnitForSR as r}from"../../../../core/units.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{copy as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s,ZEROS as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isEmpty as l,copy as u,center as d,diameter as f,squaredDistanceToPoint as p}from"../../../../geometry/support/aaBoundingBox.js";import{allFinite as m}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as h}from"../../../../geometry/support/spatialReferenceUtils.js";import{getMetersPerUnit as g}from"../../../../symbols/support/unitConversionUtils.js";import{ElevationUpdateEvent as _}from"../../support/ElevationUpdateEvent.js";import{ProjectedElevationUpdateExtent as v,calculateElevationUpdateExtents as y,fullWorldElevationUpdateExtent as b,planetCenterProximityToleranceMeters as x}from"../../support/elevationUpdateExtentUtils.js";import{affectsGeometry as S}from"../../webgl-engine/lib/affectsGeometry.js";import{Intersector as C}from"../../webgl-engine/lib/Intersector.js";const w=Symbol(`layerHandles`);let T=class extends t{get spatialReference(){return this.view.spatialReference}constructor(e){super(e),this._elevationOffset=0}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._projectedExtent=new v(this._renderCoordsHelper),this._intersectLayers=[this.stageLayer],this._intersector=new C(this.view.state.viewingMode),this._intersector.options.store=0;let[e,t]=this._computeLayerElevationRange(this.spatialReference,this.stageLayer);this._zmin=e,this._zmax=t;let n=this.stageLayer.events;this.addHandles([n.on([`layerObjectAdded`,`layerObjectRemoved`,`transformationChanged`,`shaderTransformationChanged`],e=>this._objectChanged(e)),n.on([`geometryAdded`,`geometryRemoved`],({object:e})=>this._objectChanged(e)),n.on(`attributesChanged`,({attribute:e,object:t})=>S(e)&&this._objectChanged(t))],w)}destroy(){this.removeHandles(w)}elevationInfoChanged(){let e=this.layer==null?null:this.layer.elevationInfo;if(e!=null&&e.mode!==`on-the-ground`){let t=r(this.layer.spatialReference),n=g(e.unit??`meters`);this._elevationOffset=(e.offset??0)*n/t}else this._elevationOffset=0}getElevation(e,t,r,i){if(j[0]=e,j[1]=t,j[2]=r,!this._renderCoordsHelper.toRenderCoords(j,i,j))return n.getLogger(this).error(`could not project point for elevation alignment`),null;let a=this._elevationOffset,o=this._zmin+a,s=this._zmax+a;return this._renderCoordsHelper.setAltitude(N,s,j),this._renderCoordsHelper.setAltitude(P,o,j),this._intersector.reset(N,P,null),this._intersector.intersect(this._intersectLayers,null,1,null,e=>!!e.lastValidElevationBB),this._intersector.results.min.getIntersectionPoint(j)?this._renderCoordsHelper.getAltitude(j):null}_objectChanged(e){let t=this.spatialReference;if(!e.lastValidElevationBB||!t)return;let n=e.lastValidElevationBB,{box:r,sphere:i}=e.boundingVolumeWorldSpace;if(this.view.state.viewingMode===1&&(!l(n)&&E(n)||E(r))){this._emitFullExtentElevationChange(t),u(n,r);return}let a=!l(n),o=new Float64Array(a?8:4),s=1/0,c=-1/0,d=!1;if(a&&(this._resetProjectedExtent(n,t),this._expandExtent(t,n,k,this._projectedExtent)||(d=!0),m(this._projectedExtent.extent)?(s=Math.min(s,k[0]),c=Math.max(c,k[1]),o.set(this._projectedExtent.extent)):d=!0),this._projectedExtent.reset(i.center,i.radius,t),this._expandExtent(t,r,D,this._projectedExtent)||(d=!0),m(this._projectedExtent.extent)?(s=Math.min(s,D[0]),c=Math.max(c,D[1]),o.set(this._projectedExtent.extent,a?4:0)):d=!0,d){this._emitFullExtentElevationChange(t),u(n,r);return}let f=y(o,t);f.length>0&&(this._zmin=Math.min(this._zmin,s),this._zmax=Math.max(this._zmax,c));for(let e of f)this._emitElevationChangeEvent(e,t);u(n,r)}_computeLayerElevationRange(e,t){let n=1/0,r=-1/0;return e!=null&&t.objects.forEach(t=>{this._expandExtent(e,t.boundingVolumeWorldSpace.box,O)&&(n=Math.min(n,O[0]),r=Math.max(r,O[1]))}),[n,r]}_expandExtent(e,t,n,r=null){n[0]=1/0,n[1]=-1/0;for(let i=0;i<8;++i){j[0]=t[i&1?0:3],j[1]=t[i&2?1:4],j[2]=t[i&4?2:5];let a=r==null?this._renderCoordsHelper.fromRenderCoords(j,j,e):r.addRenderPoint(j,e);if(a!=null)n[0]=Math.min(n[0],a[2]),n[1]=Math.max(n[1],a[2]);else if(r!=null)return!1;if(r!=null){for(let n=0;n<3;++n)if(!(i&1<<n)&&(o(M,j),M[n]=t[n],!r.addRenderEdge(j,M,e)))return!1}}return!0}_emitFullExtentElevationChange(e){let t=h(e);t!=null&&this._emitElevationChangeEvent(b(e,t),e)}_emitElevationChangeEvent(e,t){let n=new _(t,e);this.emit(`elevation-change`,n)}_resetProjectedExtent(e,t){d(e,A),this._projectedExtent.reset(A,.5*f(e),t)}};e([i({constructOnly:!0})],T.prototype,`layer`,void 0),e([i({constructOnly:!0})],T.prototype,`stageLayer`,void 0),e([i({constructOnly:!0})],T.prototype,`view`,void 0),e([i()],T.prototype,`spatialReference`,null),T=e([a(`esri.views.3d.layers.support.StageLayerElevationProvider`)],T);function E(e){return p(e,c)<=x*x}const D=new Float64Array(2),O=new Float64Array(2),k=new Float64Array(2),A=s(),j=s(),M=s(),N=s(),P=s();export{T as StageLayerElevationProvider};
2
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import n from"../../../../core/Logger.js";import{getMetersPerVerticalUnitForSR as r}from"../../../../core/units.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{copy as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s,ZEROS as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isEmpty as l,copy as u,center as d,diameter as f,squaredDistanceToPoint as p}from"../../../../geometry/support/aaBoundingBox.js";import{allFinite as m}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as h}from"../../../../geometry/support/spatialReferenceUtils.js";import{getMetersPerUnit as g}from"../../../../symbols/support/unitConversionUtils.js";import{ElevationUpdateEvent as _}from"../../support/ElevationUpdateEvent.js";import{ProjectedElevationUpdateExtent as v,calculateElevationUpdateExtents as y,fullWorldElevationUpdateExtent as b,planetCenterProximityToleranceMeters as x}from"../../support/elevationUpdateExtentUtils.js";import{affectsGeometry as S}from"../../webgl-engine/lib/affectsGeometry.js";import{Intersector as C}from"../../webgl-engine/lib/Intersector.js";const w=Symbol(`layerHandles`);let T=class extends t{get spatialReference(){return this.view.spatialReference}constructor(e){super(e),this._elevationOffset=0}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._projectedExtent=new v(this._renderCoordsHelper),this._intersectLayers=[this.stageLayer],this._intersector=new C(this.view.state.viewingMode),this._intersector.options.store=0;let[e,t]=this._computeLayerElevationRange(this.spatialReference,this.stageLayer);this._zmin=e,this._zmax=t;let n=this.stageLayer.events;this.addHandles([n.on([`layerObjectAdded`,`layerObjectRemoved`,`transformationChanged`,`shaderTransformationChanged`],e=>this._objectChanged(e)),n.on(`geometriesChanged`,({object:e})=>this._objectChanged(e)),n.on(`attributesChanged`,({attribute:e,object:t})=>S(e)&&this._objectChanged(t))],w)}destroy(){this.removeHandles(w)}elevationInfoChanged(){let e=this.layer==null?null:this.layer.elevationInfo;if(e!=null&&e.mode!==`on-the-ground`){let t=r(this.layer.spatialReference),n=g(e.unit??`meters`);this._elevationOffset=(e.offset??0)*n/t}else this._elevationOffset=0}getElevation(e,t,r,i){if(j[0]=e,j[1]=t,j[2]=r,!this._renderCoordsHelper.toRenderCoords(j,i,j))return n.getLogger(this).error(`could not project point for elevation alignment`),null;let a=this._elevationOffset,o=this._zmin+a,s=this._zmax+a;return this._renderCoordsHelper.setAltitude(N,s,j),this._renderCoordsHelper.setAltitude(P,o,j),this._intersector.reset(N,P,null),this._intersector.intersect(this._intersectLayers,null,1,null,e=>!!e.lastValidElevationBB),this._intersector.results.min.getIntersectionPoint(j)?this._renderCoordsHelper.getAltitude(j):null}_objectChanged(e){let t=this.spatialReference;if(!e.lastValidElevationBB||!t)return;let n=e.lastValidElevationBB,{box:r,sphere:i}=e.boundingVolumeWorldSpace;if(this.view.state.viewingMode===1&&(!l(n)&&E(n)||E(r))){this._emitFullExtentElevationChange(t),u(n,r);return}let a=!l(n),o=new Float64Array(a?8:4),s=1/0,c=-1/0,d=!1;if(a&&(this._resetProjectedExtent(n,t),this._expandExtent(t,n,k,this._projectedExtent)||(d=!0),m(this._projectedExtent.extent)?(s=Math.min(s,k[0]),c=Math.max(c,k[1]),o.set(this._projectedExtent.extent)):d=!0),this._projectedExtent.reset(i.center,i.radius,t),this._expandExtent(t,r,D,this._projectedExtent)||(d=!0),m(this._projectedExtent.extent)?(s=Math.min(s,D[0]),c=Math.max(c,D[1]),o.set(this._projectedExtent.extent,a?4:0)):d=!0,d){this._emitFullExtentElevationChange(t),u(n,r);return}let f=y(o,t);f.length>0&&(this._zmin=Math.min(this._zmin,s),this._zmax=Math.max(this._zmax,c));for(let e of f)this._emitElevationChangeEvent(e,t);u(n,r)}_computeLayerElevationRange(e,t){let n=1/0,r=-1/0;return e!=null&&t.objects.forEach(t=>{this._expandExtent(e,t.boundingVolumeWorldSpace.box,O)&&(n=Math.min(n,O[0]),r=Math.max(r,O[1]))}),[n,r]}_expandExtent(e,t,n,r=null){n[0]=1/0,n[1]=-1/0;for(let i=0;i<8;++i){j[0]=t[i&1?0:3],j[1]=t[i&2?1:4],j[2]=t[i&4?2:5];let a=r==null?this._renderCoordsHelper.fromRenderCoords(j,j,e):r.addRenderPoint(j,e);if(a!=null)n[0]=Math.min(n[0],a[2]),n[1]=Math.max(n[1],a[2]);else if(r!=null)return!1;if(r!=null){for(let n=0;n<3;++n)if(!(i&1<<n)&&(o(M,j),M[n]=t[n],!r.addRenderEdge(j,M,e)))return!1}}return!0}_emitFullExtentElevationChange(e){let t=h(e);t!=null&&this._emitElevationChangeEvent(b(e,t),e)}_emitElevationChangeEvent(e,t){let n=new _(t,e);this.emit(`elevation-change`,n)}_resetProjectedExtent(e,t){d(e,A),this._projectedExtent.reset(A,.5*f(e),t)}};e([i({constructOnly:!0})],T.prototype,`layer`,void 0),e([i({constructOnly:!0})],T.prototype,`stageLayer`,void 0),e([i({constructOnly:!0})],T.prototype,`view`,void 0),e([i()],T.prototype,`spatialReference`,null),T=e([a(`esri.views.3d.layers.support.StageLayerElevationProvider`)],T);function E(e){return p(e,c)<=x*x}const D=new Float64Array(2),O=new Float64Array(2),k=new Float64Array(2),A=s(),j=s(),M=s(),N=s(),P=s();export{T as StageLayerElevationProvider};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../core/Error.js";import"../../../../geometry/SpatialReference.js";import"../../../../geometry/support/aaBoundingBox.js";import"../../../../core/mathUtils.js";import"../../../../geometry/Extent.js";import"../../../../geometry/support/typeUtils.js";import"../../../../core/has.js";import{equals as t}from"../../../../layers/graphics/dehydratedFeatureComparison.js";class n{constructor(e,t){this.feature=e,this.resolution=t,this.refCount=1}}class r{get isReferenced(){return this.versions.length!==0}get isSingle(){return this.versions.length===1&&this.versions[0].refCount===1}constructor(e,t,n){this._highestResolutionVersion=null,this.versions=[],this.ref(n,e,t)}ref(e,r,i){let a=this.feature;o.oldVersion=a,a&&Object.defineProperty(r,"uid",{value:a.uid,configurable:!0});let s=this._highestResolutionVersion;for(let n of this.versions)if(n.resolution===i){n.refCount++;let i=s===n&&!t(r,n.feature);return(i||s!==n)&&(e.ref(r),e.unref(n.feature),n.feature=r),o.newVersion=i?r:a,o}let c=new n(r,i);return this.versions.push(c),e.ref(r),!s||i<s.resolution?(o.newVersion=r,this._highestResolutionVersion=c):o.newVersion=a,o}unref(t,n){let{versions:r}=this;for(let e=0;e<r.length;e++){let i=r[e];if(i.resolution===n)return i.refCount--,a.oldVersion=this.feature,i.refCount===0&&(t.unref(i.feature),r[e]=r[r.length-1],--r.length,this._highestResolutionVersion===i&&(this._recalculateHighestResolutionVersion(),a.oldVersion=i.feature)),a.newVersion=this.feature,a}let i=`Unref feature with no references: ${this.feature?.uid}`;throw new e(i,i,Error().stack?.slice(6))}get feature(){return this._highestResolutionVersion?.feature??null}_recalculateHighestResolutionVersion(){if(this.versions.length===0){this._highestResolutionVersion=null;return}let e=this.versions[0];for(let t=1;t<this.versions.length;t++){let n=this.versions[t];n.resolution<e.resolution&&(e=n)}this._highestResolutionVersion=e}}class i{get isReferenced(){return this._refCount!==0}get isSingle(){return this._refCount===1}constructor(e,t,n){this._feature=e,this._refCount=1,n.ref(e)}ref(e,n,r){++this._refCount;let i=this._feature;return o.oldVersion=i,i&&Object.defineProperty(n,"uid",{value:i.uid,configurable:!0}),t(i,n)||(e.ref(n),e.unref(this._feature),this._feature=n),o.newVersion=this._feature,o}unref(t,n){a.oldVersion=this._feature;let r=this._refCount;if(r>0){if(this._refCount=r-1,r===1)return t.unref(this._feature),a.newVersion=null,a}else{let t=`Unref feature with no references: ${this.feature?.uid}`;throw new e(t,t,Error().stack?.slice(6))}return a.newVersion=this._feature,a}get feature(){return this._feature}}const a={oldVersion:null,newVersion:null},o={oldVersion:null,newVersion:null};export{n as FeatureVersion,r as MultiFeatureReference,i as SingleFeatureReference};
2
+ import e from"../../../../core/Error.js";import"../../../../core/memoryEstimations.js";import"../../../../geometry/SpatialReference.js";import"../../../../geometry/support/aaBoundingBox.js";import"../../../../core/mathUtils.js";import"../../../../geometry/Extent.js";import"../../../../geometry/support/typeUtils.js";import"../../../../core/has.js";import{equals as t}from"../../../../layers/graphics/dehydratedFeatureComparison.js";class n{constructor(e,t){this.feature=e,this.resolution=t,this.refCount=1}}class r{get isReferenced(){return this.versions.length!==0}get isSingle(){return this.versions.length===1&&this.versions[0].refCount===1}constructor(e,t,n){this._highestResolutionVersion=null,this.versions=[],this.ref(n,e,t)}ref(e,r,i){let a=this.feature;o.oldVersion=a,a&&Object.defineProperty(r,"uid",{value:a.uid,configurable:!0});let s=this._highestResolutionVersion;for(let n of this.versions)if(n.resolution===i){n.refCount++;let i=s===n&&!t(r,n.feature);return(i||s!==n)&&(e.ref(r),e.unref(n.feature),n.feature=r),o.newVersion=i?r:a,o}let c=new n(r,i);return this.versions.push(c),e.ref(r),!s||i<s.resolution?(o.newVersion=r,this._highestResolutionVersion=c):o.newVersion=a,o}unref(t,n){let{versions:r}=this;for(let e=0;e<r.length;e++){let i=r[e];if(i.resolution===n)return i.refCount--,a.oldVersion=this.feature,i.refCount===0&&(t.unref(i.feature),r[e]=r[r.length-1],--r.length,this._highestResolutionVersion===i&&(this._recalculateHighestResolutionVersion(),a.oldVersion=i.feature)),a.newVersion=this.feature,a}let i=`Unref feature with no references: ${this.feature?.uid}`;throw new e(i,i,Error().stack?.slice(6))}get feature(){return this._highestResolutionVersion?.feature??null}_recalculateHighestResolutionVersion(){if(this.versions.length===0){this._highestResolutionVersion=null;return}let e=this.versions[0];for(let t=1;t<this.versions.length;t++){let n=this.versions[t];n.resolution<e.resolution&&(e=n)}this._highestResolutionVersion=e}}class i{get isReferenced(){return this._refCount!==0}get isSingle(){return this._refCount===1}constructor(e,t,n){this._feature=e,this._refCount=1,n.ref(e)}ref(e,n,r){++this._refCount;let i=this._feature;return o.oldVersion=i,i&&Object.defineProperty(n,"uid",{value:i.uid,configurable:!0}),t(i,n)||(e.ref(n),e.unref(this._feature),this._feature=n),o.newVersion=this._feature,o}unref(t,n){a.oldVersion=this._feature;let r=this._refCount;if(r>0){if(this._refCount=r-1,r===1)return t.unref(this._feature),a.newVersion=null,a}else{let t=`Unref feature with no references: ${this.feature?.uid}`;throw new e(t,t,Error().stack?.slice(6))}return a.newVersion=this._feature,a}get feature(){return this._feature}}const a={oldVersion:null,newVersion:null},o={oldVersion:null,newVersion:null};export{n as FeatureVersion,r as MultiFeatureReference,i as SingleFeatureReference};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{equals as e}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{isPowerOfTwo as t}from"../../../core/mathUtils.js";import{disposeMaybe as n,releaseMaybe as r}from"../../../core/maybe.js";import{equals as i}from"../../../geometry/support/aaBoundingRect.js";import{glLayout as a}from"../support/buffer/glUtil.js";import{GeometryState as o}from"./GeometryState.js";import{PatchGeometry as s}from"./PatchGeometry.js";import"../../../geometry/support/Ellipsoid.js";import{internalAssert as c,neighborEdgeIndices as l,oppositeEdge as u,neighborCornerIndices as d,enableTerrainInternalChecks as f}from"./terrainUtils.js";import{maxTileNeighborLevelDelta as p}from"./TerrainConst.js";import{TextureFader as m}from"./TextureFader.js";import{TextureReference as h}from"./TextureReference.js";import g from"./TileOverlayData.js";import{fallsWithinLayerView as _}from"./tileUtils.js";import{VertexArrayObject as v}from"../webgl-engine/lib/VertexArrayObject.js";import{BufferObject as y}from"../../webgl/BufferObject.js";import{VertexBuffer as b}from"../../webgl/VertexBuffer.js";class x{constructor(){this.geometry=new s,this.geometryState=null,this._texture=null,this._textureOpacity=1,this._textureFader=new m(()=>this._tile.surface.fadeDuration),this.overlay=new g,this._localOrigin=null,this._geometryStateChangedSinceLastUpdate=!0,this._hasGeometry=!1,this._modifiedFlags=0}get tile(){return this._tile}get localOrigin(){return this._localOrigin}init(e,t){this.clear(),this._tile=e,this.geometry.reset(),this.intersectionData=null,this.geometryState=new o,this._localOrigin=t,this.overlay.clear()}clear(){this.releaseGeometry(),this.releaseTexture(),this._textureFader.clear(),this._tile=null,this.intersectionData=null,this.geometryState=null}updateGeometryIfNeeded(e){if(this._tile&&this.geometryState&&((!this._vao||this._geometryStateChangedSinceLastUpdate||this.wireframeChanged||this.clippingAreaChanged||this.samplerDataChanged||this.numVerticesPerSideChanged||this.dirtyCorners||this.dirtyEdgeResolutions||this.dirtyEdges)&&(this._updateGeometry(e),this._geometryStateChangedSinceLastUpdate=!1),f&&this.tile.intersectsClippingArea))for(let e=0;e<j;++e)c(this.geometry.getEdgeCount(e)===this.geometryState.edgeResolutions[e]+1)}_calculateEdgeResolution(e,t){let n=this.tile,r=this.geometryState.numVerticesPerSide-1;if(!n.surface.isGlobal){let t=n.surface.groundExtent;if(t!=null&&(e===0&&n.extent[3]>t[3]||e===1&&n.extent[2]>t[2]||e===2&&n.extent[1]<t[1]||e===3&&n.extent[0]<t[0]))return r}let i=n.level,a=l[e];if(!t)return c(n.surface?.rootTiles==null||n.surface.updatingRootTiles||!n.shouldHaveNeighbor(a)),r;if(t.loaded){let n=t,a=n.renderData?.geometryState;if(!a)return r;let o=i-n.level;if(c(o>=0),o===0){let e=a.numVerticesPerSide-1;return Math.max(e,r)}let s=2**o,l=a.edgeResolutions[(e+2)%4]/s;return Math.max(1,l)}c(!t.leaf);let o=r;return t.forAllSubtreeOnSide(u(a),e=>e===n?!0:e.loaded?(o=Math.max(o,2**(e.level-i)),!0):(c(!e.leaf),!1)),o}updateNeighborData(){let e=this.tile;if(!e.intersectsClippingArea)return;let n=e.renderData.geometryState,r=t=>(t.loaded||t.level===e.level)&&t.intersectsClippingArea,i=n.edgePeerNeighbors,a=n.edgePeerNeighborSamplerVersions;for(let o=0;o<j;++o){let s=e.findNeighborTile(l[o],r),u=C(e,s),d=u?.renderData?.geometryState.samplerDataVersion??-1,m=i[o],h=u!==C(e,m),g=a[o]!==d;f&&s&&(c(e.level>=s.level),c(e.level-s.level<=p)),i[o]=s,(h||g)&&(a[o]=d,this._markEdgeDirty(o));let _=n.edgeResolutions[o],v=this._calculateEdgeResolution(o,s);c(t(v)),c(v>=1),n.edgeResolutions[o]=v,_!==v&&this._markEdgeResolutionDirty(o)}for(let t=0;t<j;++t){let a=e.findNeighborTile(d[t],r);n.cornerPeerNeighbors[t]=a;let o=C(e,i[t]),s=C(e,i[(t+1)%j]),l=C(e,a);S[t]=l,S[(t+1)%j]=s,S[(t+2)%j]=e,S[(t+3)%j]=o,c(S.some(t=>t?.loaded||t===e));let u=S.reduce((e,t)=>Math.min(e,t?.level??1/0),1/0);S.forEach((e,t)=>{e&&e.level>u&&(S[t]=null)}),c(S.some(t=>t?.loaded||t===e));let p=n.cornerNeighborCornerTiles,m=n.cornerNeighborCornerTileSamplerVersions;for(let e=0;e<j;++e){let n=S[e],r=n?.renderData?.geometryState?.samplerDataVersion??-1,i=t*j+e,a=p[i]!==n,o=!a&&m[i]!==r;(a||o)&&(p[i]=n,m[i]=r,this._markCornerDirty(t))}f&&c(M.some(n=>{let r=p[t*j+n];return r?.loaded||r===e}))}f&&c(n.edgeResolutions.every(e=>e>0));for(let e=0;e<j;++e)S[e]=null}_updateGeometry(e){if(!this.tile.intersectsClippingArea)return;f&&c(!this.tile.intersectsClippingArea||this.geometryState.edgeResolutions.every(e=>e>0)),this.intersectionData=null;let{tile:t,_vao:n,geometry:r,geometryState:i}=this,{vertexAttributes:a}=r,o=!n||!a||this.wireframeChanged||this.samplerDataChanged||this.clippingAreaChanged,s=this.dirtyEdgeResolutions!==0,l=i.edgeResolutions.reduce((e,t)=>Math.max(e,t),0)+1,u=s&&l>r.maxEdgeVertexCount,d=o||this.numVerticesPerSideChanged||u,p=!d&&s,m=!p&&this.dirtyEdges!==0,h=!m&&this.dirtyCorners!==0;d?(this.releaseGeometry(),this._createGeometry(e)):p?t.updateEdgeElevationsAndResolutions():m||h?t.updateEdgeElevations():console.warn(`Update for no reason?`),this._modifiedFlags=0}get hasGeometry(){return this._hasGeometry}releaseGeometry(){return this._hasGeometry=!1,this.intersectionData=null,this._vao?(this._vao=n(this._vao),this.geometry.release(),!0):!1}ensureTexture(e,t,n,r){let i=t?6408:6407;return this._texture!=null&&(n===0&&this._tile.surface.fadeDuration>0&&this._isTextureVisible(this._texture)||this._texture.descriptor.width!==e||this._texture.descriptor.pixelFormat!==i)&&this.releaseTexture(),this._texture??(this._texture=r(),this.tile.setMemoryDirty()),this._texture}releaseTexture(){this._texture&&(this._texture=r(this._texture),this.tile.setMemoryDirty())}reuseTexture(e,t){return!e||!this._texture?!1:(e.setTextureReference(new h(this._texture,0,t,this._textureOpacity,0,1)),!0)}get numVerticesPerSideChanged(){return(this._modifiedFlags&w)!==0}get samplerDataChanged(){return(this._modifiedFlags&T)!==0}get clippingAreaChanged(){return(this._modifiedFlags&E)!==0}get wireframeChanged(){return(this._modifiedFlags&D)!==0}get dirtyEdges(){return this._modifiedFlags>>O&15}get dirtyCorners(){return this._modifiedFlags>>k&15}get dirtyEdgeResolutions(){return this._modifiedFlags>>A&15}_markCornerDirty(e){let t=1<<e<<k;this._modifiedFlags|=t}_markEdgeDirty(e){let t=1<<e<<O;this._modifiedFlags|=t,this._markCornerDirty((e+0)%4),this._markCornerDirty((e+3)%4)}_markEdgeResolutionDirty(e){let t=1<<e<<A;this._modifiedFlags|=t,this._markEdgeDirty(e)}_markAllEdgesAndCornersDirty(){this._modifiedFlags|=15<<k|15<<O|15<<A}updateGeometryState(){let e=this._elevationInfo,t=this.tile,n=e.samplerData?t.getElevationVerticesPerSide(e.maxTileLevel):t.minimumVerticesPerSide,r=Math.max(n,5),a=t.clippingArea;(!t.intersectsClippingArea||t.withinClippingArea)&&(a=null);let o=this.geometryState,s=!1;o.numVerticesPerSide!==r&&(this._modifiedFlags|=w,o.numVerticesPerSide=r,o.samplerDataVersion++,s=!0),e.changed&&(this._modifiedFlags|=T,o.samplerData=e.samplerData,o.samplerDataSourceLevels=e.samplerDataSourceLevels,o.samplerDataVersion++,s=!0),i(o.clippingArea,a)||(this._modifiedFlags|=E,o.clippingArea=a,s=!0);let c=t.surface.wireframe;return o.wireframe!==c&&(this._modifiedFlags|=D,o.wireframe=c,s=!0),this._geometryStateChangedSinceLastUpdate||=s,s&&this._markAllEdgesAndCornersDirty(),this._hasGeometry=!0,this._geometryStateChangedSinceLastUpdate}_createGeometry(e){this.tile.createGeometry();let{vertexAttributes:t,indices:n}=this.geometry,r=e.gl;this._vao=new v(e,new b(e,a(t.layout),t.buffer),y.createIndex(e,r.STATIC_DRAW,n)),this._hasGeometry=!0}get vao(){return this._vao}setTextureReference(e,t=0){e?.texture===this._texture?this._textureOpacity=e.opacities[0]:this.releaseTexture(),this._textureFader.push(e,t)}get textureReference(){return this._textureFader.current}get nextTextureReference(){return this._textureFader.next}get textureFadeFactor(){return this._textureFader.fadeFactor}get textureIsFading(){return this._textureFader.isFading}_isTextureVisible(e){return this._textureFader.current?.texture===e||this._textureFader.next?.texture===e&&this._textureFader.fadeFactor<1}get _elevationInfo(){let t=this.geometryState.samplerData,n=this.geometryState.samplerDataSourceLevels,r=this.tile.layerInfo[0],i=r.length,a=Array(i),o=Array(i),s=0,c=0,l=!1;for(let e=0;e<i;e++){let n=r[e],i=n.upsampleInfo?.tile;if(i){let n=i.layerInfo[0][e].data,r=n&&n.samplerData;t&&t[s]===r||(l=!0),a[s++]=r,o[s-1]=n?.level??i.level,c=Math.max(c,i.lij[0])}else if(n.data){let r=this.tile.surface.layerViewByIndex(e,0);if(_(this.tile,r)){let e=n.data;t&&t[s]===e.samplerData||(l=!0),a[s++]=e.samplerData,o[s-1]=e.level,c=this.tile.level}}}t!=null&&t.length!==s&&(l=!0);let u=s>0,d=u?a:null,f=u?o:null;return u&&(a.length=s,o.length=s),e(n,f)||(l=!0),{changed:l,samplerData:d,samplerDataSourceLevels:f,maxTileLevel:c}}get estimatedGeometryMemoryUsage(){let e=this.intersectionData?.estimatedMemoryUsage??0;return(this.geometry.indices?.byteLength??0)+(this.geometry.vertexAttributes?.byteLength??0)+e}get texture(){return this._texture}get test(){}checkGeometryWaterproofness(){}}const S=[null,null,null,null];function C(e,t){return t?.loaded||t===e?t:null}const w=1,T=2,E=4,D=8,O=4,k=8,A=12,j=4,M=[0,1,2,3];export{x as PatchRenderData,C as neighborTileIfLoadedOrSelf,M as zeroToFour};
2
+ import{equals as e}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{isPowerOfTwo as t}from"../../../core/mathUtils.js";import{disposeMaybe as n,releaseMaybe as r}from"../../../core/maybe.js";import{equals as i}from"../../../geometry/support/aaBoundingRect.js";import{glLayout as a}from"../support/buffer/glUtil.js";import{GeometryState as o}from"./GeometryState.js";import{PatchGeometry as s}from"./PatchGeometry.js";import"../../../geometry/support/Ellipsoid.js";import{internalAssert as c,neighborEdgeIndices as l,oppositeEdge as u,neighborCornerIndices as d,enableTerrainInternalChecks as f}from"./terrainUtils.js";import{maxTileNeighborLevelDelta as p}from"./TerrainConst.js";import{TextureFader as m}from"./TextureFader.js";import{TextureReference as h}from"./TextureReference.js";import g from"./TileOverlayData.js";import{fallsWithinLayerView as _}from"./tileUtils.js";import{VertexArrayObject as v}from"../webgl-engine/lib/VertexArrayObject.js";import{BufferObject as y}from"../../webgl/BufferObject.js";import{VertexBuffer as b}from"../../webgl/VertexBuffer.js";class x{constructor(){this.geometry=new s,this.geometryState=null,this._texture=null,this._textureOpacity=1,this._textureFader=new m(()=>this._tile.surface.fadeDuration),this.overlay=new g,this._localOrigin=null,this._geometryStateChangedSinceLastUpdate=!0,this._hasGeometry=!1,this._modifiedFlags=0}get tile(){return this._tile}get localOrigin(){return this._localOrigin}init(e,t){this.clear(),this._tile=e,this.geometry.reset(),this.intersectionData=null,this.geometryState=new o,this._localOrigin=t,this.overlay.clear()}clear(){this.releaseGeometry(),this.releaseTexture(),this._textureFader.clear(),this._tile=null,this.intersectionData=null,this.geometryState=null}updateGeometryIfNeeded(e){if(this._tile&&this.geometryState&&((!this._vao||this._geometryStateChangedSinceLastUpdate||this.wireframeChanged||this.clippingAreaChanged||this.samplerDataChanged||this.numVerticesPerSideChanged||this.dirtyCorners||this.dirtyEdgeResolutions||this.dirtyEdges)&&(this._updateGeometry(e),this._geometryStateChangedSinceLastUpdate=!1),f&&this.tile.intersectsClippingArea))for(let e=0;e<j;++e)c(this.geometry.getEdgeCount(e)===this.geometryState.edgeResolutions[e]+1)}_calculateEdgeResolution(e,t){let n=this.tile,r=this.geometryState.numVerticesPerSide-1;if(!n.surface.isGlobal){let t=n.surface.groundExtent;if(t!=null&&(e===0&&n.extent[3]>t[3]||e===1&&n.extent[2]>t[2]||e===2&&n.extent[1]<t[1]||e===3&&n.extent[0]<t[0]))return r}let i=n.level,a=l[e];if(!t)return c(n.surface?.rootTiles==null||n.surface.updatingRootTiles||!n.shouldHaveNeighbor(a)),r;if(t.loaded){let n=t,a=n.renderData?.geometryState;if(!a)return r;let o=i-n.level;if(c(o>=0),o===0){let e=a.numVerticesPerSide-1;return Math.max(e,r)}let s=2**o,l=a.edgeResolutions[(e+2)%4]/s;return Math.max(1,l)}c(!t.leaf);let o=r;return t.forAllSubtreeOnSide(u(a),e=>e===n?!0:e.loaded?(o=Math.max(o,2**(e.level-i)),!0):(c(!e.leaf),!1)),o}updateNeighborData(){let e=this.tile;if(!e.intersectsClippingArea)return;let n=e.renderData.geometryState,r=t=>(t.loaded||t.level===e.level)&&t.intersectsClippingArea,i=n.edgePeerNeighbors,a=n.edgePeerNeighborSamplerVersions;for(let o=0;o<j;++o){let s=e.findNeighborTile(l[o],r),u=C(e,s),d=u?.renderData?.geometryState.samplerDataVersion??-1,m=i[o],h=u!==C(e,m),g=a[o]!==d;f&&s&&(c(e.level>=s.level),c(e.level-s.level<=p)),i[o]=s,(h||g)&&(a[o]=d,this._markEdgeDirty(o));let _=n.edgeResolutions[o],v=this._calculateEdgeResolution(o,s);c(t(v)),c(v>=1),n.edgeResolutions[o]=v,_!==v&&this._markEdgeResolutionDirty(o)}for(let t=0;t<j;++t){let a=e.findNeighborTile(d[t],r);n.cornerPeerNeighbors[t]=a;let o=C(e,i[t]),s=C(e,i[(t+1)%j]),l=C(e,a);S[t]=l,S[(t+1)%j]=s,S[(t+2)%j]=e,S[(t+3)%j]=o,c(S.some(t=>t?.loaded||t===e));let u=S.reduce((e,t)=>Math.min(e,t?.level??1/0),1/0);S.forEach((e,t)=>{e&&e.level>u&&(S[t]=null)}),c(S.some(t=>t?.loaded||t===e));let p=n.cornerNeighborCornerTiles,m=n.cornerNeighborCornerTileSamplerVersions;for(let e=0;e<j;++e){let n=S[e],r=n?.renderData?.geometryState?.samplerDataVersion??-1,i=t*j+e,a=p[i]!==n,o=!a&&m[i]!==r;(a||o)&&(p[i]=n,m[i]=r,this._markCornerDirty(t))}f&&c(M.some(n=>{let r=p[t*j+n];return r?.loaded||r===e}))}f&&c(n.edgeResolutions.every(e=>e>0));for(let e=0;e<j;++e)S[e]=null}_updateGeometry(e){if(!this.tile.intersectsClippingArea)return;f&&c(!this.tile.intersectsClippingArea||this.geometryState.edgeResolutions.every(e=>e>0)),this.intersectionData=null;let{tile:t,_vao:n,geometry:r,geometryState:i}=this,{vertexAttributes:a}=r,o=!n||!a||this.wireframeChanged||this.samplerDataChanged||this.clippingAreaChanged,s=this.dirtyEdgeResolutions!==0,l=i.edgeResolutions.reduce((e,t)=>Math.max(e,t),0)+1,u=s&&l>r.maxEdgeVertexCount,d=o||this.numVerticesPerSideChanged||u,p=!d&&s,m=!p&&this.dirtyEdges!==0,h=!m&&this.dirtyCorners!==0;d?(this.releaseGeometry(),this._createGeometry(e)):p?t.updateEdgeElevationsAndResolutions():m||h?t.updateEdgeElevations():console.warn(`Update for no reason?`),this._modifiedFlags=0}get hasGeometry(){return this._hasGeometry}releaseGeometry(){return this._hasGeometry=!1,this.intersectionData=null,this._vao?(this._vao=n(this._vao),this.geometry.release(),!0):!1}ensureTexture(e,t,n,r){let i=t?6408:6407;return this._texture!=null&&(n===0&&this._tile.surface.fadeDuration>0&&this._isTextureVisible(this._texture)||this._texture.descriptor.width!==e||this._texture.descriptor.pixelFormat!==i)&&this.releaseTexture(),this._texture??(this._texture=r(),this.tile.setMemoryDirty()),this._texture}releaseTexture(){this._texture&&(this._texture=r(this._texture),this.tile.setMemoryDirty())}reuseTexture(e,t){return!e||!this._texture?!1:(e.setTextureReference(new h(this._texture,!1,0,t,this._textureOpacity,0,1)),!0)}get numVerticesPerSideChanged(){return(this._modifiedFlags&w)!==0}get samplerDataChanged(){return(this._modifiedFlags&T)!==0}get clippingAreaChanged(){return(this._modifiedFlags&E)!==0}get wireframeChanged(){return(this._modifiedFlags&D)!==0}get dirtyEdges(){return this._modifiedFlags>>O&15}get dirtyCorners(){return this._modifiedFlags>>k&15}get dirtyEdgeResolutions(){return this._modifiedFlags>>A&15}_markCornerDirty(e){let t=1<<e<<k;this._modifiedFlags|=t}_markEdgeDirty(e){let t=1<<e<<O;this._modifiedFlags|=t,this._markCornerDirty((e+0)%4),this._markCornerDirty((e+3)%4)}_markEdgeResolutionDirty(e){let t=1<<e<<A;this._modifiedFlags|=t,this._markEdgeDirty(e)}_markAllEdgesAndCornersDirty(){this._modifiedFlags|=15<<k|15<<O|15<<A}updateGeometryState(){let e=this._elevationInfo,t=this.tile,n=e.samplerData?t.getElevationVerticesPerSide(e.maxTileLevel):t.minimumVerticesPerSide,r=Math.max(n,5),a=t.clippingArea;(!t.intersectsClippingArea||t.withinClippingArea)&&(a=null);let o=this.geometryState,s=!1;o.numVerticesPerSide!==r&&(this._modifiedFlags|=w,o.numVerticesPerSide=r,o.samplerDataVersion++,s=!0),e.changed&&(this._modifiedFlags|=T,o.samplerData=e.samplerData,o.samplerDataSourceLevels=e.samplerDataSourceLevels,o.samplerDataVersion++,s=!0),i(o.clippingArea,a)||(this._modifiedFlags|=E,o.clippingArea=a,s=!0);let c=t.surface.wireframe;return o.wireframe!==c&&(this._modifiedFlags|=D,o.wireframe=c,s=!0),this._geometryStateChangedSinceLastUpdate||=s,s&&this._markAllEdgesAndCornersDirty(),this._hasGeometry=!0,this._geometryStateChangedSinceLastUpdate}_createGeometry(e){this.tile.createGeometry();let{vertexAttributes:t,indices:n}=this.geometry,r=e.gl;this._vao=new v(e,new b(e,a(t.layout),t.buffer),y.createIndex(e,r.STATIC_DRAW,n)),this._hasGeometry=!0}get vao(){return this._vao}setTextureReference(e,t=0){e?.texture===this._texture?this._textureOpacity=e.opacities[0]:this.releaseTexture(),this._textureFader.push(e,t)}get textureReference(){return this._textureFader.current}get nextTextureReference(){return this._textureFader.next}get textureFadeFactor(){return this._textureFader.fadeFactor}get textureIsFading(){return this._textureFader.isFading}_isTextureVisible(e){return this._textureFader.current?.texture===e||this._textureFader.next?.texture===e&&this._textureFader.fadeFactor<1}get _elevationInfo(){let t=this.geometryState.samplerData,n=this.geometryState.samplerDataSourceLevels,r=this.tile.layerInfo[0],i=r.length,a=Array(i),o=Array(i),s=0,c=0,l=!1;for(let e=0;e<i;e++){let n=r[e],i=n.upsampleInfo?.tile;if(i){let n=i.layerInfo[0][e].data,r=n&&n.samplerData;t&&t[s]===r||(l=!0),a[s++]=r,o[s-1]=n?.level??i.level,c=Math.max(c,i.lij[0])}else if(n.data){let r=this.tile.surface.layerViewByIndex(e,0);if(_(this.tile,r)){let e=n.data;t&&t[s]===e.samplerData||(l=!0),a[s++]=e.samplerData,o[s-1]=e.level,c=this.tile.level}}}t!=null&&t.length!==s&&(l=!0);let u=s>0,d=u?a:null,f=u?o:null;return u&&(a.length=s,o.length=s),e(n,f)||(l=!0),{changed:l,samplerData:d,samplerDataSourceLevels:f,maxTileLevel:c}}get estimatedGeometryMemoryUsage(){let e=this.intersectionData?.estimatedMemoryUsage??0;return(this.geometry.indices?.byteLength??0)+(this.geometry.vertexAttributes?.byteLength??0)+e}get texture(){return this._texture}get test(){}checkGeometryWaterproofness(){}}const S=[null,null,null,null];function C(e,t){return t?.loaded||t===e?t:null}const w=1,T=2,E=4,D=8,O=4,k=8,A=12,j=4,M=[0,1,2,3];export{x as PatchRenderData,C as neighborTileIfLoadedOrSelf,M as zeroToFour};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- const e={type:`empty-tile`};function t(e){return e!=null&&`type`in e&&e.type===`vector-tile`}function n(e){return e!=null&&`type`in e&&e.type===`raster-tile`}function r(e){return e!=null&&`type`in e&&e.type===`tile-texture`}function i(e){return e!=null&&`type`in e&&e.type===`empty-tile`}function a(e){return e!=null&&`type`in e&&`bitmap`in e}export{e as emptyTile,a as isCreateBitmapResult,i as isEmptyTile,n as isRasterTile,r as isTileTexture,t as isVectorTile};
2
+ function e(e){return e!=null&&`type`in e&&e.type===`vector-tile`}function t(e){return e!=null&&`type`in e&&e.type===`raster-tile`}function n(e){return e!=null&&`type`in e&&e.type===`tile-texture`}function r(e){return e!=null&&`type`in e&&`bitmap`in e}export{r as isCreateBitmapResult,t as isRasterTile,n as isTileTexture,e as isVectorTile};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as n}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as i,sync as a}from"../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import{subtract as c,set as l,dot as u}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as d,fromValues as f,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as m,ZEROS as h}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as g,set as _}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as v}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as y}from"./OverlayRenderer.js";import{PatchRenderData as b}from"./PatchRenderData.js";import{TerrainAttributesCache as x}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as C}from"./TileRenderer.js";import{IteratorPreorder as w,fallsWithinLayerView as T,sortTiles as E,compareTiles as D}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as O}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as A}from"../webgl-engine/lib/Attribute.js";import{IntersectorResultRay as j}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as M,MeshIntersectionOptions as N,intersectTriangles as P}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as F}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as I,getVerticalOffsetTerrain as L}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as R}from"../webgl-engine/materials/DrawParameters.js";import{hasShadowHighlights as z}from"../webgl-engine/shaders/ReceiveShadowsConfiguration.js";import{T as B}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as V}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as H}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as U}from"../../webgl/enums.js";const W=g();let G=class extends k{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return this._stage.viewingMode===1}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,i,a,o){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._compressionTracker=a,this.type=7,this.isGround=!0,this._passParameters=new B,this._drawParameters=new R,this._renderDataPool=new r(()=>new b),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new w,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=[],this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>this._desiredSlot===1],[7,()=>this._desiredSlot===7],[9,()=>this._produces()&&this.renderOccludedFlags===y]]),this._tileSize=256,this._configuration=new H(t.viewingMode===1),this._tileTextureCache=new n((e,t)=>o.newCache(e,t),`TileTexture`),this.tileGeometryCache=new x(o)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(i(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set(`renderingDisabled`,!!e),this.setDirty()}set visible(e){this._set(`visible`,!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange(`renderPatchBorders`))}get layerViewUid(){return I}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,this._tileRenderer!=null&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){let{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;let n=m(e.lij[2]&1?.5:0,e.lij[1]&1?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,n)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;let{layerInfo:n,surface:r}=t;for(let i=0;i<n[1].length;i++){let n=r.layerViewByIndex(i,1);if(T(e,n)!==T(t,n))return!1}return!0}updateTileTexture(e,t){this._tileRenderer!=null&&(this._tileRenderer.updateTileTexture(e,t===32?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(let t of e.layerInfo[0])t.pendingUpdates&=-9;e.resetPendingUpdate(8);let t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){let t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){let t=Math.max(0,Math.floor((e.level-3)/7)*7);if(this._isGlobal&&t===0)return d;for(;e.parent&&e.level>t;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get(`wireframe`)!==e&&(this._set(`wireframe`,e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new C(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersectRay(e,t,n,r){let i=this._rootTiles;if(!i||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==0)return;let a=K,o=q;c(a,r,n),l(o,1/a[0],1/a[1],1/a[2]);let s=e.results.min,d=e.results.max,f=e.results.ground,p=e.options.store===0,m=!!e.results.ground.target,h=L(e.verticalOffset),g=e.tolerance,y,b=p&&s.distance!=null?s.distance:1/0,x=e.options,S=x.normalRequired||!x.backfacesTerrain,C=new N(g,!1,S),w=i=>{let l=i.renderData;if(!l?.vao)return;let m=l.geometry;_(W,m.boundingBox);let w=l.localOrigin;if(h!=null&&(h.localOrigin=w,h.applyToAabb(W)),J[0]=n[0]-w[0],J[1]=n[1]-w[1],J[2]=n[2]-w[2],!M(W,J,o,g,b))return;let T=(e,t,n,r)=>{e.set(this.type,i,t,n,r),b=p&&s.renderDistance!=null?s.renderDistance:1/0},E=(i,o,c)=>{(!S||c!=null)&&o>=0&&(x.backfacesTerrain||u(c,a)<0)&&(x.invisibleTerrain||!x.selectionMode||t==null||t(n,r,o))&&((f.renderDistance==null||o<f.renderDistance)&&T(f,i,o,c),x.isFiltered||(x.store===2&&(y==null?(y=new j(e.ray),T(y,i,o,c),e.results.all.push(y)):o<y.renderDistance&&T(y,i,o,c)),(s.renderDistance==null||o<s.renderDistance)&&T(s,i,o,c),x.store!==0&&(d.renderDistance==null||o>d.renderDistance)&&T(d,i,o,c)))},D=Y;c(D,r,w);let{indices:O,indexCount:k}=m,N=m.vertexAttributes,I=N.getField(`position`,v),L=new A(I.typedBuffer,3,N.stride/4),R=k/3;!h&&R>200?(l.intersectionData??=new F(O,R,L),l.intersectionData.intersectRay(J,D,C,E)):P(J,D,0,R,(e,t)=>I.getVec(O[t],e),h,C,E)},T=this._tileIterator;T.reset(i);let E=e.options.invisibleTerrain;for(let e=T.next();e;e=T.next())(e.visible||E&&e.intersectsClippingArea)&&(h!=null||e.intersectsRay(n,a,g,b))&&(!m||!this._useStencilForTile(e))?w(e):T.skipSubtree()}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(let t of this._visiblePatchesByOrigin.values())for(let n of t)n.renderData?.textureReference!=null&&e.queriesForTile(n);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return 7;case 3:case 4:return null}}acquireTechniques(e){let{shadowMap:t,viewshedEnabled:n,cutFillComputationEnabled:r,slot:i,hasEmission:a,useFloatBlend:o}=e.bind,s=!!has(`enable-feature:terrain-shadows`)&&t.enabled;if(s!==this._castShadows&&(this._castShadows=s,this._patchesByOriginDirty=!0),this._inViewshed!==n&&(this._inViewshed=n,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),this.transparency===3)return null;if(i===9){if((e.renderOccludedMask&y)===0)return null}else if(i!==this._desiredSlot)return null;let c=this._configuration;switch(c.receiveGlobalIllumination=c.screenSpaceReflections=c.cloudReflections=c.receiveShadows=c.hasShadowHighlights=c.receiveAmbientOcclusion=c.renderOccluded=c.hasHighlightMixTexture=!1,c.hasEmission=a,c.overlayMode=this._overlayRenderer.mode,c.useFloatBlend=o.value,e.output){case 0:case 1:case 2:{let n=e.bind;c.screenSpaceReflections=n.hasScreenSpaceReflections,c.cloudReflections=n.clouds.data!=null;let r=i===9;return c.receiveShadows=t.ready&&!r,c.hasShadowHighlights=z(c,e.bind),c.renderOccluded=r,c.receiveAmbientOcclusion=!r&&n.ssao!=null,c.receiveGlobalIllumination=!r&&n.globalIlluminationEnabled,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:case 11:return this._acquireTechnique(e.output);case 10:return c.hasHighlightMixTexture=e.bind.highlightMixTexture!=null,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),this._passParameters.useStencil=!1,this._passParameters.overlayContent=O(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{let n=e.bind.highlight?.name;n&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(n)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(this._tileRenderer==null)return;let t=this._tileRenderer,n;if(e!=null){let t=e.toUnitRGBA();n=f(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(n),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:t.backgroundColor==null?0:1,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){let e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(let n of e)E(n,t);e.sort((e,t)=>D(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange(`visibleTiles`),this._patchSortingDirty=!1}}_rebuildPatchGroups(){let e=this._rootTiles;if(e!=null){e[0]?.surface.checkAllTilesWaterproofness(`render-patch-groups`),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(let t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){let t=this._tileIterator;for(t.resetOne(e);!t.done;){let e=t.next(),n=e.renderData;if(!n){this._numTilesCulled++;continue}let r=n.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let i=this._visiblePatchesByOrigin.get(r);i||(i=[],this._visiblePatchesByOrigin.set(r,i)),i.push(e),t.skipSubtree()}}_useStencilForTile(e){for(let t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,n){let{rctx:r,bind:i}=e;r.bindTechnique(t,i,this._passParameters);let a=this._stencilEnabledLayerExtents.length>0;n.forEach(n=>{this._drawParameters.origin=n[0].renderData.localOrigin,t.program.bindDraw(i,this._passParameters,this._drawParameters);for(let r=0;r<n.length;r++)this._renderPatch(e,t,n[r],U.TRIANGLES,a,this._passParameters.overlayContent===null)}),r.bindVAO(null)}_renderMaterialPass(e,t){let{rctx:n,bind:r}=e,i=n.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;let a=r.slot===9;a&&(i.bindTexture(`tex`,n.emptyTexture),i.setUniform3fv(`textureOpacities`,d),i.setUniform4fv(`texOffsetAndScale`,h));let o=this._tileRenderer?.backgroundColor==null?d:this._tileRenderer.backgroundColor;this._configuration.tileBlendInput===1&&i.setUniform3fv(`backgroundColor`,o);let s=this._stencilEnabledLayerExtents.length>0,c=this.wireframe?U.LINES:U.TRIANGLES;this._configuration.textureFadingEnabled&&i.bindTexture(`texNext`,n.emptyTexture);for(let n of this._visiblePatchesByOrigin.values()){this._drawParameters.origin=n[0].renderData.localOrigin,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(let r of n){let n=r.renderData,o=n.textureReference;if(o!=null){if(!a){i.setUniform4fv(`texOffsetAndScale`,o.offsetAndScale),i.bindTexture(`tex`,o.texture.texture);let e=n.textureFadeFactor,t=e<1?n.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(i.setUniform1f(`fadeFactor`,e),i.setUniform4fv(`nextTexOffsetAndScale`,t.offsetAndScale),i.setUniform3fv(`nextTexOpacities`,t.opacities),i.bindTexture(`texNext`,t.texture.texture)):i.setUniform1f(`fadeFactor`,1),n.textureIsFading&&this.setNeedsRender(2),i.setUniform3fv(`textureOpacities`,o.opacities)}this._renderPatch(e,t,r,c,s),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}n.bindVAO(null)}_renderPatch(e,t,n,r,i,a=!1){let o=n.renderData,s=o.vao,c=s?.indexBuffer;if(!s||c==null){S&&console.error(`Rendered tile with no indices: `,n.lij,` : `,o);return}let l=t.program;!a&&!this._overlayRenderer.isEmpty&&this._bindOverlayPatchData(l,o.overlay);let{rctx:u,bind:d}=e;i&&(this._passParameters.useStencil=this._useStencilForTile(n),u.setPipelineState(t.getPipeline(d,this._passParameters)));let f=o.geometry.indexCount;u.bindVAO(s),l.assertCompatibleVertexAttributeLocations(s),u.drawElements(r,f,c.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv(`overlayTexOffset`,t.offsets),e.setUniform4fv(`overlayTexScale`,t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(V,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([o({readOnly:!0})],G.prototype,`visibleTiles`,null),e([o({readOnly:!0})],G.prototype,`_isGlobal`,null),e([o()],G.prototype,`renderOccludedFlags`,null),e([o({value:!1})],G.prototype,`renderingDisabled`,null),e([o({value:!0})],G.prototype,`visible`,null),e([o()],G.prototype,`renderPatchBorders`,null),e([o()],G.prototype,`wireframe`,null),G=e([s(`esri.views.3d.terrain.TerrainRenderer`)],G);const K=p(),q=p(),J=p(),Y=p();export{G as TerrainRenderer};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as n}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as i,sync as a}from"../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import{subtract as c,set as l,dot as u}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as d,fromValues as f,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as m,ZEROS as h}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as g,set as _}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as v}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as y}from"./OverlayRenderer.js";import{PatchRenderData as b}from"./PatchRenderData.js";import{TerrainAttributesCache as x}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as C}from"./TileRenderer.js";import{IteratorPreorder as w,fallsWithinLayerView as T,sortTiles as E,compareTiles as D}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as O}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as A}from"../webgl-engine/lib/Attribute.js";import{IntersectorResultRay as j}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as M,MeshIntersectionOptions as N,intersectTriangles as P}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as F}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as I,getVerticalOffsetTerrain as L}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as R}from"../webgl-engine/materials/DrawParameters.js";import{hasShadowHighlights as z}from"../webgl-engine/shaders/ReceiveShadowsConfiguration.js";import{T as B}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as V}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as H}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as U}from"../../webgl/enums.js";const W=g();let G=class extends k{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return this._view.stage.viewingMode===1}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,i,a,o){super({}),this._surface=e,this._overlayRenderer=t,this._allTiles=i,this._compressionTracker=a,this.type=7,this.isGround=!0,this._passParameters=new B,this._drawParameters=new R,this._renderDataPool=new r(()=>new b),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new w,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=[],this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>this._desiredSlot===1],[7,()=>this._desiredSlot===7],[9,()=>this._produces()&&this.renderOccludedFlags===y]]),this._tileSize=256,this._configuration=new H(e.isGlobal),this._tileTextureCache=new n((e,t)=>o.newCache(e,t),`TileTexture`),this.tileGeometryCache=new x(o)}normalizeCtorArgs(){return{}}initialize(){this.addHandles(i(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),a))}destroy(){this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set(`renderingDisabled`,!!e),this.setDirty()}set visible(e){this._set(`visible`,!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange(`renderPatchBorders`))}get layerViewUid(){return I}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,this._tileRenderer!=null&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){let{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;let n=m(e.lij[2]&1?.5:0,e.lij[1]&1?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,n)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;let{layerInfo:n,surface:r}=t;for(let i=0;i<n[1].length;i++){let n=r.layerViewByIndex(i,1);if(T(e,n)!==T(t,n))return!1}return!0}updateTileTexture(e,t){this._tileRenderer!=null&&(this._tileRenderer.updateTileTexture(e,t===32?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(let t of e.layerInfo[0])t.pendingUpdates&=-9;e.resetPendingUpdate(8);let t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){let t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){let t=Math.max(0,Math.floor((e.level-3)/7)*7);if(this._isGlobal&&t===0)return d;for(;e.parent&&e.level>t;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get(`wireframe`)!==e&&(this._set(`wireframe`,e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new C(this._surface,this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersectRay(e,t,n,r){let i=this._rootTiles;if(!i||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==0)return;let a=K,o=q;c(a,r,n),l(o,1/a[0],1/a[1],1/a[2]);let s=e.results.min,d=e.results.max,f=e.results.ground,p=e.options.store===0,m=!!e.results.ground.target,h=L(e.verticalOffset),g=e.tolerance,y,b=p&&s.distance!=null?s.distance:1/0,x=e.options,S=x.normalRequired||!x.backfacesTerrain,C=new N(g,!1,S),w=i=>{let l=i.renderData;if(!l?.vao)return;let m=l.geometry;_(W,m.boundingBox);let w=l.localOrigin;if(h!=null&&(h.localOrigin=w,h.applyToAabb(W)),J[0]=n[0]-w[0],J[1]=n[1]-w[1],J[2]=n[2]-w[2],!M(W,J,o,g,b))return;let T=(e,t,n,r)=>{e.set(this.type,i,t,n,r),b=p&&s.renderDistance!=null?s.renderDistance:1/0},E=(i,o,c)=>{(!S||c!=null)&&o>=0&&(x.backfacesTerrain||u(c,a)<0)&&(x.invisibleTerrain||!x.selectionMode||t==null||t(n,r,o))&&((f.renderDistance==null||o<f.renderDistance)&&T(f,i,o,c),x.isFiltered||(x.store===2&&(y==null?(y=new j(e.ray),T(y,i,o,c),e.results.all.push(y)):o<y.renderDistance&&T(y,i,o,c)),(s.renderDistance==null||o<s.renderDistance)&&T(s,i,o,c),x.store!==0&&(d.renderDistance==null||o>d.renderDistance)&&T(d,i,o,c)))},D=Y;c(D,r,w);let{indices:O,indexCount:k}=m,N=m.vertexAttributes,I=N.getField(`position`,v),L=new A(I.typedBuffer,3,N.stride/4),R=k/3;!h&&R>200?(l.intersectionData??=new F(O,R,L),l.intersectionData.intersectRay(J,D,C,E)):P(J,D,0,R,(e,t)=>I.getVec(O[t],e),h,C,E)},T=this._tileIterator;T.reset(i);let E=e.options.invisibleTerrain;for(let e=T.next();e;e=T.next())(e.visible||E&&e.intersectsClippingArea)&&(h!=null||e.intersectsRay(n,a,g,b))&&(!m||!this._useStencilForTile(e))?w(e):T.skipSubtree()}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(let t of this._visiblePatchesByOrigin.values())for(let n of t)n.renderData?.textureReference!=null&&e.queriesForTile(n);e.process(),t.madeProgress()}}get _view(){return this._surface.view}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return 7;case 3:case 4:return null}}acquireTechniques(e){let{shadowMap:t,viewshedEnabled:n,cutFillComputationEnabled:r,slot:i,hasEmission:a,useFloatBlend:o}=e.bind,s=!!has(`enable-feature:terrain-shadows`)&&t.enabled;if(s!==this._castShadows&&(this._castShadows=s,this._patchesByOriginDirty=!0),this._inViewshed!==n&&(this._inViewshed=n,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),this.transparency===3)return null;if(i===9){if((e.renderOccludedMask&y)===0)return null}else if(i!==this._desiredSlot)return null;let c=this._configuration;switch(c.receiveGlobalIllumination=c.screenSpaceReflections=c.cloudReflections=c.receiveShadows=c.hasShadowHighlights=c.receiveAmbientOcclusion=c.renderOccluded=c.hasHighlightMixTexture=!1,c.hasEmission=a,c.overlayMode=this._overlayRenderer.mode,c.useFloatBlend=o.value,e.output){case 0:case 1:case 2:{let n=e.bind;c.screenSpaceReflections=n.hasScreenSpaceReflections,c.cloudReflections=n.clouds.data!=null;let r=i===9;return c.receiveShadows=t.ready&&!r,c.hasShadowHighlights=z(c,e.bind),c.renderOccluded=r,c.receiveAmbientOcclusion=!r&&n.ssao!=null,c.receiveGlobalIllumination=!r&&n.globalIlluminationEnabled,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:case 11:return this._acquireTechnique(e.output);case 10:return c.hasHighlightMixTexture=e.bind.highlightMixTexture!=null,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),this._passParameters.useStencil=!1,this._passParameters.overlayContent=O(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{let n=e.bind.highlight?.name;n&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(n)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(this._tileRenderer==null)return;let t=this._tileRenderer,n;if(e!=null){let t=e.toUnitRGBA();n=f(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(n),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:t.backgroundColor==null?0:1,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){let e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(let n of e)E(n,t);e.sort((e,t)=>D(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange(`visibleTiles`),this._patchSortingDirty=!1}}_rebuildPatchGroups(){let e=this._rootTiles;if(e!=null){e[0]?.surface.checkAllTilesWaterproofness(`render-patch-groups`),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(let t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){let t=this._tileIterator;for(t.resetOne(e);!t.done;){let e=t.next(),n=e.renderData;if(!n){this._numTilesCulled++;continue}let r=n.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let i=this._visiblePatchesByOrigin.get(r);i||(i=[],this._visiblePatchesByOrigin.set(r,i)),i.push(e),t.skipSubtree()}}_useStencilForTile(e){for(let t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,n){let{rctx:r,bind:i}=e;r.bindTechnique(t,i,this._passParameters);let a=this._stencilEnabledLayerExtents.length>0;n.forEach(n=>{this._drawParameters.origin=n[0].renderData.localOrigin,t.program.bindDraw(i,this._passParameters,this._drawParameters);for(let r=0;r<n.length;r++)this._renderPatch(e,t,n[r],U.TRIANGLES,a,this._passParameters.overlayContent===null)}),r.bindVAO(null)}_renderMaterialPass(e,t){let{rctx:n,bind:r}=e,i=n.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;let a=r.slot===9;a&&(i.bindTexture(`tex`,n.emptyTexture),i.setUniform3fv(`textureOpacities`,d),i.setUniform4fv(`texOffsetAndScale`,h));let o=this._tileRenderer?.backgroundColor==null?d:this._tileRenderer.backgroundColor;this._configuration.tileBlendInput===1&&i.setUniform3fv(`backgroundColor`,o);let s=this._stencilEnabledLayerExtents.length>0,c=this.wireframe?U.LINES:U.TRIANGLES;this._configuration.textureFadingEnabled&&i.bindTexture(`texNext`,n.emptyTexture);for(let n of this._visiblePatchesByOrigin.values()){this._drawParameters.origin=n[0].renderData.localOrigin,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(let r of n){let n=r.renderData,o=n.textureReference;if(o!=null){if(!a){i.setUniform4fv(`texOffsetAndScale`,o.offsetAndScale),i.bindTexture(`tex`,o.texture.texture);let e=n.textureFadeFactor,t=e<1?n.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(i.setUniform1f(`fadeFactor`,e),i.setUniform4fv(`nextTexOffsetAndScale`,t.offsetAndScale),i.setUniform3fv(`nextTexOpacities`,t.opacities),i.bindTexture(`texNext`,t.texture.texture)):i.setUniform1f(`fadeFactor`,1),n.textureIsFading&&this.setNeedsRender(2),i.setUniform3fv(`textureOpacities`,o.opacities)}this._renderPatch(e,t,r,c,s),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}n.bindVAO(null)}_renderPatch(e,t,n,r,i,a=!1){let o=n.renderData,s=o.vao,c=s?.indexBuffer;if(!s||c==null){S&&console.error(`Rendered tile with no indices: `,n.lij,` : `,o);return}let l=t.program;!a&&!this._overlayRenderer.isEmpty&&this._bindOverlayPatchData(l,o.overlay);let{rctx:u,bind:d}=e;i&&(this._passParameters.useStencil=this._useStencilForTile(n),u.setPipelineState(t.getPipeline(d,this._passParameters)));let f=o.geometry.indexCount;u.bindVAO(s),l.assertCompatibleVertexAttributeLocations(s),u.drawElements(r,f,c.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv(`overlayTexOffset`,t.offsets),e.setUniform4fv(`overlayTexScale`,t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(V,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([o({readOnly:!0})],G.prototype,`visibleTiles`,null),e([o({readOnly:!0})],G.prototype,`_isGlobal`,null),e([o()],G.prototype,`renderOccludedFlags`,null),e([o({value:!1})],G.prototype,`renderingDisabled`,null),e([o({value:!0})],G.prototype,`visible`,null),e([o()],G.prototype,`renderPatchBorders`,null),e([o()],G.prototype,`wireframe`,null),G=e([s(`esri.views.3d.terrain.TerrainRenderer`)],G);const K=p(),q=p(),J=p(),Y=p();export{G as TerrainRenderer};