@arcgis/core 4.33.0-next.20250331 → 4.33.0-next.20250402

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 (209) hide show
  1. package/applications/SceneViewer/sceneViewerUtils.d.ts +1 -0
  2. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  3. package/arcade/featureSetUtils.js +1 -1
  4. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  5. package/arcade/functions/knowledgegraph.js +1 -1
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/0297e55a49ca0d1231ef.js +1 -0
  8. package/assets/esri/core/workers/chunks/{98da74243df03e0cc70d.js → 067dda58592fbf4fb812.js} +1 -1
  9. package/assets/esri/core/workers/chunks/0cd5f15b8558b23e5fcd.js +1 -0
  10. package/assets/esri/core/workers/chunks/0db4c0071282dd94f3b2.js +1 -0
  11. package/assets/esri/core/workers/chunks/1072b4f37eacbbfda2c8.js +1 -0
  12. package/assets/esri/core/workers/chunks/{4d95cc85f4b73e857b1f.js → 11badb73d43059374ad8.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{dcb043986fb065de0366.js → 16607e71804eff64c0e1.js} +1 -1
  14. package/assets/esri/core/workers/chunks/18f8b41bd761e9ab60d0.js +1 -0
  15. package/assets/esri/core/workers/chunks/{ed831e51c2a03ee95879.js → 19e83b184d8b4d0b3007.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{5de3aee547113bfd59df.js → 1b87fa15470cce26feea.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{dde03a893f9cef8e0f45.js → 1d322685016263f86cf5.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{e4b80c8f4c45fd78bde1.js → 23de8aeed5b82c682cbe.js} +1 -1
  19. package/assets/esri/core/workers/chunks/269531e770376ed9e4fd.js +1 -0
  20. package/assets/esri/core/workers/chunks/2791f1f2791087d0217f.js +1 -0
  21. package/assets/esri/core/workers/chunks/{48ad7beb48dcc2693cc3.js → 2ab7d36409e9af3ac3da.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{a7a1832274892e99c388.js → 30a047bd66f333bb7d2d.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{94292c7afff18694d55e.js → 322cb1b1871d03b69f0a.js} +37 -37
  24. package/assets/esri/core/workers/chunks/37e49d1a1407c193dcd0.js +1 -0
  25. package/assets/esri/core/workers/chunks/3b7284516a0e34a9e85e.js +1 -0
  26. package/assets/esri/core/workers/chunks/{6cb5ce0a6bb85c624a21.js → 400f95295bbfced31076.js} +1 -1
  27. package/assets/esri/core/workers/chunks/401ff3c83789c72e9ac9.js +1 -0
  28. package/assets/esri/core/workers/chunks/{6339a24874c698594101.js → 40b33c9bd271cddbd837.js} +1 -1
  29. package/assets/esri/core/workers/chunks/48fbf887da6d19838bf0.js +1 -0
  30. package/assets/esri/core/workers/chunks/4ba34124054752b363c0.js +1 -0
  31. package/assets/esri/core/workers/chunks/4cc77769009901a112ec.js +39 -0
  32. package/assets/esri/core/workers/chunks/{ba4d91816f6a0bf0d812.js → 4dc135e0133d58a06d67.js} +1 -1
  33. package/assets/esri/core/workers/chunks/5aae4e127e888f69435a.js +1 -0
  34. package/assets/esri/core/workers/chunks/{0943695a1dcd21c45e83.js → 5b32c2a1b276352593dc.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{087a09b4c41abef6b516.js → 5c757e20c0543e6a49b3.js} +1 -1
  36. package/assets/esri/core/workers/chunks/6280e1fe944ea4a71b91.js +1 -0
  37. package/assets/esri/core/workers/chunks/{9c59fc2df8081e65a128.js → 628395830c78b95b46dc.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{edcc0fefd57323d2cb67.js → 6828e4936db0121a9638.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{1cd9b5ef62582b25df9b.js → 69b5d0ef14fb521b0fd7.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{b52a3a48d2d3ff22542d.js → 6a8cf1f51cc4adc268d3.js} +1 -1
  41. package/assets/esri/core/workers/chunks/6e679703b5d6fc1b91a5.js +1 -0
  42. package/assets/esri/core/workers/chunks/6f3731f19497cbc6ea74.js +1 -0
  43. package/assets/esri/core/workers/chunks/72d7e45e7eb28f2cc0b0.js +1 -0
  44. package/assets/esri/core/workers/chunks/7649d59b0b7d53818a29.js +1 -0
  45. package/assets/esri/core/workers/chunks/{fe3ed029b07bb1e4aef3.js → 77ae11dbd3e1eeacd7ee.js} +1 -1
  46. package/assets/esri/core/workers/chunks/7978b66cdfe078960ddd.js +1 -0
  47. package/assets/esri/core/workers/chunks/7b8f0b63b968ff40d00d.js +1 -0
  48. package/assets/esri/core/workers/chunks/7e00122014d0a55363a8.js +319 -0
  49. package/assets/esri/core/workers/chunks/{f452ca61842dbe8de9af.js → 7ea5bbb52e84be9a608e.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{eb9d2bb8b44a93347274.js → 7ef9bcd58af499a14a08.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{b2f8702a9f54fff23ad9.js → 7f31dbe0ca8974a10be8.js} +1 -1
  52. package/assets/esri/core/workers/chunks/80427cd9f0c2e07f21c3.js +1 -0
  53. package/assets/esri/core/workers/chunks/{77199b4b39ee8b4303de.js → 82a58a405332d43a328f.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{626db8488f9d931cf55c.js → 899f197556b6ced6eddf.js} +2 -2
  55. package/assets/esri/core/workers/chunks/8aae03e347ab18ae6ee2.js +1 -0
  56. package/assets/esri/core/workers/chunks/8d49c79e549e90371303.js +1 -0
  57. package/assets/esri/core/workers/chunks/{a9b6377f1fef5826f28d.js → 8f35416a5036897d6289.js} +1 -1
  58. package/assets/esri/core/workers/chunks/91439b59260b0fb04be9.js +1 -0
  59. package/assets/esri/core/workers/chunks/{bdeac9196f28aff93e68.js → 93d06a1a0b700ddb3807.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{a01c86910fe4984eb788.js → 9574896c90b39fa7ecb4.js} +1 -1
  61. package/assets/esri/core/workers/chunks/96978d039f183565bffa.js +1 -0
  62. package/assets/esri/core/workers/chunks/9a641fb94819574e48f6.js +1 -0
  63. package/assets/esri/core/workers/chunks/{72c7126dbd27fa48fcdb.js → a3421383e48379012c9c.js} +1 -1
  64. package/assets/esri/core/workers/chunks/b28b699de6deb7e9fa53.js +1 -0
  65. package/assets/esri/core/workers/chunks/{1a5f96b1b892ecceb36a.js → b4a1f3f3a036226d6810.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{f8d1c7df671733c3325c.js → b64f708f821dd2bb51cd.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{3e4204502f6e09483c60.js → b7a1185ac49480fc1410.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{738e4f46feb3758456e0.js → baa9fd23414f03ef90bc.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{aa712f850fd129ca5ed8.js → bba6d7615d8f3862fe70.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{1cf8a431e5da946c7d27.js → bd0dbad694ce5531deab.js} +1 -1
  71. package/assets/esri/core/workers/chunks/c1bd47cde53918f454ca.js +1 -0
  72. package/assets/esri/core/workers/chunks/{1d0473dd43c88ab5776d.js → c589d32f8efcca6bf712.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{081699532b183db1e7c2.js → cda6ae4c5cb67e22b454.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{e2029267cddb8e2effab.js → d58fae2fc9d148e015ae.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{460afde071df9f35182d.js → e14449f07ed3386f4f2b.js} +1 -1
  76. package/assets/esri/core/workers/chunks/{d0fbd4c6bffe0cb98d14.js → e592731ac12b9bc646ff.js} +1 -1
  77. package/assets/esri/core/workers/chunks/e5aff9b10877fb04d6de.js +1 -0
  78. package/assets/esri/core/workers/chunks/e6469173c65531d6524a.js +1 -0
  79. package/assets/esri/core/workers/chunks/e6544e966f14fb410157.js +1 -0
  80. package/assets/esri/core/workers/chunks/e8312c999b3f0c9ef09e.js +1 -0
  81. package/assets/esri/core/workers/chunks/{cb386923200272cf26a9.js → e9e517a2141e504eec64.js} +1 -1
  82. package/assets/esri/core/workers/chunks/eb011e8b14db37ddb110.js +1 -0
  83. package/assets/esri/core/workers/chunks/{f809cbfb744adb4fad29.js → efb0f3ec2344adcb24f3.js} +1 -1
  84. package/assets/esri/core/workers/chunks/{999e8dbe6f4d0665b3ab.js → f5fcba6ca6f43bf1d65d.js} +1 -1
  85. package/assets/esri/core/workers/chunks/fa9ef9e8eae505371965.js +1 -0
  86. package/assets/esri/core/workers/chunks/fb5b852d0f72df014377.js +1 -0
  87. package/assets/esri/core/workers/chunks/ff62b813fff4a015a8a6.js +1 -0
  88. package/core/has.js +1 -1
  89. package/core/sql/WhereClause.js +1 -1
  90. package/core/typedArrayUtil.js +1 -1
  91. package/editing/sharedTemplates/templateDefinitions/TemplateDefinitionBase.js +1 -1
  92. package/geometry/asserts.js +1 -1
  93. package/geometry/support/normalizeUtils.js +1 -1
  94. package/identity/IdentityManagerBase.js +1 -1
  95. package/interfaces.d.ts +96 -8
  96. package/layers/TileLayer.js +1 -1
  97. package/layers/graphics/applyEditsUtils.js +1 -1
  98. package/layers/graphics/data/QueryEngineResult.js +1 -1
  99. package/layers/graphics/featureConversionUtils.js +1 -1
  100. package/layers/graphics/sources/GeoJSONSource.js +1 -1
  101. package/layers/graphics/sources/MemorySource.js +1 -1
  102. package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
  103. package/layers/graphics/sources/support/sourceUtils.js +1 -1
  104. package/layers/support/ElevationQuery.js +1 -1
  105. package/layers/support/SubtypeSublayer.js +1 -1
  106. package/layers/support/VideoElement.js +1 -1
  107. package/layers/support/wmtsUtils.js +1 -1
  108. package/networks/support/UtilityNetworkLookupHelper.js +1 -1
  109. package/package.json +3 -3
  110. package/portal/support/geometryServiceUtils.js +1 -1
  111. package/renderers/support/DictionaryScriptEvaluator.js +1 -1
  112. package/rest/support/printTaskUtils.js +1 -1
  113. package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
  114. package/support/revision.js +1 -1
  115. package/symbols/support/ElevationInfo.js +1 -1
  116. package/undoredo/support/Services.js +1 -1
  117. package/versionManagement/VersioningState.js +1 -1
  118. package/views/2d/engine/webgl/Mesh2D.js +1 -1
  119. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  120. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  121. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  122. package/views/3d/layers/I3SMeshView3D.js +1 -1
  123. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  124. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  125. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  126. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  127. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
  128. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  129. package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
  130. package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
  131. package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
  132. package/views/3d/layers/i3s/I3SBinaryReader.js +1 -1
  133. package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
  134. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  135. package/views/3d/layers/i3s/I3SQueryFeatureAdapter.js +1 -1
  136. package/views/3d/layers/i3s/I3SQueryFeatureStore.js +1 -1
  137. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  138. package/views/3d/layers/support/TemporalSceneLayerView.js +1 -1
  139. package/views/3d/support/engineContent/sdfPrimitives.js +1 -1
  140. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  141. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js +1 -1
  142. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
  143. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  144. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  145. package/views/3d/webgl-engine/lib/textureUtils.js +1 -1
  146. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  147. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  148. package/views/SceneView.js +1 -1
  149. package/views/View.js +1 -1
  150. package/views/ViewAnimation.js +1 -1
  151. package/views/interactive/snapping/FeatureSnappingSourceInfo.js +1 -1
  152. package/views/layers/PointCloudLayerView.d.ts +1 -1
  153. package/views/layers/PointCloudLayerView.js +5 -0
  154. package/views/webgl/ShaderBuilder.js +1 -1
  155. package/views/webgl/Texture.js +1 -1
  156. package/views/webgl/textureUtils.js +1 -1
  157. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  158. package/widgets/Editor/UpdateFeaturesWorkflow.js +5 -0
  159. package/widgets/Editor/UpdateFeaturesWorkflowData.js +5 -0
  160. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  161. package/widgets/Editor/workflowUtils.js +1 -1
  162. package/widgets/Feature/support/relatedFeatureUtils.js +1 -1
  163. package/widgets/FeatureForm/FieldInput.js +1 -1
  164. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  165. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  166. package/widgets/OrientedImageryViewer/dataCaptureUtils.js +1 -1
  167. package/widgets/Slider.js +1 -1
  168. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  169. package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
  170. package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
  171. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  172. package/assets/esri/core/workers/chunks/028e2e0fa6971aaaaae8.js +0 -1
  173. package/assets/esri/core/workers/chunks/0e82365be7d9257e7cb2.js +0 -1
  174. package/assets/esri/core/workers/chunks/1322096a72e910f23167.js +0 -1
  175. package/assets/esri/core/workers/chunks/186387a561364a11e574.js +0 -1
  176. package/assets/esri/core/workers/chunks/3808f10747cecc8a1a9b.js +0 -1
  177. package/assets/esri/core/workers/chunks/3f7c57d5f3bdefa74d18.js +0 -1
  178. package/assets/esri/core/workers/chunks/424e2058228e5f6a183d.js +0 -1
  179. package/assets/esri/core/workers/chunks/4816cf647eca2f4cecc2.js +0 -1
  180. package/assets/esri/core/workers/chunks/4aa0a58ded4465ea28bd.js +0 -1
  181. package/assets/esri/core/workers/chunks/4bb65ef7b3a02ebe416e.js +0 -1
  182. package/assets/esri/core/workers/chunks/4d798da25a726f179089.js +0 -319
  183. package/assets/esri/core/workers/chunks/4ffdff269aae8c293cb4.js +0 -1
  184. package/assets/esri/core/workers/chunks/564cc81c232c97646833.js +0 -1
  185. package/assets/esri/core/workers/chunks/5820808c7659460969d4.js +0 -1
  186. package/assets/esri/core/workers/chunks/5d01f0b86566d08ba29d.js +0 -1
  187. package/assets/esri/core/workers/chunks/6c378e7a6ca29d530880.js +0 -1
  188. package/assets/esri/core/workers/chunks/7d1c39c2a80e20a0595f.js +0 -1
  189. package/assets/esri/core/workers/chunks/86ee278919038260696e.js +0 -39
  190. package/assets/esri/core/workers/chunks/8752f807c05d1ec215e8.js +0 -1
  191. package/assets/esri/core/workers/chunks/8ef5e6f1c606e5e41002.js +0 -1
  192. package/assets/esri/core/workers/chunks/921b41b101957cfc1cfd.js +0 -1
  193. package/assets/esri/core/workers/chunks/9ef509e0853ad41f7690.js +0 -1
  194. package/assets/esri/core/workers/chunks/9f18de17fbcad0e5c140.js +0 -1
  195. package/assets/esri/core/workers/chunks/a53e9f5092de715da025.js +0 -1
  196. package/assets/esri/core/workers/chunks/aa3a45e8228216c1739b.js +0 -1
  197. package/assets/esri/core/workers/chunks/ab0113d1269675dcd520.js +0 -1
  198. package/assets/esri/core/workers/chunks/b23d16745674486ddd6c.js +0 -1
  199. package/assets/esri/core/workers/chunks/b3c126e8a0a722c03efc.js +0 -1
  200. package/assets/esri/core/workers/chunks/c7aa4a8263e21f631004.js +0 -1
  201. package/assets/esri/core/workers/chunks/cc441051a52bfbda9caf.js +0 -1
  202. package/assets/esri/core/workers/chunks/ccc6f6f7052985bebdab.js +0 -1
  203. package/assets/esri/core/workers/chunks/d3912886ac2910290f43.js +0 -1
  204. package/assets/esri/core/workers/chunks/d8b903b4147b090576f2.js +0 -1
  205. package/assets/esri/core/workers/chunks/da8a002d18544def5383.js +0 -1
  206. package/assets/esri/core/workers/chunks/f28eaf1d3a7f12788bcf.js +0 -1
  207. package/assets/esri/core/workers/chunks/f9bedb421d4e115a888f.js +0 -1
  208. package/assets/esri/core/workers/chunks/faed301a25252c619cff.js +0 -1
  209. package/assets/esri/core/workers/chunks/fc9758006a7135c7d9c3.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/Error.js";import{makeHandle as t}from"../../../../../core/handleUtils.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import i from"../../../../../core/Promise.js";import{on as n}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{FeatureLayerViewPerformanceInfo as u}from"../../FeatureLayerViewPerformanceInfo.js";import{Feature3DPipelineWorkerHandle as l}from"./Feature3DPipelineWorkerHandle.js";import{FeaturePipelineRenderManager as d}from"./rendering/FeaturePipelineRenderManager.js";import{emptyHighlightHandle as p}from"../../support/highlightUtils.js";import{LayerViewPerformanceInfo as m}from"../../support/LayerViewPerformanceInfo.js";import{UpdatePolicy as c}from"../../../webgl-engine/lib/UpdatePolicy.js";let y=class extends i{constructor(e){super(e),this._renderer=null,this.graphicsQuery={queryForSymbologySnapping:(e,t)=>{throw new r("unsupported-symbology-snapping")},executeQuery:async(e,r)=>await this._workerHandle.executeQuery(e,r),executeQueryForIds:async(e,r)=>await this._workerHandle.executeQueryForIds(e,r),executeQueryForCount:async(e,r)=>await this._workerHandle.executeQueryForCount(e,r),executeQueryForExtent:async(e,r)=>await this._workerHandle.executeQueryForExtent(e,r),executeQueryForLatestObservations:async(e,r)=>await this._workerHandle.executeQueryForLatestObservations(e,r)},this.maximumNumberOfFeatures=1e3}initialize(){if("point"!==this.layerView.layer.geometryType)throw new r("unsupported-geometry-type",`${this.layerView.layer.geometryType} is not supported`);this.addResolvingPromise(this.setup())}destroy(){this.removeAllHandles(),this._workerHandle.destroy(),o(this._renderer)}async setup(){const{layer:e,view:r,uid:t}=this.layerView,{spatialReference:o,renderSpatialReference:i,resourceController:s,renderCoordsHelper:a,elevationProvider:u}=r,p=r.state.viewingMode;if(this._renderer=new d({view:r,layerViewUid:t}),"feature"!==e.type)throw new Error("Only FeatureLayer is supported");const m=new l({schedule:e=>s.immediate.schedule(e),layer:e,viewSpatialReference:o,renderSpatialReference:i,viewingMode:p,renderer:this._renderer,elevationProvider:u,renderCoordsHelper:a});this._workerHandle=await m.when(),this.addHandles([this.layerView.view.featureTiles.addClient(),n((()=>this.layerView.view.featureTiles.tiles),"change",(e=>{this._workerHandle.onTileTreeChange(e)}),{onListenerAdd:e=>this._workerHandle.onTileTreeChange({added:e.toArray(),removed:[]}),onListenerRemove:e=>this._workerHandle.onTileTreeChange({added:[],removed:e.toArray()})}),r.elevationProvider.on("elevation-change",(e=>this._workerHandle.onElevationChange(e)))])}get legendEnabled(){return!1}get hasAllFeatures(){return!1}get hasAllFeaturesInView(){return!1}get hasFullGeometries(){return!1}get symbologySnappingSupported(){return!1}get scaleVisibilitySuspended(){return!1}get suspendInfo(){return{}}get updating(){return this._workerHandle.updating}get dataUpdating(){return!1}get updatePolicy(){return c.ASYNC}get maximumNumberOfFeaturesExceeded(){return!1}get updatingProgressValue(){return 1}get usedMemory(){return this._renderer?.usedMemory??0}get unloadedMemory(){return 0}get ignoresMemoryFactor(){return!0}get totalFeatures(){return this._renderer?.totalFeatures??0}get performanceInfo(){const e=this.totalFeatures;return new u(new m(this.usedMemory,e,e,this.maximumNumberOfFeatures,0,null),e,e,this.maximumNumberOfFeaturesExceeded,"tiles","n/a")}get suspendResumeExtentMode(){return"computed"}forEachGraphic(e){}findGraphic(e){return null}highlight(e){return p}maskOccludee(e){return t()}async whenGraphicBounds(e,r){return null}computeAttachmentOrigin(e,r){return null}elevationAlignPointsInFeatures(e,t){throw new r("unsupported-elevation-alignment")}async doRefresh(e){}setVisibility(e,r){}getMissingAttributesForFeature(e){return null}getHydratedGeometry(e){return null}};e([s()],y.prototype,"layerView",void 0),e([s()],y.prototype,"updating",null),e([s()],y.prototype,"totalFeatures",null),y=e([a("esri.views.3d.layers.graphics.pipeline.Feature3DPipeline")],y);export{y as Feature3DPipeline};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/Error.js";import{makeHandle as t}from"../../../../../core/handleUtils.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import i from"../../../../../core/Promise.js";import{on as n}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{FeatureLayerViewPerformanceInfo as u}from"../../FeatureLayerViewPerformanceInfo.js";import{Feature3DPipelineWorkerHandle as l}from"./Feature3DPipelineWorkerHandle.js";import{FeaturePipelineRenderManager as d}from"./rendering/FeaturePipelineRenderManager.js";import{emptyHighlightHandle as p}from"../../support/highlightUtils.js";import{LayerViewPerformanceInfo as m}from"../../support/LayerViewPerformanceInfo.js";import{UpdatePolicy as c}from"../../../webgl-engine/lib/UpdatePolicy.js";let y=class extends i{constructor(e){super(e),this._renderer=null,this.graphicsQuery={queryForSymbologySnapping:(e,t)=>{throw new r("featurelayer","unsupported-symbology-snapping")},executeQuery:async(e,r)=>await this._workerHandle.executeQuery(e,r),executeQueryForIds:async(e,r)=>await this._workerHandle.executeQueryForIds(e,r),executeQueryForCount:async(e,r)=>await this._workerHandle.executeQueryForCount(e,r),executeQueryForExtent:async(e,r)=>await this._workerHandle.executeQueryForExtent(e,r),executeQueryForLatestObservations:async(e,r)=>await this._workerHandle.executeQueryForLatestObservations(e,r)},this.maximumNumberOfFeatures=1e3}initialize(){if("point"!==this.layerView.layer.geometryType)throw new r("unsupported-geometry-type",`${this.layerView.layer.geometryType} is not supported`);this.addResolvingPromise(this.setup())}destroy(){this.removeAllHandles(),this._workerHandle.destroy(),o(this._renderer)}async setup(){const{layer:e,view:r,uid:t}=this.layerView,{spatialReference:o,renderSpatialReference:i,resourceController:s,renderCoordsHelper:a,elevationProvider:u}=r,p=r.state.viewingMode;if(this._renderer=new d({view:r,layerViewUid:t}),"feature"!==e.type)throw new Error("Only FeatureLayer is supported");const m=new l({schedule:e=>s.immediate.schedule(e),layer:e,viewSpatialReference:o,renderSpatialReference:i,viewingMode:p,renderer:this._renderer,elevationProvider:u,renderCoordsHelper:a});this._workerHandle=await m.when(),this.addHandles([this.layerView.view.featureTiles.addClient(),n((()=>this.layerView.view.featureTiles.tiles),"change",(e=>{this._workerHandle.onTileTreeChange(e)}),{onListenerAdd:e=>this._workerHandle.onTileTreeChange({added:e.toArray(),removed:[]}),onListenerRemove:e=>this._workerHandle.onTileTreeChange({added:[],removed:e.toArray()})}),r.elevationProvider.on("elevation-change",(e=>this._workerHandle.onElevationChange(e)))])}get legendEnabled(){return!1}get hasAllFeatures(){return!1}get hasAllFeaturesInView(){return!1}get hasFullGeometries(){return!1}get symbologySnappingSupported(){return!1}get scaleVisibilitySuspended(){return!1}get suspendInfo(){return{}}get updating(){return this._workerHandle.updating}get dataUpdating(){return!1}get updatePolicy(){return c.ASYNC}get maximumNumberOfFeaturesExceeded(){return!1}get updatingProgressValue(){return 1}get usedMemory(){return this._renderer?.usedMemory??0}get unloadedMemory(){return 0}get ignoresMemoryFactor(){return!0}get totalFeatures(){return this._renderer?.totalFeatures??0}get performanceInfo(){const e=this.totalFeatures;return new u(new m(this.usedMemory,e,e,this.maximumNumberOfFeatures,0,null),e,e,this.maximumNumberOfFeaturesExceeded,"tiles","n/a")}get suspendResumeExtentMode(){return"computed"}forEachGraphic(e){}findGraphic(e){return null}highlight(e){return p}maskOccludee(e){return t()}async whenGraphicBounds(e,r){return null}computeAttachmentOrigin(e,r){return null}elevationAlignPointsInFeatures(e,t){throw new r("featurelayer","unsupported-elevation-alignment")}async doRefresh(e){}setVisibility(e,r){}getMissingAttributesForFeature(e){return null}getHydratedGeometry(e){return null}};e([s()],y.prototype,"layerView",void 0),e([s()],y.prototype,"updating",null),e([s()],y.prototype,"totalFeatures",null),y=e([a("esri.views.3d.layers.graphics.pipeline.Feature3DPipeline")],y);export{y as Feature3DPipeline};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Evented.js";import{throwIfAborted as r}from"../../../../../core/promiseUtils.js";import{watch as a,initial as n}from"../../../../../core/reactiveUtils.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import s from"../../../../../geometry/Extent.js";import{initializeProjection as u,project as m}from"../../../../../geometry/projection.js";import c from"../../../../../geometry/SpatialReference.js";import{QueryEngine as d}from"../../../../../layers/graphics/data/QueryEngine.js";import l from"../../../../../rest/support/Query.js";import{Tile3DManager as p}from"./Tile3DManager.js";import{TiledFeatureStore as y}from"./featureSet/TiledFeatureStore.js";import{Tile3DFetcher as h}from"./fetching/Tile3DFetcher.js";import{RenderCommandContext as f}from"./rendering/RenderCommandContext.js";import{UniqueValueFeatureRenderer as _}from"./symbolization/UniqueValueFeatureRenderer.js";import{RenderCoordsHelper as g}from"../../../support/RenderCoordsHelper.js";let C=class extends t.EventedAccessor{constructor(){super(...arguments),this.remoteClient=null,this._featureStore=new y,this._tileManager=null,this._renderer=null,this._fetcher=null,this._queryEngine=null,this._defaultQueryJSON=null}get updating(){return this._tileManager.updating}destroy(){this._featureStore.clear(),this._tileManager?.destroy()}async setup({viewSpatialReference:e,renderSpatialReference:t,viewingMode:r,baseQuery:i,url:o,objectIdField:y,capabilities:C,fieldsIndex:w,timeInfo:v,elevationInfo:F,fullExtent:j}){const R=c.fromJSON(e),x=c.fromJSON(t);this._fetcher=new h(R,l.fromJSON(i),o,y,C),this._queryEngine=new d({hasZ:!0,hasM:!1,geometryType:"esriGeometryPoint",objectIdField:y,fieldsIndex:w,availableFields:[y],spatialReference:e,featureStore:this._featureStore,timeInfo:v});const Q={createMaterial:async(e,t)=>{const r={materialId:e,type:t};await this.remoteClient.invoke("createMaterial",r)},createDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("createDirectRenderer",t)},createLodRenderer:async(e,t,r)=>{const a={rendererId:e,lodRenderGeometry:t};await this.remoteClient.invoke("createLoDRenderer",a,{transferList:r})},executeRenderCommands:async e=>{const t={commands:e.commands};await this.remoteClient.invoke("dispatchRenderCommands",t,{transferList:e.transferList})},applyElevationAlignmentTo:async e=>{const t={mapPoints:e};return await this.remoteClient.invoke("applyElevationAlignment",t,{transferList:[e.buffer]})}};this._renderer=new _({viewSpatialReference:R,renderSpatialReference:x,renderCoordsHelper:g.create(r,x),renderCommandContext:new f(r,Q),elevationInfo:F??{},mainThreadDelegate:Q}),this._defaultQueryJSON=new l({outSpatialReference:R}).toJSON();let E=null;if(null!=j){const e=s.fromJSON(j);await u(e.spatialReference,R),E=m(e,R)}return this._tileManager=new p({loadTile:(e,t)=>this._fetcher.fetch(e,t),createAddFeatureDataCommand:(e,t)=>this._createAddFeatureDataCommand(e,t),createRemoveFeatureDataCommand:e=>this._createRemoveFeatureDataCommand(e),createUpdateFeatureDataVisibilityCommand:(e,t)=>this._createUpdateFeatureDataVisibilityCommand(e,t),extent:E}),this.addHandles(a((()=>this.updating),(e=>{this.emit("notify-updating",{updating:e})})),n),await this._renderer.load(),S}async executeQuery(e,t){return{result:await this._queryEngine.executeQuery(this._ensureQuery(e),t)}}async executeQueryForIds(e,t){const r=await this._queryEngine.executeQueryForIdSet(this._ensureQuery(e),t);return{result:Array.from(r)}}async executeQueryForCount(e,t){return{result:await this._queryEngine.executeQueryForCount(this._ensureQuery(e),t)}}async executeQueryForExtent(e,t){return{result:await this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t)}}async executeQueryForLatestObservations(e,t){return{result:await this._queryEngine.executeQueryForLatestObservations(this._ensureQuery(e),t)}}async onTileTreeChange(e){return await this._tileManager.onTileTreeChange(e),S}async onElevationChange(e){return S}async _createAddFeatureDataCommand(e,t){const a=this._featureStore,n=await this._renderer.createAddCommand(e);return r(t),n.appendPipelineStateCommand((()=>{a.addTile(e)})),n}async _createRemoveFeatureDataCommand(e){const t=this._featureStore,r=this._renderer,a=await r.createRemoveCommand(e);return a.appendPipelineStateCommand((()=>{t.removeTile(e)})),a}async _createUpdateFeatureDataVisibilityCommand(e,t){const a=this._renderer,n=await a.createUpdateVisibilityCommand(e);return r(t),n}_ensureQuery(e){return e??this._defaultQueryJSON}};e([i()],C.prototype,"updating",null),C=e([o("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorker")],C);const w=C,S={result:void 0};export{w as default};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Evented.js";import{throwIfAborted as r}from"../../../../../core/promiseUtils.js";import{watch as a,initial as n}from"../../../../../core/reactiveUtils.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import o from"../../../../../geometry/Extent.js";import{initializeProjection as u,project as m}from"../../../../../geometry/projection.js";import c from"../../../../../geometry/SpatialReference.js";import{QueryEngine as l}from"../../../../../layers/graphics/data/QueryEngine.js";import d from"../../../../../rest/support/Query.js";import{Tile3DManager as p}from"./Tile3DManager.js";import{TiledFeatureStore as y}from"./featureSet/TiledFeatureStore.js";import{Tile3DFetcher as h}from"./fetching/Tile3DFetcher.js";import{RenderCommandContext as f}from"./rendering/RenderCommandContext.js";import{UniqueValueFeatureRenderer as _}from"./symbolization/UniqueValueFeatureRenderer.js";import{RenderCoordsHelper as g}from"../../../support/RenderCoordsHelper.js";let C=class extends t.EventedAccessor{constructor(){super(...arguments),this.remoteClient=null,this._featureStore=new y,this._tileManager=null,this._renderer=null,this._fetcher=null,this._queryEngine=null,this._defaultQueryJSON=null}get updating(){return this._tileManager.updating}destroy(){this._featureStore.clear(),this._tileManager?.destroy()}async setup({viewSpatialReference:e,renderSpatialReference:t,viewingMode:r,baseQuery:i,url:s,objectIdField:y,capabilities:C,fieldsIndex:w,timeInfo:S,elevationInfo:x,fullExtent:F}){const j=c.fromJSON(e),R=c.fromJSON(t);this._fetcher=new h(j,d.fromJSON(i),s,y,C),this._queryEngine=new l({hasZ:!0,hasM:!1,geometryType:"esriGeometryPoint",objectIdField:y,fieldsIndex:w,availableFields:[y],spatialReference:e,featureStore:this._featureStore,timeInfo:S});const Q={createTexture:async(e,t)=>{const r={data:e,parameters:t};return await this.remoteClient.invoke("createTexture",r,{transferList:[e.buffer]})},releaseTexture:async e=>{const t={uid:e};await this.remoteClient.invoke("releaseTexture",t)},createMaterial:async e=>{const t={materialJSON:e};await this.remoteClient.invoke("createMaterial",t)},createDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("createDirectRenderer",t)},createLodRenderer:async(e,t,r)=>{const a={rendererId:e,lodRenderGeometry:t};await this.remoteClient.invoke("createLoDRenderer",a,{transferList:r})},executeRenderCommands:async e=>{const t={commands:e.commands};await this.remoteClient.invoke("dispatchRenderCommands",t,{transferList:e.transferList})},applyElevationAlignmentTo:async e=>{const t={mapPoints:e};return await this.remoteClient.invoke("applyElevationAlignment",t,{transferList:[e.buffer]})}};this._renderer=new _({viewSpatialReference:j,renderSpatialReference:R,renderCoordsHelper:g.create(r,R),renderCommandContext:new f(r,Q),elevationInfo:x??{},mainThreadDelegate:Q}),this._defaultQueryJSON=new d({outSpatialReference:j}).toJSON();let E=null;if(null!=F){const e=o.fromJSON(F);await u(e.spatialReference,j),E=m(e,j)}return this._tileManager=new p({loadTile:(e,t)=>this._fetcher.fetch(e,t),createAddFeatureDataCommand:(e,t)=>this._createAddFeatureDataCommand(e,t),createRemoveFeatureDataCommand:e=>this._createRemoveFeatureDataCommand(e),createUpdateFeatureDataVisibilityCommand:(e,t)=>this._createUpdateFeatureDataVisibilityCommand(e,t),extent:E}),this.addHandles(a((()=>this.updating),(e=>{this.emit("notify-updating",{updating:e})})),n),await this._renderer.load(),v}async executeQuery(e,t){return{result:await this._queryEngine.executeQuery(this._ensureQuery(e),t)}}async executeQueryForIds(e,t){const r=await this._queryEngine.executeQueryForIdSet(this._ensureQuery(e),t);return{result:Array.from(r)}}async executeQueryForCount(e,t){return{result:await this._queryEngine.executeQueryForCount(this._ensureQuery(e),t)}}async executeQueryForExtent(e,t){return{result:await this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t)}}async executeQueryForLatestObservations(e,t){return{result:await this._queryEngine.executeQueryForLatestObservations(this._ensureQuery(e),t)}}async onTileTreeChange(e){return await this._tileManager.onTileTreeChange(e),v}async onElevationChange(e){return v}async _createAddFeatureDataCommand(e,t){const a=this._featureStore,n=await this._renderer.createAddCommand(e);return r(t),n.appendPipelineStateCommand((()=>{a.addTile(e)})),n}async _createRemoveFeatureDataCommand(e){const t=this._featureStore,r=this._renderer,a=await r.createRemoveCommand(e);return a.appendPipelineStateCommand((()=>{t.removeTile(e)})),a}async _createUpdateFeatureDataVisibilityCommand(e,t){const a=this._renderer,n=await a.createUpdateVisibilityCommand(e);return r(t),n}_ensureQuery(e){return e??this._defaultQueryJSON}};e([i()],C.prototype,"updating",null),C=e([s("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorker")],C);const w=C,v={result:void 0};export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Promise.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{WorkerHandle as n}from"../../../../../core/workers/WorkerHandle.js";import i from"../../../../../geometry/Extent.js";import{clone as a}from"../../../../../geometry/support/aaBoundingRect.js";import s from"../../../../../rest/support/FeatureSet.js";import{ElevationContext as d}from"../ElevationContext.js";import{applyElevationAlignment as c}from"./utils.js";let l=class extends t{constructor(e){super(e),this.schedule=null,this._workerUpdating=!0}get updating(){return this._workerUpdating}initialize(){const{layer:e,viewSpatialReference:t,renderSpatialReference:r}=this,o=e.elevationInfo;this._elevationContext=d.fromElevationInfo(o),this._workerHandle=new u(this.schedule,{createMaterial:async({materialId:e,type:t})=>(await this.renderer.createMaterial(e,t),y),createDirectRenderer:async({materialId:e})=>(await this.renderer.createDirectRenderer(e),y),createLoDRenderer:async({rendererId:e,lodRenderGeometry:t},r)=>(await this.renderer.createLoDRenderer(e,t,r?.signal??void 0),y),dispatchRenderCommands:async({commands:e})=>(await this.renderer.executeRenderCommands(e),y),applyElevationAlignment:async({mapPoints:e})=>{const{viewSpatialReference:t,elevationProvider:r,renderCoordsHelper:o}=this,n=c(e,t,this._elevationContext,r,o);return{result:n,transferList:[n.buffer]}}}),this.addResolvingPromise((async()=>{await e.load();const{fullExtent:n}=e;await this._workerHandle.invokeMethod("setup",{url:e.parsedUrl?.path??"",baseQuery:e.createQuery().toJSON(),viewSpatialReference:t.toJSON(),renderSpatialReference:r.toJSON(),viewingMode:this.viewingMode,objectIdField:e.objectIdField,capabilities:e.capabilities,timeInfo:e.timeInfo?.toJSON(),elevationInfo:o?.toJSON(),fieldsIndex:e.fieldsIndex.toJSON(),fullExtent:n?.toJSON()})})()),this.addHandles(this._workerHandle.on("notify-updating",(({updating:e})=>{this._workerUpdating=e})))}onTileTreeChange({added:e,removed:t}){if(0===e.length&&0===t.length)return;const r=e.map(p),o=t.map(p);this._workerHandle.invokeMethod("onTileTreeChange",{added:r,removed:o})}onElevationChange(e){this._workerHandle.invokeMethod("onElevationChange",{context:e.context,spatialReference:e.spatialReference?.toJSON(),extent:a(e.extent)})}async executeQuery(e,t){const r=await this._workerHandle.invokeMethod("executeQuery",e?.toJSON(),t),o=s.fromJSON(r);return this._ensureLayerOnFeatures(o),o}async executeQueryForIds(e,t){return await this._workerHandle.invokeMethod("executeQueryForIds",e?.toJSON(),t)}async executeQueryForCount(e,t){return await this._workerHandle.invokeMethod("executeQueryForCount",e?.toJSON(),t)}async executeQueryForExtent(e,t){const{count:r,extent:o}=await this._workerHandle.invokeMethod("executeQueryForExtent",e?.toJSON(),t);return{count:r,extent:i.fromJSON(o)}}async executeQueryForLatestObservations(e,t){const r=await this._workerHandle.invokeMethod("executeQueryForLatestObservations",e?.toJSON(),t),o=s.fromJSON(r);return this._ensureLayerOnFeatures(o),o}_ensureLayerOnFeatures(e){const{layer:t}=this;for(const r of e.features)r.layer=t,r.sourceLayer=t}};e([r()],l.prototype,"updating",null),e([r({constructOnly:!0})],l.prototype,"schedule",void 0),e([r({constructOnly:!0})],l.prototype,"layer",void 0),e([r({constructOnly:!0})],l.prototype,"viewSpatialReference",void 0),e([r({constructOnly:!0})],l.prototype,"renderSpatialReference",void 0),e([r({constructOnly:!0})],l.prototype,"viewingMode",void 0),e([r({constructOnly:!0})],l.prototype,"renderer",void 0),e([r({constructOnly:!0})],l.prototype,"elevationProvider",void 0),e([r({constructOnly:!0})],l.prototype,"renderCoordsHelper",void 0),e([r()],l.prototype,"_workerUpdating",void 0),l=e([o("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorkerHandle")],l);class u extends n{constructor(e,t){super("Feature3DPipelineWorker","setup",{},e,{strategy:"dedicated",client:t})}}function p({id:e,lij:t,extent:r}){return{id:e,lij:t,extent:r}}const y={result:void 0};export{l as Feature3DPipelineWorkerHandle};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Promise.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{WorkerHandle as n}from"../../../../../core/workers/WorkerHandle.js";import a from"../../../../../geometry/Extent.js";import{clone as i}from"../../../../../geometry/support/aaBoundingRect.js";import s from"../../../../../rest/support/FeatureSet.js";import{ElevationContext as d}from"../ElevationContext.js";import{applyElevationAlignment as c}from"./utils.js";let l=class extends t{constructor(e){super(e),this.schedule=null,this._workerUpdating=!0}get updating(){return this._workerUpdating}initialize(){const{layer:e,viewSpatialReference:t,renderSpatialReference:r}=this,o=e.elevationInfo;this._elevationContext=d.fromElevationInfo(o),this._workerHandle=new u(this.schedule,{createTexture:async({data:e,parameters:t})=>({result:await this.renderer.createTexture(e,t),transferList:[]}),releaseTexture:async({uid:e})=>(await this.renderer.releaseTexture(e),y),createMaterial:async({materialJSON:e})=>(await this.renderer.createMaterial(e),y),createDirectRenderer:async({materialId:e})=>(await this.renderer.createDirectRenderer(e),y),createLoDRenderer:async({rendererId:e,lodRenderGeometry:t},r)=>(await this.renderer.createLoDRenderer(e,t,r?.signal??void 0),y),dispatchRenderCommands:async({commands:e})=>(await this.renderer.executeRenderCommands(e),y),applyElevationAlignment:async({mapPoints:e})=>{const{viewSpatialReference:t,elevationProvider:r,renderCoordsHelper:o}=this,n=c(e,t,this._elevationContext,r,o);return{result:n,transferList:[n.buffer]}}}),this.addResolvingPromise((async()=>{await e.load();const{fullExtent:n}=e;await this._workerHandle.invokeMethod("setup",{url:e.parsedUrl?.path??"",baseQuery:e.createQuery().toJSON(),viewSpatialReference:t.toJSON(),renderSpatialReference:r.toJSON(),viewingMode:this.viewingMode,objectIdField:e.objectIdField,capabilities:e.capabilities,timeInfo:e.timeInfo?.toJSON(),elevationInfo:o?.toJSON(),fieldsIndex:e.fieldsIndex.toJSON(),fullExtent:n?.toJSON()})})()),this.addHandles(this._workerHandle.on("notify-updating",(({updating:e})=>{this._workerUpdating=e})))}onTileTreeChange({added:e,removed:t}){if(0===e.length&&0===t.length)return;const r=e.map(p),o=t.map(p);this._workerHandle.invokeMethod("onTileTreeChange",{added:r,removed:o})}onElevationChange(e){this._workerHandle.invokeMethod("onElevationChange",{context:e.context,spatialReference:e.spatialReference?.toJSON(),extent:i(e.extent)})}async executeQuery(e,t){const r=await this._workerHandle.invokeMethod("executeQuery",e?.toJSON(),t),o=s.fromJSON(r);return this._ensureLayerOnFeatures(o),o}async executeQueryForIds(e,t){return await this._workerHandle.invokeMethod("executeQueryForIds",e?.toJSON(),t)}async executeQueryForCount(e,t){return await this._workerHandle.invokeMethod("executeQueryForCount",e?.toJSON(),t)}async executeQueryForExtent(e,t){const{count:r,extent:o}=await this._workerHandle.invokeMethod("executeQueryForExtent",e?.toJSON(),t);return{count:r,extent:a.fromJSON(o)}}async executeQueryForLatestObservations(e,t){const r=await this._workerHandle.invokeMethod("executeQueryForLatestObservations",e?.toJSON(),t),o=s.fromJSON(r);return this._ensureLayerOnFeatures(o),o}_ensureLayerOnFeatures(e){const{layer:t}=this;for(const r of e.features)r.layer=t,r.sourceLayer=t}};e([r()],l.prototype,"updating",null),e([r({constructOnly:!0})],l.prototype,"schedule",void 0),e([r({constructOnly:!0})],l.prototype,"layer",void 0),e([r({constructOnly:!0})],l.prototype,"viewSpatialReference",void 0),e([r({constructOnly:!0})],l.prototype,"renderSpatialReference",void 0),e([r({constructOnly:!0})],l.prototype,"viewingMode",void 0),e([r({constructOnly:!0})],l.prototype,"renderer",void 0),e([r({constructOnly:!0})],l.prototype,"elevationProvider",void 0),e([r({constructOnly:!0})],l.prototype,"renderCoordsHelper",void 0),e([r()],l.prototype,"_workerUpdating",void 0),l=e([o("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorkerHandle")],l);class u extends n{constructor(e,t){super("Feature3DPipelineWorker","setup",{},e,{strategy:"dedicated",client:t})}}function p({id:e,lij:t,extent:r}){return{id:e,lij:t,extent:r}}const y={result:void 0};export{l as Feature3DPipelineWorkerHandle};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import r from"../../../../../../core/Accessor.js";import"../../../../../../core/has.js";import{makeHandle as t}from"../../../../../../core/handleUtils.js";import{releaseMaybe as s}from"../../../../../../core/maybe.js";import{createAbortError as i}from"../../../../../../core/promiseUtils.js";import{property as o}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{ONES as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as l}from"../../../../../ViewingMode.js";import{namedAnchorToHUDMaterialAnchorPos as c}from"../../placementUtils.js";import{DirectRenderer as u}from"./DirectRenderer.js";import{LodRenderer as m}from"./LodRenderer.js";import{defaultBoundingBox as f,createTexture as h,requiresHalfTexelOffset as p}from"../../../../support/engineContent/sdfPrimitives.js";import{CullFaceOptions as w}from"../../../../webgl-engine/lib/basicInterfaces.js";import{DefaultMaterial as g}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as v}from"../../../../webgl-engine/materials/HUDMaterial.js";import{schematicMRRFactors as y}from"../../../../webgl-engine/materials/pbrUtils.js";let R=class extends r{constructor(e){super(),this.view=null,this.layerViewUid=null,this._materials=new Map,this._directRenderers=new Map,this._lodRenderers=new Map,this.totalFeatures=0,this.view=e.view,this.layerViewUid=e.layerViewUid}initialize(){}destroy(){this.removeAllHandles(),this._lodRenderers.forEach((e=>e.destroy()))}async createMaterial(e,r){const{view:i}=this,{sharedSymbolResources:o}=i;if(null==o)throw new Error("No shared symbol resources found!");const{textures:n}=o,d=i.state.viewingMode===l.Global;let a=null;switch(r){case"default":a=_(o,{physicalBasedRenderingEnabled:!0,slicePlaneEnabled:!1,castShadows:!0,isPrimitive:!0,screenSizePerspectiveEnabled:!0},d);break;case"hud":{const[e,r]=b(n,d);this.addHandles([t((()=>s(r)))]),a=e}break;default:throw new Error(`unable to create unknown material type ${r}`)}this._materials.set(e,a)}async createDirectRenderer(e){if(this._directRenderers.has(e))return;const r=this._materials.get(e);if(null==r)throw new Error(`material not found ${e}`);const{view:t}=this,s=new u({material:r,layerViewUid:this.layerViewUid});this._directRenderers.set(e,s),t.stage.addRenderPlugin(s),t.stage.renderView.renderer.updateHasFlags()}async createLoDRenderer(e,r,t){const s=new m({view:this.view,layerViewUid:this.layerViewUid}),o=e=>this._materials.get(e);if(await s.doLoad(r,o,t),t?.aborted)throw s.destroy(),i();this._lodRenderers.set(e,s)}async executeRenderCommands(e){for(const r of e)switch(r.id){case"add-direct-renderer-geometry-buffer":this._addDirectRendererGeometryBuffer(r);break;case"update-direct-renderer-geometry-buffer":this._updateDirectRendererGeometryBuffer(r);break;case"remove-direct-renderer-geometry-buffer":this._removeDirectRendererGeometryBuffer(r);break;case"add-lod-instances":this._addLodInstances(r);break;case"remove-lod-instances":this._removeLodInstances(r);break;case"update-lod-instance-data":this._updateLodInstanceData(r);break;case"update-visibility":this._updateVisibility(r)}e.length>0&&this._updateFeatureCount()}_updateFeatureCount(){let e=0;for(const r of this._directRenderers.values())e+=r.numFeatures;for(const r of this._lodRenderers.values())e+=r.numFeatures;this._set("totalFeatures",e)}get usedMemory(){let e=0;for(const r of this._directRenderers.values())e+=r.usedMemory;for(const r of this._lodRenderers.values())e+=r.usedMemory;return e}_addDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const o=this._directRenderers.get(r);null!=o?(o.addRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_updateDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const o=this._directRenderers.get(r);null!=o?(o.updateRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_removeDirectRendererGeometryBuffer({groupId:e,rendererId:r}){const t=this._directRenderers.get(r);null!=t?(t.removeRenderGeometryBuffer(e),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_addLodInstances({rendererId:e,groupId:r,data:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("no lod renderer assigned to provided lod renderer Id");s.addInstances(r,t),this.view.stage.renderView.requestRender()}_removeLodInstances({rendererId:e,groupId:r}){const t=this._lodRenderers.get(e);if(null==t)throw new Error("no lod renderer assigned to provided lod renderer Id");t.removeInstances(r),this.view.stage.renderView.requestRender()}_updateLodInstanceData({rendererId:e,groupId:r,globalTransforms:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");null!=t&&s.updateGlobalTransforms(r,t),this.view.stage.renderView.requestRender()}_updateVisibility({rendererId:e,groupId:r,visibility:t}){const s=this._directRenderers.get(e)??this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");s.updateVisibility(r,t),this.view.stage.renderView.requestRender()}};function b(e,r){const t={anchorPosition:c.center,occlusionTest:!0,hasSlicePlane:!1,color:[1,0,0,1],outlineColor:[0,0,0,1],outlineSize:1,distanceFieldBoundingBox:f},s=null;if(null!=e){const r=e.fromData("circle-icon",(()=>h("circle")));t.textureId=r.texture.id,t.textureIsSignedDistanceField=!0,t.sampleSignedDistanceFieldTexelCenter=p("circle")}return[new v(t,r),s]}function _(e,r,t){const s={usePBR:r.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:y,ambient:d,diffuse:d,hasSlicePlane:r.slicePlaneEnabled,castShadows:r.castShadows,offsetTransparentBackfaces:!r.isPrimitive};r.screenSizePerspectiveEnabled&&(s.screenSizePerspective=e.screenSizePerspectiveSettings),s.externalColor=a,s.isInstanced=!0;const i=new g(s,{spherical:t});return i.setParameters({cullFace:i.transparent?w.None:w.Back}),i}e([o({readOnly:!0})],R.prototype,"totalFeatures",void 0),R=e([n("esri.views.3d.layers.graphics.pipeline.rendering.FeaturePipelineRenderManager")],R);export{R as FeaturePipelineRenderManager,_ as createDefaultMaterial,b as createHudMaterial};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import r from"../../../../../../core/Accessor.js";import"../../../../../../core/has.js";import{createAbortError as t}from"../../../../../../core/promiseUtils.js";import{property as s}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{ONES as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as o}from"../../../../../ViewingMode.js";import{DirectRenderer as a}from"./DirectRenderer.js";import{LodRenderer as l}from"./LodRenderer.js";import{CullFaceOptions as c}from"../../../../webgl-engine/lib/basicInterfaces.js";import{Texture as u}from"../../../../webgl-engine/lib/Texture.js";import{DefaultMaterial as m}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as f}from"../../../../webgl-engine/materials/HUDMaterial.js";import{schematicMRRFactors as h}from"../../../../webgl-engine/materials/pbrUtils.js";let p=class extends r{constructor(e){super(),this.view=null,this.layerViewUid=null,this._stage=null,this._materials=new Map,this._textures=new Map,this._directRenderers=new Map,this._lodRenderers=new Map,this.totalFeatures=0,this.view=e.view,this.layerViewUid=e.layerViewUid}initialize(){this._stage=this.view.stage}destroy(){this.removeAllHandles(),this._lodRenderers.forEach((e=>e.destroy()))}async createTexture(e,r){const{_textures:t,_stage:s}=this,i=new u(e,r);return t.set(i.id,i),s&&(i.load(s.renderView.renderingContext),s.add(i)),i.id}async releaseTexture(e){const{_textures:r,_stage:t}=this,s=r.get(e);s&&(t&&(s.unload(),t.remove(s)),r.delete(e))}async createMaterial(e){const{view:r}=this,t=r.state.viewingMode===o.Global;let s=null;switch(e.type){case"default":{const r=e.parameters,i=new m(r,{spherical:t});i.setParameters({cullFace:i.transparent?c.None:c.Back}),s=i;break}case"hud":{const r=e.parameters;s=new f(r,t)}}this._materials.set(e.id,s)}async createDirectRenderer(e){if(this._directRenderers.has(e))return;const r=this._materials.get(e);if(null==r)throw new Error(`material not found ${e}`);const{view:t}=this,s=new a({material:r,layerViewUid:this.layerViewUid});this._directRenderers.set(e,s),t.stage.addRenderPlugin(s),t.stage.renderView.renderer.updateHasFlags()}async createLoDRenderer(e,r,s){const i=new l({view:this.view,layerViewUid:this.layerViewUid}),n=e=>this._materials.get(e);if(await i.doLoad(r,n,s),s?.aborted)throw i.destroy(),t();this._lodRenderers.set(e,i)}async executeRenderCommands(e){for(const r of e)switch(r.id){case"add-direct-renderer-geometry-buffer":this._addDirectRendererGeometryBuffer(r);break;case"update-direct-renderer-geometry-buffer":this._updateDirectRendererGeometryBuffer(r);break;case"remove-direct-renderer-geometry-buffer":this._removeDirectRendererGeometryBuffer(r);break;case"add-lod-instances":this._addLodInstances(r);break;case"remove-lod-instances":this._removeLodInstances(r);break;case"update-lod-instance-data":this._updateLodInstanceData(r);break;case"update-visibility":this._updateVisibility(r)}e.length>0&&this._updateFeatureCount()}_updateFeatureCount(){let e=0;for(const r of this._directRenderers.values())e+=r.numFeatures;for(const r of this._lodRenderers.values())e+=r.numFeatures;this._set("totalFeatures",e)}get usedMemory(){let e=0;for(const r of this._directRenderers.values())e+=r.usedMemory;for(const r of this._lodRenderers.values())e+=r.usedMemory;return e}_addDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const n=this._directRenderers.get(r);null!=n?(n.addRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_updateDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const n=this._directRenderers.get(r);null!=n?(n.updateRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_removeDirectRendererGeometryBuffer({groupId:e,rendererId:r}){const t=this._directRenderers.get(r);null!=t?(t.removeRenderGeometryBuffer(e),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_addLodInstances({rendererId:e,groupId:r,data:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("no lod renderer assigned to provided lod renderer Id");s.addInstances(r,t),this.view.stage.renderView.requestRender()}_removeLodInstances({rendererId:e,groupId:r}){const t=this._lodRenderers.get(e);if(null==t)throw new Error("no lod renderer assigned to provided lod renderer Id");t.removeInstances(r),this.view.stage.renderView.requestRender()}_updateLodInstanceData({rendererId:e,groupId:r,globalTransforms:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");null!=t&&s.updateGlobalTransforms(r,t),this.view.stage.renderView.requestRender()}_updateVisibility({rendererId:e,groupId:r,visibility:t}){const s=this._directRenderers.get(e)??this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");s.updateVisibility(r,t),this.view.stage.renderView.requestRender()}};function g(e,r,t){const s={usePBR:r.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:h,ambient:n,diffuse:n,hasSlicePlane:r.slicePlaneEnabled,castShadows:r.castShadows,offsetTransparentBackfaces:!r.isPrimitive};r.screenSizePerspectiveEnabled&&(s.screenSizePerspective=e.screenSizePerspectiveSettings),s.externalColor=d,s.isInstanced=!0;const i=new m(s,{spherical:t});return i.setParameters({cullFace:i.transparent?c.None:c.Back}),i}e([s({readOnly:!0})],p.prototype,"totalFeatures",void 0),p=e([i("esri.views.3d.layers.graphics.pipeline.rendering.FeaturePipelineRenderManager")],p);export{p as FeaturePipelineRenderManager,g as createDefaultMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{copy as e,invert as r,transpose as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{getContinuousIndexArray as i}from"../../../../../../geometry/support/Indices.js";import{ViewingMode as o}from"../../../../../ViewingMode.js";import{generateId as a}from"../utils.js";import{createHudMaterial as s}from"./FeaturePipelineRenderManager.js";import{BoundingInfo as d}from"../../../../webgl-engine/lib/BoundingInfo.js";import{VertexAttribute as f}from"../../../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as m}from"../../../../webgl-engine/materials/DefaultMaterial.js";class u{constructor(e,r){this._mainThreadDelegate=r,this._bufferWriters=new Map,this.globalViewingMode=e===o.Global}createRenderCommandBuffer(){return{commands:[],transferList:[]}}mergeRenderCommandBuffers(e){const r=this.createRenderCommandBuffer();for(const t of e)null!=t&&(r.commands.push(...t.commands),r.transferList.push(...t.transferList));return r}async createMaterial(e){const r=a("material");let t;switch(e){case"default":t=new m({},{spherical:this.globalViewingMode});break;case"hud":t=s(null,this.globalViewingMode)[0]}return this._bufferWriters.set(r,t.createBufferWriter()),await this._mainThreadDelegate.createMaterial(r,e),r}async createDirectRenderer(e){return await this._mainThreadDelegate.createDirectRenderer(e),e}addDirectRendererGeometry(e,r,t){const{materialId:n}=r;if(null==this._bufferWriters.get(n))throw new Error(`no bufferwriter found for material ${n}`);const{renderGeometryBuffer:i,renderGeometryBufferItems:o}=this.createRenderGeometryBuffer(r,t);return this.addDirectRendererGeometryBuffer(n,e,i,o,t)}updateDirectRendererGeometry(e,r,t){const{materialId:n}=r;if(null==this._bufferWriters.get(n))throw new Error(`no bufferwriter found for material ${n}`);const{renderGeometryBuffer:i,renderGeometryBufferItems:o}=this.createRenderGeometryBuffer(r,t);return this.updateDirectRendererGeometryBuffer(n,e,i,o,t)}addDirectRendererGeometryBuffer(e,r,t,n,i){const{objectIds:o,visibilities:a}=n;return{commands:[{id:"add-direct-renderer-geometry-buffer",rendererId:e,groupId:r,renderGeometryBuffer:t,renderGeometryBufferItems:n,localOrigin:i}],transferList:[t.data,o.buffer,a.buffer]}}updateDirectRendererGeometryBuffer(e,r,t,n,i){const{objectIds:o,visibilities:a}=n;return{commands:[{id:"update-direct-renderer-geometry-buffer",rendererId:e,groupId:r,renderGeometryBuffer:t,renderGeometryBufferItems:n,localOrigin:i}],transferList:[t.data,o.buffer,a.buffer]}}removeDirectRendererGeometryBuffer(e,r){return{commands:[{id:"remove-direct-renderer-geometry-buffer",rendererId:e,groupId:r}],transferList:[]}}async createLodRenderer(e){const r=a("lod-renderer"),t=new Set,n={levels:e.levels.map((e=>({components:e.components.map((e=>{const r=e.attributes.get(f.POSITION);if(!r||0===r.indices.length)throw new Error("positions attribute expected");const n=3,o=i(r.indices.length/n),a=new d(o,n,r);if(null==this._bufferWriters.get(e.materialId))throw new Error("writer not found");const{renderGeometryBuffer:s}=this.createRenderGeometryBuffer(e,null);t.add(s.data);return{materialId:e.materialId,renderGeometryBuffer:s,boundingInfo:{bbMax:a.bbMax,bbMin:a.bbMin}}})),minScreenSpaceRadius:e.minScreenSpaceRadius})))};return await this._mainThreadDelegate.createLodRenderer(r,n,Array.from(t)),r}addLodInstances(e,r,t){return{commands:[{id:"add-lod-instances",rendererId:e,groupId:r,data:t}],transferList:[t.featureIds.buffer,t.globalTransforms.buffer,t.localTransforms.buffer,t.visibility.buffer]}}removeLodInstances(e,r){return{commands:[{id:"remove-lod-instances",rendererId:e,groupId:r}],transferList:[]}}updateLodInstancesData(e,r,t){return{commands:[{id:"update-lod-instance-data",rendererId:e,groupId:r,globalTransforms:t}],transferList:[t.buffer]}}updateVisibility(e,r,t){return{commands:[{id:"update-visibility",rendererId:e,groupId:r,visibility:t}],transferList:[t.buffer]}}async dispatchRenderCommands(e){0!==e.commands.length&&await this._mainThreadDelegate.executeRenderCommands(e)}createRenderGeometryBuffer(n,i){const{materialId:o,visibilities:a,objectIds:s}=n,d=this._bufferWriters.get(o);if(null==d)throw new Error("no registered bufferWriter for material found");let f=null;if(n.transformation&&i)e(l,n.transformation),l[12]-=i[0],l[13]-=i[1],l[14]-=i[2],f=l;else{if(i)throw new Error("not implemented");n.transformation&&(f=n.transformation)}let m=null;f&&(r(c,l),t(c,c),m=c);const u=n.attributes,g=d.elementCount(u),h=d.vertexBufferLayout.stride/4;g>Math.floor(b/h)&&console.warn("geometry with very large number of elements encountered");const I=d.vertexBufferLayout.createBuffer(g),p=0,y=d.write(f,m,u,n.objectAndLayerIdColor,I,p);if(null==y)throw new Error("Bufferwriter.write does not provide item information.");if(a.length!==y.numItems||s.length!==y.numItems)throw new Error("Unexpected mismatch between number of RenderGeometryBufferItems and provided objectIds/visibility flags.");return{renderGeometryBuffer:{data:I.buffer,elementCount:g},renderGeometryBufferItems:{objectIds:s,visibilities:a,ranges:{numVertices:y.numVerticesPerItem,numItems:y.numItems}}}}}const l=n(),c=n(),b=16777216/4;export{u as RenderCommandContext};
5
+ import{copy as e,invert as r,transpose as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{getContinuousIndexArray as a}from"../../../../../../geometry/support/Indices.js";import{ViewingMode as i}from"../../../../../ViewingMode.js";import{generateId as s}from"../utils.js";import{BoundingInfo as o}from"../../../../webgl-engine/lib/BoundingInfo.js";import{VertexAttribute as d}from"../../../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as f}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as m}from"../../../../webgl-engine/materials/HUDMaterial.js";class u{constructor(e,r){this._mainThreadDelegate=r,this._bufferWriters=new Map,this._sharedTextures=new Map,this.globalViewingMode=e===i.Global}createRenderCommandBuffer(){return{commands:[],transferList:[]}}mergeRenderCommandBuffers(e){const r=this.createRenderCommandBuffer();for(const t of e)null!=t&&(r.commands.push(...t.commands),r.transferList.push(...t.transferList));return r}async getOrCreateSharedTexture(e,r){const{data:t,parameters:n}=r(),a=await this._mainThreadDelegate.createTexture(t,n);return this._sharedTextures.set(e,a),a}async releaseSharedTexture(e){const r=this._sharedTextures,t=r.get(e);null!=t&&(r.delete(e),await this._mainThreadDelegate.releaseTexture(t))}async createMaterial(e){const{type:r,parameters:t}=e,n=s("material");let a,i;switch(r){case"default":a=new f(e.parameters,{spherical:this.globalViewingMode}),i={type:r,id:n,parameters:e.parameters};break;case"hud":a=new m(t,this.globalViewingMode),i={type:r,id:n,parameters:e.parameters}}return this._bufferWriters.set(n,a.createBufferWriter()),await this._mainThreadDelegate.createMaterial(i),n}async createDirectRenderer(e){return await this._mainThreadDelegate.createDirectRenderer(e),e}addDirectRendererGeometry(e,r,t){const{materialId:n}=r;if(null==this._bufferWriters.get(n))throw new Error(`no bufferwriter found for material ${n}`);const{renderGeometryBuffer:a,renderGeometryBufferItems:i}=this.createRenderGeometryBuffer(r,t);return this.addDirectRendererGeometryBuffer(n,e,a,i,t)}updateDirectRendererGeometry(e,r,t){const{materialId:n}=r;if(null==this._bufferWriters.get(n))throw new Error(`no bufferwriter found for material ${n}`);const{renderGeometryBuffer:a,renderGeometryBufferItems:i}=this.createRenderGeometryBuffer(r,t);return this.updateDirectRendererGeometryBuffer(n,e,a,i,t)}addDirectRendererGeometryBuffer(e,r,t,n,a){const{objectIds:i,visibilities:s}=n;return{commands:[{id:"add-direct-renderer-geometry-buffer",rendererId:e,groupId:r,renderGeometryBuffer:t,renderGeometryBufferItems:n,localOrigin:a}],transferList:[t.data,i.buffer,s.buffer]}}updateDirectRendererGeometryBuffer(e,r,t,n,a){const{objectIds:i,visibilities:s}=n;return{commands:[{id:"update-direct-renderer-geometry-buffer",rendererId:e,groupId:r,renderGeometryBuffer:t,renderGeometryBufferItems:n,localOrigin:a}],transferList:[t.data,i.buffer,s.buffer]}}removeDirectRendererGeometryBuffer(e,r){return{commands:[{id:"remove-direct-renderer-geometry-buffer",rendererId:e,groupId:r}],transferList:[]}}async createLodRenderer(e){const r=s("lod-renderer"),t=new Set,n={levels:e.levels.map((e=>({components:e.components.map((e=>{const r=e.attributes.get(d.POSITION);if(!r||0===r.indices.length)throw new Error("positions attribute expected");const n=3,i=a(r.indices.length/n),s=new o(i,n,r);if(null==this._bufferWriters.get(e.materialId))throw new Error("writer not found");const{renderGeometryBuffer:f}=this.createRenderGeometryBuffer(e,null);t.add(f.data);return{materialId:e.materialId,renderGeometryBuffer:f,boundingInfo:{bbMax:s.bbMax,bbMin:s.bbMin}}})),minScreenSpaceRadius:e.minScreenSpaceRadius})))};return await this._mainThreadDelegate.createLodRenderer(r,n,Array.from(t)),r}addLodInstances(e,r,t){return{commands:[{id:"add-lod-instances",rendererId:e,groupId:r,data:t}],transferList:[t.featureIds.buffer,t.globalTransforms.buffer,t.localTransforms.buffer,t.visibility.buffer]}}removeLodInstances(e,r){return{commands:[{id:"remove-lod-instances",rendererId:e,groupId:r}],transferList:[]}}updateLodInstancesData(e,r,t){return{commands:[{id:"update-lod-instance-data",rendererId:e,groupId:r,globalTransforms:t}],transferList:[t.buffer]}}updateVisibility(e,r,t){return{commands:[{id:"update-visibility",rendererId:e,groupId:r,visibility:t}],transferList:[t.buffer]}}async dispatchRenderCommands(e){0!==e.commands.length&&await this._mainThreadDelegate.executeRenderCommands(e)}createRenderGeometryBuffer(n,a){const{materialId:i,visibilities:s,objectIds:o}=n,d=this._bufferWriters.get(i);if(null==d)throw new Error("no registered bufferWriter for material found");let f=null;if(n.transformation&&a)e(l,n.transformation),l[12]-=a[0],l[13]-=a[1],l[14]-=a[2],f=l;else{if(a)throw new Error("not implemented");n.transformation&&(f=n.transformation)}let m=null;f&&(r(c,l),t(c,c),m=c);const u=n.attributes,h=d.elementCount(u),g=d.vertexBufferLayout.stride/4;h>Math.floor(b/g)&&console.warn("geometry with very large number of elements encountered");const p=d.vertexBufferLayout.createBuffer(h),y=0,w=d.write(f,m,u,n.objectAndLayerIdColor,p,y);if(null==w)throw new Error("Bufferwriter.write does not provide item information.");if(s.length!==w.numItems||o.length!==w.numItems)throw new Error("Unexpected mismatch between number of RenderGeometryBufferItems and provided objectIds/visibility flags.");return{renderGeometryBuffer:{data:p.buffer,elementCount:h},renderGeometryBufferItems:{objectIds:o,visibilities:s,ranges:{numVertices:w.numVerticesPerItem,numItems:w.numItems}}}}}const l=n(),c=n(),b=16777216/4;export{u as RenderCommandContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{identity as e,scale as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as o,create as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as i}from"../../../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as a,size as s}from"../../../../../../geometry/support/aaBoundingBox.js";import{objectSymbolLayerPrimitiveBoundingBox as l,objectSymbolLayerSizeWithResourceSize as d}from"../../../../../../symbols/support/symbolLayerUtils3D.js";import{computeObjectScale as m}from"../../graphicUtils.js";import{readMapCoordinates as c,readObjectIds as f}from"../featureData/processingUtils.js";import{createPrimitiveGeometry as u}from"./primitiveObjectUtils.js";class p{constructor(e){this._context=e,this.lodRendererId=null,this._loaded=!1,this._loadingPromise=null,this._primitive="cone"}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}async _load(){const e=this._context.renderCommandContext,t=await e.createMaterial("default"),r=u(this._primitive,t);this.lodRendererId=await e.createLodRenderer(r),this._loaded=!0}async createAddCommand(e){const t=this._context,{renderCommandContext:r,mainThreadDelegate:n}=t;if(null==this.lodRendererId)throw new Error("expected lod renderer id to not be null");const{featureCount:i}=e;if(0===i)return r.createRenderCommandBuffer();const m=!0,u=a(l(this._primitive)),p=o(s(u)),h=o(d(p,{isPrimitive:m,width:100,depth:null,height:null})),x=new Float64Array(16*i),g=new Float64Array(16*i),C=c(e),T=await n.applyElevationAlignmentTo(C);for(let o=0;o<i;++o){const e=o,t=T[3*o+0],r=T[3*o+1],n=T[3*o+2],i=this._computeGlobalTransform(t,r,n,this._context.viewSpatialReference,y),a=this._computeLocalTransform(h,p,_);this._writeMatrixToTypedBuffer(x,e,a),this._writeMatrixToTypedBuffer(g,e,i)}const w=f(e),b=new Uint8Array(i);e.getVisibilityArray(b);const R={featureIds:new Uint32Array(w),visibility:b,localTransforms:x,globalTransforms:g};return r.addLodInstances(this.lodRendererId,e.id,R)}async createRemoveCommand(e){const{_context:t,lodRendererId:r}=this,o=t.renderCommandContext;return null==r?o.createRenderCommandBuffer():o.removeLodInstances(r,e)}async createUpdateVisibilityCommand(e){const{lodRendererId:t,_context:r}=this,o=r.renderCommandContext;if(null==t)return o.createRenderCommandBuffer();const n=new Uint8Array(e.featureCount);return e.getVisibilityArray(n),o.updateVisibility(t,e.id,n)}async createUpdateElevationCommand(e){const{_context:t,lodRendererId:r}=this,{renderCommandContext:o,mainThreadDelegate:n}=t,{featureCount:i,id:a}=e;if(null==r||0===i)return o.createRenderCommandBuffer();const s=new Float64Array(16*i),l=c(e),d=await n.applyElevationAlignmentTo(l);for(let m=0;m<i;++m){const e=m,t=d[3*m+0],r=d[3*m+1],o=d[3*m+2],n=this._computeGlobalTransform(t,r,o,this._context.viewSpatialReference,y);this._writeMatrixToTypedBuffer(s,e,n)}return o.updateLodInstancesData(r,a,s)}_writeMatrixToTypedBuffer(e,t,r){let o=16*t;for(let n=0;n<16;n++)e[o++]=r[n]}_computeGlobalTransform(e,t,r,o,n){return h[0]=e,h[1]=t,h[2]=r,i(o,h,n,this._context.renderSpatialReference),n}_computeLocalTransform(t,r,o){return e(o),this._applyObjectScale(t,r,o),o}_applyObjectScale(e,r,o){const n=m(e,e,r,this._context.renderCoordsHelper.unitInMeters);1===n[0]&&1===n[1]&&1===n[2]||t(o,o,n)}}const h=n(),_=r(),y=r();export{p as TestObjectSymbol};
5
+ import{identity as e,scale as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as a,create as i,ONES as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as s}from"../../../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as l,size as d}from"../../../../../../geometry/support/aaBoundingBox.js";import{objectSymbolLayerPrimitiveBoundingBox as c,objectSymbolLayerSizeWithResourceSize as m}from"../../../../../../symbols/support/symbolLayerUtils3D.js";import{computeObjectScale as f}from"../../graphicUtils.js";import{readMapCoordinates as p,readObjectIds as u}from"../featureData/processingUtils.js";import{createPrimitiveGeometry as h}from"./primitiveObjectUtils.js";import{schematicMRRFactors as y}from"../../../../webgl-engine/materials/pbrUtils.js";class _{constructor(e){this._context=e,this.lodRendererId=null,this._loaded=!1,this._loadingPromise=null,this._primitive="cone"}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}async _load(){const e=this._context.renderCommandContext,t={physicalBasedRenderingEnabled:!0,slicePlaneEnabled:!1,castShadows:!0,isPrimitive:!0,screenSizePerspectiveEnabled:!0},r={usePBR:t.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:y,ambient:o,diffuse:o,hasSlicePlane:t.slicePlaneEnabled,castShadows:t.castShadows,offsetTransparentBackfaces:!1,screenSizePerspective:{}};r.externalColor=n,r.isInstanced=!0;const a=await e.createMaterial({type:"default",parameters:r}),i=h(this._primitive,a);this.lodRendererId=await e.createLodRenderer(i),this._loaded=!0}async createAddCommand(e){const t=this._context,{renderCommandContext:r,mainThreadDelegate:i}=t;if(null==this.lodRendererId)throw new Error("expected lod renderer id to not be null");const{featureCount:o}=e;if(0===o)return r.createRenderCommandBuffer();const n=!0,s=l(c(this._primitive)),f=a(d(s)),h=a(m(f,{isPrimitive:n,width:100,depth:null,height:null})),y=new Float64Array(16*o),_=new Float64Array(16*o),b=p(e),w=await i.applyElevationAlignmentTo(b);for(let a=0;a<o;++a){const e=a,t=w[3*a+0],r=w[3*a+1],i=w[3*a+2],o=this._computeGlobalTransform(t,r,i,this._context.viewSpatialReference,x),n=this._computeLocalTransform(h,f,g);this._writeMatrixToTypedBuffer(y,e,n),this._writeMatrixToTypedBuffer(_,e,o)}const C=u(e),T=new Uint8Array(o);e.getVisibilityArray(T);const R={featureIds:new Uint32Array(C),visibility:T,localTransforms:y,globalTransforms:_};return r.addLodInstances(this.lodRendererId,e.id,R)}async createRemoveCommand(e){const{_context:t,lodRendererId:r}=this,a=t.renderCommandContext;return null==r?a.createRenderCommandBuffer():a.removeLodInstances(r,e)}async createUpdateVisibilityCommand(e){const{lodRendererId:t,_context:r}=this,a=r.renderCommandContext;if(null==t)return a.createRenderCommandBuffer();const i=new Uint8Array(e.featureCount);return e.getVisibilityArray(i),a.updateVisibility(t,e.id,i)}async createUpdateElevationCommand(e){const{_context:t,lodRendererId:r}=this,{renderCommandContext:a,mainThreadDelegate:i}=t,{featureCount:o,id:n}=e;if(null==r||0===o)return a.createRenderCommandBuffer();const s=new Float64Array(16*o),l=p(e),d=await i.applyElevationAlignmentTo(l);for(let c=0;c<o;++c){const e=c,t=d[3*c+0],r=d[3*c+1],a=d[3*c+2],i=this._computeGlobalTransform(t,r,a,this._context.viewSpatialReference,x);this._writeMatrixToTypedBuffer(s,e,i)}return a.updateLodInstancesData(r,n,s)}_writeMatrixToTypedBuffer(e,t,r){let a=16*t;for(let i=0;i<16;i++)e[a++]=r[i]}_computeGlobalTransform(e,t,r,a,i){return b[0]=e,b[1]=t,b[2]=r,s(a,b,i,this._context.renderSpatialReference),i}_computeLocalTransform(t,r,a){return e(a),this._applyObjectScale(t,r,a),a}_applyObjectScale(e,r,a){const i=f(e,e,r,this._context.renderCoordsHelper.unitInMeters);1===i[0]&&1===i[1]&&1===i[2]||t(a,a,i)}}const b=i(),g=r(),x=r();export{_ as TestObjectSymbol};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{computeTileCenterRenderCoordinates as t,readObjectIds as r,readMapCoordinates as n,projectToRenderCoordinates as a}from"../featureData/processingUtils.js";import{inputAttributesToAttributesMap as i}from"./symbolizationUtils.js";import{Attribute as o}from"../../../../webgl-engine/lib/Attribute.js";import{VertexAttribute as l}from"../../../../webgl-engine/lib/VertexAttribute.js";class d{constructor(e){this._context=e,this.materialId=null,this._loaded=!1,this._loadingPromise=null}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}async _load(){const e=this._context.renderCommandContext;this.materialId=await e.createMaterial("hud"),await e.createDirectRenderer(this.materialId),this._loaded=!0}async createAddCommand(e){const{materialId:r,_context:n}=this,{renderCommandContext:a}=n;if(null==r)throw new Error("expected material not to be null");const i=await this._createGeometry(e);if(null==i)return a.createRenderCommandBuffer();const o=t(e,n);return a.addDirectRendererGeometry(e.id,i,o)}async _createGeometry(t){const{materialId:d,_context:s}=this,{mainThreadDelegate:m}=s,{featureCount:c}=t;if(0===c||null==d)return null;const u=r(t),f=n(t),y=await m.applyElevationAlignmentTo(f),w=a(y,s),C=new Float64Array([0,0,1]),h=new Float64Array([255,255,255,255]),A=new Float64Array([24,24]),_=new Float64Array([0,0,0,1]),b=new Float64Array([0,0]),x=new Float64Array([0]),I=new Uint32Array(c);for(let e=0;e<c;++e)I[e]=e;const g=new Uint32Array(c);for(let e=0;e<c;++e)g[e]=0;const p=new o(w,I,3,!0),R=new o(C,g,3,!0),U=new o(b,g,2,!0),D=new o(h,g,4,!0),E=new o(x,g,1,!0),F=new o(A,g,2,!0),O=new o(_,g,4,!0),T=[[l.POSITION,p],[l.NORMAL,R],[l.UV0,U],[l.COLOR,D],[l.ROTATION,E],[l.SIZE,F],[l.CENTEROFFSETANDDISTANCE,O]],j=new Uint8Array(c);t.getVisibilityArray(j);return{attributes:i(T),objectAndLayerIdColor:void 0,transformation:e(),materialId:d,objectIds:u,visibilities:j}}async createRemoveCommand(e){const{materialId:t,_context:r}=this,n=r.renderCommandContext;return null==t?n.createRenderCommandBuffer():n.removeDirectRendererGeometryBuffer(t,e)}async createUpdateVisibilityCommand(e){const{materialId:t,_context:r}=this,n=r.renderCommandContext;if(null==t)return n.createRenderCommandBuffer();const a=new Uint8Array(e.featureCount);return e.getVisibilityArray(a),n.updateVisibility(t,e.id,a)}async createUpdateElevationCommand(e){const{materialId:r,_context:n}=this,{renderCommandContext:a}=n,{featureCount:i,id:o}=e;if(null==r||0===i)return a.createRenderCommandBuffer();const l=await this._createGeometry(e);if(null==l)return a.createRenderCommandBuffer();const d=t(e,n);return a.updateDirectRendererGeometry(o,l,d)}}export{d as TestSymbol};
5
+ import{removeMaybe as e}from"../../../../../../core/maybe.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{namedAnchorToHUDMaterialAnchorPos as r}from"../../placementUtils.js";import{computeTileCenterRenderCoordinates as n,readObjectIds as i,readMapCoordinates as a,projectToRenderCoordinates as o}from"../featureData/processingUtils.js";import{inputAttributesToAttributesMap as l}from"./symbolizationUtils.js";import{createTextureInfo as s,defaultBoundingBox as d,requiresHalfTexelOffset as c}from"../../../../support/engineContent/sdfPrimitives.js";import{Attribute as m}from"../../../../webgl-engine/lib/Attribute.js";import{VertexAttribute as u}from"../../../../webgl-engine/lib/VertexAttribute.js";class f{constructor(e){this._context=e,this.materialId=null,this._loaded=!1,this._loadingPromise=null,this._iconTexture=null}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}destroy(){this._iconTexture=e(this._iconTexture)}async _load(){const e=this._context.renderCommandContext,t=await e.getOrCreateSharedTexture("circle-icon",(()=>s("circle")));this._iconTexture={remove:()=>e.releaseSharedTexture("circle-icon")};const n={anchorPosition:r.center,occlusionTest:!0,hasSlicePlane:!1,color:[1,0,0,1],outlineColor:[0,0,0,1],outlineSize:1,distanceFieldBoundingBox:d,textureId:t,textureIsSignedDistanceField:!0,sampleSignedDistanceFieldTexelCenter:c("circle")};this.materialId=await e.createMaterial({type:"hud",parameters:n}),await e.createDirectRenderer(this.materialId),this._loaded=!0}async createAddCommand(e){const{materialId:t,_context:r}=this,{renderCommandContext:i}=r;if(null==t)throw new Error("expected material not to be null");const a=await this._createGeometry(e);if(null==a)return i.createRenderCommandBuffer();const o=n(e,r);return i.addDirectRendererGeometry(e.id,a,o)}async _createGeometry(e){const{materialId:r,_context:n}=this,{mainThreadDelegate:s}=n,{featureCount:d}=e;if(0===d||null==r)return null;const c=i(e),f=a(e),y=await s.applyElevationAlignmentTo(f),h=o(y,n),C=new Float64Array([0,0,1]),w=new Float64Array([255,255,255,255]),x=new Float64Array([24,24]),p=new Float64Array([0,0,0,1]),_=new Float64Array([0,0]),A=new Float64Array([0]),g=new Uint32Array(d);for(let t=0;t<d;++t)g[t]=t;const b=new Uint32Array(d);for(let t=0;t<d;++t)b[t]=0;const I=new m(h,g,3,!0),T=new m(C,b,3,!0),R=new m(_,b,2,!0),F=new m(w,b,4,!0),j=new m(A,b,1,!0),D=new m(x,b,2,!0),S=new m(p,b,4,!0),U=[[u.POSITION,I],[u.NORMAL,T],[u.UV0,R],[u.COLOR,F],[u.ROTATION,j],[u.SIZE,D],[u.CENTEROFFSETANDDISTANCE,S]],O=new Uint8Array(d);e.getVisibilityArray(O);return{attributes:l(U),objectAndLayerIdColor:void 0,transformation:t(),materialId:r,objectIds:c,visibilities:O}}async createRemoveCommand(e){const{materialId:t,_context:r}=this,n=r.renderCommandContext;return null==t?n.createRenderCommandBuffer():n.removeDirectRendererGeometryBuffer(t,e)}async createUpdateVisibilityCommand(e){const{materialId:t,_context:r}=this,n=r.renderCommandContext;if(null==t)return n.createRenderCommandBuffer();const i=new Uint8Array(e.featureCount);return e.getVisibilityArray(i),n.updateVisibility(t,e.id,i)}async createUpdateElevationCommand(e){const{materialId:t,_context:r}=this,{renderCommandContext:i}=r,{featureCount:a,id:o}=e;if(null==t||0===a)return i.createRenderCommandBuffer();const l=await this._createGeometry(e);if(null==l)return i.createRenderCommandBuffer();const s=n(e,r);return i.updateDirectRendererGeometry(o,l,s)}}export{f as TestSymbol};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import{clone as t}from"../../../../core/lang.js";import n from"../../../../core/Logger.js";import{nativeArrayMaxSize as r}from"../../../../core/typedArrayUtil.js";import{compactUCharArray as o}from"../../../../geometry/support/UCharArray.js";import{compactUShortArray as i}from"../../../../geometry/support/UShortArray.js";import{decodeRGB as u,decodeIntensity as a}from"./LEPCC.js";import{VertexAttribute as s}from"../../webgl-engine/lib/VertexAttribute.js";const c=()=>n.getLogger("esri.views.3d.layers.i3s.I3SBinaryReader");function f(t,n,r){let o="",i=0;for(;i<r;){const u=t[n+i];if(u<128)o+=String.fromCharCode(u),i++;else if(u>=192&&u<224){if(i+1>=r)throw new e("utf8-decode-error","UTF-8 Decode failed. Two byte character was truncated.");const a=(31&u)<<6|63&t[n+i+1];o+=String.fromCharCode(a),i+=2}else if(u>=224&&u<240){if(i+2>=r)throw new e("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const a=(15&u)<<12|(63&t[n+i+1])<<6|63&t[n+i+2];o+=String.fromCharCode(a),i+=3}else{if(!(u>=240&&u<248))throw new e("utf8-decode-error","UTF-8 Decode failed. Invalid multi byte sequence.");{if(i+3>=r)throw new e("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const a=(7&u)<<18|(63&t[n+i+1])<<12|(63&t[n+i+2])<<6|63&t[n+i+3];if(a>=65536){const e=55296+(a-65536>>10),t=56320+(1023&a);o+=String.fromCharCode(e,t)}else o+=String.fromCharCode(a);i+=4}}}return o}function l(e,t){const n={byteOffset:0,byteCount:0,fields:Object.create(null)};let r=0;for(let o=0;o<t.length;o++){const i=t[o],u=i.valueType||i.type,a=T[u];n.fields[i.property]=a(e,r),r+=E[u].BYTES_PER_ELEMENT}return n.byteCount=r,n}function d(e,t,n){return b(e,t,n).map((e=>{const t=e?Date.parse(e):null;return null==t||Number.isNaN(t)?null:t}))}function b(t,n,r){const o=[];let i,u,a=0;for(u=0;u<t;u+=1){if(i=n[u],i>0){if(o.push(f(r,a,i-1)),0!==r[a+i-1])throw new e("string-array-error","Invalid string array: missing null termination.")}else o.push(null);a+=i}return o}function y(e,t){return new(0,E[t.valueType])(e,t.byteOffset,t.count*t.valuesPerElement)}function g(e,t){const n=y(e,t);return n.length<r?Array.from(n):n}function p(e,t){return new Uint8Array(e,t.byteOffset,t.byteCount)}function m(n,r,o){const i=null!=r.header?l(n,r.header):{byteOffset:0,byteCount:0,fields:{count:o}},u={header:i,byteOffset:i.byteCount,byteCount:0,entries:Object.create(null)};let a=i.byteCount;for(let s=0;s<r.ordering.length;s++){const n=r.ordering[s],o=t(r[n]);if(o.count=i.fields.count??0,"String"===o.valueType){if(o.byteOffset=a,o.byteCount=i.fields[n+"ByteCount"],"UTF-8"!==o.encoding)throw new e("unsupported-encoding","Unsupported String encoding.",{encoding:o.encoding});if(o.timeEncoding&&"ECMA_ISO8601"!==o.timeEncoding)throw new e("unsupported-time-encoding","Unsupported time encoding.",{timeEncoding:o.timeEncoding})}else{if(!S(o.valueType))throw new e("unsupported-value-type","Unsupported binary valueType",{valueType:o.valueType});{const e=x(o.valueType);a+=a%e!=0?e-a%e:0,o.byteOffset=a,o.byteCount=e*o.valuesPerElement*o.count}}a+=o.byteCount??0,u.entries[n]=o}return u.byteCount=a-u.byteOffset,u}function w(t,n,r){if(n!==t&&c().error(`Invalid ${r} buffer size\n expected: ${t}, actual: ${n})`),n<t)throw new e("buffer-too-small","Binary buffer is too small",{expectedSize:t,actualSize:n})}function v(e){return{isDraco:!1,isLegacy:!1,color:null!=e.color,normal:null!=e.normal,uv0:null!=e.uv0,uvRegion:null!=e.uvRegion,featureIndex:null!=e.faceRange&&null!=e.featureId}}function C(e,t){const n=l(e,t&&t.header);let r=n.byteCount;const o={isDraco:!1,header:n,byteOffset:n.byteCount,byteCount:0,vertexAttributes:{}},i=n.fields,u=null!=i.vertexCount?i.vertexCount:i.count;for(const c of t.ordering){if(!t.vertexAttributes[c])continue;const e={...t.vertexAttributes[c],byteOffset:r,count:u},n=O[c]||"_"+c;o.vertexAttributes[n]=e,r+=x(e.valueType)*e.valuesPerElement*u}const a=i.faceCount;if(t.faces&&a){o.faces={};for(const e of t.ordering){if(!t.faces[e])continue;const n={...t.faces[e],byteOffset:r,count:a};o.faces[e]=n,r+=x(n.valueType)*n.valuesPerElement*a}}const s=i.featureCount;if(t.featureAttributes&&t.featureAttributeOrder&&s){o.featureAttributes={};for(const e of t.featureAttributeOrder){if(!t.featureAttributes[e])continue;const n={...t.featureAttributes[e],byteOffset:r,count:s};o.featureAttributes[e]=n;r+=("UInt64"===n.valueType?8:x(n.valueType))*n.valuesPerElement*s}}return w(r,e.byteLength,"geometry"),o.byteCount=r-o.byteOffset,o}function I(e,t){return!(!e||!e.compressedAttributes||"draco"!==e.compressedAttributes.encoding)?A(e.compressedAttributes.attributes):e?v(e):h(t)}function h(e){const t={isDraco:!1,isLegacy:!0,color:!1,normal:!1,uv0:!1,uvRegion:!1,featureIndex:!1};for(const n of e.ordering)if(e.vertexAttributes[n])switch(n){case"position":break;case"normal":t.normal=!0;break;case"color":t.color=!0;break;case"uv0":t.uv0=!0;break;case"region":t.uvRegion=!0}return e.featureAttributes&&e.featureAttributeOrder&&(t.featureIndex=!0),t}function A(e){const t={isDraco:!0,isLegacy:!1,color:!1,normal:!1,uv0:!1,uvRegion:!1,featureIndex:!1};for(const n of e)switch(n){case"position":break;case"normal":t.normal=!0;break;case"uv0":t.uv0=!0;break;case"color":t.color=!0;break;case"uv-region":t.uvRegion=!0;break;case"feature-index":t.featureIndex=!0}return t}const O={position:s.POSITION,normal:s.NORMAL,color:s.COLOR,uv0:s.UV0,region:s.UVREGION};function U(t,n,r,s=!1){if("lepcc-rgb"===t.encoding)return s?u(n):o(u(n));if("lepcc-intensity"===t.encoding)return s?a(n):i(a(n));if(null!=t.encoding&&""!==t.encoding)throw new e("unknown-attribute-storage-info-encoding","Unknown Attribute Storage Info Encoding");t["attributeByteCounts "]&&!t.attributeByteCounts&&(c().warn("Warning: Trailing space in 'attributeByteCounts '."),t.attributeByteCounts=t["attributeByteCounts "]),"ObjectIds"===t.ordering[0]&&t.hasOwnProperty("objectIds")&&(c().warn("Warning: Case error in objectIds"),t.ordering[0]="objectIds");const f=m(n,t,r);w(f.byteOffset+f.byteCount,n.byteLength,"attribute");const l=f.entries.attributeValues||f.entries.objectIds;if(l){if("String"===l.valueType){const e=f.entries.attributeByteCounts,t=y(n,e),r=p(n,l);return l.timeEncoding?d(e.count,t,r):b(e.count,t,r)}return s?y(n,l):g(n,l)}throw new e("bad-attribute-storage-info","Bad attributeStorageInfo specification.")}const E={Float32:Float32Array,Float64:Float64Array,UInt8:Uint8Array,Int8:Int8Array,UInt16:Uint16Array,Int16:Int16Array,UInt32:Uint32Array,Int32:Int32Array},T={Float32:(e,t)=>new DataView(e,0).getFloat32(t,!0),Float64:(e,t)=>new DataView(e,0).getFloat64(t,!0),UInt8:(e,t)=>new DataView(e,0).getUint8(t),Int8:(e,t)=>new DataView(e,0).getInt8(t),UInt16:(e,t)=>new DataView(e,0).getUint16(t,!0),Int16:(e,t)=>new DataView(e,0).getInt16(t,!0),UInt32:(e,t)=>new DataView(e,0).getUint32(t,!0),Int32:(e,t)=>new DataView(e,0).getInt32(t,!0)};function S(e){return E.hasOwnProperty(e)}function x(e){return S(e)?E[e].BYTES_PER_ELEMENT:0}export{m as createAttributeDataIndex,I as createGeometryDescriptor,A as createGeometryDescriptorForDraco,v as createGeometryDescriptorFromDefinition,h as createGeometryDescriptorFromSchema,C as createGeometryIndexFromSchema,p as createRawView,y as createTypedView,x as getBytesPerValue,S as isValueType,U as readBinaryAttribute,d as readDateStringArray,l as readHeader,b as readStringArray,T as valueType2ArrayBufferReader,E as valueType2TypedArrayClassMap};
5
+ import e from"../../../../core/Error.js";import{clone as t}from"../../../../core/lang.js";import n from"../../../../core/Logger.js";import{isInt16Array as r,minInt16 as o,isInt32Array as i,minInt32 as u,nativeArrayMaxSize as a}from"../../../../core/typedArrayUtil.js";import{compactUCharArray as s}from"../../../../geometry/support/UCharArray.js";import{compactUShortArray as c}from"../../../../geometry/support/UShortArray.js";import{decodeRGB as f,decodeIntensity as l}from"./LEPCC.js";import{VertexAttribute as d}from"../../webgl-engine/lib/VertexAttribute.js";const b=()=>n.getLogger("esri.views.3d.layers.i3s.I3SBinaryReader");function y(t,n,r){let o="",i=0;for(;i<r;){const u=t[n+i];if(u<128)o+=String.fromCharCode(u),i++;else if(u>=192&&u<224){if(i+1>=r)throw new e("utf8-decode-error","UTF-8 Decode failed. Two byte character was truncated.");const a=(31&u)<<6|63&t[n+i+1];o+=String.fromCharCode(a),i+=2}else if(u>=224&&u<240){if(i+2>=r)throw new e("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const a=(15&u)<<12|(63&t[n+i+1])<<6|63&t[n+i+2];o+=String.fromCharCode(a),i+=3}else{if(!(u>=240&&u<248))throw new e("utf8-decode-error","UTF-8 Decode failed. Invalid multi byte sequence.");{if(i+3>=r)throw new e("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const a=(7&u)<<18|(63&t[n+i+1])<<12|(63&t[n+i+2])<<6|63&t[n+i+3];if(a>=65536){const e=55296+(a-65536>>10),t=56320+(1023&a);o+=String.fromCharCode(e,t)}else o+=String.fromCharCode(a);i+=4}}}return o}function g(e,t){const n={byteOffset:0,byteCount:0,fields:Object.create(null)};let r=0;for(let o=0;o<t.length;o++){const i=t[o],u=i.valueType||i.type,a=F[u];n.fields[i.property]=a(e,r),r+=j[u].BYTES_PER_ELEMENT}return n.byteCount=r,n}function p(e,t,n){return m(e,t,n).map((e=>{const t=e?Date.parse(e):null;return null==t||Number.isNaN(t)?null:t}))}function m(t,n,r){const o=[];let i,u,a=0;for(u=0;u<t;u+=1){if(i=n[u],i>0){if(o.push(y(r,a,i-1)),0!==r[a+i-1])throw new e("string-array-error","Invalid string array: missing null termination.")}else o.push(null);a+=i}return o}function w(e,t){return new(0,j[t.valueType])(e,t.byteOffset,t.count*t.valuesPerElement)}function v(e,t){const n=w(e,t);if(n.length>=a)return n;const r=new Array;return n.forEach(((e,t)=>r.push(C(n,t)))),r}function C(e,t){if(!e)return null;const n=e[t];if(r(e))return n===o?null:n;if(i(e))return n===u?null:n;return n!=n?null:n}function I(e,t){return new Uint8Array(e,t.byteOffset,t.byteCount)}function h(n,r,o){const i=null!=r.header?g(n,r.header):{byteOffset:0,byteCount:0,fields:{count:o}},u={header:i,byteOffset:i.byteCount,byteCount:0,entries:Object.create(null)};let a=i.byteCount;for(let s=0;s<r.ordering.length;s++){const n=r.ordering[s],o=t(r[n]);if(o.count=i.fields.count??0,"String"===o.valueType){if(o.byteOffset=a,o.byteCount=i.fields[n+"ByteCount"],"UTF-8"!==o.encoding)throw new e("unsupported-encoding","Unsupported String encoding.",{encoding:o.encoding});if(o.timeEncoding&&"ECMA_ISO8601"!==o.timeEncoding)throw new e("unsupported-time-encoding","Unsupported time encoding.",{timeEncoding:o.timeEncoding})}else{if(!R(o.valueType))throw new e("unsupported-value-type","Unsupported binary valueType",{valueType:o.valueType});{const e=B(o.valueType);a+=a%e!=0?e-a%e:0,o.byteOffset=a,o.byteCount=e*o.valuesPerElement*o.count}}a+=o.byteCount??0,u.entries[n]=o}return u.byteCount=a-u.byteOffset,u}function A(t,n,r){if(n!==t&&b().error(`Invalid ${r} buffer size\n expected: ${t}, actual: ${n})`),n<t)throw new e("buffer-too-small","Binary buffer is too small",{expectedSize:t,actualSize:n})}function O(e){return{isDraco:!1,isLegacy:!1,color:null!=e.color,normal:null!=e.normal,uv0:null!=e.uv0,uvRegion:null!=e.uvRegion,featureIndex:null!=e.faceRange&&null!=e.featureId}}function U(e,t){const n=g(e,t&&t.header);let r=n.byteCount;const o={isDraco:!1,header:n,byteOffset:n.byteCount,byteCount:0,vertexAttributes:{}},i=n.fields,u=null!=i.vertexCount?i.vertexCount:i.count;for(const c of t.ordering){if(!t.vertexAttributes[c])continue;const e={...t.vertexAttributes[c],byteOffset:r,count:u},n=x[c]||"_"+c;o.vertexAttributes[n]=e,r+=B(e.valueType)*e.valuesPerElement*u}const a=i.faceCount;if(t.faces&&a){o.faces={};for(const e of t.ordering){if(!t.faces[e])continue;const n={...t.faces[e],byteOffset:r,count:a};o.faces[e]=n,r+=B(n.valueType)*n.valuesPerElement*a}}const s=i.featureCount;if(t.featureAttributes&&t.featureAttributeOrder&&s){o.featureAttributes={};for(const e of t.featureAttributeOrder){if(!t.featureAttributes[e])continue;const n={...t.featureAttributes[e],byteOffset:r,count:s};o.featureAttributes[e]=n;r+=("UInt64"===n.valueType?8:B(n.valueType))*n.valuesPerElement*s}}return A(r,e.byteLength,"geometry"),o.byteCount=r-o.byteOffset,o}function E(e,t){return!(!e||!e.compressedAttributes||"draco"!==e.compressedAttributes.encoding)?S(e.compressedAttributes.attributes):e?O(e):T(t)}function T(e){const t={isDraco:!1,isLegacy:!0,color:!1,normal:!1,uv0:!1,uvRegion:!1,featureIndex:!1};for(const n of e.ordering)if(e.vertexAttributes[n])switch(n){case"position":break;case"normal":t.normal=!0;break;case"color":t.color=!0;break;case"uv0":t.uv0=!0;break;case"region":t.uvRegion=!0}return e.featureAttributes&&e.featureAttributeOrder&&(t.featureIndex=!0),t}function S(e){const t={isDraco:!0,isLegacy:!1,color:!1,normal:!1,uv0:!1,uvRegion:!1,featureIndex:!1};for(const n of e)switch(n){case"position":break;case"normal":t.normal=!0;break;case"uv0":t.uv0=!0;break;case"color":t.color=!0;break;case"uv-region":t.uvRegion=!0;break;case"feature-index":t.featureIndex=!0}return t}const x={position:d.POSITION,normal:d.NORMAL,color:d.COLOR,uv0:d.UV0,region:d.UVREGION};function D(t,n,r,o=!1){if("lepcc-rgb"===t.encoding)return o?f(n):s(f(n));if("lepcc-intensity"===t.encoding)return o?l(n):c(l(n));if(null!=t.encoding&&""!==t.encoding)throw new e("unknown-attribute-storage-info-encoding","Unknown Attribute Storage Info Encoding");t["attributeByteCounts "]&&!t.attributeByteCounts&&(b().warn("Warning: Trailing space in 'attributeByteCounts '."),t.attributeByteCounts=t["attributeByteCounts "]),"ObjectIds"===t.ordering[0]&&t.hasOwnProperty("objectIds")&&(b().warn("Warning: Case error in objectIds"),t.ordering[0]="objectIds");const i=h(n,t,r);A(i.byteOffset+i.byteCount,n.byteLength,"attribute");const u=i.entries.attributeValues||i.entries.objectIds;if(u){if("String"===u.valueType){const e=i.entries.attributeByteCounts,t=w(n,e),r=I(n,u);return u.timeEncoding?p(e.count,t,r):m(e.count,t,r)}return o?w(n,u):v(n,u)}throw new e("bad-attribute-storage-info","Bad attributeStorageInfo specification.")}const j={Float32:Float32Array,Float64:Float64Array,UInt8:Uint8Array,Int8:Int8Array,UInt16:Uint16Array,Int16:Int16Array,UInt32:Uint32Array,Int32:Int32Array},F={Float32:(e,t)=>new DataView(e,0).getFloat32(t,!0),Float64:(e,t)=>new DataView(e,0).getFloat64(t,!0),UInt8:(e,t)=>new DataView(e,0).getUint8(t),Int8:(e,t)=>new DataView(e,0).getInt8(t),UInt16:(e,t)=>new DataView(e,0).getUint16(t,!0),Int16:(e,t)=>new DataView(e,0).getInt16(t,!0),UInt32:(e,t)=>new DataView(e,0).getUint32(t,!0),Int32:(e,t)=>new DataView(e,0).getInt32(t,!0)};function R(e){return j.hasOwnProperty(e)}function B(e){return R(e)?j[e].BYTES_PER_ELEMENT:0}export{h as createAttributeDataIndex,E as createGeometryDescriptor,S as createGeometryDescriptorForDraco,O as createGeometryDescriptorFromDefinition,T as createGeometryDescriptorFromSchema,U as createGeometryIndexFromSchema,I as createRawView,w as createTypedView,B as getBytesPerValue,C as getCachedAttributeValue,R as isValueType,D as readBinaryAttribute,p as readDateStringArray,g as readHeader,m as readStringArray,F as valueType2ArrayBufferReader,j as valueType2TypedArrayClassMap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import o from"../../../../core/Error.js";import{loadImageAsync as t}from"../../../../support/requestUtils.js";import{EncodedMeshTexture as r}from"../../glTF/internal/resourceUtils.js";import{TextureUsage as a,TextureEncoding as s}from"./enums.js";import{CullFaceOptions as n}from"../../webgl-engine/lib/basicInterfaces.js";import{useSchematicPBR as i,schematicMRRFactors as l}from"../../webgl-engine/materials/pbrUtils.js";import{alphaCutoff as u}from"../../../../webscene/support/AlphaCutoff.js";async function c(o){const t=[],r=[];if(null==o){return{material:{alphaMode:"opaque",alphaCutoff:u,doubleSided:!0,cullFace:0,normalTextureId:-1,emissiveTextureId:-1,occlusionTextureId:-1,emissiveFactor:[0,0,0],metallicRoughness:{baseColorFactor:[1,1,1,1],baseColorTextureId:-1,metallicRoughnessTextureId:-1,metallicFactor:0,roughnessFactor:.6000000238418579},wrapTextures:!1,hasParametersFromSource:!0},requiredTextures:t,textureData:r}}const s=d(o);"auto"===o.alphaMode&&console.warn('alphaMode "auto" not supported by I3S PBRMaterial - defaulting to "blend".');const c=i({normalTexture:o.normalTexture,emissiveTexture:s?o.emissiveTexture:null,emissiveFactor:s?e.toUnitRGB(o.emissiveColor):null,occlusionTexture:s?o.occlusionTexture:null,metallicRoughnessTexture:s?o.metallicRoughnessTexture:null,metallicFactor:s?o.metallic:null,roughnessFactor:s?o.roughness:null}),g=c?l[0]:s?o.metallic:0,p=c?l[1]:s?o.roughness:0;return{material:{alphaMode:"auto"===o.alphaMode?"blend":o.alphaMode,alphaCutoff:o.alphaCutoff,doubleSided:o.doubleSided,cullFace:o.doubleSided?n.None:n.Back,normalTextureId:await m(o.normalTexture,t,r,a.Normal),emissiveTextureId:s?await m(o.emissiveTexture,t,r,a.Emissive):-1,occlusionTextureId:s?await m(o.occlusionTexture,t,r,a.Occlusion):-1,emissiveFactor:s&&null!=o.emissiveColor?e.toUnitRGB(o.emissiveColor):[0,0,0],metallicRoughness:{baseColorFactor:null!=o.color?e.toUnitRGBA(o.color):[1,1,1,1],baseColorTextureId:await m(o.colorTexture,t,r,a.Color),metallicRoughnessTextureId:s?await m(o.metallicRoughnessTexture,t,r,a.MetallicRoughness):-1,metallicFactor:g,roughnessFactor:p},wrapTextures:!0,hasParametersFromSource:c},requiredTextures:t,textureData:r}}async function m(e,a,n,i){if(null==e)return-1;const l=n.length,u=e.data,c=e.url;if(null!=u){if(u instanceof HTMLImageElement||u instanceof HTMLCanvasElement)return n.push({id:l,usage:i,data:u,encoding:s.PNG}),a.push({id:l,usage:i,encodings:[{name:void 0,encoding:s.PNG}]}),l;if(u instanceof HTMLVideoElement)return-1;if(u instanceof ImageData)throw new o("ImageData textures not supported yet for client side I3S nodes");if(u instanceof r)return n.push({id:l,usage:i,data:u.data,encoding:s.KTX2}),a.push({id:l,usage:i,encodings:[{name:void 0,encoding:s.KTX2}]}),l}else if(null!=c){const e=new Image;e.src=c;const o=await t(e,e.src,!1,void 0);return n.push({id:l,usage:i,data:o,encoding:s.PNG}),a.push({id:l,usage:i,encodings:[{name:void 0,encoding:s.PNG}]}),l}return-1}function d(e){return e.hasOwnProperty("metallicRoughnessTexture")}export{c as convertMeshMaterialToPBRMaterial};
5
+ import e from"../../../../Color.js";import o from"../../../../core/Error.js";import{loadImageAsync as t}from"../../../../support/requestUtils.js";import{EncodedMeshTexture as r}from"../../glTF/internal/resourceUtils.js";import{TextureUsage as a,TextureEncoding as s}from"./enums.js";import{CullFaceOptions as n}from"../../webgl-engine/lib/basicInterfaces.js";import{useSchematicPBR as i,schematicMRRFactors as l}from"../../webgl-engine/materials/pbrUtils.js";import{alphaCutoff as u}from"../../../../webscene/support/AlphaCutoff.js";async function c(o){const t=[],r=[];if(null==o){return{material:{alphaMode:"opaque",alphaCutoff:u,doubleSided:!0,cullFace:0,normalTextureId:-1,emissiveTextureId:-1,occlusionTextureId:-1,emissiveFactor:[0,0,0],metallicRoughness:{baseColorFactor:[1,1,1,1],baseColorTextureId:-1,metallicRoughnessTextureId:-1,metallicFactor:0,roughnessFactor:.6000000238418579},wrapTextures:!1,hasParametersFromSource:!0},requiredTextures:t,textureData:r}}const s=d(o);"auto"===o.alphaMode&&console.warn('alphaMode "auto" not supported by I3S PBRMaterial - defaulting to "blend".');const c=i({normalTexture:o.normalTexture,emissiveTexture:s?o.emissiveTexture:null,emissiveFactor:s?e.toUnitRGB(o.emissiveColor):null,occlusionTexture:s?o.occlusionTexture:null,metallicRoughnessTexture:s?o.metallicRoughnessTexture:null,metallicFactor:s?o.metallic:null,roughnessFactor:s?o.roughness:null}),g=c?l[0]:s?o.metallic:0,p=c?l[1]:s?o.roughness:0;return{material:{alphaMode:"auto"===o.alphaMode?"blend":o.alphaMode,alphaCutoff:o.alphaCutoff,doubleSided:o.doubleSided,cullFace:o.doubleSided?n.None:n.Back,normalTextureId:await m(o.normalTexture,t,r,a.Normal),emissiveTextureId:s?await m(o.emissiveTexture,t,r,a.Emissive):-1,occlusionTextureId:s?await m(o.occlusionTexture,t,r,a.Occlusion):-1,emissiveFactor:s&&null!=o.emissiveColor?e.toUnitRGB(o.emissiveColor):[0,0,0],metallicRoughness:{baseColorFactor:null!=o.color?e.toUnitRGBA(o.color):[1,1,1,1],baseColorTextureId:await m(o.colorTexture,t,r,a.Color),metallicRoughnessTextureId:s?await m(o.metallicRoughnessTexture,t,r,a.MetallicRoughness):-1,metallicFactor:g,roughnessFactor:p},wrapTextures:!0,hasParametersFromSource:c},requiredTextures:t,textureData:r}}async function m(e,a,n,i){if(null==e)return-1;const l=n.length,u=e.data,c=e.url;if(null!=u){if(u instanceof HTMLImageElement||u instanceof HTMLCanvasElement)return n.push({id:l,usage:i,data:u,encoding:s.PNG}),a.push({id:l,usage:i,encodings:[{name:void 0,encoding:s.PNG}]}),l;if(u instanceof HTMLVideoElement)return-1;if(u instanceof ImageData)throw new o("scenelayer","ImageData textures not supported yet for client side I3S nodes");if(u instanceof r)return n.push({id:l,usage:i,data:u.data,encoding:s.KTX2}),a.push({id:l,usage:i,encodings:[{name:void 0,encoding:s.KTX2}]}),l}else if(null!=c){const e=new Image;e.src=c;const o=await t(e,e.src,!1,void 0);return n.push({id:l,usage:i,data:o,encoding:s.PNG}),a.push({id:l,usage:i,encodings:[{name:void 0,encoding:s.PNG}]}),l}return-1}function d(e){return e.hasOwnProperty("metallicRoughnessTexture")}export{c as convertMeshMaterialToPBRMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import{assertIsSome as t}from"../../../../core/maybe.js";import{MinPriority as r}from"../../../../core/MemCache.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{generateUUID as n}from"../../../../core/uuid.js";import{normalFromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{p as a}from"../../../../chunks/vec32.js";import{ONES as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as d}from"../../../../geometry/projection/projectBoundingSphere.js";import{isRelativeVertexSpace as c}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{l as u}from"../../../../chunks/sphere.js";import{CachedMeshData as m}from"./CachedMeshData.js";import{convertMeshMaterialToPBRMaterial as h}from"./I3SClientMaterialUtil.js";class f{constructor(e,t,r,o){this._uid=e,this._worker=o,this._id2Meta=new Map,this._oid2Meta=new Map,this._indexSR=t.indexSR,this._vertexSR=t.vertexSR,this._renderSR=t.renderSR,this._memCache=r.newCache(`sl-client-mesh-data-${this._uid}`)}get uid(){return this._uid}get worker(){return this._worker}get indexSR(){return this._indexSR}get renderSR(){return this._renderSR}createMeshNodeInfo(e,t){const r=`mesh${t}`,o=e.extent,n=o.spatialReference,s=this._indexSR,i=x(o,e.origin);d(i,n,i,s);return{type:"mesh",id:r,version:w(e),oid:t,mbs:i,componentNodeIds:[],unloadedMesh:e,nodeIndex:null,loadMeshPromise:null}}addMeshNode(t,r){if(null!=this.getMeshNodeIndex(r.oid))throw new e(`I3SClientNodeLoader: client side mesh for feature oid=${r.oid} already exists`);r.nodeIndex=t,this._id2Meta.set(r.id,r),this._oid2Meta.set(r.oid,r)}getMeshNodeIndex(e){const t=this._oid2Meta.get(e);return null==t||"mesh"!==t.type?null:t.nodeIndex}getMeshNodeInfo(e){const t=this._oid2Meta.values();for(const r of t)if("mesh"===r.type&&r.id===e)return r;return null}removeNode(e){const t=this._id2Meta.get(e);null!=t&&(this._id2Meta.delete(e),"mesh"===t.type&&this._oid2Meta.delete(t.oid))}async loadNodeJSON(t){const r=this._id2Meta.get(t);if(null==r)throw new e(`I3SClientNodeLoader::loadNodeJSON unable to find node ${t}`);switch(r.type){case"mesh":return this._loadMeshNodeJSON(r);case"mesh-component":return p(r);default:throw new e(`I3SClientNodeLoader::loadNodeJSON unable to handle node ${t}`)}}async _loadMeshNodeJSON(e){const t=e.id,r=(await this._getMeshData(e)).loadedMesh;if(null==r.components||0===r.components.length)return{id:t,version:null,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:null};const o=[],n=r.components;for(let s=0;s<n.length;++s){const r=`${t}-component${s}`,n={type:"mesh-component",id:r,mbs:e.mbs,componentIndex:s,meshNodeInfo:e,textureData:new Map};this._id2Meta.set(n.id,n),e.componentNodeIds.push(r),o.push({id:n.id,href:null,mbs:n.mbs,obb:null})}return{id:t,version:null,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:o}}updateNodeIndex(e,t,r){const o=this._id2Meta.get(e);o&&"mesh"===o.type&&(o.nodeIndex=r)}async loadNodeData(r,n){const s=this._id2Meta.get(r);if(null==s||"mesh-component"!==s.type)throw new e(`Failed to load client node data for node ${r} (unexpected node info)`);const i=s.meshNodeInfo,a=await this._getMeshData(i),l=a.loadedMesh,d=i.oid;if(null==l.components)throw new e(`Failed to load client node data for node ${r} (unexpected null reference)`);const c=l.components[s.componentIndex],{material:u,requiredTextures:m,textureData:f}=await h(c.material);if(null!=f)for(const e of f)null!=e&&s.textureData.set(e.id,e);const p={params:{material:u},type:"ArrayBufferView"},{vertexSpace:x,origin:M,transform:w}=l,S=[M.x,M.y,M.z??0];a.projectionPromise||(t(this._worker,"SceneLayerWorker is needed to project mesh"),a.projectionPromise=this._worker.project({positions:l.vertexAttributes.position,localMatrix:w?.localMatrix,vertexSpace:x.toJSON(),origin:S,inSpatialReference:l.spatialReference.toJSON(),outSpatialReference:this._vertexSR.toJSON()},n));const{projected:b,original:_,projectedOrigin:N}=await a.projectionPromise;l.vertexAttributes.position=_;const{transformed:v,original:D}=await y(c,a,this._worker,n);l.vertexAttributes.normal=D,o(n);const{geometryBuffer:R,geometryDescriptor:j}=g(b,c.faces,v,l.vertexAttributes.uv,l.vertexAttributes.color,d);return{geometryData:{featureDataPosition:N,featureIds:[],geometries:[p]},attributeDataInfo:{attributeData:{},loadedAttributes:[]},geometryBuffer:R,geometryDescriptor:j,requiredTextures:m,textureData:f,normalReferenceFrame:this._vertexSR.isGeographic?"east-north-up":"vertex-reference-frame"}}async loadAttributes(e,t,r){const o=e.numFeatures,n={};for(const{field:{name:s}}of t)n[s]=new Array(o);return n}async loadTextures(e,t,r){const o=e.id,n=this._id2Meta.get(o);if(null==n||"mesh-component"!==n.type)throw new Error(`Failed to load textures for node ${e.id} (unexpected node info)`);const s=[];for(const i of t)s.push(n.textureData.get(i.id)||null);return s}async _getMeshData(e){const t=e.version,o=this._memCache.get(t);if(null==o){if(null!=e.loadMeshPromise)return e.loadMeshPromise;const o=async(o,n)=>{const s=e.unloadedMesh.clone();try{await s.load()}catch(a){n(a)}const i=new m(s);this._memCache.put(t,i,r),e.loadMeshPromise=null,o(i)};return e.loadMeshPromise=new Promise(((e,t)=>o(e,t))),e.loadMeshPromise}return o}}async function p(e){return{id:e.id,version:e.meshNodeInfo.version,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:null,isEmpty:!1}}function x(e,t){const{spatialReference:r}=e,o=[1,-1],n=[.5*e.width,.5*e.height,e.hasZ?.5*(e.zmax-e.zmin):0],s=r.isGeographic?r.metersPerUnit:1,i=e.center;let a=0;if(e.hasZ)for(let l=0;l<2;++l)for(let e=0;e<2;++e)for(let r=0;r<2;++r){const d=(i.x+o[l]*n[0]-t.x)*s,c=(i.y+o[e]*n[1]-t.y)*s,u=i.z+o[r]*n[2]-t.z;a=Math.max(d*d+c*c+u*u,a)}else for(let l=0;l<2;++l)for(let e=0;e<2;++e){const r=(i.x+o[l]*n[0]-t.x)*s,d=(i.y+o[e]*n[1]-t.y)*s;a=Math.max(r*r+d*d,a)}return u([t.x,t.y,t.z],Math.sqrt(a))}async function y(e,r,o,n){const{transform:d,vertexAttributes:c}=r.loadedMesh,u="source"===e.shading?c.normal:null;if(!(null!=u&&null!=d&&(0!==d.rotationAngle||!a(d.scale,l))))return{transformed:u,original:c.normal};if(!r.normalsTransformPromise){t(o,"SceneLayerWorker is needed to transform mesh normals");const e=i();s(e,d.localMatrix),r.normalsTransformPromise=o.transformNormals({normalMatrix:e,normals:u},n)}return r.normalsTransformPromise}function g(e,t,r,o,n,s){const i=1,a=(t?.length??0)/3,l=3*a;let d=0,c=0,u=!1,m=0,h=!1,f=0,p=!1,x=0,y=0,g=0;d+=S,d+=S,c=d,d+=3*l*b,null!=r&&(u=!0,m=d,d+=3*l*b),null!=o&&(h=!0,f=d,d+=2*l*b),null!=n&&(p=!0,x=d,d+=4*l*_),y=d,d+=i*N,g=d,d+=2*i*S;const w=new ArrayBuffer(d),v=new Uint8Array(w);M(v,0,l),M(v,S,i);const D=new Float32Array(w,c),R=null!=r?new Float32Array(w,m):null,j=null!=o?new Float32Array(w,f):null,I=null!=n?new Uint8Array(w,x):null;for(let M=0;M<a;++M){const s=3*M;for(let i=0;i<3;++i){const a=t[s+i],l=3*a,d=9*M+3*i;if(D[d]=e[l],D[d+1]=e[l+1],D[d+2]=e[l+2],R&&(R[d]=r[l],R[d+1]=r[l+1],R[d+2]=r[l+2]),j){const e=2*a,t=6*M+2*i;j[t]=o[e],j[t+1]=o[e+1]}if(I){const e=4*a,t=12*M+4*i;I[t]=n[e],I[t+1]=n[e+1],I[t+2]=n[e+2],I[t+3]=n[e+3]}}}M(v,y,s),M(v,y+S,s/2**32),M(v,g,0),M(v,g+S,a-1);return{geometryBuffer:w,geometryDescriptor:{isDraco:!1,isLegacy:!0,color:p,normal:u,uv0:h,uvRegion:!1,featureIndex:!0}}}function M(e,t,r){e[t]=255&r,e[t+1]=255&r>>8,e[t+2]=255&r>>16,e[t+3]=255&r>>24}function w(e){const t=e.metadata.displaySource?.source;if(null==t||!Array.isArray(t)||!t.length||t[0]instanceof File)return n();const r=t;let o="";for(const n of r)o+=n.makeHash();return o+JSON.stringify(e.transform?.toJSON()??"")+(c(e.vertexSpace)?JSON.stringify(e.vertexSpace.origin):"")+JSON.stringify(e.spatialReference)}const S=4,b=4,_=1,N=8;export{f as I3SClientNodeLoader,x as createSphereFromExtent,b as sizeOfFloat32,S as sizeOfInt32,N as sizeOfUInt64,_ as sizeOfUInt8,y as transformNormals};
5
+ import e from"../../../../core/Error.js";import{assertIsSome as t}from"../../../../core/maybe.js";import{MinPriority as r}from"../../../../core/MemCache.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{generateUUID as n}from"../../../../core/uuid.js";import{normalFromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{p as i}from"../../../../chunks/vec32.js";import{ONES as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as d}from"../../../../geometry/projection/projectBoundingSphere.js";import{isRelativeVertexSpace as c}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{l as u}from"../../../../chunks/sphere.js";import{CachedMeshData as m}from"./CachedMeshData.js";import{convertMeshMaterialToPBRMaterial as h}from"./I3SClientMaterialUtil.js";class f{constructor(e,t,r,o){this._uid=e,this._worker=o,this._id2Meta=new Map,this._oid2Meta=new Map,this._indexSR=t.indexSR,this._vertexSR=t.vertexSR,this._renderSR=t.renderSR,this._memCache=r.newCache(`sl-client-mesh-data-${this._uid}`)}get uid(){return this._uid}get worker(){return this._worker}get indexSR(){return this._indexSR}get renderSR(){return this._renderSR}createMeshNodeInfo(e,t){const r=`mesh${t}`,o=e.extent,n=o.spatialReference,s=this._indexSR,a=y(o,e.origin);d(a,n,a,s);return{type:"mesh",id:r,version:w(e),oid:t,mbs:a,componentNodeIds:[],unloadedMesh:e,nodeIndex:null,loadMeshPromise:null}}addMeshNode(t,r){if(null!=this.getMeshNodeIndex(r.oid))throw new e("scenelayer",`I3SClientNodeLoader: client side mesh for feature oid=${r.oid} already exists`);r.nodeIndex=t,this._id2Meta.set(r.id,r),this._oid2Meta.set(r.oid,r)}getMeshNodeIndex(e){const t=this._oid2Meta.get(e);return null==t||"mesh"!==t.type?null:t.nodeIndex}getMeshNodeInfo(e){const t=this._oid2Meta.values();for(const r of t)if("mesh"===r.type&&r.id===e)return r;return null}removeNode(e){const t=this._id2Meta.get(e);null!=t&&(this._id2Meta.delete(e),"mesh"===t.type&&this._oid2Meta.delete(t.oid))}async loadNodeJSON(t){const r=this._id2Meta.get(t);if(null==r)throw new e("scenelayer",`I3SClientNodeLoader::loadNodeJSON unable to find node ${t}`);switch(r.type){case"mesh":return this._loadMeshNodeJSON(r);case"mesh-component":return p(r);default:throw new e("scenelayer",`I3SClientNodeLoader::loadNodeJSON unable to handle node ${t}`)}}async _loadMeshNodeJSON(e){const t=e.id,r=(await this._getMeshData(e)).loadedMesh;if(null==r.components||0===r.components.length)return{id:t,version:null,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:null};const o=[],n=r.components;for(let s=0;s<n.length;++s){const r=`${t}-component${s}`,n={type:"mesh-component",id:r,mbs:e.mbs,componentIndex:s,meshNodeInfo:e,textureData:new Map};this._id2Meta.set(n.id,n),e.componentNodeIds.push(r),o.push({id:n.id,href:null,mbs:n.mbs,obb:null})}return{id:t,version:null,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:o}}updateNodeIndex(e,t,r){const o=this._id2Meta.get(e);o&&"mesh"===o.type&&(o.nodeIndex=r)}async loadNodeData(r,n){const s=this._id2Meta.get(r);if(null==s||"mesh-component"!==s.type)throw new e("scenelayer",`Failed to load client node data for node ${r} (unexpected node info)`);const a=s.meshNodeInfo,i=await this._getMeshData(a),l=i.loadedMesh,d=a.oid;if(null==l.components)throw new e("scenelayer",`Failed to load client node data for node ${r} (unexpected null reference)`);const c=l.components[s.componentIndex],{material:u,requiredTextures:m,textureData:f}=await h(c.material);if(null!=f)for(const e of f)null!=e&&s.textureData.set(e.id,e);const p={params:{material:u},type:"ArrayBufferView"},{vertexSpace:y,origin:M,transform:w}=l,S=[M.x,M.y,M.z??0];i.projectionPromise||(t(this._worker,"SceneLayerWorker is needed to project mesh"),i.projectionPromise=this._worker.project({positions:l.vertexAttributes.position,localMatrix:w?.localMatrix,vertexSpace:y.toJSON(),origin:S,inSpatialReference:l.spatialReference.toJSON(),outSpatialReference:this._vertexSR.toJSON()},n));const{projected:b,original:_,projectedOrigin:N}=await i.projectionPromise;l.vertexAttributes.position=_;const{transformed:v,original:D}=await x(c,i,this._worker,n);l.vertexAttributes.normal=D,o(n);const{geometryBuffer:R,geometryDescriptor:j}=g(b,c.faces,v,l.vertexAttributes.uv,l.vertexAttributes.color,d);return{geometryData:{featureDataPosition:N,featureIds:[],geometries:[p]},attributeDataInfo:{attributeData:{},loadedAttributes:[]},geometryBuffer:R,geometryDescriptor:j,requiredTextures:m,textureData:f,normalReferenceFrame:this._vertexSR.isGeographic?"east-north-up":"vertex-reference-frame"}}async loadAttributes(e,t,r){const o=e.numFeatures,n={};for(const{field:{name:s}}of t)n[s]=new Array(o);return n}async loadTextures(e,t,r){const o=e.id,n=this._id2Meta.get(o);if(null==n||"mesh-component"!==n.type)throw new Error(`Failed to load textures for node ${e.id} (unexpected node info)`);const s=[];for(const a of t)s.push(n.textureData.get(a.id)||null);return s}async _getMeshData(e){const t=e.version,o=this._memCache.get(t);if(null==o){if(null!=e.loadMeshPromise)return e.loadMeshPromise;const o=async(o,n)=>{const s=e.unloadedMesh.clone();try{await s.load()}catch(i){n(i)}const a=new m(s);this._memCache.put(t,a,r),e.loadMeshPromise=null,o(a)};return e.loadMeshPromise=new Promise(((e,t)=>o(e,t))),e.loadMeshPromise}return o}}async function p(e){return{id:e.id,version:e.meshNodeInfo.version,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:null,isEmpty:!1}}function y(e,t){const{spatialReference:r}=e,o=[1,-1],n=[.5*e.width,.5*e.height,e.hasZ?.5*(e.zmax-e.zmin):0],s=r.isGeographic?r.metersPerUnit:1,a=e.center;let i=0;if(e.hasZ)for(let l=0;l<2;++l)for(let e=0;e<2;++e)for(let r=0;r<2;++r){const d=(a.x+o[l]*n[0]-t.x)*s,c=(a.y+o[e]*n[1]-t.y)*s,u=a.z+o[r]*n[2]-t.z;i=Math.max(d*d+c*c+u*u,i)}else for(let l=0;l<2;++l)for(let e=0;e<2;++e){const r=(a.x+o[l]*n[0]-t.x)*s,d=(a.y+o[e]*n[1]-t.y)*s;i=Math.max(r*r+d*d,i)}return u([t.x,t.y,t.z],Math.sqrt(i))}async function x(e,r,o,n){const{transform:d,vertexAttributes:c}=r.loadedMesh,u="source"===e.shading?c.normal:null;if(!(null!=u&&null!=d&&(0!==d.rotationAngle||!i(d.scale,l))))return{transformed:u,original:c.normal};if(!r.normalsTransformPromise){t(o,"SceneLayerWorker is needed to transform mesh normals");const e=a();s(e,d.localMatrix),r.normalsTransformPromise=o.transformNormals({normalMatrix:e,normals:u},n)}return r.normalsTransformPromise}function g(e,t,r,o,n,s){const a=1,i=(t?.length??0)/3,l=3*i;let d=0,c=0,u=!1,m=0,h=!1,f=0,p=!1,y=0,x=0,g=0;d+=S,d+=S,c=d,d+=3*l*b,null!=r&&(u=!0,m=d,d+=3*l*b),null!=o&&(h=!0,f=d,d+=2*l*b),null!=n&&(p=!0,y=d,d+=4*l*_),x=d,d+=a*N,g=d,d+=2*a*S;const w=new ArrayBuffer(d),v=new Uint8Array(w);M(v,0,l),M(v,S,a);const D=new Float32Array(w,c),R=null!=r?new Float32Array(w,m):null,j=null!=o?new Float32Array(w,f):null,I=null!=n?new Uint8Array(w,y):null;for(let M=0;M<i;++M){const s=3*M;for(let a=0;a<3;++a){const i=t[s+a],l=3*i,d=9*M+3*a;if(D[d]=e[l],D[d+1]=e[l+1],D[d+2]=e[l+2],R&&(R[d]=r[l],R[d+1]=r[l+1],R[d+2]=r[l+2]),j){const e=2*i,t=6*M+2*a;j[t]=o[e],j[t+1]=o[e+1]}if(I){const e=4*i,t=12*M+4*a;I[t]=n[e],I[t+1]=n[e+1],I[t+2]=n[e+2],I[t+3]=n[e+3]}}}M(v,x,s),M(v,x+S,s/2**32),M(v,g,0),M(v,g+S,i-1);return{geometryBuffer:w,geometryDescriptor:{isDraco:!1,isLegacy:!0,color:p,normal:u,uv0:h,uvRegion:!1,featureIndex:!0}}}function M(e,t,r){e[t]=255&r,e[t+1]=255&r>>8,e[t+2]=255&r>>16,e[t+3]=255&r>>24}function w(e){const t=e.metadata.displaySource?.source;if(null==t||!Array.isArray(t)||!t.length||t[0]instanceof File)return n();const r=t;let o="";for(const n of r)o+=n.makeHash();return o+JSON.stringify(e.transform?.toJSON()??"")+(c(e.vertexSpace)?JSON.stringify(e.vertexSpace.origin):"")+JSON.stringify(e.spatialReference)}const S=4,b=4,_=1,N=8;export{f as I3SClientNodeLoader,y as createSphereFromExtent,b as sizeOfFloat32,S as sizeOfInt32,N as sizeOfUInt64,_ as sizeOfUInt8,x as transformNormals};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{create as t}from"../../../../geometry/support/aaBoundingBox.js";import{getCentroidOptimizedGeometry as e}from"../../../../layers/graphics/centroid.js";import r from"../../../../layers/graphics/OptimizedGeometry.js";import{getCachedAttributeValue as i}from"./I3SUtil.js";class o{constructor(t){this._objectIdField=t.objectIdField,this._getFeatureExtent=t.getFeatureExtent}getObjectId(t){return t.id}getAttributes(t){const{meta:e,index:r}=t,o={};this._objectIdField&&(o[this._objectIdField]=t.id);const n=e.attributeInfo?.attributeData;if(null!=n)for(const s of Object.keys(n))o[s]=i(n[s],r);return o}getAttribute(t,e){if(e===this._objectIdField)return t.id;const{meta:r,index:o}=t,n=r.attributeInfo?.attributeData;return null!=n?i(n[e],o):null}getGeometry(t){if(t.geometry)return t.geometry;const[e,i,o,n,u]=this._getFeatureExtent(t,s);return new r([5],[e,i,o,n,i,o,n,u,o,e,u,o,e,i,o])}getCentroid(t,i){if(t.geometry)return e(new r,t.geometry,i.hasZ,i.hasM);const[o,n,u,a,d,c]=this._getFeatureExtent(t,s);return new r([0],[(o+a)/2,(n+d)/2,(u+c)/2])}cloneWithGeometry(t,e){const{id:r,index:i,meta:o}=t;return new n(r,i,o,e)}}class n{constructor(t,e,r,i){this.id=t,this.index=e,this.meta=r,this.geometry=i}get usedMemory(){return 32+(this.geometry?.usedMemory??0)}}const s=t();export{n as I3SQueryFeature,o as I3SQueryFeatureAdapter};
5
+ import{create as t}from"../../../../geometry/support/aaBoundingBox.js";import{getCentroidOptimizedGeometry as e}from"../../../../layers/graphics/centroid.js";import r from"../../../../layers/graphics/OptimizedGeometry.js";import{getCachedAttributeValue as i}from"./I3SBinaryReader.js";class o{constructor(t){this._objectIdField=t.objectIdField,this._getFeatureExtent=t.getFeatureExtent}getObjectId(t){return t.id}getAttributes(t){const{meta:e,index:r}=t,o={};this._objectIdField&&(o[this._objectIdField]=t.id);const n=e.attributeInfo?.attributeData;if(null!=n)for(const s of Object.keys(n))o[s]=i(n[s],r);return o}getAttribute(t,e){if(e===this._objectIdField)return t.id;const{meta:r,index:o}=t,n=r.attributeInfo?.attributeData;return null!=n?i(n[e],o):null}getGeometry(t){if(t.geometry)return t.geometry;const[e,i,o,n,u]=this._getFeatureExtent(t,s);return new r([5],[e,i,o,n,i,o,n,u,o,e,u,o,e,i,o])}getCentroid(t,i){if(t.geometry)return e(new r,t.geometry,i.hasZ,i.hasM);const[o,n,u,a,d,c]=this._getFeatureExtent(t,s);return new r([0],[(o+a)/2,(n+d)/2,(u+c)/2])}cloneWithGeometry(t,e){const{id:r,index:i,meta:o}=t;return new n(r,i,o,e)}}class n{constructor(t,e,r,i){this.id=t,this.index=e,this.meta=r,this.geometry=i}get usedMemory(){return 32+(this.geometry?.usedMemory??0)}}const s=t();export{n as I3SQueryFeature,o as I3SQueryFeatureAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{toConst as o}from"../../../../core/compilerUtils.js";import t from"../../../../core/Evented.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{projectBoundingSphere as n}from"../../../../geometry/projection/projectBoundingSphere.js";import{create as i,toRect as p}from"../../../../geometry/support/aaBoundingBox.js";import{create as a,intersects as m}from"../../../../geometry/support/aaBoundingRect.js";import{f as u}from"../../../../chunks/sphere.js";import{ForAllFeaturesReturnType as f}from"../II3SMeshView3D.js";const l=i();let d=class extends r{constructor(e){super(e),this.events=new t}forEach(e){this.forAllFeatures((r=>(e(r),f.CONTINUE)))}forEachBounds(e,r){for(const o of e)r(this.getFeatureExtent(o,l))}forEachInBounds(e,r){this.forAllFeatures((t=>{const s=this.getFeatureExtent(o(t),y);return m(e,p(s,j))&&r(o(t)),f.CONTINUE}),(r=>{if(n(r.node.serviceMbsInIndexSR,this.sourceSpatialReference,h,this.viewSpatialReference),h[0]>=e[0]&&h[2]<=e[2]&&h[1]>=e[1]&&h[3]<=e[3])return f.CONTINUE;const o=Math.max(e[0],Math.min(h[0],e[2])),t=Math.max(e[1],Math.min(h[1],e[3])),s=h[0]-o,c=h[1]-t;return s*s+c*c<=h[3]*h[3]?f.CONTINUE:f.SKIP}))}};e([s({constructOnly:!0})],d.prototype,"featureAdapter",void 0),e([s({constructOnly:!0})],d.prototype,"forAllFeatures",void 0),e([s({constructOnly:!0})],d.prototype,"getFeatureExtent",void 0),e([s({constructOnly:!0})],d.prototype,"sourceSpatialReference",void 0),e([s({constructOnly:!0})],d.prototype,"viewSpatialReference",void 0),d=e([c("esri.views.3d.layers.i3s.I3SQueryFeatureStore")],d);const h=u(0,0,0,0),y=i(),j=a();export{d as I3SQueryFeatureStore};
5
+ import{_ as r}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import{toConst as t}from"../../../../core/compilerUtils.js";import o from"../../../../core/Evented.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{projectBoundingSphere as i}from"../../../../geometry/projection/projectBoundingSphere.js";import{create as n,toRect as p}from"../../../../geometry/support/aaBoundingBox.js";import{create as a,intersects as m}from"../../../../geometry/support/aaBoundingRect.js";import{f as u}from"../../../../chunks/sphere.js";import{ForAllFeaturesReturnType as f}from"../II3SMeshView3D.js";const l=n();let h=class extends e{constructor(r){super(r),this.events=new o}forEach(r){this.forAllFeatures((e=>(r(e),f.CONTINUE)))}forEachBounds(r,e){for(const t of r)e(this.getFeatureExtent(t,l))}forEachInBounds(r,e){this.forAllFeatures((o=>{const s=this.getFeatureExtent(t(o),y);return m(r,p(s,j))&&e(t(o)),f.CONTINUE}),(e=>{if(i(e,this.sourceSpatialReference,d,this.viewSpatialReference),d[0]>=r[0]&&d[2]<=r[2]&&d[1]>=r[1]&&d[3]<=r[3])return f.CONTINUE;const t=Math.max(r[0],Math.min(d[0],r[2])),o=Math.max(r[1],Math.min(d[1],r[3])),s=d[0]-t,c=d[1]-o;return s*s+c*c<=d[3]*d[3]?f.CONTINUE:f.SKIP}))}};r([s({constructOnly:!0})],h.prototype,"featureAdapter",void 0),r([s({constructOnly:!0})],h.prototype,"forAllFeatures",void 0),r([s({constructOnly:!0})],h.prototype,"getFeatureExtent",void 0),r([s({constructOnly:!0})],h.prototype,"sourceSpatialReference",void 0),r([s({constructOnly:!0})],h.prototype,"viewSpatialReference",void 0),h=r([c("esri.views.3d.layers.i3s.I3SQueryFeatureStore")],h);const d=u(0,0,0,0),y=n(),j=a();export{h as I3SQueryFeatureStore};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../request.js";import{binaryIndexOf as t,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import o from"../../../../core/Error.js";import has from"../../../../core/has.js";import{isInt16Array as n,isInt32Array as s}from"../../../../core/typedArrayUtil.js";import{invert as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as l,t as c,c as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as p}from"../../../../geometry/projection.js";import m from"../../../../geometry/SpatialReference.js";import{projectVectorToVector as d}from"../../../../geometry/projection/projectVectorToVector.js";import{create as y,empty as h,expandPointInPlace as g,intersects as S}from"../../../../geometry/support/aaBoundingRect.js";import{a as b}from"../../../../chunks/sphere.js";import w from"../../../../rest/support/Query.js";import{readBinaryAttribute as I}from"./I3SBinaryReader.js";import{computeGlobalTransformation as T}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as E,createMaterialFromEdges as R}from"../support/edgeUtils.js";import{parseColorMixMode as x,ColorMixModeEnum as v}from"../support/symbolColorUtils.js";import{Obb as M,compute as j}from"../../support/orientedBoundingBox.js";import{spatialReferenceIncompatibleError as C}from"../../../support/layerViewUtils.js";function U(e){return e?parseInt(e.slice(e.lastIndexOf("/")+1),10):void 0}function k(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function N(e,t,r,o){r.traverse(t,(t=>{const r=t.serviceMbsInIndexSR;return(null!=r&&F(e,r))!==q.OUTSIDE&&(o(t),!0)}))}function D(e,t,r){let o=0,n=0;for(let s=0;s<t.length&&o<e.length;s++)e[o]===t[s]&&(r(s)&&(e[n]=e[o],n++),o++);e.length=n}function W(e,r,o){let n=0,s=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[s]=o[n],s++),n++}o.length=s}function _(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return O[0]=(e[0]-t.position[0])/t.rotationScale[0],O[1]=(e[1]-t.position[1])/t.rotationScale[4],O[2]=(e[2]-t.position[0])/t.rotationScale[0],O[3]=(e[3]-t.position[1])/t.rotationScale[4],O}const O=y();var q;function F(e,t){const r=t[0],o=t[1],n=t[3],s=e[0]-r,a=r-e[2],i=e[1]-o,l=o-e[3],c=Math.max(s,a,0),u=Math.max(i,l,0),f=c*c+u*u;if(f>n*n)return q.OUTSIDE;if(f>0)return q.INTERSECTS_CENTER_OUTSIDE;return-Math.max(s,a,i,l)>n?q.INSIDE:q.INTERSECTS_CENTER_INSIDE}function L(e,t,r){const o=[],n=r?.missingFields,s=r?.originalFields;for(const a of e){const e=a.toLowerCase();let r=!1;for(const n of t)if(e===n.name.toLowerCase()){o.push(n.name),r=!0,s&&s.push(a);break}!r&&n&&n.push(a)}return o}async function A(e,t,r,n,s,a){if(0===t.length)return[];const i=e.attributeStorageInfo;if(null!=e.associatedLayer)try{return await P(e.associatedLayer,t,r,n,a)}catch(l){if(e.associatedLayer.loaded)throw l}if(i){const l=K(t,r,s);if(null==l)throw new o("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const c=e.parsedUrl.path;return(await Promise.all(l.map((t=>G(c,i,t.node,t.indices,n,e.apiKey,e.customParameters,a).then((e=>{for(let r=0;r<t.graphics.length;r++){const o=t.graphics[r],n=e[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}return t.graphics})))))).flat()}throw new o("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function K(e,t,r){const o=new Map,n=[],s=r();for(const a of e){const e=a.attributes[t];for(let t=0;t<s.length;t++){const r=s[t],i=r.featureIds.indexOf(e);if(i>=0){let e=o.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},n.push(e),o.set(r.node,e)),e.indices.push(i),e.graphics.push(a);for(let r=t;r>0;r--)s[r]=s[r-1];s[0]=r;break}}}return n}async function P(e,t,r,o,n){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const s=t.map((e=>e.attributes[r])),a=[],i=L(o,e.fields,{originalFields:a}),l=await B(e,s,i,n);for(let c=0;c<t.length;c++){const e=t[c],r=l[c],o={};if(e.attributes)for(const t in e.attributes)o[t]=e.attributes[t];for(let t=0;t<a.length;t++)o[a[t]]=r[i[t]];e.attributes=o}return t}function B(e,t,n,s){const a=e.capabilities.query.maxRecordCount;if(null!=a&&t.length>a){const o=r(t,a);return Promise.all(o.map((t=>B(e,t,n,s)))).then((e=>e.flat()))}const i=new w({objectIds:t,outFields:n,orderByFields:[e.objectIdField]});return e.queryFeatures(i,s).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new o("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function G(e,t,r,o,n,s,a,i){return V(e,t,r.resources.attributes,o,n,s,a,i)}async function V(t,r,o,n,s,a,i,l){const c=[];for(const e of r)if(e&&s.includes(e.name)){const r=`${t}/nodes/${o}/attributes/${e.key}/0`;c.push({url:r,storageInfo:e})}const u=await Promise.allSettled(c.map((t=>e(t.url,{responseType:"array-buffer",query:{...i,token:a},signal:l?.signal}).then((e=>I(t.storageInfo,e.data)))))),f=[];for(const e of n){const t={};for(let r=0;r<u.length;r++){const o=u[r];if("fulfilled"===o.status){const n=o.value;t[c[r].storageInfo.name]=Q(n,e)}}f.push(t)}return f}!function(e){e[e.OUTSIDE=0]="OUTSIDE",e[e.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",e[e.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",e[e.INSIDE=3]="INSIDE"}(q||(q={}));const $=-32768,z=-2147483648;function Q(e,t){if(!e)return null;const r=e[t];if(n(e))return r===$?null:r;if(s(e))return r===z?null:r;return r!=r?null:r}function Z(e){const t=e.store,r=t.indexCRS||t.geographicCRS,n=void 0===r?t.indexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-index-incompatible","The indexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const s=r?new m(U(r)):e.spatialReference;return s.equals(e.spatialReference)?e.spatialReference:s}function H(e){const t=e.store,r=t.vertexCRS||t.projectedCRS,n=void 0===r?t.vertexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const s=r?new m(U(r)):e.spatialReference;return s.equals(e.spatialReference)?e.spatialReference:s}function J(e,t,r){if(!p(e,t))throw C("scene layer",e?.wkid,t?.wkid);if("local"===r&&!Y(e,t))throw C("scene layer",e?.wkid,t?.wkid)}function X(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new o("layerview:recycle-failed")}function Y(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function ee(e,t,r){const o=Z(e),n=H(e);J(o,t,r),J(n,t,r)}function te(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&null!=e.vertexAttributes?.position)}function re(e){if(null==e.store?.defaultGeometrySchema||!te(e.store.defaultGeometrySchema))throw new o("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function oe(e,t){ee(e,t.spatialReference,t.viewingMode)}function ne(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&null!=e.vertexAttributes?.position))}function se(e){if(null==e.store?.defaultGeometrySchema||!ne(e.store.defaultGeometrySchema))throw new o("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function ae(e,t){J(e.spatialReference,t.spatialReference,t.viewingMode)}function ie(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function le(e){return"mesh-3d"===e.type}function ce(e){if(null==e||!ie(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.symbols;if(0===t.length)return!0;for(const r of t){if(!le(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||null==e.material?.color||"replace"!==e.material.colorMixMode)return!0}return!1}const ue=E({color:[0,0,0,0],opacity:0});class fe{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function pe(e){const t=new fe;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,s=n.edges;if(null!=e&&!r){const o=e.color,s=x(e.colorMixMode);t.material=null!=o?{color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:s}:{color:[1,1,1],alpha:1,colorMixMode:v.Multiply},t.castShadows=n.castShadows,r=!0}null==s||o||(t.edgeMaterial=R(s,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:v.Multiply}),t}function me(e,t){return(0|e)+(0|t)|0}function de(e,t,r,o,n,s,i){if(!s||0===s.length||null==t||!e.serviceMbsInIndexSR)return null;const f=T(e.serviceMbsInIndexSR,n,"none",r,t);a(Ee,f);let p=null;const m=()=>{if(!p)if(p=ge,h(be),null!=e.serviceObbInIndexSR){e.serviceObbInIndexSR.transform(we,r,t,n,i),we.getCorners(p);for(const e of p)c(e,e,Ee),g(be,e)}else{const o=e.serviceMbsInIndexSR;if(!o)return;const s=o[3];d(b(o),r,Ie,t),c(Ie,Ie,Ee),Ie[2]+=n;for(let e=0;e<8;++e){const t=1&e?s:-s,r=2&e?s:-s,o=4&e?s:-s,n=p[e];u(n,[Ie[0]+t,Ie[1]+r,Ie[2]+o]),g(be,n)}}};let y=1/0,w=-1/0;const I=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r?.hasZ)return;h(Se);const n=r.spatialReference||o,s=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(l(Ie,r[0],r[1],r[2]),d(Ie,n,Ie,t),c(Ie,Ie,Ee),g(Se,Ie),Math.min(Ie[2],e))),e)),1/0);m(),S(be,Se)&&(y=Math.min(y,s),w=Math.max(w,s))};if(s.forEach((e=>I(e))),y===1/0)return null;const E=(e,t,r)=>{c(Ie,r,f),e[t]=Ie[0],e[t+1]=Ie[1],e[t+2]=Ie[2],t+=24,r[2]=y,c(Ie,r,f),e[t]=Ie[0],e[t+1]=Ie[1],e[t+2]=Ie[2],t+=24,r[2]=w,c(Ie,r,f),e[t]=Ie[0],e[t+1]=Ie[1],e[t+2]=Ie[2]};for(let a=0;a<8;++a)E(Te.data,3*a,p[a]);return j(Te)}function ye(e){return e[3]>=0}function he(e){null!=e&&(e[3]=-1)}const ge=[f(),f(),f(),f(),f(),f(),f(),f()],Se=y(),be=y(),we=new M,Ie=f(),Te={data:new Array(72),size:3,exclusive:!0,stride:3},Ee=i();export{q as MbsIntersectResult,fe as SymbolInfo,me as addWraparound,ae as checkPointCloudLayerCompatibleWithView,se as checkPointCloudLayerValid,X as checkRecyclable,oe as checkSceneLayerCompatibleWithView,re as checkSceneLayerValid,J as checkSpatialReference,ee as checkSpatialReferences,de as computeVisibilityObb,k as containsDraco,U as extractWkid,D as filterInPlace,L as findFieldsCaseInsensitive,N as findIntersectingNodes,Q as getCachedAttributeValue,_ as getClipRect,Z as getIndexCrs,pe as getSymbolInfo,H as getVertexCrs,F as intersectBoundingRectWithMbs,he as invalidateMbs,Y as isSupportedLocalModeProjection,ye as isValidMbs,W as objectIdFilter,V as queryAttributesFromCachedAttributesId,ce as rendererNeedsTextures,ue as transparentEdgeMaterial,A as whenGraphicAttributes};
5
+ import e from"../../../../request.js";import{binaryIndexOf as t,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import o from"../../../../core/Error.js";import has from"../../../../core/has.js";import{invert as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as s,t as i,c as l}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as u}from"../../../../geometry/projection.js";import f from"../../../../geometry/SpatialReference.js";import{projectVectorToVector as p}from"../../../../geometry/projection/projectVectorToVector.js";import{create as d,empty as m,expandPointInPlace as y,intersects as h}from"../../../../geometry/support/aaBoundingRect.js";import{a as g}from"../../../../chunks/sphere.js";import S from"../../../../rest/support/Query.js";import{readBinaryAttribute as b,getCachedAttributeValue as w}from"./I3SBinaryReader.js";import{computeGlobalTransformation as I}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as T,createMaterialFromEdges as E}from"../support/edgeUtils.js";import{parseColorMixMode as R,ColorMixModeEnum as v}from"../support/symbolColorUtils.js";import{Obb as x,compute as M}from"../../support/orientedBoundingBox.js";import{spatialReferenceIncompatibleError as j}from"../../../support/layerViewUtils.js";function C(e){return e?parseInt(e.slice(e.lastIndexOf("/")+1),10):void 0}function k(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function N(e,t,r,o){r.traverse(t,(t=>{const r=t.serviceMbsInIndexSR;return(null!=r&&q(e,r))!==O.OUTSIDE&&(o(t),!0)}))}function U(e,t,r){let o=0,n=0;for(let a=0;a<t.length&&o<e.length;a++)e[o]===t[a]&&(r(a)&&(e[n]=e[o],n++),o++);e.length=n}function D(e,r,o){let n=0,a=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[a]=o[n],a++),n++}o.length=a}function W(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return _[0]=(e[0]-t.position[0])/t.rotationScale[0],_[1]=(e[1]-t.position[1])/t.rotationScale[4],_[2]=(e[2]-t.position[0])/t.rotationScale[0],_[3]=(e[3]-t.position[1])/t.rotationScale[4],_}const _=d();var O;function q(e,t){const r=t[0],o=t[1],n=t[3],a=e[0]-r,s=r-e[2],i=e[1]-o,l=o-e[3],c=Math.max(a,s,0),u=Math.max(i,l,0),f=c*c+u*u;if(f>n*n)return O.OUTSIDE;if(f>0)return O.INTERSECTS_CENTER_OUTSIDE;return-Math.max(a,s,i,l)>n?O.INSIDE:O.INTERSECTS_CENTER_INSIDE}function F(e,t,r){const o=[],n=r?.missingFields,a=r?.originalFields;for(const s of e){const e=s.toLowerCase();let r=!1;for(const n of t)if(e===n.name.toLowerCase()){o.push(n.name),r=!0,a&&a.push(s);break}!r&&n&&n.push(s)}return o}async function L(e,t,r,n,a,s){if(0===t.length)return[];const i=e.attributeStorageInfo;if(null!=e.associatedLayer)try{return await A(e.associatedLayer,t,r,n,s)}catch(l){if(e.associatedLayer.loaded)throw l}if(i){const l=K(t,r,a);if(null==l)throw new o("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const c=e.parsedUrl.path;return(await Promise.all(l.map((t=>B(c,i,t.node,t.indices,n,e.apiKey,e.customParameters,s).then((e=>{for(let r=0;r<t.graphics.length;r++){const o=t.graphics[r],n=e[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}return t.graphics})))))).flat()}throw new o("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function K(e,t,r){const o=new Map,n=[],a=r();for(const s of e){const e=s.attributes[t];for(let t=0;t<a.length;t++){const r=a[t],i=r.featureIds.indexOf(e);if(i>=0){let e=o.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},n.push(e),o.set(r.node,e)),e.indices.push(i),e.graphics.push(s);for(let r=t;r>0;r--)a[r]=a[r-1];a[0]=r;break}}}return n}async function A(e,t,r,o,n){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const a=t.map((e=>e.attributes[r])),s=[],i=F(o,e.fields,{originalFields:s}),l=await P(e,a,i,n);for(let c=0;c<t.length;c++){const e=t[c],r=l[c],o={};if(e.attributes)for(const t in e.attributes)o[t]=e.attributes[t];for(let t=0;t<s.length;t++)o[s[t]]=r[i[t]];e.attributes=o}return t}function P(e,t,n,a){const s=e.capabilities.query.maxRecordCount;if(null!=s&&t.length>s){const o=r(t,s);return Promise.all(o.map((t=>P(e,t,n,a)))).then((e=>e.flat()))}const i=new S({objectIds:t,outFields:n,orderByFields:[e.objectIdField]});return e.queryFeatures(i,a).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new o("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function B(e,t,r,o,n,a,s,i){return G(e,t,r.resources.attributes,o,n,a,s,i)}async function G(t,r,o,n,a,s,i,l){const c=[];for(const e of r)if(e&&a.includes(e.name)){const r=`${t}/nodes/${o}/attributes/${e.key}/0`;c.push({url:r,storageInfo:e})}const u=await Promise.allSettled(c.map((t=>e(t.url,{responseType:"array-buffer",query:{...i,token:s},signal:l?.signal}).then((e=>b(t.storageInfo,e.data)))))),f=[];for(const e of n){const t={};for(let r=0;r<u.length;r++){const o=u[r];if("fulfilled"===o.status){const n=o.value;t[c[r].storageInfo.name]=w(n,e)}}f.push(t)}return f}function V(e){const t=e.store,r=t.indexCRS||t.geographicCRS,n=void 0===r?t.indexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-index-incompatible","The indexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const a=r?new f(C(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function $(e){const t=e.store,r=t.vertexCRS||t.projectedCRS,n=void 0===r?t.vertexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const a=r?new f(C(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function z(e,t,r){if(!u(e,t))throw j("scene layer",e?.wkid,t?.wkid);if("local"===r&&!Z(e,t))throw j("scene layer",e?.wkid,t?.wkid)}function Q(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new o("layerview:recycle-failed","Could not recycle layerview")}function Z(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function H(e,t,r){const o=V(e),n=$(e);z(o,t,r),z(n,t,r)}function J(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&null!=e.vertexAttributes?.position)}function X(e){if(null==e.store?.defaultGeometrySchema||!J(e.store.defaultGeometrySchema))throw new o("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function Y(e,t){H(e,t.spatialReference,t.viewingMode)}function ee(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&null!=e.vertexAttributes?.position))}function te(e){if(null==e.store?.defaultGeometrySchema||!ee(e.store.defaultGeometrySchema))throw new o("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function re(e,t){z(e.spatialReference,t.spatialReference,t.viewingMode)}function oe(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function ne(e){return"mesh-3d"===e.type}function ae(e){if(null==e||!oe(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.symbols;if(0===t.length)return!0;for(const r of t){if(!ne(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||null==e.material?.color||"replace"!==e.material.colorMixMode)return!0}return!1}!function(e){e[e.OUTSIDE=0]="OUTSIDE",e[e.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",e[e.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",e[e.INSIDE=3]="INSIDE"}(O||(O={}));const se=T({color:[0,0,0,0],opacity:0});class ie{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function le(e){const t=new ie;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,a=n.edges;if(null!=e&&!r){const o=e.color,a=R(e.colorMixMode);t.material=null!=o?{color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:a}:{color:[1,1,1],alpha:1,colorMixMode:v.Multiply},t.castShadows=n.castShadows,r=!0}null==a||o||(t.edgeMaterial=E(a,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:v.Multiply}),t}function ce(e,t){return(0|e)+(0|t)|0}function ue(e,t,r,o,a,c,u){if(!c||0===c.length||null==t||!e.serviceMbsInIndexSR)return null;const f=I(e.serviceMbsInIndexSR,a,"none",r,t);n(be,f);let d=null;const S=()=>{if(!d)if(d=de,m(ye),null!=e.serviceObbInIndexSR){e.serviceObbInIndexSR.transform(he,r,t,a,u),he.getCorners(d);for(const e of d)i(e,e,be),y(ye,e)}else{const o=e.serviceMbsInIndexSR;if(!o)return;const n=o[3];p(g(o),r,ge,t),i(ge,ge,be),ge[2]+=a;for(let e=0;e<8;++e){const t=1&e?n:-n,r=2&e?n:-n,o=4&e?n:-n,a=d[e];l(a,[ge[0]+t,ge[1]+r,ge[2]+o]),y(ye,a)}}};let b=1/0,w=-1/0;const T=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r?.hasZ)return;m(me);const n=r.spatialReference||o,a=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(s(ge,r[0],r[1],r[2]),p(ge,n,ge,t),i(ge,ge,be),y(me,ge),Math.min(ge[2],e))),e)),1/0);S(),h(ye,me)&&(b=Math.min(b,a),w=Math.max(w,a))};if(c.forEach((e=>T(e))),b===1/0)return null;const E=(e,t,r)=>{i(ge,r,f),e[t]=ge[0],e[t+1]=ge[1],e[t+2]=ge[2],t+=24,r[2]=b,i(ge,r,f),e[t]=ge[0],e[t+1]=ge[1],e[t+2]=ge[2],t+=24,r[2]=w,i(ge,r,f),e[t]=ge[0],e[t+1]=ge[1],e[t+2]=ge[2]};for(let n=0;n<8;++n)E(Se.data,3*n,d[n]);return M(Se)}function fe(e){return e[3]>=0}function pe(e){null!=e&&(e[3]=-1)}const de=[c(),c(),c(),c(),c(),c(),c(),c()],me=d(),ye=d(),he=new x,ge=c(),Se={data:new Array(72),size:3,exclusive:!0,stride:3},be=a();export{O as MbsIntersectResult,ie as SymbolInfo,ce as addWraparound,re as checkPointCloudLayerCompatibleWithView,te as checkPointCloudLayerValid,Q as checkRecyclable,Y as checkSceneLayerCompatibleWithView,X as checkSceneLayerValid,z as checkSpatialReference,H as checkSpatialReferences,ue as computeVisibilityObb,k as containsDraco,C as extractWkid,U as filterInPlace,F as findFieldsCaseInsensitive,N as findIntersectingNodes,W as getClipRect,V as getIndexCrs,le as getSymbolInfo,$ as getVertexCrs,q as intersectBoundingRectWithMbs,pe as invalidateMbs,Z as isSupportedLocalModeProjection,fe as isValidMbs,D as objectIdFilter,G as queryAttributesFromCachedAttributesId,ae as rendererNeedsTextures,se as transparentEdgeMaterial,L as whenGraphicAttributes};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{getTimeOperator as i}from"../../../../layers/graphics/data/timeSupport.js";import s from"../../../../layers/support/FeatureFilter.js";import{combineTimeExtent as n}from"../../../../layers/support/timeSupport.js";import{filterInPlace as o,getCachedAttributeValue as l}from"../i3s/I3SUtil.js";const u=i=>{let o=class extends i{get timeExtent(){return n(this.i3slayer,this.view?.timeExtent,this._get("timeExtent"))}get mergedFilter(){const{filter:t,timeExtent:e}=this;if(null==e)return t;const r=t?.clone()??new s;return null!=e&&(r.timeExtent=r.timeExtent?.intersection(e)??e),r}getTimeFilterDependencies(){const{timeInfo:t}=this.i3slayer;if(null==t)return[];const{startField:e,endField:r}=t;return[e,r]}addTimeFilter(t,e){if(null==e)return;const{timeInfo:r}=this.i3slayer;if(null==r)return;const{startField:i,endField:s,useTime:n}=r;if(!n||null==i&&null==s)return;const o=r.toJSON(),l=e.toJSON();t.push(((t,e)=>a(t,e,o,l)))}};return t([e({readOnly:!0})],o.prototype,"timeExtent",null),t([e()],o.prototype,"mergedFilter",null),o=t([r("esri.views.3d.layers.support.TemporalSceneLayerView")],o),o};function a(t,e,r,s){const n=e.attributeInfo?.attributeData;if(null==n)return;const{startTimeField:l,endTimeField:u}=r;if(!!(null!=l&&null==n[l]||null!=u&&null==n[u]))return;const a=i(r,s,new m(n));if(null==a)return;const{featureIds:p}=e;o(t,p,a)}class m{constructor(t){this.attributeData=t}getAttribute(t,e){return l(this.attributeData[e],t)}getAttributeAsTimestamp(t,e){const r=this.getAttribute(t,e);return"string"==typeof r?new Date(r).getTime():"number"==typeof r||null==r?r:null}}export{u as TemporalSceneLayerView};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{getTimeOperator as i}from"../../../../layers/graphics/data/timeSupport.js";import s from"../../../../layers/support/FeatureFilter.js";import{combineTimeExtent as n}from"../../../../layers/support/timeSupport.js";import{getCachedAttributeValue as o}from"../i3s/I3SBinaryReader.js";import{filterInPlace as l}from"../i3s/I3SUtil.js";const u=i=>{let o=class extends i{get timeExtent(){return n(this.i3slayer,this.view?.timeExtent,this._get("timeExtent"))}get mergedFilter(){const{filter:t,timeExtent:e}=this;if(null==e)return t;const r=t?.clone()??new s;return null!=e&&(r.timeExtent=r.timeExtent?.intersection(e)??e),r}getTimeFilterDependencies(){const{timeInfo:t}=this.i3slayer;if(null==t)return[];const{startField:e,endField:r}=t;return[e,r]}addTimeFilter(t,e){if(null==e)return;const{timeInfo:r}=this.i3slayer;if(null==r)return;const{startField:i,endField:s,useTime:n}=r;if(!n||null==i&&null==s)return;const o=r.toJSON(),l=e.toJSON();t.push(((t,e)=>a(t,e,o,l)))}};return t([e({readOnly:!0})],o.prototype,"timeExtent",null),t([e()],o.prototype,"mergedFilter",null),o=t([r("esri.views.3d.layers.support.TemporalSceneLayerView")],o),o};function a(t,e,r,s){const n=e.attributeInfo?.attributeData;if(null==n)return;const{startTimeField:o,endTimeField:u}=r;if(!!(null!=o&&null==n[o]||null!=u&&null==n[u]))return;const a=i(r,s,new m(n));if(null==a)return;const{featureIds:p}=e;l(t,p,a)}class m{constructor(t){this.attributeData=t}getAttribute(t,e){return o(this.attributeData[e],t)}getAttributeAsTimestamp(t,e){const r=this.getAttribute(t,e);return"string"==typeof r?new Date(r).getTime():"number"==typeof r||null==r?r:null}}export{u as TemporalSceneLayerView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import{packFloatRGBA as t}from"../../../../core/floatRGBA.js";import{freeze as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Texture as n}from"../../webgl-engine/lib/Texture.js";import{TextureWrapMode as e}from"../../../webgl/enums.js";const o=128,a=.5,c=r(a/2,a/2,1-a/2,1-a/2);function s(t){return"cross"===t||"x"===t}function u(t,r=o,c=r*a,s=0){const u=i(t,r,c,s);return new n(u,{mipmap:!1,wrap:{s:e.CLAMP_TO_EDGE,t:e.CLAMP_TO_EDGE},width:r,height:r,components:4,noUnpackFlip:!0,reloadable:!0})}function i(t,r=o,n=r*a,e=0){switch(t){case"circle":default:return f(r,n);case"square":return h(r,n);case"cross":return l(r,n,e);case"x":return m(r,n,e);case"kite":return M(r,n);case"triangle":return p(r,n);case"arrow":return b(r,n)}}function f(t,r){const n=t/2-.5;return g(t,x(n,n,r/2))}function h(t,r){return T(t,r,!1)}function M(t,r){return T(t,r,!0)}function l(t,r,n=0){return w(t,r,!1,n)}function m(t,r,n=0){return w(t,r,!0,n)}function p(t,r){return g(t,R(t/2,r,r/2))}function b(t,r){const n=r,e=r/2,o=t/2,a=.8*n,c=x(o,(t-r)/2-a,Math.sqrt(a*a+e*e)),s=R(o,n,e);return g(t,((t,r)=>Math.max(s(t,r),-c(t,r))))}function T(t,r,n){return n&&(r/=Math.SQRT2),g(t,((e,o)=>{let a=e-.5*t+.25,c=.5*t-o-.75;if(n){const t=(a+c)/Math.SQRT2;c=(c-a)/Math.SQRT2,a=t}return Math.max(Math.abs(a),Math.abs(c))-.5*r}))}function w(t,r,n,e=0){r-=e,n&&(r*=Math.SQRT2);const o=.5*r;return g(t,((r,a)=>{let c,s=r-.5*t,u=.5*t-a-1;if(n){const t=(s+u)/Math.SQRT2;u=(u-s)/Math.SQRT2,s=t}return s=Math.abs(s),u=Math.abs(u),c=s>u?s>o?Math.sqrt((s-o)*(s-o)+u*u):u:u>o?Math.sqrt(s*s+(u-o)*(u-o)):s,c-=e/2,c}))}function x(t,r,n){return(e,o)=>{const a=e-t,c=o-r;return Math.sqrt(a*a+c*c)-n}}function R(t,r,n){const e=Math.sqrt(r*r+n*n);return(o,a)=>{const c=Math.abs(o-t)-n,s=a-t+r/2+.75,u=(r*c+n*s)/e,i=-s;return Math.max(u,i)}}function g(r,n){const e=new Uint8Array(4*r*r);for(let o=0;o<r;o++)for(let a=0;a<r;a++){const c=a+r*o;let s=n(a,o);s=s/r+.5,t(s,e,4*c)}return e}export{b as createArrow,f as createCircle,l as createCross,M as createKite,i as createPrimitive,h as createSquare,u as createTexture,p as createTriangle,m as createX,c as defaultBoundingBox,a as defaultSymbolSizeRatio,o as defaultTexSize,s as requiresHalfTexelOffset};
5
+ import"../../../../core/has.js";import{packFloatRGBA as t}from"../../../../core/floatRGBA.js";import{freeze as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Texture as n}from"../../webgl-engine/lib/Texture.js";import{TextureWrapMode as e}from"../../../webgl/enums.js";const a=128,o=.5,s=r(o/2,o/2,1-o/2,1-o/2);function c(t){return"cross"===t||"x"===t}function u(t,r=a,e=r*o,s=0){const{data:c,parameters:u}=i(t,r,e,s);return new n(c,u)}function i(t,r=a,n=r*o,s=0){return{data:f(t,r,n,s),parameters:{mipmap:!1,wrap:{s:e.CLAMP_TO_EDGE,t:e.CLAMP_TO_EDGE},width:r,height:r,components:4,noUnpackFlip:!0,reloadable:!0}}}function f(t,r=a,n=r*o,e=0){switch(t){case"circle":default:return h(r,n);case"square":return M(r,n);case"cross":return l(r,n,e);case"x":return p(r,n,e);case"kite":return m(r,n);case"triangle":return b(r,n);case"arrow":return T(r,n)}}function h(t,r){const n=t/2-.5;return q(t,R(n,n,r/2))}function M(t,r){return w(t,r,!1)}function m(t,r){return w(t,r,!0)}function l(t,r,n=0){return x(t,r,!1,n)}function p(t,r,n=0){return x(t,r,!0,n)}function b(t,r){return q(t,g(t/2,r,r/2))}function T(t,r){const n=r,e=r/2,a=t/2,o=.8*n,s=R(a,(t-r)/2-o,Math.sqrt(o*o+e*e)),c=g(a,n,e);return q(t,((t,r)=>Math.max(c(t,r),-s(t,r))))}function w(t,r,n){return n&&(r/=Math.SQRT2),q(t,((e,a)=>{let o=e-.5*t+.25,s=.5*t-a-.75;if(n){const t=(o+s)/Math.SQRT2;s=(s-o)/Math.SQRT2,o=t}return Math.max(Math.abs(o),Math.abs(s))-.5*r}))}function x(t,r,n,e=0){r-=e,n&&(r*=Math.SQRT2);const a=.5*r;return q(t,((r,o)=>{let s,c=r-.5*t,u=.5*t-o-1;if(n){const t=(c+u)/Math.SQRT2;u=(u-c)/Math.SQRT2,c=t}return c=Math.abs(c),u=Math.abs(u),s=c>u?c>a?Math.sqrt((c-a)*(c-a)+u*u):u:u>a?Math.sqrt(c*c+(u-a)*(u-a)):c,s-=e/2,s}))}function R(t,r,n){return(e,a)=>{const o=e-t,s=a-r;return Math.sqrt(o*o+s*s)-n}}function g(t,r,n){const e=Math.sqrt(r*r+n*n);return(a,o)=>{const s=Math.abs(a-t)-n,c=o-t+r/2+.75,u=(r*s+n*c)/e,i=-c;return Math.max(u,i)}}function q(r,n){const e=new Uint8Array(4*r*r);for(let a=0;a<r;a++)for(let o=0;o<r;o++){const s=o+r*a;let c=n(o,a);c=c/r+.5,t(c,e,4*s)}return e}export{T as createArrow,h as createCircle,l as createCross,m as createKite,f as createPrimitive,M as createSquare,u as createTexture,i as createTextureInfo,b as createTriangle,p as createX,s as defaultBoundingBox,o as defaultSymbolSizeRatio,a as defaultTexSize,c as requiresHalfTexelOffset};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import{ColorFormat as t,DepthRenderbuffer16f as r}from"../../webgl/formats.js";import{ManagedColorAttachment as a}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthAttachment as o}from"../../webgl/ManagedDepthAttachment.js";import n from"../../webgl/ManagedFBO.js";import{AttachmentType as i}from"../../webgl/ManagedFBOResource.js";import{FBOPool as c}from"./FBOPool.js";import{PixelFormat as h,SizedPixelFormat as s,TextureWrapMode as m,TextureSamplingMode as l,PixelType as d,DepthStencilAttachment as _,RenderbufferFormat as p,ColorAttachment0 as u}from"../../../webgl/enums.js";import{FramebufferObject as f}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as w}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as E}from"../../../webgl/RenderbufferDescriptor.js";import{Texture as C}from"../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../webgl/TextureDescriptor.js";class A{constructor(e){this.rctx=e,this._acquired=new Set,this._cache=new c(e.newCache,"FBOCache"),this._depthCache=new c(e.newCache,"DepthAttachmentCache"),this._colorCache=new c(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.()}frameEnd(){const e=this.debugCallback;e&&this._acquired.forEach((t=>t.type===i.FBO&&e(t.name,t.fbo,t.numberOfColorAttachments)))}get usedMemory(){return Array.from(this._acquired.values()).reduce(((e,t)=>e+("getTexture"in t?t.getTexture()?.usedMemory??0:t.cachedMemory)),this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e}acquire(r,a,o,i=t.RGBA8){const c=T(i,r,a);let h=this._cache.pop(c);if(h){h.retain(),h.setName(o);const t=this.rctx.getBoundFramebufferObject();if(this.rctx.bindFramebuffer(h.fbo),this.rctx.setDrawBuffers([u]),!h.fbo)throw new e("attempt to use a not existing framebuffer");this.rctx.unbindTexture(h.fbo.colorTexture),this.rctx.bindFramebuffer(t)}else h=new n(c,o,new f(this.rctx,{...P[i],width:r,height:a}),(e=>{e??=_;const t=this._acquireDepth(e,h.fbo.width,h.fbo.height,`${h.name} depth`);return h.attachDepth(t),t.release(),h}),((e,o,n)=>{o??=t.RGBA8;const i=this._acquireColor(o,r,a,n??`${h.name} color ${e}`);return this.rctx.unbindTexture(i.attachment),h.attachColor(i,e),i.release(),h}),(()=>{this.debugCallback?.(h.name,h.fbo,h.numberOfColorAttachments),h.fbo?.invalidateAttachments([u],!0),this._acquired.delete(h),h.detachAll(),this._cache.put(h)}));return this._trackHandle(h)}acquireDepth(e,t,r,a){return this._acquireDepth(e,t,r,a)}_acquireDepth(e,t,r,a){const n=T(e,t,r),i=this._depthCache.pop(n);if(i)return i.retain(),i.name=a,this._trackHandle(i);const c=new o(n,e===_?new C(this.rctx,{...j[e],width:t,height:r}):new w(this.rctx,{...j[e],width:t,height:r}),(()=>{this._acquired.delete(c),this._depthCache.put(c)}));return c.name=a,this._trackHandle(c)}_acquireColor(e,t,r,o){const n=T(e,t,r),i=this._colorCache.pop(n);if(i)return i.retain(),i.name=o,this._trackHandle(i);const c=new a(n,new C(this.rctx,{...P[e],width:t,height:r}),(()=>{this._acquired.delete(c),this._colorCache.put(c)}));return c.name=o,this._trackHandle(c)}_trackHandle(e){return this._acquired.add(e),e}}const M=new n("default","default",null,(()=>M),(()=>M),(()=>{}));function T(e,t,r){return`${e}x${t}x${r}`}M.release=()=>!1;const R=new b;R.pixelFormat=h.RED,R.internalFormat=s.R8,R.wrapMode=m.CLAMP_TO_EDGE;const g=new b;g.pixelFormat=h.RED_INTEGER,g.internalFormat=s.R8UI,g.wrapMode=m.CLAMP_TO_EDGE,g.samplingMode=l.NEAREST;const F=new b;F.pixelFormat=h.RG,F.internalFormat=s.RG8,F.wrapMode=m.CLAMP_TO_EDGE;const x=new b;x.pixelFormat=h.RG_INTEGER,x.internalFormat=s.RG8UI,x.wrapMode=m.CLAMP_TO_EDGE,x.samplingMode=l.NEAREST;const D=new b;D.internalFormat=s.RGBA4,D.dataType=d.UNSIGNED_SHORT_4_4_4_4,D.wrapMode=m.CLAMP_TO_EDGE;const G=new b;G.wrapMode=m.CLAMP_TO_EDGE;const O=new b;O.wrapMode=m.CLAMP_TO_EDGE,O.samplingMode=l.LINEAR_MIPMAP_LINEAR,O.hasMipmap=!0,O.maxAnisotropy=8;const N=new b;N.pixelFormat=h.RED,N.dataType=d.HALF_FLOAT,N.internalFormat=s.R16F,N.samplingMode=l.NEAREST;const y=new b;y.dataType=d.HALF_FLOAT,y.internalFormat=s.RGBA16F,y.samplingMode=l.NEAREST;const P={[t.R8]:R,[t.R8UI]:g,[t.RG8]:F,[t.RG8UI]:x,[t.RGBA4]:D,[t.RGBA8]:G,[t.RGBA8_MIPMAP]:O,[t.R16F]:N,[t.RGBA16F]:y},L=new b;L.pixelFormat=h.DEPTH_STENCIL,L.dataType=d.UNSIGNED_INT_24_8,L.samplingMode=l.NEAREST,L.wrapMode=m.CLAMP_TO_EDGE,L.internalFormat=h.DEPTH24_STENCIL8;const j={[_]:L,[r]:new E(p.DEPTH_COMPONENT16,4)};export{A as FBOCache,M as defaultWebGLFBO};
5
+ import e from"../../../../core/Error.js";import{ColorFormat as t,DepthRenderbuffer16f as r}from"../../webgl/formats.js";import{ManagedColorAttachment as a}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthAttachment as o}from"../../webgl/ManagedDepthAttachment.js";import n from"../../webgl/ManagedFBO.js";import{AttachmentType as i}from"../../webgl/ManagedFBOResource.js";import{FBOPool as c}from"./FBOPool.js";import{PixelFormat as h,SizedPixelFormat as s,TextureWrapMode as m,TextureSamplingMode as l,PixelType as d,DepthStencilAttachment as _,RenderbufferFormat as p,ColorAttachment0 as u}from"../../../webgl/enums.js";import{FramebufferObject as f}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as w}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as E}from"../../../webgl/RenderbufferDescriptor.js";import{Texture as C}from"../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../webgl/TextureDescriptor.js";class A{constructor(e){this.rctx=e,this._acquired=new Set,this._cache=new c(e.newCache,"FBOCache"),this._depthCache=new c(e.newCache,"DepthAttachmentCache"),this._colorCache=new c(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.()}frameEnd(){const e=this.debugCallback;e&&this._acquired.forEach((t=>t.type===i.FBO&&e(t.name,t.fbo,t.numberOfColorAttachments)))}get usedMemory(){return Array.from(this._acquired.values()).reduce(((e,t)=>e+("getTexture"in t?t.getTexture()?.usedMemory??0:t.cachedMemory)),this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e}acquire(r,a,o,i=t.RGBA8){const c=T(i,r,a);let h=this._cache.pop(c);if(h){h.retain(),h.setName(o);const t=this.rctx.getBoundFramebufferObject();if(this.rctx.bindFramebuffer(h.fbo),this.rctx.setDrawBuffers([u]),!h.fbo)throw new e("renderer","attempt to use a not existing framebuffer");this.rctx.unbindTexture(h.fbo.colorTexture),this.rctx.bindFramebuffer(t)}else h=new n(c,o,new f(this.rctx,{...P[i],width:r,height:a}),(e=>{e??=_;const t=this._acquireDepth(e,h.fbo.width,h.fbo.height,`${h.name} depth`);return h.attachDepth(t),t.release(),h}),((e,o,n)=>{o??=t.RGBA8;const i=this._acquireColor(o,r,a,n??`${h.name} color ${e}`);return this.rctx.unbindTexture(i.attachment),h.attachColor(i,e),i.release(),h}),(()=>{this.debugCallback?.(h.name,h.fbo,h.numberOfColorAttachments),h.fbo?.invalidateAttachments([u],!0),this._acquired.delete(h),h.detachAll(),this._cache.put(h)}));return this._trackHandle(h)}acquireDepth(e,t,r,a){return this._acquireDepth(e,t,r,a)}_acquireDepth(e,t,r,a){const n=T(e,t,r),i=this._depthCache.pop(n);if(i)return i.retain(),i.name=a,this._trackHandle(i);const c=new o(n,e===_?new C(this.rctx,{...j[e],width:t,height:r}):new w(this.rctx,{...j[e],width:t,height:r}),(()=>{this._acquired.delete(c),this._depthCache.put(c)}));return c.name=a,this._trackHandle(c)}_acquireColor(e,t,r,o){const n=T(e,t,r),i=this._colorCache.pop(n);if(i)return i.retain(),i.name=o,this._trackHandle(i);const c=new a(n,new C(this.rctx,{...P[e],width:t,height:r}),(()=>{this._acquired.delete(c),this._colorCache.put(c)}));return c.name=o,this._trackHandle(c)}_trackHandle(e){return this._acquired.add(e),e}}const M=new n("default","default",null,(()=>M),(()=>M),(()=>{}));function T(e,t,r){return`${e}x${t}x${r}`}M.release=()=>!1;const R=new b;R.pixelFormat=h.RED,R.internalFormat=s.R8,R.wrapMode=m.CLAMP_TO_EDGE;const g=new b;g.pixelFormat=h.RED_INTEGER,g.internalFormat=s.R8UI,g.wrapMode=m.CLAMP_TO_EDGE,g.samplingMode=l.NEAREST;const F=new b;F.pixelFormat=h.RG,F.internalFormat=s.RG8,F.wrapMode=m.CLAMP_TO_EDGE;const x=new b;x.pixelFormat=h.RG_INTEGER,x.internalFormat=s.RG8UI,x.wrapMode=m.CLAMP_TO_EDGE,x.samplingMode=l.NEAREST;const D=new b;D.internalFormat=s.RGBA4,D.dataType=d.UNSIGNED_SHORT_4_4_4_4,D.wrapMode=m.CLAMP_TO_EDGE;const G=new b;G.wrapMode=m.CLAMP_TO_EDGE;const O=new b;O.wrapMode=m.CLAMP_TO_EDGE,O.samplingMode=l.LINEAR_MIPMAP_LINEAR,O.hasMipmap=!0,O.maxAnisotropy=8;const N=new b;N.pixelFormat=h.RED,N.dataType=d.HALF_FLOAT,N.internalFormat=s.R16F,N.samplingMode=l.NEAREST;const y=new b;y.dataType=d.HALF_FLOAT,y.internalFormat=s.RGBA16F,y.samplingMode=l.NEAREST;const P={[t.R8]:R,[t.R8UI]:g,[t.RG8]:F,[t.RG8UI]:x,[t.RGBA4]:D,[t.RGBA8]:G,[t.RGBA8_MIPMAP]:O,[t.R16F]:N,[t.RGBA16F]:y},L=new b;L.pixelFormat=h.DEPTH_STENCIL,L.dataType=d.UNSIGNED_INT_24_8,L.samplingMode=l.NEAREST,L.wrapMode=m.CLAMP_TO_EDGE,L.internalFormat=h.DEPTH24_STENCIL8;const j={[_]:L,[r]:new E(p.DEPTH_COMPONENT16,4)};export{A as FBOCache,M as defaultWebGLFBO};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../core/Error.js";import{ShaderTechniqueConfigurationKey as t}from"./ShaderTechniqueConfigurationKey.js";import{NoParameters as r}from"../../../../webgl/NoParameters.js";class a extends r{constructor(){super(),this._parameterBits=this._parameterBits?.map((()=>0))??[],this._parameterNames??=[]}get key(){return this._key??=new t(this._parameterBits),this._key}decode(e=this.key){const t=this._parameterBits;this._parameterBits=[...e.bits];const r=this._parameterNames.map((e=>` ${e}: ${this[e]}`)).join("\n");return this._parameterBits=t,r}}function i(t={}){return(r,a)=>{r.hasOwnProperty("_parameterNames")||Object.defineProperty(r,"_parameterNames",{value:r._parameterNames?.slice()??[],configurable:!0,writable:!0}),r.hasOwnProperty("_parameterBits")||Object.defineProperty(r,"_parameterBits",{value:r._parameterBits?.slice()??[0],configurable:!0,writable:!0}),r._parameterNames.push(a);const i=t.count||2,s=Math.ceil(Math.log2(i)),o=r._parameterBits;let n=0;for(;o[n]+s>16;)n++,n>=o.length&&o.push(0);const p=o[n],m=(1<<s)-1<<p;o[n]+=s,t.count?Object.defineProperty(r,a,{get(){return(this._parameterBits[n]&m)>>p},set(r){if(this[a]!==r){if(this._key=null,this._parameterBits[n]=this._parameterBits[n]&~m|+r<<p&m,"number"!=typeof r)throw new e(`Configuration value for ${a} must be a number, got ${typeof r}`);if(null==t.count)throw new e(`Configuration value for ${a} must provide a count option`)}}}):Object.defineProperty(r,a,{get(){return!!((this._parameterBits[n]&m)>>p)},set(t){if(this[a]!==t&&(this._key=null,this._parameterBits[n]=this._parameterBits[n]&~m|+t<<p&m,"boolean"!=typeof t))throw new e(`Configuration value for ${a} must be boolean, got ${typeof t}`)}})}}export{a as ShaderTechniqueConfiguration,i as parameter};
5
+ import e from"../../../../../core/Error.js";import{ShaderTechniqueConfigurationKey as t}from"./ShaderTechniqueConfigurationKey.js";import{NoParameters as r}from"../../../../webgl/NoParameters.js";class a extends r{constructor(){super(),this._parameterBits=this._parameterBits?.map((()=>0))??[],this._parameterNames??=[]}get key(){return this._key??=new t(this._parameterBits),this._key}decode(e=this.key){const t=this._parameterBits;this._parameterBits=[...e.bits];const r=this._parameterNames.map((e=>` ${e}: ${this[e]}`)).join("\n");return this._parameterBits=t,r}}function i(t={}){return(r,a)=>{r.hasOwnProperty("_parameterNames")||Object.defineProperty(r,"_parameterNames",{value:r._parameterNames?.slice()??[],configurable:!0,writable:!0}),r.hasOwnProperty("_parameterBits")||Object.defineProperty(r,"_parameterBits",{value:r._parameterBits?.slice()??[0],configurable:!0,writable:!0}),r._parameterNames.push(a);const i=t.count||2,s=Math.ceil(Math.log2(i)),o=r._parameterBits;let n=0;for(;o[n]+s>16;)n++,n>=o.length&&o.push(0);const p=o[n],m=(1<<s)-1<<p;o[n]+=s,t.count?Object.defineProperty(r,a,{get(){return(this._parameterBits[n]&m)>>p},set(r){if(this[a]!==r){if(this._key=null,this._parameterBits[n]=this._parameterBits[n]&~m|+r<<p&m,"number"!=typeof r)throw new e("internal:invalid-shader-configuration",`Configuration value for ${a} must be a number, got ${typeof r}`);if(null==t.count)throw new e("internal:invalid-shader-configuration",`Configuration value for ${a} must provide a count option`)}}}):Object.defineProperty(r,a,{get(){return!!((this._parameterBits[n]&m)>>p)},set(t){if(this[a]!==t&&(this._key=null,this._parameterBits[n]=this._parameterBits[n]&~m|+t<<p&m,"boolean"!=typeof t))throw new e("internal:invalid-shader-configuration",`Configuration value for ${a} must be boolean, got ${typeof t}`)}})}}export{a as ShaderTechniqueConfiguration,i as parameter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../core/Error.js";import"../../../../../core/has.js";import{NestedMap as t}from"../../../../../core/NestedMap.js";import{ShaderTechniqueConfiguration as i}from"./ShaderTechniqueConfiguration.js";class o{constructor(e){this.context=e,this._debug=!1,this._precompiling=this._debug?0:1,this._cache=new t}get precompiling(){return this._precompiling}set precompiling(e){this._precompiling=e,0===e&&this.context.rctx.gl.flush()}get viewingMode(){return this.context.viewingMode}destroy(){this._cache.forAll((e=>e.destroy())),this._cache.clear()}precompile(e,t=r){++this.precompiling,this.get(e,t),--this.precompiling}get(t,i=r){const o=i.key.code;let c=this._cache.get(t,o);if(null==c){if(0===this._precompiling){let o=`Uncached shader compile in ${(new Error).stack}\n for configuration\n${i.decode()}`;const c=this._cache.getInner(t);throw c?.size&&(o+="\n\n cached configurations:\n",o+=Array.from(c.values()).map((e=>i.decode(e.key))).sort().join("\n\n")),console.log(o),new e(o)}c=new t(this.context,i),this._cache.set(t,o,c)}return c}async reloadAll(){const e=new Array;this._cache.forEach((t=>e.push(c(t)))),await Promise.all(e)}}async function c(e){let t=!0;e.forEach((async e=>{await e.reload(t),t=!1}))}const r=new i;export{r as NoConfiguration,o as ShaderTechniqueRepository};
5
+ import e from"../../../../../core/Error.js";import"../../../../../core/has.js";import{NestedMap as t}from"../../../../../core/NestedMap.js";import{ShaderTechniqueConfiguration as i}from"./ShaderTechniqueConfiguration.js";class o{constructor(e){this.context=e,this._debug=!1,this._precompiling=this._debug?0:1,this._cache=new t}get precompiling(){return this._precompiling}set precompiling(e){this._precompiling=e,0===e&&this.context.rctx.gl.flush()}get viewingMode(){return this.context.viewingMode}destroy(){this._cache.forAll((e=>e.destroy())),this._cache.clear()}precompile(e,t=c){++this.precompiling,this.get(e,t),--this.precompiling}get(t,i=c){const o=i.key.code;let r=this._cache.get(t,o);if(null==r){if(0===this._precompiling){let o=`Uncached shader compile in ${(new Error).stack}\n for configuration\n${i.decode()}`;const r=this._cache.getInner(t);throw r?.size&&(o+="\n\n cached configurations:\n",o+=Array.from(r.values()).map((e=>i.decode(e.key))).sort().join("\n\n")),console.log(o),new e("shader",o)}r=new t(this.context,i),this._cache.set(t,o,r)}return r}async reloadAll(){const e=new Array;this._cache.forEach((t=>e.push(r(t)))),await Promise.all(e)}}async function r(e){let t=!0;e.forEach((async e=>{await e.reload(t),t=!1}))}const c=new i;export{c as NoConfiguration,o as ShaderTechniqueRepository};