@arcgis/core 5.0.0-next.43 → 5.0.0-next.44

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 (305) hide show
  1. package/applications/Components/imageryUtils.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{f97a7cb367634353177d.js → 001a7a4cf6fe74432ed6.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{324d66962aeec17d3e28.js → 1e0e7cef7ef947894bbe.js} +1 -1
  5. package/assets/esri/core/workers/chunks/20ad34f9d45c64392022.js +1 -0
  6. package/assets/esri/core/workers/chunks/23396a6318edf9264c1f.js +1 -0
  7. package/assets/esri/core/workers/chunks/{ad891ac388fa6c1c9b94.js → 2b34a010f76e5f289868.js} +1 -1
  8. package/assets/esri/core/workers/chunks/2ef4c0092c59a98a5532.js +1 -0
  9. package/assets/esri/core/workers/chunks/35272810c2ed04eb403d.js +1 -0
  10. package/assets/esri/core/workers/chunks/{d1f4152b2b8d47cbf586.js → 72fbee59d5d909615408.js} +1 -1
  11. package/assets/esri/core/workers/chunks/75c66e38bdc1c786c599.js +1 -0
  12. package/assets/esri/core/workers/chunks/7d3c2a063598bdd015e2.js +1 -0
  13. package/assets/esri/core/workers/chunks/897ce6fc9cefb1e14a64.js +1 -0
  14. package/assets/esri/core/workers/chunks/992e9bbdf9d3787ddb0e.js +1 -0
  15. package/assets/esri/core/workers/chunks/a2442549c5daf3653eb4.js +1 -0
  16. package/assets/esri/core/workers/chunks/a7cd795042ebb8585906.js +1 -0
  17. package/assets/esri/core/workers/chunks/{385cfd3087f00dbd1146.js → ca1c65eb7f5900c60170.js} +1 -1
  18. package/assets/esri/core/workers/chunks/cddce67919e13e2f365e.js +1 -0
  19. package/assets/esri/core/workers/chunks/e6784251bbb8b71ead93.js +1 -0
  20. package/assets/esri/core/workers/chunks/{96f798ee286b59396131.js → ea3cba01c60d9bc72719.js} +1 -1
  21. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  22. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  23. package/config.js +1 -1
  24. package/interfaces.d.ts +78 -2
  25. package/kernel.js +1 -1
  26. package/layers/ImageryTileLayer.js +1 -1
  27. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  28. package/layers/WCSLayer.js +1 -1
  29. package/layers/mixins/ArcGISImageService.js +1 -1
  30. package/layers/mixins/ImageryTileMixin.js +1 -1
  31. package/layers/mixins/RasterJobHandlerMixin.js +1 -1
  32. package/layers/ogc/wcsUtils.js +1 -1
  33. package/layers/raster/datasets/BaseRaster.js +5 -0
  34. package/layers/raster/datasets/CovJSONRaster.js +5 -0
  35. package/layers/raster/datasets/FunctionRaster.js +5 -0
  36. package/layers/raster/datasets/ImageAuxRaster.js +5 -0
  37. package/layers/raster/datasets/ImageServerRaster.js +5 -0
  38. package/layers/raster/datasets/InMemoryRaster.js +5 -0
  39. package/layers/raster/datasets/MRFRaster.js +5 -0
  40. package/layers/raster/datasets/RawBlockCache.js +5 -0
  41. package/layers/raster/datasets/TIFFRaster.js +5 -0
  42. package/layers/raster/datasets/WCSRaster.js +5 -0
  43. package/layers/raster/datasets/covJSONParser.js +5 -0
  44. package/layers/raster/datasets/multidimensionalUtils.js +5 -0
  45. package/layers/raster/datasets/pamParser.js +5 -0
  46. package/layers/raster/datasets/pixelReader.js +5 -0
  47. package/layers/raster/datasets/wcsCoverageParser.js +5 -0
  48. package/layers/raster/formats/Lerc.js +5 -0
  49. package/layers/raster/formats/Qb3.js +5 -0
  50. package/layers/raster/formats/RasterCodec.js +5 -0
  51. package/layers/raster/formats/TiffDecoder.js +5 -0
  52. package/layers/raster/functions/ArithmeticFunction.js +5 -0
  53. package/layers/{support/rasterFunctions → raster/functions}/ArithmeticFunctionArguments.js +1 -1
  54. package/layers/{support/rasterFunctions → raster/functions}/AspectFunction.js +1 -1
  55. package/layers/{support/rasterFunctions → raster/functions}/AspectFunctionArguments.js +1 -1
  56. package/layers/raster/functions/BandArithmeticFunction.js +5 -0
  57. package/layers/{support/rasterFunctions → raster/functions}/BandArithmeticFunctionArguments.js +1 -1
  58. package/layers/{support/rasterFunctions → raster/functions}/BaseFunctionArguments.js +1 -1
  59. package/layers/raster/functions/BaseRasterFunction.js +5 -0
  60. package/layers/{support/rasterFunctions → raster/functions}/ClipFunction.js +1 -1
  61. package/layers/{support/rasterFunctions → raster/functions}/ClipFunctionArguments.js +1 -1
  62. package/layers/raster/functions/ColormapFunction.js +5 -0
  63. package/layers/{support/rasterFunctions → raster/functions}/ColormapFunctionArguments.js +1 -1
  64. package/layers/raster/functions/ColormapToRGBFunction.js +5 -0
  65. package/layers/{support/rasterFunctions → raster/functions}/ColormapToRGBFunctionArguments.js +1 -1
  66. package/layers/raster/functions/CompositeBandFunction.js +5 -0
  67. package/layers/raster/functions/CompositeBandFunctionArguments.js +5 -0
  68. package/layers/raster/functions/ComputeChangeFunction.js +5 -0
  69. package/layers/{support/rasterFunctions → raster/functions}/ComputeChangeFunctionArguments.js +1 -1
  70. package/layers/{support/rasterFunctions → raster/functions}/ContrastBrightnessFunction.js +1 -1
  71. package/layers/{support/rasterFunctions → raster/functions}/ContrastBrightnessFunctionArguments.js +1 -1
  72. package/layers/raster/functions/ConvolutionFunction.js +5 -0
  73. package/layers/raster/functions/ConvolutionFunctionArguments.js +5 -0
  74. package/layers/{support/rasterFunctions → raster/functions}/CurvatureFunction.js +1 -1
  75. package/layers/{support/rasterFunctions → raster/functions}/CurvatureFunctionArguments.js +1 -1
  76. package/layers/{support/rasterFunctions → raster/functions}/ExtractBandFunction.js +1 -1
  77. package/layers/{support/rasterFunctions → raster/functions}/ExtractBandFunctionArguments.js +1 -1
  78. package/layers/{support/rasterFunctions → raster/functions}/GrayscaleFunction.js +1 -1
  79. package/layers/{support/rasterFunctions → raster/functions}/GrayscaleFunctionArguments.js +1 -1
  80. package/layers/raster/functions/HillshadeFunction.js +5 -0
  81. package/layers/{support/rasterFunctions → raster/functions}/HillshadeFunctionArguments.js +1 -1
  82. package/layers/raster/functions/LocalFunction.js +5 -0
  83. package/layers/{support/rasterFunctions → raster/functions}/LocalFunctionArguments.js +1 -1
  84. package/layers/{support/rasterFunctions → raster/functions}/MaskFunction.js +1 -1
  85. package/layers/{support/rasterFunctions → raster/functions}/MaskFunctionArguments.js +1 -1
  86. package/layers/{support/rasterFunctions → raster/functions}/NDVIFunction.js +1 -1
  87. package/layers/{support/rasterFunctions → raster/functions}/NDVIFunctionArguments.js +1 -1
  88. package/layers/raster/functions/RemapFunction.js +5 -0
  89. package/layers/{support/rasterFunctions → raster/functions}/RemapFunctionArguments.js +1 -1
  90. package/layers/raster/functions/ShadedReliefFunction.js +5 -0
  91. package/layers/{support/rasterFunctions → raster/functions}/ShadedReliefFunctionArguments.js +1 -1
  92. package/layers/raster/functions/SlopeFunction.js +5 -0
  93. package/layers/{support/rasterFunctions → raster/functions}/SlopeFunctionArguments.js +1 -1
  94. package/layers/raster/functions/StatisticsFunction.js +5 -0
  95. package/layers/{support/rasterFunctions → raster/functions}/StatisticsFunctionArguments.js +1 -1
  96. package/layers/{support/rasterFunctions → raster/functions}/StatisticsHistogramFunction.js +1 -1
  97. package/layers/{support/rasterFunctions → raster/functions}/StatisticsHistogramFunctionArguments.js +1 -1
  98. package/layers/raster/functions/StretchFunction.js +5 -0
  99. package/layers/{support/rasterFunctions → raster/functions}/StretchFunctionArguments.js +1 -1
  100. package/layers/{support/rasterFunctions → raster/functions}/TableFunction.js +1 -1
  101. package/layers/{support/rasterFunctions → raster/functions}/TableFunctionArguments.js +1 -1
  102. package/layers/raster/functions/bandIndexUtils.js +5 -0
  103. package/layers/raster/functions/changeDetectionUtils.js +5 -0
  104. package/layers/raster/functions/clipUtils.js +5 -0
  105. package/layers/raster/functions/conversionUtils.js +5 -0
  106. package/layers/raster/functions/convolutionUtils.js +5 -0
  107. package/layers/raster/functions/creators/createDataManagementFunctions.js +5 -0
  108. package/layers/raster/functions/creators/utils.js +5 -0
  109. package/layers/raster/functions/focalStatUtils.js +5 -0
  110. package/layers/raster/functions/localUtils.js +5 -0
  111. package/layers/raster/functions/pixelTransformUtils.js +5 -0
  112. package/layers/raster/functions/pixelUtils.js +5 -0
  113. package/layers/raster/functions/stretchUtils.js +5 -0
  114. package/layers/raster/functions/surfaceUtils.js +5 -0
  115. package/layers/raster/functions/vectorFieldUtils.js +5 -0
  116. package/layers/raster/transforms/BaseRasterTransform.js +5 -0
  117. package/layers/{support/rasterTransforms → raster/transforms}/GCSShiftTransform.js +1 -1
  118. package/layers/{support/rasterTransforms → raster/transforms}/IdentityTransform.js +1 -1
  119. package/layers/{support/rasterTransforms → raster/transforms}/PolynomialTransform.js +1 -1
  120. package/layers/save/imageryUtils.js +1 -1
  121. package/layers/support/PixelBlock.js +1 -1
  122. package/layers/support/RasterWorker.js +1 -1
  123. package/layers/support/imageryRendererUtils.js +1 -1
  124. package/layers/support/rasterFunctionUtils.js +1 -1
  125. package/package.json +1 -1
  126. package/renderers/VectorFieldRenderer.js +1 -1
  127. package/renderers/support/RasterSymbolizer.js +1 -1
  128. package/renderers/support/rasterRendererHelper.js +1 -1
  129. package/rest/locator/addressToLocations.js +1 -1
  130. package/rest/locator/addressesToLocations.js +1 -1
  131. package/rest/locator/suggestLocations.js +1 -1
  132. package/rest/networks/support/Association.js +1 -1
  133. package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
  134. package/smartMapping/raster/support/adapters/ImageryTileLayerAdapter.js +1 -1
  135. package/support/revision.js +1 -1
  136. package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
  137. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterRangeHighlightShader.js +1 -1
  138. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MaskShader.js +1 -1
  139. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/RemapShader.js +1 -1
  140. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/math.js +1 -1
  141. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  142. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  143. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  144. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  145. package/views/2d/layers/imagery/ImageryView2D.js +1 -1
  146. package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
  147. package/views/2d/layers/imagery/VectorFieldView2D.js +1 -1
  148. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  149. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  150. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  151. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  152. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  153. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
  154. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +1 -1
  155. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  156. package/views/3d/webgl-engine/materials/DrawParameters.js +1 -1
  157. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  158. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  159. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  160. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  161. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  162. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  163. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  164. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  165. package/views/3d/webgl-engine/materials/renderers/Instance.js +1 -1
  166. package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
  167. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  168. package/views/3d/webgl-engine/materials/renderers/PerOriginData.js +1 -1
  169. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  170. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  171. package/views/DOMContainer.js +1 -1
  172. package/views/GroundView.js +1 -1
  173. package/views/layers/ImageryLayerViewMixin.js +1 -1
  174. package/views/layers/ImageryTileLayerViewMixin.js +1 -1
  175. package/views/support/imageReprojection.js +1 -1
  176. package/widgets/BatchAttributeForm.js +1 -1
  177. package/widgets/BuildingExplorer/BuildingExplorerViewModel.js +1 -1
  178. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  179. package/widgets/CoordinateConversion.js +1 -1
  180. package/widgets/DirectLineMeasurement3D.js +1 -1
  181. package/widgets/DistanceMeasurement2D.js +1 -1
  182. package/widgets/Editor/EditorViewModel.js +1 -1
  183. package/widgets/Editor.js +1 -1
  184. package/widgets/ElevationProfile.js +1 -1
  185. package/widgets/Feature.js +1 -1
  186. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  187. package/widgets/FeatureForm.js +1 -1
  188. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  189. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  190. package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
  191. package/widgets/FeatureTable/support/TableTemplate.js +1 -1
  192. package/widgets/FeatureTable.js +1 -1
  193. package/widgets/FeatureTemplates.js +1 -1
  194. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  195. package/widgets/Legend.js +1 -1
  196. package/widgets/LineOfSight.js +1 -1
  197. package/widgets/Locate.js +1 -1
  198. package/widgets/OrientedImageryViewer/galleryUtils.js +1 -1
  199. package/widgets/OrientedImageryViewer/services/DepthImageService.js +1 -1
  200. package/widgets/PanoramicViewer/support/importUtils.js +1 -1
  201. package/widgets/Print.js +1 -1
  202. package/widgets/ScaleBar.js +1 -1
  203. package/widgets/ScaleRangeSlider.js +1 -1
  204. package/widgets/Search/SearchResultRenderer.js +1 -1
  205. package/widgets/Search/SearchViewModel.js +1 -1
  206. package/widgets/Search/types.js +1 -1
  207. package/widgets/Search.js +1 -1
  208. package/widgets/ShadowCast.js +1 -1
  209. package/widgets/Sketch/SketchViewModel.js +1 -1
  210. package/widgets/Sketch.js +1 -1
  211. package/assets/esri/core/workers/chunks/1f6ead46b723630db897.js +0 -1
  212. package/assets/esri/core/workers/chunks/3a16347e17312556e02c.js +0 -1
  213. package/assets/esri/core/workers/chunks/478def691ae6763686f3.js +0 -1
  214. package/assets/esri/core/workers/chunks/4c4a55be41ba105c091c.js +0 -1
  215. package/assets/esri/core/workers/chunks/4cbf5a97b2b3c6553f6f.js +0 -1
  216. package/assets/esri/core/workers/chunks/646f58b69d2354f1ef27.js +0 -1
  217. package/assets/esri/core/workers/chunks/93d11075f65a5b6625ea.js +0 -1
  218. package/assets/esri/core/workers/chunks/9f2a8445a5848502c7e7.js +0 -1
  219. package/assets/esri/core/workers/chunks/a1b08aab73747f4e7e25.js +0 -1
  220. package/assets/esri/core/workers/chunks/ba59568e748f0ba53b78.js +0 -1
  221. package/assets/esri/core/workers/chunks/f21cb5b34d4d1e3af1a9.js +0 -1
  222. package/assets/esri/core/workers/chunks/f93f0586ce10cb5d98b3.js +0 -1
  223. package/layers/support/rasterDatasets/BaseRaster.js +0 -5
  224. package/layers/support/rasterDatasets/CovJSONRaster.js +0 -5
  225. package/layers/support/rasterDatasets/FunctionRaster.js +0 -5
  226. package/layers/support/rasterDatasets/ImageAuxRaster.js +0 -5
  227. package/layers/support/rasterDatasets/ImageServerRaster.js +0 -5
  228. package/layers/support/rasterDatasets/InMemoryRaster.js +0 -5
  229. package/layers/support/rasterDatasets/MRFRaster.js +0 -5
  230. package/layers/support/rasterDatasets/RawBlockCache.js +0 -5
  231. package/layers/support/rasterDatasets/TIFFRaster.js +0 -5
  232. package/layers/support/rasterDatasets/WCSRaster.js +0 -5
  233. package/layers/support/rasterDatasets/covJSONParser.js +0 -5
  234. package/layers/support/rasterDatasets/multidimensionalUtils.js +0 -5
  235. package/layers/support/rasterDatasets/pamParser.js +0 -5
  236. package/layers/support/rasterDatasets/pixelReader.js +0 -5
  237. package/layers/support/rasterDatasets/wcsCoverageParser.js +0 -5
  238. package/layers/support/rasterFormats/Lerc.js +0 -5
  239. package/layers/support/rasterFormats/Qb3.js +0 -5
  240. package/layers/support/rasterFormats/RasterCodec.js +0 -5
  241. package/layers/support/rasterFormats/TiffDecoder.js +0 -5
  242. package/layers/support/rasterFunctions/ArithmeticFunction.js +0 -5
  243. package/layers/support/rasterFunctions/BandArithmeticFunction.js +0 -5
  244. package/layers/support/rasterFunctions/BaseRasterFunction.js +0 -5
  245. package/layers/support/rasterFunctions/ColormapFunction.js +0 -5
  246. package/layers/support/rasterFunctions/ColormapToRGBFunction.js +0 -5
  247. package/layers/support/rasterFunctions/CompositeBandFunction.js +0 -5
  248. package/layers/support/rasterFunctions/CompositeBandFunctionArguments.js +0 -5
  249. package/layers/support/rasterFunctions/ComputeChangeFunction.js +0 -5
  250. package/layers/support/rasterFunctions/ConvolutionFunction.js +0 -5
  251. package/layers/support/rasterFunctions/ConvolutionFunctionArguments.js +0 -5
  252. package/layers/support/rasterFunctions/HillshadeFunction.js +0 -5
  253. package/layers/support/rasterFunctions/LocalFunction.js +0 -5
  254. package/layers/support/rasterFunctions/RemapFunction.js +0 -5
  255. package/layers/support/rasterFunctions/ShadedReliefFunction.js +0 -5
  256. package/layers/support/rasterFunctions/SlopeFunction.js +0 -5
  257. package/layers/support/rasterFunctions/StatisticsFunction.js +0 -5
  258. package/layers/support/rasterFunctions/StretchFunction.js +0 -5
  259. package/layers/support/rasterFunctions/bandIndexUtils.js +0 -5
  260. package/layers/support/rasterFunctions/changeDetectionUtils.js +0 -5
  261. package/layers/support/rasterFunctions/clipUtils.js +0 -5
  262. package/layers/support/rasterFunctions/conversionUtils.js +0 -5
  263. package/layers/support/rasterFunctions/convolutionUtils.js +0 -5
  264. package/layers/support/rasterFunctions/creators/createDataManagementFunctions.js +0 -5
  265. package/layers/support/rasterFunctions/creators/utils.js +0 -5
  266. package/layers/support/rasterFunctions/focalStatUtils.js +0 -5
  267. package/layers/support/rasterFunctions/localUtils.js +0 -5
  268. package/layers/support/rasterFunctions/pixelTransformUtils.js +0 -5
  269. package/layers/support/rasterFunctions/pixelUtils.js +0 -5
  270. package/layers/support/rasterFunctions/stretchUtils.js +0 -5
  271. package/layers/support/rasterFunctions/surfaceUtils.js +0 -5
  272. package/layers/support/rasterFunctions/vectorFieldUtils.js +0 -5
  273. package/layers/support/rasterTransforms/BaseRasterTransform.js +0 -5
  274. /package/assets/esri/layers/{support/rasterFormats → raster/formats}/lerc-wasm.wasm +0 -0
  275. /package/assets/esri/layers/{support/rasterFormats → raster/formats}/qb3-wasm.wasm +0 -0
  276. /package/layers/{support/rasterDatasets → raster/datasets}/DBFParser.js +0 -0
  277. /package/layers/{support/rasterDatasets → raster/datasets}/EphemeralBlockCache.js +0 -0
  278. /package/layers/{support/rasterDatasets → raster/datasets}/RasterFactory.js +0 -0
  279. /package/layers/{support/rasterDatasets → raster/datasets}/byteStreamUtils.js +0 -0
  280. /package/layers/{support/rasterDatasets → raster/datasets}/datasetUtils.js +0 -0
  281. /package/layers/{support/rasterDatasets → raster/datasets}/multipartParser.js +0 -0
  282. /package/layers/{support/rasterDatasets → raster/datasets}/wcsCapabilitiesParser.js +0 -0
  283. /package/layers/{support/rasterDatasets → raster/datasets}/xmlUtilities.js +0 -0
  284. /package/layers/{support/rasterFormats → raster/formats}/ImageCanvasDecoder.js +0 -0
  285. /package/layers/{support/rasterFormats → raster/formats}/JpgPlus.js +0 -0
  286. /package/layers/{support/rasterFormats → raster/formats}/Lzw.js +0 -0
  287. /package/layers/{support/rasterFormats → raster/formats}/Raw.js +0 -0
  288. /package/layers/{support/rasterFormats → raster/formats}/pixelRangeUtils.js +0 -0
  289. /package/layers/{support/rasterFormats → raster/formats}/tiffTag.js +0 -0
  290. /package/layers/{support/rasterFormats → raster/formats}/utils.js +0 -0
  291. /package/layers/{support/rasterFunctions → raster/functions}/colormaps.js +0 -0
  292. /package/layers/{support/rasterFunctions → raster/functions}/creators/createAppearenceFunctions.js +0 -0
  293. /package/layers/{support/rasterFunctions → raster/functions}/creators/createBandIndexFunctions.js +0 -0
  294. /package/layers/{support/rasterFunctions → raster/functions}/creators/createChangeFunctions.js +0 -0
  295. /package/layers/{support/rasterFunctions → raster/functions}/creators/createConversionFunctions.js +0 -0
  296. /package/layers/{support/rasterFunctions → raster/functions}/creators/createLocalFunctions.js +0 -0
  297. /package/layers/{support/rasterFunctions → raster/functions}/creators/createMultiRasterAnalysisFunctions.js +0 -0
  298. /package/layers/{support/rasterFunctions → raster/functions}/creators/createStatisticsFunctions.js +0 -0
  299. /package/layers/{support/rasterFunctions → raster/functions}/creators/createSurfaceFunctions.js +0 -0
  300. /package/layers/{support/rasterFunctions → raster/functions}/customBandIndexUtils.js +0 -0
  301. /package/layers/{support/rasterFunctions → raster/functions}/mirror.js +0 -0
  302. /package/layers/{support/rasterFunctions → raster/functions}/rasterFunctionHelper.js +0 -0
  303. /package/layers/{support/rasterFunctions → raster/functions}/rasterFunctionSchema.js +0 -0
  304. /package/layers/{support/rasterFunctions → raster/functions}/rasterProjectionHelper.js +0 -0
  305. /package/layers/{support/rasterTransforms → raster/transforms}/utils.js +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import{identity as t,translate as e,rotate as a,scaleByVec2 as s,multiply as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{createVFMesh as l,createVFMeshScalar as n}from"../../../../layers/support/rasterFunctions/vectorFieldUtils.js";import{DisplayObject as c}from"../DisplayObject.js";import{createProgramDescriptor as h}from"../webgl/Utils.js";import{BufferObject as m}from"../../../webgl/BufferObject.js";import{DataType as u}from"../../../webgl/enums.js";import{VertexArrayObject as d}from"../../../webgl/VertexArrayObject.js";import{VertexBuffer as f}from"../../../webgl/VertexBuffer.js";class v extends c{constructor(t=null){super(),this._source=null,this._symbolizerParameters=null,this._vaoInvalidated=!0,this.coordScale=[1,1],this.height=null,this.key=null,this.offset=null,this.stencilRef=0,this.resolution=null,this.pixelRatio=1,this.x=0,this.y=0,this.rotation=0,this.rawPixelData=null,this.vaoData=null,this.width=null,this.source=t}destroy(){super.destroy(),null!=this.vaoData&&(this.vaoData.magdir?.vao.dispose(),this.vaoData.scalar?.vao.dispose(),this.vaoData=null)}get symbolizerParameters(){return this._symbolizerParameters}set symbolizerParameters(t){JSON.stringify(this._symbolizerParameters)!==JSON.stringify(t)&&(this._symbolizerParameters=t,this.invalidateVAO())}get source(){return this._source}set source(t){this._source=t,this.invalidateVAO()}invalidateVAO(){this._vaoInvalidated||null==this.vaoData||(this.vaoData.magdir?.vao.dispose(),this.vaoData.scalar?.vao.dispose(),this.vaoData=null,this._vaoInvalidated=!0,this.requestRender())}updateVectorFieldVAO(t){if(this._vaoInvalidated){if(this._vaoInvalidated=!1,null!=this.source&&null==this.vaoData){const{style:e}=this.symbolizerParameters;switch(e){case"beaufort_ft":case"beaufort_km":case"beaufort_kn":case"beaufort_m":case"beaufort_mi":case"classified_arrow":case"ocean_current_kn":case"ocean_current_m":case"single_arrow":{const e=l(this.source,this.symbolizerParameters),a=this._createVectorFieldVAO(t.context,e);this.vaoData={magdir:a}}break;case"simple_scalar":{const e=n(this.source,this.symbolizerParameters),a=this._createVectorFieldVAO(t.context,e);this.vaoData={scalar:a}}break;case"wind_speed":{const e=l(this.source,this.symbolizerParameters),a=this._createVectorFieldVAO(t.context,e),s=n(this.source,this.symbolizerParameters),i=this._createVectorFieldVAO(t.context,s);this.vaoData={magdir:a,scalar:i}}}}this.ready(),this.requestRender()}}_createTransforms(){return{displayViewScreenMat3:r()}}setTransform(r){const l=t(this.transforms.displayViewScreenMat3),[n,c]=r.toScreenNoRotation([0,0],[this.x,this.y]),h=this.resolution/this.pixelRatio/r.resolution,m=h*this.width,u=h*this.height,d=Math.PI*this.rotation/180;e(l,l,o(n,c)),e(l,l,o(m/2,u/2)),a(l,l,-d),e(l,l,o(-m/2,-u/2)),s(l,l,o(m,u)),i(this.transforms.displayViewScreenMat3,r.displayViewMat3,l)}onAttach(){this.invalidateVAO()}onDetach(){this.invalidateVAO()}_createVectorFieldVAO(t,e){const{vertexData:a,indexData:s}=e,i=m.createIndex(t,35044,new Uint32Array(s)),r=h("vector-field",[{location:0,name:"a_pos",count:2,type:u.FLOAT,normalized:!1},{location:1,name:"a_offset",count:2,type:u.FLOAT,normalized:!1},{location:2,name:"a_vv",count:2,type:u.FLOAT,normalized:!1}]),o=new f(t,r.bufferLayout,new Float32Array(a));return{vao:new d(t,o,i),elementCount:s.length}}}export{v as RasterVFDisplayObject};
5
+ import"../../../../core/has.js";import{identity as t,translate as e,rotate as a,scaleByVec2 as s,multiply as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{createVFMesh as l,createVFMeshScalar as n}from"../../../../layers/raster/functions/vectorFieldUtils.js";import{DisplayObject as c}from"../DisplayObject.js";import{createProgramDescriptor as h}from"../webgl/Utils.js";import{BufferObject as m}from"../../../webgl/BufferObject.js";import{DataType as u}from"../../../webgl/enums.js";import{VertexArrayObject as d}from"../../../webgl/VertexArrayObject.js";import{VertexBuffer as f}from"../../../webgl/VertexBuffer.js";class v extends c{constructor(t=null){super(),this._source=null,this._symbolizerParameters=null,this._vaoInvalidated=!0,this.coordScale=[1,1],this.height=null,this.key=null,this.offset=null,this.stencilRef=0,this.resolution=null,this.pixelRatio=1,this.x=0,this.y=0,this.rotation=0,this.rawPixelData=null,this.vaoData=null,this.width=null,this.source=t}destroy(){super.destroy(),null!=this.vaoData&&(this.vaoData.magdir?.vao.dispose(),this.vaoData.scalar?.vao.dispose(),this.vaoData=null)}get symbolizerParameters(){return this._symbolizerParameters}set symbolizerParameters(t){JSON.stringify(this._symbolizerParameters)!==JSON.stringify(t)&&(this._symbolizerParameters=t,this.invalidateVAO())}get source(){return this._source}set source(t){this._source=t,this.invalidateVAO()}invalidateVAO(){this._vaoInvalidated||null==this.vaoData||(this.vaoData.magdir?.vao.dispose(),this.vaoData.scalar?.vao.dispose(),this.vaoData=null,this._vaoInvalidated=!0,this.requestRender())}updateVectorFieldVAO(t){if(this._vaoInvalidated){if(this._vaoInvalidated=!1,null!=this.source&&null==this.vaoData){const{style:e}=this.symbolizerParameters;switch(e){case"beaufort_ft":case"beaufort_km":case"beaufort_kn":case"beaufort_m":case"beaufort_mi":case"classified_arrow":case"ocean_current_kn":case"ocean_current_m":case"single_arrow":{const e=l(this.source,this.symbolizerParameters),a=this._createVectorFieldVAO(t.context,e);this.vaoData={magdir:a}}break;case"simple_scalar":{const e=n(this.source,this.symbolizerParameters),a=this._createVectorFieldVAO(t.context,e);this.vaoData={scalar:a}}break;case"wind_speed":{const e=l(this.source,this.symbolizerParameters),a=this._createVectorFieldVAO(t.context,e),s=n(this.source,this.symbolizerParameters),i=this._createVectorFieldVAO(t.context,s);this.vaoData={magdir:a,scalar:i}}}}this.ready(),this.requestRender()}}_createTransforms(){return{displayViewScreenMat3:r()}}setTransform(r){const l=t(this.transforms.displayViewScreenMat3),[n,c]=r.toScreenNoRotation([0,0],[this.x,this.y]),h=this.resolution/this.pixelRatio/r.resolution,m=h*this.width,u=h*this.height,d=Math.PI*this.rotation/180;e(l,l,o(n,c)),e(l,l,o(m/2,u/2)),a(l,l,-d),e(l,l,o(-m/2,-u/2)),s(l,l,o(m,u)),i(this.transforms.displayViewScreenMat3,r.displayViewMat3,l)}onAttach(){this.invalidateVAO()}onDetach(){this.invalidateVAO()}_createVectorFieldVAO(t,e){const{vertexData:a,indexData:s}=e,i=m.createIndex(t,35044,new Uint32Array(s)),r=h("vector-field",[{location:0,name:"a_pos",count:2,type:u.FLOAT,normalized:!1},{location:1,name:"a_offset",count:2,type:u.FLOAT,normalized:!1},{location:2,name:"a_vv",count:2,type:u.FLOAT,normalized:!1}]),o=new f(t,r.bufferLayout,new Float32Array(a));return{vao:new d(t,o,i),elementCount:s.length}}}export{v as RasterVFDisplayObject};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as o}from"tslib";import{maxMapSizeGpu as r}from"../../../../../../../../layers/support/rasterFunctions/pixelUtils.js";import{uniform as t,UniformGroup as e}from"../../../GraphShaderModule.js";import{sign as i,FixedArray as s,Float as p,Mat3 as a,Vec4 as l}from"../../../graph/glsl.js";import{BaseRasterHighlightShader as g}from"./BaseRasterHighlightShader.js";import{computeSingleBandRangeFactor as h}from"./processor/math.js";class m extends e{}o([t(s.ofType(p,2*r))],m.prototype,"ranges",void 0),o([t(a)],m.prototype,"bandSwap",void 0),o([t(l)],m.prototype,"color",void 0);class n extends g{constructor(){super(...arguments),this.type="RasterRangeHighlightShader"}_colorize(o,r){const t=this._getPixel(o),{ranges:e,color:s,bandSwap:p}=this.rangeHighlightConfig,a=p.multiply(t.rgb).x,l=h(a,e).multiply(i(t.a));return this._computeHighlightedColor(l,s,r)}}o([t(m)],n.prototype,"rangeHighlightConfig",void 0);export{m as RangeHighlightConfig,n as RasterRangeHighlightShader};
5
+ import{__decorate as o}from"tslib";import{maxMapSizeGpu as r}from"../../../../../../../../layers/raster/functions/pixelUtils.js";import{uniform as t,UniformGroup as e}from"../../../GraphShaderModule.js";import{sign as i,FixedArray as s,Float as p,Mat3 as a,Vec4 as l}from"../../../graph/glsl.js";import{BaseRasterHighlightShader as g}from"./BaseRasterHighlightShader.js";import{computeSingleBandRangeFactor as h}from"./processor/math.js";class m extends e{}o([t(s.ofType(p,2*r))],m.prototype,"ranges",void 0),o([t(a)],m.prototype,"bandSwap",void 0),o([t(l)],m.prototype,"color",void 0);class n extends g{constructor(){super(...arguments),this.type="RasterRangeHighlightShader"}_colorize(o,r){const t=this._getPixel(o),{ranges:e,color:s,bandSwap:p}=this.rangeHighlightConfig,a=p.multiply(t.rgb).x,l=h(a,e).multiply(i(t.a));return this._computeHighlightedColor(l,s,r)}}o([t(m)],n.prototype,"rangeHighlightConfig",void 0);export{m as RangeHighlightConfig,n as RasterRangeHighlightShader};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{maxMapSizeGpu as o}from"../../../../../../../../../layers/support/rasterFunctions/pixelUtils.js";import{uniform as e,define as s,UniformGroup as r}from"../../../../GraphShaderModule.js";import{Vec3 as i,abs as a,sign as l,step as p,FixedArray as n,Float as u}from"../../../../graph/glsl.js";import{BaseRasterProcessorShader as m}from"./BaseRasterProcessorShader.js";class c extends r{}t([e(n.ofType(u,6))],c.prototype,"includedRanges",void 0),t([e(n.ofType(u,o))],c.prototype,"noDataValues",void 0);class y extends m{constructor(){super(...arguments),this.type="MaskShader",this.isMultiband=!0}_process(t){const o=this._getPixel(t),e=this._computeNoDataFactor(o.r),s=this._computeRangeFactor(o.rgb);let r;if(this.isMultiband){const t=this._computeNoDataFactor(o.g),a=this._computeNoDataFactor(o.b),l=new i(e,t,a).multiply(s);r=l.x.multiply(l.y).multiply(l.z)}else r=e.multiply(s.x);return o.multiply(r)}_computeNoDataFactor(t){const{noDataValues:e}=this.maskConfig;let s=new i(1);for(let r=0;r<o/3;r++){const o=3*r,p=new i(e[o+0],e[o+1],e[o+2]),n=a(l(p.subtract(t)));s=s.multiply(n)}return s.x.multiply(s.y).multiply(s.z)}_computeRangeFactor(t){const{includedRanges:o}=this.maskConfig,e=new i(o[0],o[2],o[4]),s=new i(o[1],o[3],o[5]);return p(e,t).multiply(p(t,s))}}t([s],y.prototype,"isMultiband",void 0),t([e(c)],y.prototype,"maskConfig",void 0);export{y as MaskShader};
5
+ import{__decorate as t}from"tslib";import{maxMapSizeGpu as o}from"../../../../../../../../../layers/raster/functions/pixelUtils.js";import{uniform as e,define as s,UniformGroup as r}from"../../../../GraphShaderModule.js";import{Vec3 as i,abs as a,sign as l,step as p,FixedArray as n,Float as u}from"../../../../graph/glsl.js";import{BaseRasterProcessorShader as m}from"./BaseRasterProcessorShader.js";class c extends r{}t([e(n.ofType(u,6))],c.prototype,"includedRanges",void 0),t([e(n.ofType(u,o))],c.prototype,"noDataValues",void 0);class y extends m{constructor(){super(...arguments),this.type="MaskShader",this.isMultiband=!0}_process(t){const o=this._getPixel(t),e=this._computeNoDataFactor(o.r),s=this._computeRangeFactor(o.rgb);let r;if(this.isMultiband){const t=this._computeNoDataFactor(o.g),a=this._computeNoDataFactor(o.b),l=new i(e,t,a).multiply(s);r=l.x.multiply(l.y).multiply(l.z)}else r=e.multiply(s.x);return o.multiply(r)}_computeNoDataFactor(t){const{noDataValues:e}=this.maskConfig;let s=new i(1);for(let r=0;r<o/3;r++){const o=3*r,p=new i(e[o+0],e[o+1],e[o+2]),n=a(l(p.subtract(t)));s=s.multiply(n)}return s.x.multiply(s.y).multiply(s.z)}_computeRangeFactor(t){const{includedRanges:o}=this.maskConfig,e=new i(o[0],o[2],o[4]),s=new i(o[1],o[3],o[5]);return p(e,t).multiply(p(t,s))}}t([s],y.prototype,"isMultiband",void 0),t([e(c)],y.prototype,"maskConfig",void 0);export{y as MaskShader};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{maxMapSizeGpu as e}from"../../../../../../../../../layers/support/rasterFunctions/pixelUtils.js";import{uniform as o,define as r,UniformGroup as a}from"../../../../GraphShaderModule.js";import{mix as p,clamp as s,max as i,Vec4 as m,Vec3 as n,step as l,sign as c,dot as u,FixedArray as d,Float as h,Vec2 as y}from"../../../../graph/glsl.js";import{oneMinus as f}from"../../utils.js";import{BaseRasterProcessorShader as g}from"./BaseRasterProcessorShader.js";import{computeMapValue as v}from"./math.js";class j extends a{}t([o(d.ofType(h,3*e))],j.prototype,"rangeMaps",void 0),t([o(d.ofType(h,2*e))],j.prototype,"noDataRanges",void 0),t([o(h)],j.prototype,"unmatchMask",void 0),t([o(h)],j.prototype,"replacementValue",void 0),t([o(y)],j.prototype,"clampRange",void 0);class x extends g{constructor(){super(...arguments),this.type="RemapShader"}_process(t){const o=this._getPixel(t),{rangeMaps:r,unmatchMask:a,clampRange:n,replacementValue:l}=this.remapConfig,{mapValue:c,includeMask:u}=v(o.r,r,e),d=this.replaceUnmatched?l:a.multiply(o.r),h=p(d,c,u),y=s(h,n.x,n.y),f=this._computeNoDataFactor(o.rrr).multiply(i(a,u));return new m(y,y,y,o.a).multiply(f)}_computeNoDataFactor(t){const{noDataRanges:o}=this.remapConfig;let r=new n(0,0,0);for(let a=0;a<e/3;a++){const e=6*a,p=new n(o[e],o[e+2],o[e+4]),s=new n(o[e+1],o[e+3],o[e+5]);r=r.add(l(p,t).multiply(l(t,s)))}return f(c(u(r,new n(1,1,1))))}}t([o(j)],x.prototype,"remapConfig",void 0),t([r],x.prototype,"replaceUnmatched",void 0);export{x as RemapShader};
5
+ import{__decorate as e}from"tslib";import{maxMapSizeGpu as t}from"../../../../../../../../../layers/raster/functions/pixelUtils.js";import{uniform as o,define as r,UniformGroup as a}from"../../../../GraphShaderModule.js";import{mix as p,clamp as s,max as i,Vec4 as m,Vec3 as n,step as l,sign as c,dot as u,FixedArray as d,Float as h,Vec2 as y}from"../../../../graph/glsl.js";import{oneMinus as f}from"../../utils.js";import{BaseRasterProcessorShader as g}from"./BaseRasterProcessorShader.js";import{computeMapValue as v}from"./math.js";class j extends a{}e([o(d.ofType(h,3*t))],j.prototype,"rangeMaps",void 0),e([o(d.ofType(h,2*t))],j.prototype,"noDataRanges",void 0),e([o(h)],j.prototype,"unmatchMask",void 0),e([o(h)],j.prototype,"replacementValue",void 0),e([o(y)],j.prototype,"clampRange",void 0);class x extends g{constructor(){super(...arguments),this.type="RemapShader"}_process(e){const o=this._getPixel(e),{rangeMaps:r,unmatchMask:a,clampRange:n,replacementValue:l}=this.remapConfig,{mapValue:c,includeMask:u}=v(o.r,r,t),d=this.replaceUnmatched?l:a.multiply(o.r),h=p(d,c,u),y=s(h,n.x,n.y),f=this._computeNoDataFactor(o.rrr).multiply(i(a,u));return new m(y,y,y,o.a).multiply(f)}_computeNoDataFactor(e){const{noDataRanges:o}=this.remapConfig;let r=new n(0,0,0);for(let a=0;a<t/3;a++){const t=6*a,p=new n(o[t],o[t+2],o[t+4]),s=new n(o[t+1],o[t+3],o[t+5]);r=r.add(l(p,e).multiply(l(e,s)))}return f(c(u(r,new n(1,1,1))))}}e([o(j)],x.prototype,"remapConfig",void 0),e([r],x.prototype,"replaceUnmatched",void 0);export{x as RemapShader};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{maxMapSizeGpu as n}from"../../../../../../../../../layers/support/rasterFunctions/pixelUtils.js";import{step as t,Vec3 as e,sign as r,dot as l,abs as o,Vec4 as u,floor as i,Float as s,mix as c}from"../../../../graph/glsl.js";function w(n){const t=r(n),e=n.add(o(t).subtract(1));return t.multiply(t).divide(e)}function a(n){return new u(i(n.rgb.add(.5)),n.a)}function p(n,e){return t(e.x,n).multiply(t(n,e.y))}function d(o,u){let i=new e(0,0,0);const s=new e(o);for(let r=0;r<n/3;r++){const n=6*r,l=new e(u[n],u[n+2],u[n+4]),o=new e(u[n+1],u[n+3],u[n+5]);i=i.add(t(l,s).multiply(t(s,o)))}return r(l(i,new e(1,1,1)))}function f(n,o,u){const i=new e(n);let w=new e(0,0,0),a=new s(0);for(let r=0;r<u/3;r++){const n=9*r,l=new e(o[n],o[n+3],o[n+6]),u=new e(o[n+1],o[n+4],o[n+7]),s=t(l,i).multiply(t(i,u)),p=new e(o[n+2],o[n+5],o[n+8]);a=c(a,p.x,s.x),a=c(a,p.y,s.y),a=c(a,p.z,s.z),w=w.add(s)}return{mapValue:a,includeMask:r(l(w,new e(1,1,1)))}}export{f as computeMapValue,d as computeSingleBandRangeFactor,p as getRangeClipFactor,w as invertValue,a as roundOutput};
5
+ import{maxMapSizeGpu as n}from"../../../../../../../../../layers/raster/functions/pixelUtils.js";import{step as t,Vec3 as e,sign as r,dot as l,abs as o,Vec4 as u,floor as i,Float as s,mix as c}from"../../../../graph/glsl.js";function w(n){const t=r(n),e=n.add(o(t).subtract(1));return t.multiply(t).divide(e)}function a(n){return new u(i(n.rgb.add(.5)),n.a)}function d(n,e){return t(e.x,n).multiply(t(n,e.y))}function f(o,u){let i=new e(0,0,0);const s=new e(o);for(let r=0;r<n/3;r++){const n=6*r,l=new e(u[n],u[n+2],u[n+4]),o=new e(u[n+1],u[n+3],u[n+5]);i=i.add(t(l,s).multiply(t(s,o)))}return r(l(i,new e(1,1,1)))}function p(n,o,u){const i=new e(n);let w=new e(0,0,0),a=new s(0);for(let r=0;r<u/3;r++){const n=9*r,l=new e(o[n],o[n+3],o[n+6]),u=new e(o[n+1],o[n+4],o[n+7]),s=t(l,i).multiply(t(i,u)),d=new e(o[n+2],o[n+5],o[n+8]);a=c(a,d.x,s.x),a=c(a,d.y,s.y),a=c(a,d.z,s.z),w=w.add(s)}return{mapValue:a,includeMask:r(l(w,new e(1,1,1)))}}export{p as computeMapValue,f as computeSingleBandRangeFactor,d as getRangeClipFactor,w as invertValue,a as roundOutput};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as i}from"tslib";import t from"../../../Graphic.js";import{isSome as e}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{makeHandle as r}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import{watch as h,sync as a}from"../../../core/reactiveUtils.js";import{property as o,subclass as n}from"../../../core/accessorSupport/decorators.js";import{convertGeometryToMask as l}from"../../../layers/support/rasterFunctions/clipUtils.js";import{GraphicsCollection as g}from"../../../support/GraphicsCollection.js";import p from"../engine/flow/FlowView2D.js";import{LayerView2DMixin as d}from"./LayerView2D.js";import c from"./graphics/GraphicsView2D.js";import m from"./graphics/HighlightGraphicContainer.js";import u from"./imagery/ImageryView2D.js";import w from"./imagery/VectorFieldView2D.js";import{ImageryLayerViewMixin as y}from"../../layers/ImageryLayerViewMixin.js";import v from"../../layers/LayerView.js";import{RefreshableLayerView as f}from"../../layers/RefreshableLayerView.js";import{defaultColor as x}from"../../support/HighlightDefaults.js";import{getHighlightName as _}from"../../support/highlightOptionsUtils.js";let b=class extends(y(f(d(v)))){constructor(){super(...arguments),this._exportImageVersion=-1,this._highlightGraphics=new g,this._highlightView=void 0,this._pixelHighlights=[],this.layer=null,this.subview=null}get pixelData(){const{subview:i}=this;return this.updating||!i?null:"getPixelData"in i?i.getPixelData():null}update(i){this.subview?.update(i)}attach(){this.layer.increaseRasterJobHandlerUsage(),this._setSubView(),this.view&&(this._highlightView=new c({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new m(this.view.featuresTilingScheme)}),this.container.addChild(this._highlightView.container)),this.addAttachHandles([h(()=>this.layer.exportImageServiceParameters.version,i=>{i&&this._exportImageVersion!==i&&(this._exportImageVersion=i,this.requestUpdate())},a),h(()=>this.timeExtent,i=>{const{subview:t}=this;t&&(t.timeExtent=i,"redraw"in t?this.requestUpdate():t.redrawOrRefetch())},a),this.layer.on("redraw",()=>{const{subview:i}=this;i&&("redraw"in i?i.redraw():i.redrawOrRefetch())}),h(()=>this.layer.renderer,()=>this._setSubView()),h(()=>this.view.highlights.items.map(({name:i,color:t})=>({name:i,color:t})),()=>this._updateHighlightOptions(this.subview))])}detach(){this.layer.decreaseRasterJobHandlerUsage(),this.container.removeAllChildren(),this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null,this._highlightView?.destroy(),this._exportImageVersion=-1}viewChange(){}moveEnd(){this.requestUpdate()}highlight(i,h){if(i&&"pixelRanges"in i&&(!Array.isArray(i.pixelRanges)||i.pixelRanges.length))return this._highlightPixels(i,h);if(!((Array.isArray(i)?i[0]:s.isCollection(i)?i.at(0):i)instanceof t))return r();let a=[];Array.isArray(i)||s.isCollection(i)?a=i.map(i=>i.clone()):i instanceof t&&(a=[i.clone()]);const o=a?.filter(e);if(!o?.length)return r();const n=_(h);return this._addHighlightGraphics(a,n),r(()=>!this.destroyed&&this._removeHighlightGraphics(a,n))}_highlightPixels(i,t){const e={target:i,options:t};return this._pixelHighlights.push(e),this._updateHighlightOptions(this.subview),r(()=>{const i=this._pixelHighlights.indexOf(e);i>-1&&(this._pixelHighlights.splice(i,1),this._updateHighlightOptions(this.subview))})}_addHighlightGraphics(i,t){this._highlightGraphics.addMany(i),this._addHighlights(i.map(i=>i.uid),t)}_removeHighlightGraphics(i,t){this._highlightGraphics.removeMany(i),this._removeHighlights(i.map(i=>i.uid),t)}async doRefresh(){this.requestUpdate()}isUpdating(){const i=!this.subview||this.subview.updating||!!this._highlightView?.updating;return has("esri-2d-log-updating")&&console.log(`Updating ImageryLayerView2D (${this.layer.id}): ${i}\n-> subview ${!this.subview||this.subview.updating}\n-> higlightView ${this._highlightView?.updating}\n`),i}_processHighlight(){const i=this._getHighlights();this._highlightView?.setHighlight(i)}_setSubView(){if(!this.view)return;const i=this.layer.renderer?.type;let t="imagery";if("vector-field"===i?t="imageryVF":"flow"===i&&(t="flow"),this.subview){const{type:i}=this.subview;if(i===t)return this._attachSubview(this.subview),void("flow"===i?this.subview.redrawOrRefetch():"imagery"===i&&"lerc"===this.layer.format?this.subview.redraw():this.requestUpdate());this._detachSubview(this.subview),this.subview?.destroy()}"imagery"===t?(this.subview=new u({layer:this.layer,view:this.view,timeExtent:this.timeExtent}),this._updateHighlightOptions(this.subview)):this.subview="imageryVF"===t?new w({layer:this.layer,view:this.view,timeExtent:this.timeExtent}):new p({layer:this.layer,layerView:this}),this._attachSubview(this.subview),this.requestUpdate()}_attachSubview(i){i&&!i.attached&&(i.attach(),i.attached=!0,this.container.addChildAt(i.container,0))}_detachSubview(i){i?.attached&&(this.container.removeChild(i.container),i.detach(),i.attached=!1)}_updateHighlightOptions(i){const t=this.view.highlights;this._pixelHighlights.sort((i,e)=>t.findIndex(({name:i})=>i===_(e.options))-t.findIndex(({name:t})=>t===_(i.options)));const s=this._pixelHighlights.map(({target:i,options:e})=>V(i,t,e)).filter(e);"imagery"===i?.type&&(i.pixelHighlights=s,i.attached&&("lerc"===this.layer.format?i.redraw():this.requestUpdate()))}};function V(i,t,e){const s=_(e),r=(t.find(i=>i.name===s)?.color??x).toArray(),{pixelRanges:h}=i;if(Array.isArray(h))return{ranges:h,bandId:i.bandId??0,color:r};const a="extent"===h.type?h:h.extent;if(!a)return;const o=[a.xmin,a.xmax],n=[a.ymin,a.ymax],{xBandId:g,yBandId:p}=i,d=1024,c=1024;return{xBandId:g,yBandId:p,xBandRange:o,yBandRange:n,color:r,width:d,height:c,xyMask:"polygon"===h.type?l({srcExtent:a,geometry:h,size:[d,c]}):void 0}}i([o()],b.prototype,"pixelData",null),i([o()],b.prototype,"subview",void 0),b=i([n("esri.views.2d.layers.ImageryLayerView2D")],b);const H=b;export{H as default};
5
+ import{__decorate as i}from"tslib";import t from"../../../Graphic.js";import{isSome as e}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{makeHandle as r}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import{watch as h,sync as a}from"../../../core/reactiveUtils.js";import{property as o,subclass as n}from"../../../core/accessorSupport/decorators.js";import{convertGeometryToMask as l}from"../../../layers/raster/functions/clipUtils.js";import{GraphicsCollection as g}from"../../../support/GraphicsCollection.js";import p from"../engine/flow/FlowView2D.js";import{LayerView2DMixin as d}from"./LayerView2D.js";import c from"./graphics/GraphicsView2D.js";import m from"./graphics/HighlightGraphicContainer.js";import u from"./imagery/ImageryView2D.js";import w from"./imagery/VectorFieldView2D.js";import{ImageryLayerViewMixin as y}from"../../layers/ImageryLayerViewMixin.js";import v from"../../layers/LayerView.js";import{RefreshableLayerView as f}from"../../layers/RefreshableLayerView.js";import{defaultColor as x}from"../../support/HighlightDefaults.js";import{getHighlightName as _}from"../../support/highlightOptionsUtils.js";let b=class extends(y(f(d(v)))){constructor(){super(...arguments),this._exportImageVersion=-1,this._highlightGraphics=new g,this._highlightView=void 0,this._pixelHighlights=[],this.layer=null,this.subview=null}get pixelData(){const{subview:i}=this;return this.updating||!i?null:"getPixelData"in i?i.getPixelData():null}update(i){this.subview?.update(i)}attach(){this.layer.increaseRasterJobHandlerUsage(),this._setSubView(),this.view&&(this._highlightView=new c({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new m(this.view.featuresTilingScheme)}),this.container.addChild(this._highlightView.container)),this.addAttachHandles([h(()=>this.layer.exportImageServiceParameters.version,i=>{i&&this._exportImageVersion!==i&&(this._exportImageVersion=i,this.requestUpdate())},a),h(()=>this.timeExtent,i=>{const{subview:t}=this;t&&(t.timeExtent=i,"redraw"in t?this.requestUpdate():t.redrawOrRefetch())},a),this.layer.on("redraw",()=>{const{subview:i}=this;i&&("redraw"in i?i.redraw():i.redrawOrRefetch())}),h(()=>this.layer.renderer,()=>this._setSubView()),h(()=>this.view.highlights.items.map(({name:i,color:t})=>({name:i,color:t})),()=>this._updateHighlightOptions(this.subview))])}detach(){this.layer.decreaseRasterJobHandlerUsage(),this.container.removeAllChildren(),this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null,this._highlightView?.destroy(),this._exportImageVersion=-1}viewChange(){}moveEnd(){this.requestUpdate()}highlight(i,h){if(i&&"pixelRanges"in i&&(!Array.isArray(i.pixelRanges)||i.pixelRanges.length))return this._highlightPixels(i,h);if(!((Array.isArray(i)?i[0]:s.isCollection(i)?i.at(0):i)instanceof t))return r();let a=[];Array.isArray(i)||s.isCollection(i)?a=i.map(i=>i.clone()):i instanceof t&&(a=[i.clone()]);const o=a?.filter(e);if(!o?.length)return r();const n=_(h);return this._addHighlightGraphics(a,n),r(()=>!this.destroyed&&this._removeHighlightGraphics(a,n))}_highlightPixels(i,t){const e={target:i,options:t};return this._pixelHighlights.push(e),this._updateHighlightOptions(this.subview),r(()=>{const i=this._pixelHighlights.indexOf(e);i>-1&&(this._pixelHighlights.splice(i,1),this._updateHighlightOptions(this.subview))})}_addHighlightGraphics(i,t){this._highlightGraphics.addMany(i),this._addHighlights(i.map(i=>i.uid),t)}_removeHighlightGraphics(i,t){this._highlightGraphics.removeMany(i),this._removeHighlights(i.map(i=>i.uid),t)}async doRefresh(){this.requestUpdate()}isUpdating(){const i=!this.subview||this.subview.updating||!!this._highlightView?.updating;return has("esri-2d-log-updating")&&console.log(`Updating ImageryLayerView2D (${this.layer.id}): ${i}\n-> subview ${!this.subview||this.subview.updating}\n-> higlightView ${this._highlightView?.updating}\n`),i}_processHighlight(){const i=this._getHighlights();this._highlightView?.setHighlight(i)}_setSubView(){if(!this.view)return;const i=this.layer.renderer?.type;let t="imagery";if("vector-field"===i?t="imageryVF":"flow"===i&&(t="flow"),this.subview){const{type:i}=this.subview;if(i===t)return this._attachSubview(this.subview),void("flow"===i?this.subview.redrawOrRefetch():"imagery"===i&&"lerc"===this.layer.format?this.subview.redraw():this.requestUpdate());this._detachSubview(this.subview),this.subview?.destroy()}"imagery"===t?(this.subview=new u({layer:this.layer,view:this.view,timeExtent:this.timeExtent}),this._updateHighlightOptions(this.subview)):this.subview="imageryVF"===t?new w({layer:this.layer,view:this.view,timeExtent:this.timeExtent}):new p({layer:this.layer,layerView:this}),this._attachSubview(this.subview),this.requestUpdate()}_attachSubview(i){i&&!i.attached&&(i.attach(),i.attached=!0,this.container.addChildAt(i.container,0))}_detachSubview(i){i?.attached&&(this.container.removeChild(i.container),i.detach(),i.attached=!1)}_updateHighlightOptions(i){const t=this.view.highlights;this._pixelHighlights.sort((i,e)=>t.findIndex(({name:i})=>i===_(e.options))-t.findIndex(({name:t})=>t===_(i.options)));const s=this._pixelHighlights.map(({target:i,options:e})=>V(i,t,e)).filter(e);"imagery"===i?.type&&(i.pixelHighlights=s,i.attached&&("lerc"===this.layer.format?i.redraw():this.requestUpdate()))}};function V(i,t,e){const s=_(e),r=(t.find(i=>i.name===s)?.color??x).toArray(),{pixelRanges:h}=i;if(Array.isArray(h))return{ranges:h,bandId:i.bandId??0,color:r};const a="extent"===h.type?h:h.extent;if(!a)return;const o=[a.xmin,a.xmax],n=[a.ymin,a.ymax],{xBandId:g,yBandId:p}=i,d=1024,c=1024;return{xBandId:g,yBandId:p,xBandRange:o,yBandRange:n,color:r,width:d,height:c,xyMask:"polygon"===h.type?l({srcExtent:a,geometry:h,size:[d,c]}):void 0}}i([o()],b.prototype,"pixelData",null),i([o()],b.prototype,"subview",void 0),b=i([n("esri.views.2d.layers.ImageryLayerView2D")],b);const H=b;export{H 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{makeHandle as i}from"../../../core/handleUtils.js";import t from"../../../core/Logger.js";import{isAbortError as s}from"../../../core/promiseUtils.js";import{watch as r,sync as o,initial as a}from"../../../core/reactiveUtils.js";import{property as n,subclass as h}from"../../../core/accessorSupport/decorators.js";import{hasExcludedVariableOrDimension as u}from"../../../layers/support/rasterDatasets/multidimensionalUtils.js";import l from"../engine/flow/FlowView2D.js";import{LayerView2DMixin as p}from"./LayerView2D.js";import d from"./imagery/ImageryTileView2D.js";import g from"./imagery/VectorFieldTileView2D.js";import{canUseMajorityInterpolationOnDataSource as c}from"./support/util.js";import{ImageryTileLayerViewMixin as v}from"../../layers/ImageryTileLayerViewMixin.js";import w from"../../layers/LayerView.js";import{RefreshableLayerView as b}from"../../layers/RefreshableLayerView.js";let m=class extends(v(b(p(w)))){constructor(){super(...arguments),this._useWebGLForProcessing=!0,this._useProgressiveUpdate=!0,this._pixelHighlights=[],this.subview=null}get useWebGLForProcessing(){return this._useWebGLForProcessing}set useWebGLForProcessing(e){this._useWebGLForProcessing=e,this.subview&&"useWebGLForProcessing"in this.subview&&(this.subview.useWebGLForProcessing=e)}get useProgressiveUpdate(){return this._useWebGLForProcessing}set useProgressiveUpdate(e){this._useProgressiveUpdate=e,this.subview&&"useProgressiveUpdate"in this.subview&&(this.subview.useProgressiveUpdate=e)}get displayParameters(){const{layer:e}=this,i=this._get("displayParameters");return e.renderer&&e.visible?{bandIds:e.bandIds,renderer:e.renderer,interpolation:e.interpolation,multidimensionalDefinition:e.multidimensionalDefinition,rasterFunction:"imagery-tile"===e.type?e.rasterFunction:null}:i}update(e){this.subview?.update(e),this.notifyChange("updating")}isUpdating(){return!this.subview||this.subview.updating}attach(){this.layer.increaseRasterJobHandlerUsage(),this._updateSubview(),this.addAttachHandles([r(()=>this.displayParameters,(e,i)=>{const r=e.interpolation!==i?.interpolation&&("majority"===e.interpolation||"majority"===i?.interpolation)&&c(this.layer),o=!!this.layer.serviceRasterInfo?.storageInfo?.isBsqTile&&e.bandIds?.join()!==i?.bandIds?.join(),a=e.renderer!==i?.renderer&&this._getSubviewType(i?.renderer)!==this._getSubviewType(e.renderer);a&&this._updateSubview();const n=e.multidimensionalDefinition!==i?.multidimensionalDefinition,h=e.rasterFunction!==i?.rasterFunction,u=h&&!this._useWebGLForProcessing,l=n||r||a||u||o;this.subview.redrawOrRefetch({refetch:l,reprocess:h}).catch(e=>{s(e)||t.getLogger(this).error(e)}),this.notifyChange("updating")}),r(()=>this.layer.multidimensionalSubset??null,(e,i)=>{const{multidimensionalDefinition:r}=this.layer;null!=r&&u(r,e)!==u(r,i)&&(this.subview.redrawOrRefetch({refetch:!0}).catch(e=>{s(e)||t.getLogger(this).error(e)}),this.notifyChange("updating"))},o),r(()=>this.timeExtent,()=>{this.subview.timeExtent=this.timeExtent,this.subview.redrawOrRefetch({refetch:!0}).catch(e=>{s(e)||t.getLogger(this).error(e)})},a),r(()=>this.view.highlights.items.map(({name:e,color:i})=>({name:e,color:i})),()=>this._updateHighlightOptions(this.subview),a)])}detach(){this.layer.decreaseRasterJobHandlerUsage(),this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null}viewChange(){this.requestUpdate()}moveEnd(){this.subview.moveEnd()}highlight(e,t){if(!e.pixelRanges||Array.isArray(e.pixelRanges)&&0===e.pixelRanges.length)return i();const s={target:{...e},options:{...t}};return this._pixelHighlights.push(s),this._updateHighlightOptions(this.subview),i(()=>{const e=this._pixelHighlights.indexOf(s);-1!==e&&(this._pixelHighlights.splice(e,1),this._updateHighlightOptions(this.subview))})}doRefresh(){return this.subview?this.subview.doRefresh():Promise.resolve()}_updateSubview(){const{renderer:e}=this.layer;if(!e)return;const i=this._getSubviewType(e);if(this.subview){if(this.subview.type===i)return void this._attachSubview(this.subview);this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null}const{layer:t}=this;let s;if(s="rasterVF"===i?new g({layer:t,layerView:this,scheduler:this.scheduler}):"flow"===i?new l({layer:t,layerView:this,scheduler:this.scheduler}):new d({layer:t,layerView:this,scheduler:this.scheduler}),"useWebGLForProcessing"in s&&(s.useWebGLForProcessing=this._useWebGLForProcessing),"useProgressiveUpdate"in s&&(s.useProgressiveUpdate=this._useProgressiveUpdate),"previousLOD"in s){const{subview:e}=this;s.previousLOD=e&&"previousLOD"in e?e.previousLOD:null}this._attachSubview(s),this._updateHighlightOptions(s),this.subview=s,this.requestUpdate()}_attachSubview(e){e&&!e.attached&&(e.attach(),e.attached=!0,this.container.addChildAt(e.container,0))}_detachSubview(e){e?.attached&&(this.container.removeChild(e.container),e.detach(),e.attached=!1)}_getSubviewType(e){const i=e?.type;return"vector-field"===i?"rasterVF":"flow"===i?"flow":"raster"}_updateHighlightOptions(e){"raster"===e?.type&&e.updateHighlightOptions(this._pixelHighlights)}};e([n()],m.prototype,"subview",void 0),e([n()],m.prototype,"useWebGLForProcessing",null),e([n()],m.prototype,"useProgressiveUpdate",null),e([n({readOnly:!0})],m.prototype,"displayParameters",null),m=e([h("esri.views.2d.layers.ImageryTileLayerView2D")],m);const y=m;export{y as default};
5
+ import{__decorate as e}from"tslib";import{makeHandle as i}from"../../../core/handleUtils.js";import t from"../../../core/Logger.js";import{isAbortError as s}from"../../../core/promiseUtils.js";import{watch as r,sync as o,initial as a}from"../../../core/reactiveUtils.js";import{property as n,subclass as h}from"../../../core/accessorSupport/decorators.js";import{hasExcludedVariableOrDimension as u}from"../../../layers/raster/datasets/multidimensionalUtils.js";import l from"../engine/flow/FlowView2D.js";import{LayerView2DMixin as d}from"./LayerView2D.js";import p from"./imagery/ImageryTileView2D.js";import g from"./imagery/VectorFieldTileView2D.js";import{canUseMajorityInterpolationOnDataSource as c}from"./support/util.js";import{ImageryTileLayerViewMixin as v}from"../../layers/ImageryTileLayerViewMixin.js";import w from"../../layers/LayerView.js";import{RefreshableLayerView as b}from"../../layers/RefreshableLayerView.js";let m=class extends(v(b(d(w)))){constructor(){super(...arguments),this._useWebGLForProcessing=!0,this._useProgressiveUpdate=!0,this._pixelHighlights=[],this.subview=null}get useWebGLForProcessing(){return this._useWebGLForProcessing}set useWebGLForProcessing(e){this._useWebGLForProcessing=e,this.subview&&"useWebGLForProcessing"in this.subview&&(this.subview.useWebGLForProcessing=e)}get useProgressiveUpdate(){return this._useWebGLForProcessing}set useProgressiveUpdate(e){this._useProgressiveUpdate=e,this.subview&&"useProgressiveUpdate"in this.subview&&(this.subview.useProgressiveUpdate=e)}get displayParameters(){const{layer:e}=this,i=this._get("displayParameters");return e.renderer&&e.visible?{bandIds:e.bandIds,renderer:e.renderer,interpolation:e.interpolation,multidimensionalDefinition:e.multidimensionalDefinition,rasterFunction:"imagery-tile"===e.type?e.rasterFunction:null}:i}update(e){this.subview?.update(e),this.notifyChange("updating")}isUpdating(){return!this.subview||this.subview.updating}attach(){this.layer.increaseRasterJobHandlerUsage(),this._updateSubview(),this.addAttachHandles([r(()=>this.displayParameters,(e,i)=>{const r=e.interpolation!==i?.interpolation&&("majority"===e.interpolation||"majority"===i?.interpolation)&&c(this.layer),o=!!this.layer.serviceRasterInfo?.storageInfo?.isBsqTile&&e.bandIds?.join()!==i?.bandIds?.join(),a=e.renderer!==i?.renderer&&this._getSubviewType(i?.renderer)!==this._getSubviewType(e.renderer);a&&this._updateSubview();const n=e.multidimensionalDefinition!==i?.multidimensionalDefinition,h=e.rasterFunction!==i?.rasterFunction,u=h&&!this._useWebGLForProcessing,l=n||r||a||u||o;this.subview.redrawOrRefetch({refetch:l,reprocess:h}).catch(e=>{s(e)||t.getLogger(this).error(e)}),this.notifyChange("updating")}),r(()=>this.layer.multidimensionalSubset??null,(e,i)=>{const{multidimensionalDefinition:r}=this.layer;null!=r&&u(r,e)!==u(r,i)&&(this.subview.redrawOrRefetch({refetch:!0}).catch(e=>{s(e)||t.getLogger(this).error(e)}),this.notifyChange("updating"))},o),r(()=>this.timeExtent,()=>{this.subview.timeExtent=this.timeExtent,this.subview.redrawOrRefetch({refetch:!0}).catch(e=>{s(e)||t.getLogger(this).error(e)})},a),r(()=>this.view.highlights.items.map(({name:e,color:i})=>({name:e,color:i})),()=>this._updateHighlightOptions(this.subview),a)])}detach(){this.layer.decreaseRasterJobHandlerUsage(),this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null}viewChange(){this.requestUpdate()}moveEnd(){this.subview.moveEnd()}highlight(e,t){if(!e.pixelRanges||Array.isArray(e.pixelRanges)&&0===e.pixelRanges.length)return i();const s={target:{...e},options:{...t}};return this._pixelHighlights.push(s),this._updateHighlightOptions(this.subview),i(()=>{const e=this._pixelHighlights.indexOf(s);-1!==e&&(this._pixelHighlights.splice(e,1),this._updateHighlightOptions(this.subview))})}doRefresh(){return this.subview?this.subview.doRefresh():Promise.resolve()}_updateSubview(){const{renderer:e}=this.layer;if(!e)return;const i=this._getSubviewType(e);if(this.subview){if(this.subview.type===i)return void this._attachSubview(this.subview);this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null}const{layer:t}=this;let s;if(s="rasterVF"===i?new g({layer:t,layerView:this,scheduler:this.scheduler}):"flow"===i?new l({layer:t,layerView:this,scheduler:this.scheduler}):new p({layer:t,layerView:this,scheduler:this.scheduler}),"useWebGLForProcessing"in s&&(s.useWebGLForProcessing=this._useWebGLForProcessing),"useProgressiveUpdate"in s&&(s.useProgressiveUpdate=this._useProgressiveUpdate),"previousLOD"in s){const{subview:e}=this;s.previousLOD=e&&"previousLOD"in e?e.previousLOD:null}this._attachSubview(s),this._updateHighlightOptions(s),this.subview=s,this.requestUpdate()}_attachSubview(e){e&&!e.attached&&(e.attach(),e.attached=!0,this.container.addChildAt(e.container,0))}_detachSubview(e){e?.attached&&(this.container.removeChild(e.container),e.detach(),e.attached=!1)}_getSubviewType(e){const i=e?.type;return"vector-field"===i?"rasterVF":"flow"===i?"flow":"raster"}_updateHighlightOptions(e){"raster"===e?.type&&e.updateHighlightOptions(this._pixelHighlights)}};e([n()],m.prototype,"subview",void 0),e([n()],m.prototype,"useWebGLForProcessing",null),e([n()],m.prototype,"useProgressiveUpdate",null),e([n({readOnly:!0})],m.prototype,"displayParameters",null),m=e([h("esri.views.2d.layers.ImageryTileLayerView2D")],m);const y=m;export{y 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{assertIsSome as s}from"../../../../core/maybe.js";import{debounce as r,isAbortError as a}from"../../../../core/promiseUtils.js";import{property as o,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as n}from"../../../../core/support/UpdatingHandles.js";import h from"../../../../geometry/Extent.js";import c from"../../../../geometry/Point.js";import u from"../../../../layers/support/PixelBlock.js";import d from"../../../../layers/support/TileInfo.js";import{update as p,unregister as y,getRasterId as m,register as g}from"../../../../layers/support/rasterDatasets/RawBlockCache.js";import{getWorldWidth as _,computeProjectedScales as f}from"../../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import b from"../../tiling/TileInfoView.js";import"../../tiling/TileKey.js";import w from"../../tiling/TileQueue.js";import P from"../../tiling/TileStrategy.js";import{tileSize as I}from"../../engine/webgl/definitions.js";import{TaskPriority as R}from"../../../support/Scheduler.js";import{getWebGLCapabilities as U}from"../../../webgl/capabilities.js";const C=[0,0];let S=class extends t{constructor(){super(...arguments),this._updatingHandles=new n,this._emptyTilePixelBlock=null,this._tileStrategy=null,this._tileInfoView=null,this._fetchQueue=null,this._blockCacheRegistryUrl=null,this._blockCacheRegistryId=null,this._srcResolutions=[],this.previousLOD=null,this._needBlockCacheUpdate=!1,this._globalSymbolizerParams=null,this._symbolizerParams=null,this._abortController=null,this._isCustomTilingScheme=!1,this._maxIndexedColormapSize=0,this._rasterFunctionState="na",this._globalUpdateRequested=!1,this.attached=!1,this.timeExtent=null,this.redrawOrRefetch=r(async(e={})=>{const t=this._rasterFunctionState,i=e.reprocess||"gpu"===t&&!this.canUseWebGLForProcessing||"cpu"===t&&this.canUseWebGLForProcessing;if(i&&(await this._updatingHandles.addPromise(this.layer.updateRasterFunction()),this.updateRasterFunctionParameters()),!this.previousLOD||this.layerView.suspended)return;const s=this._rasterFunctionState,{type:r}=this;return e.refetch||"raster"!==r&&!!i||"cpu"===s||"cpu"===t?this._updatingHandles.addPromise(this.doRefresh()):this._updatingHandles.addPromise(this._redrawImage(e.signal))})}destroy(){this._updatingHandles.destroy()}get canUseWebGLForProcessing(){return!1}get canUseLocalSymbolizerParams(){return(this.canUseWebGLForProcessing||"rasterVF"===this.type)&&!this.layerView.hasTilingEffects}get isCPUBasedDRA(){const{renderer:e}=this.layer;return"raster-stretch"===e?.type&&e.dynamicRangeAdjustment&&(!this.canUseWebGLForProcessing||!("min-max"===e.stretchType||"standard-deviation"===e.stretchType))}get useWebGLForProcessing(){return this._get("useWebGLForProcessing")??!0}set useWebGLForProcessing(e){this._set("useWebGLForProcessing",e)}get useProgressiveUpdate(){return this._get("useProgressiveUpdate")??!0}set useProgressiveUpdate(e){if(this._tileStrategy&&this.useProgressiveUpdate!==e){this._tileStrategy.destroy(),this.container.removeAllChildren();const t=this._getCacheSize(e);this._tileStrategy=new P({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:t,tileInfoView:this._tileInfoView}),this._set("useProgressiveUpdate",e),this.layerView.requestUpdate()}}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume();const{extent:t,resolution:i,scale:s}=e.state,r=this._tileInfoView.getClosestInfoForScale(s);if(this.layer.raster){if(!this.useProgressiveUpdate||this._needBlockCacheUpdate){const e=this._srcResolutions[r.level],s="toJSON"in t?t:h.fromJSON(t);p(this._blockCacheRegistryUrl,this._blockCacheRegistryId,s,i,e,this.layer.raster.ioConfig.sampling)}this._needBlockCacheUpdate=!1,this.previousLOD?.level!==r.level&&(this.previousLOD=r,null!=this._symbolizerParams&&this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._tileStrategy.updateCacheSize(0))}}moveEnd(){!this.isCPUBasedDRA&&this.useProgressiveUpdate||(this._abortController&&this._abortController.abort(),this._abortController=new AbortController,0===this._fetchQueue.length&&this._redrawImage(this._abortController.signal).then(()=>{this._globalUpdateRequested=!1,this.layerView.requestUpdate()}));const e=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy.updateCacheSize(e),this.layerView.requestUpdate()}get updating(){return this._globalUpdateRequested||this._updatingHandles?.updating}attach(){const e=U();this._maxIndexedColormapSize=4*(e.maxTextureSize||4096),this._initializeTileInfo(),this._tileInfoView=new b(this.layerView.tileInfo,this.layerView.fullExtent);const t=this._computeFetchConcurrency();this._fetchQueue=new w({tileInfoView:this._tileInfoView,concurrency:t,process:(e,t)=>this._fetchTile(e,t),priority:R.MAPVIEW_FETCH_QUEUE,scheduler:this.scheduler});const i=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy=new P({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:i,tileInfoView:this._tileInfoView}),this._updateBlockCacheRegistry()}detach(){this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null,y(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryUrl=this._blockCacheRegistryId=null}acquireTile(e){const t=this.container.createTile(e);return this._updatingHandles.addPromise(this._enqueueTileFetch(t)),this.layerView.requestUpdate(),this._needBlockCacheUpdate=!0,this._globalUpdateRequested=this.isCPUBasedDRA||!this.useProgressiveUpdate,t}releaseTile(e){this._fetchQueue.abort(e.key.id),this.container.removeChild(e),e.once("detach",()=>{e.destroy(),this.layerView.requestUpdate()}),this.layerView.requestUpdate()}createEmptyTilePixelBlock(e=null){const t=null==e||e.join(",")===this._tileInfoView.tileInfo.size.join(",");if(t&&null!=this._emptyTilePixelBlock)return this._emptyTilePixelBlock;e=e||this._tileInfoView.tileInfo.size;const[i,s]=e,r=new u({width:i,height:s,pixels:[new Uint8Array(i*s)],mask:new Uint8Array(i*s),pixelType:"u8"});return t&&(this._emptyTilePixelBlock=r),r}_getBandIds(){if(this.container&&(!("rasterFunctionChain"in this.container)||!this.container.rasterFunctionChain))return this.layer.bandIds;const{bandIds:e,raster:t}=this.layer,i="rasterFunction"in t?t.rasterFunction.rawInputBandIds:null;return e?.length&&i?.length&&1!==t.rasterInfo.bandCount?e.map(e=>i[Math.min(e,i.length-1)]):"rasterFunction"in t?i:e}updateRasterFunctionParameters(){}_fetchTile(e,t){const i=this._getFetchOptions(e.level,t.signal);return this.fetchTile(e,i)}_getFetchOptions(e,t){const{canUseWebGLForProcessing:i}=this,{layerView:s}=this,{tileInfo:r}=s,a=!r.isWrappable&&null!=_(s.view.spatialReference),o=i&&this.layer.raster.hasUniqueSourceStorageInfo,{layer:l}=this.layerView,n=l.serviceRasterInfo?.storageInfo.isBsqTile?l.getRawDisplayBandIds():void 0;return{allowPartialFill:!0,datumTransformation:s.datumTransformation,interpolation:i?"nearest":this.layer.interpolation,registryId:this._blockCacheRegistryId,requestRawData:o,skipRasterFunction:"raster"===this.type&&null!=this.container.rasterFunctionChain,signal:t,srcResolution:this._srcResolutions[e],timeExtent:s.timeExtent,tileInfo:r,bandIds:n,disableWrapAround:a}}_getCacheSize(e){return e?40:0}_initializeTileInfo(){const{layerView:e}=this,t=e.view.spatialReference;if(this._canUseLayerLODs()){const{origin:i,lods:s}=this.layer.tileInfo,r=s.map(({scale:e})=>e),a=d.create({spatialReference:t,size:I,scales:r,origin:i});return e.set("tileInfo",a),void(this._srcResolutions=s.map(({resolution:e})=>({x:e,y:e})))}const{scales:i,srcResolutions:r,isCustomTilingScheme:a}=f(this.layer.serviceRasterInfo,t,{tileSize:I,alignGlobalDatasetWithAGOL:!0,limitToSrcResolution:!1}),o=d.create({spatialReference:t,size:I,scales:i}),l=0===o.origin.x;s(e.fullExtent);const{xmin:n,ymax:h}=e.fullExtent;(l||a&&o.origin.x>n)&&(o.origin=new c({x:n,y:h,spatialReference:t})),this._isCustomTilingScheme=a,e.set("tileInfo",o),this._srcResolutions=r??[]}_canUseLayerLODs(){const{layer:e,layerView:t}=this;if("Map"!==e.raster.tileType)return!1;const{lods:i}=e.tileInfo,s=t.view.constraints?.effectiveLODs;return s?.length===i.length&&s.every(({scale:e},t)=>Math.abs(e-i[t].scale)<.001)}_computeFetchConcurrency(){const{blockBoundary:e}=this.layer.serviceRasterInfo.storageInfo,t=e[e.length-1];return(t.maxCol-t.minCol+1)*(t.maxRow-t.minRow+1)>64?2:10}async _enqueueTileFetch(e,t){if(!this._fetchQueue.has(e.key.id)){try{let t=e.once("detach",()=>t=void 0);const r=await this._fetchQueue.push(e.key),o=this._getBandIds();let l=!this.useProgressiveUpdate||this.isCPUBasedDRA&&!this._globalSymbolizerParams;if(this._globalUpdateRequested&&!this.layerView.moving&&0===this._fetchQueue.length){l=!1;try{await this._redrawImage(this._abortController?.signal)}catch(s){a(s)&&i.getLogger(this).error(s)}this._globalUpdateRequested=!1}if(!t)return;this.canUseLocalSymbolizerParams&&null==this._symbolizerParams&&this._updateSymbolizerParams();const n=this._tileInfoView.getTileCoords(C,e.key),h=this._tileInfoView.getTileResolution(e.key);await this.updateTileSource(e,{source:r,symbolizerParams:this._symbolizerParams,globalSymbolizerParams:this._globalSymbolizerParams,suspended:l,bandIds:o,coords:n,resolution:h}),t&&(e.once("attach",()=>this.layerView.requestUpdate()),this.container.addChild(e),t.remove())}catch(s){a(s)||i.getLogger(this).error(s)}this.layerView.requestUpdate()}}async _redrawImage(e){if(!this.attached||0===this.container.children.length)return;if(await this.layer.updateRenderer(),this.isCPUBasedDRA?await this._updateGlobalSymbolizerParams(e):(this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._globalSymbolizerParams=null),!this.attached||e?.aborted)return;const t=this.container.children.map(async t=>this.updateTileSymbolizerParameters(t,{local:this._symbolizerParams,global:this._globalSymbolizerParams},e));await Promise.allSettled(t),this.attached&&!e?.aborted&&this.container.requestRender()}async _updateGlobalSymbolizerParams(e){const t=this._getFetchOptions(this.previousLOD.level,e),i=await this.layer.fetchPixels(this.layerView.view.extent,this.layerView.view.width,this.layerView.view.height,{...t,interpolation:"nearest",requestRawData:!1,skipRasterFunction:!1});if(!i?.pixelBlock)return;const{resolution:s}=this.previousLOD,{isBsqTile:r}=this.layer.raster.rasterInfo.storageInfo,a=r?null:this._getBandIds(),o=this.layer.symbolizer.generateWebGLParameters({pixelBlock:i.pixelBlock.extractBands(a),isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:s,y:s},bandIds:a});!this.canUseWebGLForProcessing&&o&&"stretch"===o.type&&"raster-stretch"===this.layer.renderer?.type&&(o.factor=o.factor.map(e=>255*e),o.minOutput=Math.round(255*o.minOutput),o.maxOutput=Math.round(255*o.maxOutput)),this._globalSymbolizerParams=o}_updateSymbolizerParams(){const{resolution:e}=this.previousLOD,t=this._getBandIds();this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null,isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:e,y:e},bandIds:t})}_updateBlockCacheRegistry(e=!1){const{layer:t,layerView:i}=this,{raster:s}=t,{multidimensionalDefinition:r}=t.normalizeRasterFetchOptions({multidimensionalDefinition:t.multidimensionalDefinition,timeExtent:i.timeExtent}),a=s.rasterInfo.multidimensionalInfo?s.getSliceIndex(r):null,o=s.rasterInfo.storageInfo.isBsqTile?t.getRawDisplayBandIds():null,l=m(s.rasterId,a,o);if(l!==this._blockCacheRegistryUrl){if(null!=this._blockCacheRegistryUrl&&y(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryId=g(l,s.rasterInfo),e){const{view:e}=i,t=this._tileInfoView.getClosestInfoForScale(e.scale),r=this._srcResolutions[t.level];p(l,this._blockCacheRegistryId,e.extent,e.resolution,r,s.ioConfig.sampling)}this._blockCacheRegistryUrl=l}}async doRefresh(){if(!this.attached||!this.previousLOD||this.layerView.suspended)return;await this.layer.updateRenderer(),this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._updateBlockCacheRegistry(!0),this._fetchQueue.reset();const e=[];this._globalUpdateRequested=this.isCPUBasedDRA||!this.useProgressiveUpdate,this._tileStrategy.refresh(t=>e.push(this._enqueueTileFetch(t))),await this._updatingHandles.addPromise(Promise.allSettled(e))}};e([o()],S.prototype,"_globalUpdateRequested",void 0),e([o()],S.prototype,"attached",void 0),e([o()],S.prototype,"canUseWebGLForProcessing",null),e([o()],S.prototype,"canUseLocalSymbolizerParams",null),e([o()],S.prototype,"isCPUBasedDRA",null),e([o()],S.prototype,"container",void 0),e([o()],S.prototype,"layer",void 0),e([o()],S.prototype,"layerView",void 0),e([o()],S.prototype,"scheduler",void 0),e([o()],S.prototype,"type",void 0),e([o()],S.prototype,"useWebGLForProcessing",null),e([o()],S.prototype,"useProgressiveUpdate",null),e([o()],S.prototype,"timeExtent",void 0),e([o()],S.prototype,"updating",null),S=e([l("esri.views.2d.layers.imagery.BaseImageryTileSubView2D")],S);export{S as BaseImageryTileSubView2D};
5
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{assertIsSome as s}from"../../../../core/maybe.js";import{debounce as r,isAbortError as a}from"../../../../core/promiseUtils.js";import{property as o,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as n}from"../../../../core/support/UpdatingHandles.js";import h from"../../../../geometry/Extent.js";import c from"../../../../geometry/Point.js";import{update as u,unregister as d,getRasterId as p,register as y}from"../../../../layers/raster/datasets/RawBlockCache.js";import{getWorldWidth as m,computeProjectedScales as g}from"../../../../layers/raster/functions/rasterProjectionHelper.js";import _ from"../../../../layers/support/PixelBlock.js";import f from"../../../../layers/support/TileInfo.js";import b from"../../tiling/TileInfoView.js";import"../../tiling/TileKey.js";import w from"../../tiling/TileQueue.js";import P from"../../tiling/TileStrategy.js";import{tileSize as I}from"../../engine/webgl/definitions.js";import{TaskPriority as R}from"../../../support/Scheduler.js";import{getWebGLCapabilities as U}from"../../../webgl/capabilities.js";const C=[0,0];let S=class extends t{constructor(){super(...arguments),this._updatingHandles=new n,this._emptyTilePixelBlock=null,this._tileStrategy=null,this._tileInfoView=null,this._fetchQueue=null,this._blockCacheRegistryUrl=null,this._blockCacheRegistryId=null,this._srcResolutions=[],this.previousLOD=null,this._needBlockCacheUpdate=!1,this._globalSymbolizerParams=null,this._symbolizerParams=null,this._abortController=null,this._isCustomTilingScheme=!1,this._maxIndexedColormapSize=0,this._rasterFunctionState="na",this._globalUpdateRequested=!1,this.attached=!1,this.timeExtent=null,this.redrawOrRefetch=r(async(e={})=>{const t=this._rasterFunctionState,i=e.reprocess||"gpu"===t&&!this.canUseWebGLForProcessing||"cpu"===t&&this.canUseWebGLForProcessing;if(i&&(await this._updatingHandles.addPromise(this.layer.updateRasterFunction()),this.updateRasterFunctionParameters()),!this.previousLOD||this.layerView.suspended)return;const s=this._rasterFunctionState,{type:r}=this;return e.refetch||"raster"!==r&&!!i||"cpu"===s||"cpu"===t?this._updatingHandles.addPromise(this.doRefresh()):this._updatingHandles.addPromise(this._redrawImage(e.signal))})}destroy(){this._updatingHandles.destroy()}get canUseWebGLForProcessing(){return!1}get canUseLocalSymbolizerParams(){return(this.canUseWebGLForProcessing||"rasterVF"===this.type)&&!this.layerView.hasTilingEffects}get isCPUBasedDRA(){const{renderer:e}=this.layer;return"raster-stretch"===e?.type&&e.dynamicRangeAdjustment&&(!this.canUseWebGLForProcessing||!("min-max"===e.stretchType||"standard-deviation"===e.stretchType))}get useWebGLForProcessing(){return this._get("useWebGLForProcessing")??!0}set useWebGLForProcessing(e){this._set("useWebGLForProcessing",e)}get useProgressiveUpdate(){return this._get("useProgressiveUpdate")??!0}set useProgressiveUpdate(e){if(this._tileStrategy&&this.useProgressiveUpdate!==e){this._tileStrategy.destroy(),this.container.removeAllChildren();const t=this._getCacheSize(e);this._tileStrategy=new P({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:t,tileInfoView:this._tileInfoView}),this._set("useProgressiveUpdate",e),this.layerView.requestUpdate()}}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume();const{extent:t,resolution:i,scale:s}=e.state,r=this._tileInfoView.getClosestInfoForScale(s);if(this.layer.raster){if(!this.useProgressiveUpdate||this._needBlockCacheUpdate){const e=this._srcResolutions[r.level],s="toJSON"in t?t:h.fromJSON(t);u(this._blockCacheRegistryUrl,this._blockCacheRegistryId,s,i,e,this.layer.raster.ioConfig.sampling)}this._needBlockCacheUpdate=!1,this.previousLOD?.level!==r.level&&(this.previousLOD=r,null!=this._symbolizerParams&&this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._tileStrategy.updateCacheSize(0))}}moveEnd(){!this.isCPUBasedDRA&&this.useProgressiveUpdate||(this._abortController&&this._abortController.abort(),this._abortController=new AbortController,0===this._fetchQueue.length&&this._redrawImage(this._abortController.signal).then(()=>{this._globalUpdateRequested=!1,this.layerView.requestUpdate()}));const e=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy.updateCacheSize(e),this.layerView.requestUpdate()}get updating(){return this._globalUpdateRequested||this._updatingHandles?.updating}attach(){const e=U();this._maxIndexedColormapSize=4*(e.maxTextureSize||4096),this._initializeTileInfo(),this._tileInfoView=new b(this.layerView.tileInfo,this.layerView.fullExtent);const t=this._computeFetchConcurrency();this._fetchQueue=new w({tileInfoView:this._tileInfoView,concurrency:t,process:(e,t)=>this._fetchTile(e,t),priority:R.MAPVIEW_FETCH_QUEUE,scheduler:this.scheduler});const i=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy=new P({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:i,tileInfoView:this._tileInfoView}),this._updateBlockCacheRegistry()}detach(){this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null,d(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryUrl=this._blockCacheRegistryId=null}acquireTile(e){const t=this.container.createTile(e);return this._updatingHandles.addPromise(this._enqueueTileFetch(t)),this.layerView.requestUpdate(),this._needBlockCacheUpdate=!0,this._globalUpdateRequested=this.isCPUBasedDRA||!this.useProgressiveUpdate,t}releaseTile(e){this._fetchQueue.abort(e.key.id),this.container.removeChild(e),e.once("detach",()=>{e.destroy(),this.layerView.requestUpdate()}),this.layerView.requestUpdate()}createEmptyTilePixelBlock(e=null){const t=null==e||e.join(",")===this._tileInfoView.tileInfo.size.join(",");if(t&&null!=this._emptyTilePixelBlock)return this._emptyTilePixelBlock;e=e||this._tileInfoView.tileInfo.size;const[i,s]=e,r=new _({width:i,height:s,pixels:[new Uint8Array(i*s)],mask:new Uint8Array(i*s),pixelType:"u8"});return t&&(this._emptyTilePixelBlock=r),r}_getBandIds(){if(this.container&&(!("rasterFunctionChain"in this.container)||!this.container.rasterFunctionChain))return this.layer.bandIds;const{bandIds:e,raster:t}=this.layer,i="rasterFunction"in t?t.rasterFunction.rawInputBandIds:null;return e?.length&&i?.length&&1!==t.rasterInfo.bandCount?e.map(e=>i[Math.min(e,i.length-1)]):"rasterFunction"in t?i:e}updateRasterFunctionParameters(){}_fetchTile(e,t){const i=this._getFetchOptions(e.level,t.signal);return this.fetchTile(e,i)}_getFetchOptions(e,t){const{canUseWebGLForProcessing:i}=this,{layerView:s}=this,{tileInfo:r}=s,a=!r.isWrappable&&null!=m(s.view.spatialReference),o=i&&this.layer.raster.hasUniqueSourceStorageInfo,{layer:l}=this.layerView,n=l.serviceRasterInfo?.storageInfo.isBsqTile?l.getRawDisplayBandIds():void 0;return{allowPartialFill:!0,datumTransformation:s.datumTransformation,interpolation:i?"nearest":this.layer.interpolation,registryId:this._blockCacheRegistryId,requestRawData:o,skipRasterFunction:"raster"===this.type&&null!=this.container.rasterFunctionChain,signal:t,srcResolution:this._srcResolutions[e],timeExtent:s.timeExtent,tileInfo:r,bandIds:n,disableWrapAround:a}}_getCacheSize(e){return e?40:0}_initializeTileInfo(){const{layerView:e}=this,t=e.view.spatialReference;if(this._canUseLayerLODs()){const{origin:i,lods:s}=this.layer.tileInfo,r=s.map(({scale:e})=>e),a=f.create({spatialReference:t,size:I,scales:r,origin:i});return e.set("tileInfo",a),void(this._srcResolutions=s.map(({resolution:e})=>({x:e,y:e})))}const{scales:i,srcResolutions:r,isCustomTilingScheme:a}=g(this.layer.serviceRasterInfo,t,{tileSize:I,alignGlobalDatasetWithAGOL:!0,limitToSrcResolution:!1}),o=f.create({spatialReference:t,size:I,scales:i}),l=0===o.origin.x;s(e.fullExtent);const{xmin:n,ymax:h}=e.fullExtent;(l||a&&o.origin.x>n)&&(o.origin=new c({x:n,y:h,spatialReference:t})),this._isCustomTilingScheme=a,e.set("tileInfo",o),this._srcResolutions=r??[]}_canUseLayerLODs(){const{layer:e,layerView:t}=this;if("Map"!==e.raster.tileType)return!1;const{lods:i}=e.tileInfo,s=t.view.constraints?.effectiveLODs;return s?.length===i.length&&s.every(({scale:e},t)=>Math.abs(e-i[t].scale)<.001)}_computeFetchConcurrency(){const{blockBoundary:e}=this.layer.serviceRasterInfo.storageInfo,t=e[e.length-1];return(t.maxCol-t.minCol+1)*(t.maxRow-t.minRow+1)>64?2:10}async _enqueueTileFetch(e,t){if(!this._fetchQueue.has(e.key.id)){try{let t=e.once("detach",()=>t=void 0);const r=await this._fetchQueue.push(e.key),o=this._getBandIds();let l=!this.useProgressiveUpdate||this.isCPUBasedDRA&&!this._globalSymbolizerParams;if(this._globalUpdateRequested&&!this.layerView.moving&&0===this._fetchQueue.length){l=!1;try{await this._redrawImage(this._abortController?.signal)}catch(s){a(s)&&i.getLogger(this).error(s)}this._globalUpdateRequested=!1}if(!t)return;this.canUseLocalSymbolizerParams&&null==this._symbolizerParams&&this._updateSymbolizerParams();const n=this._tileInfoView.getTileCoords(C,e.key),h=this._tileInfoView.getTileResolution(e.key);await this.updateTileSource(e,{source:r,symbolizerParams:this._symbolizerParams,globalSymbolizerParams:this._globalSymbolizerParams,suspended:l,bandIds:o,coords:n,resolution:h}),t&&(e.once("attach",()=>this.layerView.requestUpdate()),this.container.addChild(e),t.remove())}catch(s){a(s)||i.getLogger(this).error(s)}this.layerView.requestUpdate()}}async _redrawImage(e){if(!this.attached||0===this.container.children.length)return;if(await this.layer.updateRenderer(),this.isCPUBasedDRA?await this._updateGlobalSymbolizerParams(e):(this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._globalSymbolizerParams=null),!this.attached||e?.aborted)return;const t=this.container.children.map(async t=>this.updateTileSymbolizerParameters(t,{local:this._symbolizerParams,global:this._globalSymbolizerParams},e));await Promise.allSettled(t),this.attached&&!e?.aborted&&this.container.requestRender()}async _updateGlobalSymbolizerParams(e){const t=this._getFetchOptions(this.previousLOD.level,e),i=await this.layer.fetchPixels(this.layerView.view.extent,this.layerView.view.width,this.layerView.view.height,{...t,interpolation:"nearest",requestRawData:!1,skipRasterFunction:!1});if(!i?.pixelBlock)return;const{resolution:s}=this.previousLOD,{isBsqTile:r}=this.layer.raster.rasterInfo.storageInfo,a=r?null:this._getBandIds(),o=this.layer.symbolizer.generateWebGLParameters({pixelBlock:i.pixelBlock.extractBands(a),isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:s,y:s},bandIds:a});!this.canUseWebGLForProcessing&&o&&"stretch"===o.type&&"raster-stretch"===this.layer.renderer?.type&&(o.factor=o.factor.map(e=>255*e),o.minOutput=Math.round(255*o.minOutput),o.maxOutput=Math.round(255*o.maxOutput)),this._globalSymbolizerParams=o}_updateSymbolizerParams(){const{resolution:e}=this.previousLOD,t=this._getBandIds();this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null,isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:e,y:e},bandIds:t})}_updateBlockCacheRegistry(e=!1){const{layer:t,layerView:i}=this,{raster:s}=t,{multidimensionalDefinition:r}=t.normalizeRasterFetchOptions({multidimensionalDefinition:t.multidimensionalDefinition,timeExtent:i.timeExtent}),a=s.rasterInfo.multidimensionalInfo?s.getSliceIndex(r):null,o=s.rasterInfo.storageInfo.isBsqTile?t.getRawDisplayBandIds():null,l=p(s.rasterId,a,o);if(l!==this._blockCacheRegistryUrl){if(null!=this._blockCacheRegistryUrl&&d(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryId=y(l,s.rasterInfo),e){const{view:e}=i,t=this._tileInfoView.getClosestInfoForScale(e.scale),r=this._srcResolutions[t.level];u(l,this._blockCacheRegistryId,e.extent,e.resolution,r,s.ioConfig.sampling)}this._blockCacheRegistryUrl=l}}async doRefresh(){if(!this.attached||!this.previousLOD||this.layerView.suspended)return;await this.layer.updateRenderer(),this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._updateBlockCacheRegistry(!0),this._fetchQueue.reset();const e=[];this._globalUpdateRequested=this.isCPUBasedDRA||!this.useProgressiveUpdate,this._tileStrategy.refresh(t=>e.push(this._enqueueTileFetch(t))),await this._updatingHandles.addPromise(Promise.allSettled(e))}};e([o()],S.prototype,"_globalUpdateRequested",void 0),e([o()],S.prototype,"attached",void 0),e([o()],S.prototype,"canUseWebGLForProcessing",null),e([o()],S.prototype,"canUseLocalSymbolizerParams",null),e([o()],S.prototype,"isCPUBasedDRA",null),e([o()],S.prototype,"container",void 0),e([o()],S.prototype,"layer",void 0),e([o()],S.prototype,"layerView",void 0),e([o()],S.prototype,"scheduler",void 0),e([o()],S.prototype,"type",void 0),e([o()],S.prototype,"useWebGLForProcessing",null),e([o()],S.prototype,"useProgressiveUpdate",null),e([o()],S.prototype,"timeExtent",void 0),e([o()],S.prototype,"updating",null),S=e([l("esri.views.2d.layers.imagery.BaseImageryTileSubView2D")],S);export{S as BaseImageryTileSubView2D};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../Color.js";import has from"../../../../core/has.js";import{numberMaxFloat32 as r}from"../../../../core/mathUtils.js";import{property as s,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{isFunctionRaster as o}from"../../../../layers/support/rasterDatasets/datasetUtils.js";import{getBytesPerPixel as n}from"../../../../layers/support/rasterFormats/pixelRangeUtils.js";import{convertGeometryToMask as a}from"../../../../layers/support/rasterFunctions/clipUtils.js";import{maxMapSizeGpu as l}from"../../../../layers/support/rasterFunctions/pixelUtils.js";import{RasterTileContainer as c}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as p}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as u}from"../support/util.js";import{defaultColor as h}from"../../../support/HighlightDefaults.js";import{getHighlightName as d}from"../../../support/highlightOptionsUtils.js";const m=[1024,1024];let y=class extends p{constructor(){super(...arguments),this.type="raster"}get canUseWebGLForProcessing(){const{loaded:e,symbolizer:t}=this.layer;if(!e||!t)return!1;const r=t.lookup.colormapLut?.indexedColormap,s=r&&r.length>this._maxIndexedColormapSize,i=n(this.layer.serviceRasterInfo);return!(has("ios")&&i>4)&&this.useWebGLForProcessing&&t.canRenderInWebGL&&!s&&!("majority"===this.layer.interpolation&&u(this.layer))}attach(){super.attach(),this.container=new c(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme,this.updateRasterFunctionParameters()}detach(){super.detach(),this.container.removeAllChildren(),this.container=null}fetchTile(e,t){return this.layer.fetchTile(e.level,e.row,e.col,t)}updateRasterFunctionParameters(){const{raster:e,type:t}=this.layer,{container:r}=this;if("Function"!==e.datasetFormat||"wcs"===t)return r.rasterFunctionChain=null,r.children.forEach(e=>{const{bitmap:t}=e;t&&(t.suspended=!0,t.processed=!1,t.projected&&(t.invalidateTexture(),t.rasterTexture=null))}),void(this._rasterFunctionState="na");const s=this._rasterFunctionState,{rasterFunction:i,primaryRasters:o}=e,n=i.supportsGPU&&(!o||o.rasters.length<=1),a=n?i.flatWebGLFunctionChain:null,{renderer:l}=this.layer,c=!n||!a?.functions.length||"raster-stretch"===l?.type&&l.dynamicRangeAdjustment||!this.canUseWebGLForProcessing;r.rasterFunctionChain=c?null:this._addProjection(a);const p=null==i?"na":r.rasterFunctionChain?"gpu":"cpu",u=s===p||"na"===s&&"cpu"===p&&0===a?.functions?.length;r.children.forEach(e=>{const{bitmap:t}=e;t&&(t.suspended=!u,t.processed=!1,t.processedTexture=null)}),this._rasterFunctionState=p}async updateTileSource(e,t){const r=this._getBandIds(),s=this._getLayerInterpolation(),{canUseWebGLForProcessing:i}=this,{source:n,globalSymbolizerParams:l,suspended:c,coords:p,resolution:u}=t,h=this.isCPUBasedDRA?l:t.symbolizerParams,{bitmap:d}=e;if([d.x,d.y]=p,d.resolution=u,null!=n?.pixelBlock){const e={extent:n.extent,pixelBlock:n.pixelBlock,srcPixelSize:n.srcTilePixelSize};if(d.rawPixelData=e,i)d.source=n.pixelBlock,d.isRendereredSource=!1;else{const t=await this.layer.applyRenderer(e,"stretch"===l?.type?l:void 0);d.source=t,d.isRendereredSource=!0}d.symbolizerParameters=i?h:null,d.transformGrid=i?n.transformGrid:null}else{const e=this.createEmptyTilePixelBlock();d.source=e,d.symbolizerParameters=i?h:null,d.transformGrid=null}const{isBsqTile:m}=this.layer.raster.rasterInfo.storageInfo;d.bandIds=i&&!m?r:null,d.width=this._tileInfoView.tileInfo.size[0],d.height=this._tileInfoView.tileInfo.size[1],d.interpolation=s,d.suspended=c;const{raster:y}=this.layer;if(o(y)){const t=y.getClippingGeometry(this.layerView.view.spatialReference);if(t){const r=y.getTileExtentFromTileInfo(e.key.level,e.key.row,e.key.col,this._tileInfoView.tileInfo);r&&(d.mask=a({srcExtent:r,geometry:t,size:[d.width,d.height]}))}}d.invalidateTexture()}async updateTileSymbolizerParameters(e,t,r){const{local:s,global:i}=t,o=this._getBandIds(),n=this._getLayerInterpolation(),{canUseWebGLForProcessing:a}=this,{bitmap:l}=e,{rawPixelData:c}=l;a||null==c?(l.isRendereredSource&&null!=c&&(l.source=c.pixelBlock),l.isRendereredSource=!1):(l.source=await this.layer.applyRenderer(c,"stretch"===i?.type?i:void 0,{signal:r}),l.isRendereredSource=!0),l.symbolizerParameters=a?this.layerView.hasTilingEffects?i:s:null;const{isBsqTile:p}=this.layer.raster.rasterInfo.storageInfo;l.bandIds=a&&!p?o:null,l.interpolation=n,l.suspended=!1}updateHighlightOptions(e){if(!e.length)return void(this.container.pixelHighlights=void 0);const s=[],{highlights:i}=this.layerView.view;e.sort((e,t)=>i.findIndex(({name:e})=>e===d(t.options))-i.findIndex(({name:t})=>t===d(e.options)));for(const{target:o,options:n}of e){const{pixelRanges:e}=o,c=d(n),p=i.find(e=>e.name===c)?.color??h,u=t.toUnitRGBA(p);if(Array.isArray(e)){const t=Array.from({length:2*l},()=>0);for(let r=0;r<e.length;r++)t[2*r]=e[r][0],t[2*r+1]=e[r][1];for(let s=e.length;s<l;s++)t[2*s]=r,t[2*s+1]=-r;const i=o.bandId??0;s.push({ranges:t,bandId:i,color:u,type:"single-band"})}else{const t="extent"===e.type?e:e.extent;if(!t)continue;const r=[t.xmin,t.xmax],i=[t.ymin,t.ymax],{xBandId:n,yBandId:l}=o,c={xRange:r,yRange:i,bandIds:[n,l],color:u,type:"xy-band"};"polygon"===e.type&&(c.maskSize=m,c.mask=a({srcExtent:t,geometry:e,size:m})),s.push(c)}}this.container.pixelHighlights=s}_getLayerInterpolation(){const{interpolation:e,renderer:t}=this.layer;if(!t)return e;const r=t.type;return"raster-colormap"===r||"unique-value"===r?"nearest":"raster-stretch"===t.type&&null!=t.colorRamp?"bilinear"===e||"cubic"===e?"bilinear":"nearest":e}_addProjection(e){return e?.functions?.length&&!e.hasFocalFunction&&e.functions.unshift({name:"Reproject",parameters:{targetImageSize:this._tileInfoView.tileInfo.size,requireNNEdge:e.isSourceSingleBand},pixelType:"f32",id:0,isNoopProcess:!1}),e}};e([s()],y.prototype,"canUseWebGLForProcessing",null),e([s()],y.prototype,"container",void 0),e([s()],y.prototype,"layer",void 0),e([s()],y.prototype,"type",void 0),y=e([i("esri.views.2d.layers.imagery.ImageryTileView2D")],y);export{y as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../../Color.js";import has from"../../../../core/has.js";import{numberMaxFloat32 as r}from"../../../../core/mathUtils.js";import{property as i,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{isFunctionRaster as n}from"../../../../layers/raster/datasets/datasetUtils.js";import{getBytesPerPixel as o}from"../../../../layers/raster/formats/pixelRangeUtils.js";import{convertGeometryToMask as a}from"../../../../layers/raster/functions/clipUtils.js";import{maxMapSizeGpu as l}from"../../../../layers/raster/functions/pixelUtils.js";import{RasterTileContainer as c}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as p}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as u}from"../support/util.js";import{defaultColor as d}from"../../../support/HighlightDefaults.js";import{getHighlightName as h}from"../../../support/highlightOptionsUtils.js";const m=[1024,1024];let y=class extends p{constructor(){super(...arguments),this.type="raster"}get canUseWebGLForProcessing(){const{loaded:e,symbolizer:t}=this.layer;if(!e||!t)return!1;const r=t.lookup.colormapLut?.indexedColormap,i=r&&r.length>this._maxIndexedColormapSize,s=o(this.layer.serviceRasterInfo);return!(has("ios")&&s>4)&&this.useWebGLForProcessing&&t.canRenderInWebGL&&!i&&!("majority"===this.layer.interpolation&&u(this.layer))}attach(){super.attach(),this.container=new c(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme,this.updateRasterFunctionParameters()}detach(){super.detach(),this.container.removeAllChildren(),this.container=null}fetchTile(e,t){return this.layer.fetchTile(e.level,e.row,e.col,t)}updateRasterFunctionParameters(){const{raster:e,type:t}=this.layer,{container:r}=this;if("Function"!==e.datasetFormat||"wcs"===t)return r.rasterFunctionChain=null,r.children.forEach(e=>{const{bitmap:t}=e;t&&(t.suspended=!0,t.processed=!1,t.projected&&(t.invalidateTexture(),t.rasterTexture=null))}),void(this._rasterFunctionState="na");const i=this._rasterFunctionState,{rasterFunction:s,primaryRasters:n}=e,o=s.supportsGPU&&(!n||n.rasters.length<=1),a=o?s.flatWebGLFunctionChain:null,{renderer:l}=this.layer,c=!o||!a?.functions.length||"raster-stretch"===l?.type&&l.dynamicRangeAdjustment||!this.canUseWebGLForProcessing;r.rasterFunctionChain=c?null:this._addProjection(a);const p=null==s?"na":r.rasterFunctionChain?"gpu":"cpu",u=i===p||"na"===i&&"cpu"===p&&0===a?.functions?.length;r.children.forEach(e=>{const{bitmap:t}=e;t&&(t.suspended=!u,t.processed=!1,t.processedTexture=null)}),this._rasterFunctionState=p}async updateTileSource(e,t){const r=this._getBandIds(),i=this._getLayerInterpolation(),{canUseWebGLForProcessing:s}=this,{source:o,globalSymbolizerParams:l,suspended:c,coords:p,resolution:u}=t,d=this.isCPUBasedDRA?l:t.symbolizerParams,{bitmap:h}=e;if([h.x,h.y]=p,h.resolution=u,null!=o?.pixelBlock){const e={extent:o.extent,pixelBlock:o.pixelBlock,srcPixelSize:o.srcTilePixelSize};if(h.rawPixelData=e,s)h.source=o.pixelBlock,h.isRendereredSource=!1;else{const t=await this.layer.applyRenderer(e,"stretch"===l?.type?l:void 0);h.source=t,h.isRendereredSource=!0}h.symbolizerParameters=s?d:null,h.transformGrid=s?o.transformGrid:null}else{const e=this.createEmptyTilePixelBlock();h.source=e,h.symbolizerParameters=s?d:null,h.transformGrid=null}const{isBsqTile:m}=this.layer.raster.rasterInfo.storageInfo;h.bandIds=s&&!m?r:null,h.width=this._tileInfoView.tileInfo.size[0],h.height=this._tileInfoView.tileInfo.size[1],h.interpolation=i,h.suspended=c;const{raster:y}=this.layer;if(n(y)){const t=y.getClippingGeometry(this.layerView.view.spatialReference);if(t){const r=y.getTileExtentFromTileInfo(e.key.level,e.key.row,e.key.col,this._tileInfoView.tileInfo);r&&(h.mask=a({srcExtent:r,geometry:t,size:[h.width,h.height]}))}}h.invalidateTexture()}async updateTileSymbolizerParameters(e,t,r){const{local:i,global:s}=t,n=this._getBandIds(),o=this._getLayerInterpolation(),{canUseWebGLForProcessing:a}=this,{bitmap:l}=e,{rawPixelData:c}=l;a||null==c?(l.isRendereredSource&&null!=c&&(l.source=c.pixelBlock),l.isRendereredSource=!1):(l.source=await this.layer.applyRenderer(c,"stretch"===s?.type?s:void 0,{signal:r}),l.isRendereredSource=!0),l.symbolizerParameters=a?this.layerView.hasTilingEffects?s:i:null;const{isBsqTile:p}=this.layer.raster.rasterInfo.storageInfo;l.bandIds=a&&!p?n:null,l.interpolation=o,l.suspended=!1}updateHighlightOptions(e){if(!e.length)return void(this.container.pixelHighlights=void 0);const i=[],{highlights:s}=this.layerView.view;e.sort((e,t)=>s.findIndex(({name:e})=>e===h(t.options))-s.findIndex(({name:t})=>t===h(e.options)));for(const{target:n,options:o}of e){const{pixelRanges:e}=n,c=h(o),p=s.find(e=>e.name===c)?.color??d,u=t.toUnitRGBA(p);if(Array.isArray(e)){const t=Array.from({length:2*l},()=>0);for(let r=0;r<e.length;r++)t[2*r]=e[r][0],t[2*r+1]=e[r][1];for(let i=e.length;i<l;i++)t[2*i]=r,t[2*i+1]=-r;const s=n.bandId??0;i.push({ranges:t,bandId:s,color:u,type:"single-band"})}else{const t="extent"===e.type?e:e.extent;if(!t)continue;const r=[t.xmin,t.xmax],s=[t.ymin,t.ymax],{xBandId:o,yBandId:l}=n,c={xRange:r,yRange:s,bandIds:[o,l],color:u,type:"xy-band"};"polygon"===e.type&&(c.maskSize=m,c.mask=a({srcExtent:t,geometry:e,size:m})),i.push(c)}}this.container.pixelHighlights=i}_getLayerInterpolation(){const{interpolation:e,renderer:t}=this.layer;if(!t)return e;const r=t.type;return"raster-colormap"===r||"unique-value"===r?"nearest":"raster-stretch"===t.type&&null!=t.colorRamp?"bilinear"===e||"cubic"===e?"bilinear":"nearest":e}_addProjection(e){return e?.functions?.length&&!e.hasFocalFunction&&e.functions.unshift({name:"Reproject",parameters:{targetImageSize:this._tileInfoView.tileInfo.size,requireNNEdge:e.isSourceSingleBand},pixelType:"f32",id:0,isNoopProcess:!1}),e}};e([i()],y.prototype,"canUseWebGLForProcessing",null),e([i()],y.prototype,"container",void 0),e([i()],y.prototype,"layer",void 0),e([i()],y.prototype,"type",void 0),y=e([s("esri.views.2d.layers.imagery.ImageryTileView2D")],y);export{y 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../../../Graphic.js";import i from"../../../../core/Accessor.js";import r from"../../../../core/Logger.js";import{isAbortError as a}from"../../../../core/promiseUtils.js";import{property as s,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{mosaicPixelData as l}from"../../../../layers/support/rasterFunctions/pixelUtils.js";import{BitmapContainer as p}from"../../engine/BitmapContainer.js";import{Container as n}from"../../engine/Container.js";import h from"../../engine/ImageryBitmapSource.js";import g from"../support/ExportStrategy.js";let c=class extends i{constructor(){super(...arguments),this.attached=!1,this.container=new n,this.updateRequested=!1,this.pixelHighlights=[],this.type="imagery",this._bitmapView=new p}destroy(){this.attached&&(this.detach(),this.attached=!1),this.updateRequested=!1}get updating(){return!this.attached||this.isUpdating()}update(t){this.strategy.update(t).catch(t=>{a(t)||r.getLogger(this).error(t)})}hitTest(t){return new e({attributes:{},geometry:t.clone(),layer:this.layer})}attach(){this.container.addChild(this._bitmapView);const t=this.layer.version>=10,e=this.layer.version>=10.1?this.layer.imageMaxHeight:2048,i=this.layer.version>=10.1?this.layer.imageMaxWidth:2048;this.strategy=new g({container:this._bitmapView,imageNormalizationSupported:t,imageMaxHeight:e,imageMaxWidth:i,fetchSource:this._fetchImage.bind(this),requestUpdate:()=>this.requestUpdate()})}detach(){this.strategy.destroy(),this._bitmapView.removeAllChildren(),this.container.removeAllChildren(),this.updateRequested=!1}redraw(){this.strategy.updateExports(async t=>{const{source:e}=t;if(!e||e instanceof ImageBitmap)return;const i=e.originalPixelBlock??e.pixelBlock,{pixelHighlights:r}=this,a=r.length>0,s=await this.layer.applyRenderer({extent:e.extent,pixelBlock:i,isRawData:a}),o=s.pixelBlock;a&&i&&o&&await this.layer.highlightPixels({pixelBlock:i,renderedPixelBlock:o,highlightOptions:r}),e.filter=t=>this.layer.pixelFilter?this.layer.applyFilter(t):{...s,extent:e.extent}}).catch(t=>{a(t)||r.getLogger(this).error(t)})}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.view.requestUpdate())}isUpdating(){return this.strategy.updating||this.updateRequested}getPixelData(){if(this.updating)return null;const t=this.strategy.bitmaps;if(1===t.length&&t[0].source)return{extent:t[0].source.extent,pixelBlock:t[0].source.originalPixelBlock};if(t.length>1){const e=this.view.extent,i=t.map(t=>t.source).filter(t=>t.extent&&t.extent.intersects(e)).map(t=>({extent:t.extent,pixelBlock:t.originalPixelBlock})),r=l(i,e);return null!=r?{extent:r.extent,pixelBlock:r.pixelBlock}:null}return null}async _fetchImage(t,e,i,r){(r=r||{}).timeExtent=this.timeExtent;const a=this.pixelHighlights.length>0;r.requestAsImageElement=!a,r.returnImageBitmap=!a,r.requestRawData=a;const s=await this.layer.internalFetchImage(t,e,i,r);if(s.imageBitmap)return s.imageBitmap;const o=await this.layer.applyRenderer({...s.pixelData,isRawData:a},{signal:r.signal}),l=s.pixelData.pixelBlock,p=o.pixelBlock;a&&l&&p&&await this.layer.highlightPixels({pixelBlock:l,renderedPixelBlock:p,highlightOptions:this.pixelHighlights});const n=new h(p,o.extent?.clone(),l);return n.filter=t=>this.layer.applyFilter(t),n}};t([s()],c.prototype,"attached",void 0),t([s()],c.prototype,"container",void 0),t([s()],c.prototype,"layer",void 0),t([s()],c.prototype,"strategy",void 0),t([s()],c.prototype,"timeExtent",void 0),t([s()],c.prototype,"view",void 0),t([s()],c.prototype,"updateRequested",void 0),t([s()],c.prototype,"updating",null),t([s()],c.prototype,"pixelHighlights",void 0),t([s()],c.prototype,"type",void 0),c=t([o("esri.views.2d.layers.imagery.ImageryView2D")],c);export{c as default};
5
+ import{__decorate as t}from"tslib";import e from"../../../../Graphic.js";import i from"../../../../core/Accessor.js";import r from"../../../../core/Logger.js";import{isAbortError as a}from"../../../../core/promiseUtils.js";import{property as s,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{mosaicPixelData as l}from"../../../../layers/raster/functions/pixelUtils.js";import{BitmapContainer as n}from"../../engine/BitmapContainer.js";import{Container as p}from"../../engine/Container.js";import h from"../../engine/ImageryBitmapSource.js";import g from"../support/ExportStrategy.js";let c=class extends i{constructor(){super(...arguments),this.attached=!1,this.container=new p,this.updateRequested=!1,this.pixelHighlights=[],this.type="imagery",this._bitmapView=new n}destroy(){this.attached&&(this.detach(),this.attached=!1),this.updateRequested=!1}get updating(){return!this.attached||this.isUpdating()}update(t){this.strategy.update(t).catch(t=>{a(t)||r.getLogger(this).error(t)})}hitTest(t){return new e({attributes:{},geometry:t.clone(),layer:this.layer})}attach(){this.container.addChild(this._bitmapView);const t=this.layer.version>=10,e=this.layer.version>=10.1?this.layer.imageMaxHeight:2048,i=this.layer.version>=10.1?this.layer.imageMaxWidth:2048;this.strategy=new g({container:this._bitmapView,imageNormalizationSupported:t,imageMaxHeight:e,imageMaxWidth:i,fetchSource:this._fetchImage.bind(this),requestUpdate:()=>this.requestUpdate()})}detach(){this.strategy.destroy(),this._bitmapView.removeAllChildren(),this.container.removeAllChildren(),this.updateRequested=!1}redraw(){this.strategy.updateExports(async t=>{const{source:e}=t;if(!e||e instanceof ImageBitmap)return;const i=e.originalPixelBlock??e.pixelBlock,{pixelHighlights:r}=this,a=r.length>0,s=await this.layer.applyRenderer({extent:e.extent,pixelBlock:i,isRawData:a}),o=s.pixelBlock;a&&i&&o&&await this.layer.highlightPixels({pixelBlock:i,renderedPixelBlock:o,highlightOptions:r}),e.filter=t=>this.layer.pixelFilter?this.layer.applyFilter(t):{...s,extent:e.extent}}).catch(t=>{a(t)||r.getLogger(this).error(t)})}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.view.requestUpdate())}isUpdating(){return this.strategy.updating||this.updateRequested}getPixelData(){if(this.updating)return null;const t=this.strategy.bitmaps;if(1===t.length&&t[0].source)return{extent:t[0].source.extent,pixelBlock:t[0].source.originalPixelBlock};if(t.length>1){const e=this.view.extent,i=t.map(t=>t.source).filter(t=>t.extent&&t.extent.intersects(e)).map(t=>({extent:t.extent,pixelBlock:t.originalPixelBlock})),r=l(i,e);return null!=r?{extent:r.extent,pixelBlock:r.pixelBlock}:null}return null}async _fetchImage(t,e,i,r){(r=r||{}).timeExtent=this.timeExtent;const a=this.pixelHighlights.length>0;r.requestAsImageElement=!a,r.returnImageBitmap=!a,r.requestRawData=a;const s=await this.layer.internalFetchImage(t,e,i,r);if(s.imageBitmap)return s.imageBitmap;const o=await this.layer.applyRenderer({...s.pixelData,isRawData:a},{signal:r.signal}),l=s.pixelData.pixelBlock,n=o.pixelBlock;a&&l&&n&&await this.layer.highlightPixels({pixelBlock:l,renderedPixelBlock:n,highlightOptions:this.pixelHighlights});const p=new h(n,o.extent?.clone(),l);return p.filter=t=>this.layer.applyFilter(t),p}};t([s()],c.prototype,"attached",void 0),t([s()],c.prototype,"container",void 0),t([s()],c.prototype,"layer",void 0),t([s()],c.prototype,"strategy",void 0),t([s()],c.prototype,"timeExtent",void 0),t([s()],c.prototype,"view",void 0),t([s()],c.prototype,"updateRequested",void 0),t([s()],c.prototype,"updating",null),t([s()],c.prototype,"pixelHighlights",void 0),t([s()],c.prototype,"type",void 0),c=t([o("esri.views.2d.layers.imagery.ImageryView2D")],c);export{c 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as i,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{sampleVectorField as o}from"../../../../layers/support/rasterFunctions/vectorFieldUtils.js";import{RasterVFTileContainer as l}from"../../engine/imagery/RasterVFTileContainer.js";import{BaseImageryTileSubView2D as s}from"./BaseImageryTileSubView2D.js";let a=class extends s{constructor(){super(...arguments),this._handle=null,this.type="rasterVF"}async fetchTile(e,t){t={...t,interpolation:"nearest",requestProjectedLocalDirections:!0};const i=await this.layer.fetchTile(e.level,e.row,e.col,t);return"vector-magdir"===this.layer.serviceRasterInfo?.dataType&&i?.pixelBlock&&(i.pixelBlock=await this.layer.convertVectorFieldData(i.pixelBlock,"vector-magdir",t)),i}updateTileSource(e,t){const i=t.symbolizerParams,{tileData:r}=e;r.key=e.key,r.width=this._tileInfoView.tileInfo.size[0],r.height=this._tileInfoView.tileInfo.size[1];const{symbolTileSize:o}=i,{source:l}=t;if(r.offset=this._getTileSymbolOffset(r.key,o),null!=l?.pixelBlock){const e={extent:l.extent,pixelBlock:l.pixelBlock};r.rawPixelData=e,r.symbolizerParameters=i,r.source=this._sampleVectorFieldData(l.pixelBlock,i,r.offset)}else{const e=[Math.round((this._tileInfoView.tileInfo.size[0]-r.offset[0])/o),Math.round((this._tileInfoView.tileInfo.size[1]-r.offset[1])/o)],t=this.createEmptyTilePixelBlock(e);r.source=t,r.symbolizerParameters=i}return r.invalidateVAO(),Promise.resolve()}updateTileSymbolizerParameters(e,t){const i=t.local,{symbolTileSize:r}=i,{tileData:o}=e;o.offset=this._getTileSymbolOffset(o.key,r);const l=o.symbolizerParameters.symbolTileSize;o.symbolizerParameters=i;const s=o.rawPixelData?.pixelBlock;return null!=s&&l!==r&&(o.source=this._sampleVectorFieldData(s,o.symbolizerParameters,o.offset)),Promise.resolve()}attach(){super.attach(),this.container=new l(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme,this._updateSymbolType(this.layer.renderer),this._handle=t(()=>this.layer.renderer,e=>this._updateSymbolType(e))}detach(){super.detach(),this.container.removeAllChildren(),this._handle?.remove(),this._handle=null,this.container=null}_getTileSymbolOffset(e,t){const i=e.col*this._tileInfoView.tileInfo.size[0]%t,r=e.row*this._tileInfoView.tileInfo.size[1]%t;return[i>t/2?t-i:-i,r>t/2?t-r:-r]}_sampleVectorFieldData(e,t,i){const{symbolTileSize:r}=t;return o(e,"vector-uv",r,i)}_updateSymbolType(e){"vector-field"===e?.type&&(this.container.symbolTypes="wind-barb"===e.style?["scalar","triangle"]:"simple-scalar"===e.style?["scalar"]:["triangle"])}};e([i()],a.prototype,"container",void 0),e([i()],a.prototype,"layer",void 0),e([i()],a.prototype,"type",void 0),a=e([r("esri.views.2d.layers.imagery.VectorFieldTileView2D")],a);export{a as default};
5
+ import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as i,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{sampleVectorField as l}from"../../../../layers/raster/functions/vectorFieldUtils.js";import{RasterVFTileContainer as o}from"../../engine/imagery/RasterVFTileContainer.js";import{BaseImageryTileSubView2D as s}from"./BaseImageryTileSubView2D.js";let a=class extends s{constructor(){super(...arguments),this._handle=null,this.type="rasterVF"}async fetchTile(e,t){t={...t,interpolation:"nearest",requestProjectedLocalDirections:!0};const i=await this.layer.fetchTile(e.level,e.row,e.col,t);return"vector-magdir"===this.layer.serviceRasterInfo?.dataType&&i?.pixelBlock&&(i.pixelBlock=await this.layer.convertVectorFieldData(i.pixelBlock,"vector-magdir",t)),i}updateTileSource(e,t){const i=t.symbolizerParams,{tileData:r}=e;r.key=e.key,r.width=this._tileInfoView.tileInfo.size[0],r.height=this._tileInfoView.tileInfo.size[1];const{symbolTileSize:l}=i,{source:o}=t;if(r.offset=this._getTileSymbolOffset(r.key,l),null!=o?.pixelBlock){const e={extent:o.extent,pixelBlock:o.pixelBlock};r.rawPixelData=e,r.symbolizerParameters=i,r.source=this._sampleVectorFieldData(o.pixelBlock,i,r.offset)}else{const e=[Math.round((this._tileInfoView.tileInfo.size[0]-r.offset[0])/l),Math.round((this._tileInfoView.tileInfo.size[1]-r.offset[1])/l)],t=this.createEmptyTilePixelBlock(e);r.source=t,r.symbolizerParameters=i}return r.invalidateVAO(),Promise.resolve()}updateTileSymbolizerParameters(e,t){const i=t.local,{symbolTileSize:r}=i,{tileData:l}=e;l.offset=this._getTileSymbolOffset(l.key,r);const o=l.symbolizerParameters.symbolTileSize;l.symbolizerParameters=i;const s=l.rawPixelData?.pixelBlock;return null!=s&&o!==r&&(l.source=this._sampleVectorFieldData(s,l.symbolizerParameters,l.offset)),Promise.resolve()}attach(){super.attach(),this.container=new o(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme,this._updateSymbolType(this.layer.renderer),this._handle=t(()=>this.layer.renderer,e=>this._updateSymbolType(e))}detach(){super.detach(),this.container.removeAllChildren(),this._handle?.remove(),this._handle=null,this.container=null}_getTileSymbolOffset(e,t){const i=e.col*this._tileInfoView.tileInfo.size[0]%t,r=e.row*this._tileInfoView.tileInfo.size[1]%t;return[i>t/2?t-i:-i,r>t/2?t-r:-r]}_sampleVectorFieldData(e,t,i){const{symbolTileSize:r}=t;return l(e,"vector-uv",r,i)}_updateSymbolType(e){"vector-field"===e?.type&&(this.container.symbolTypes="wind-barb"===e.style?["scalar","triangle"]:"simple-scalar"===e.style?["scalar"]:["triangle"])}};e([i()],a.prototype,"container",void 0),e([i()],a.prototype,"layer",void 0),e([i()],a.prototype,"type",void 0),a=e([r("esri.views.2d.layers.imagery.VectorFieldTileView2D")],a);export{a 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../../../Graphic.js";import r from"../../../../request.js";import i from"../../../../core/Accessor.js";import a from"../../../../core/Logger.js";import{isAbortError as s}from"../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{property as l,subclass as m}from"../../../../core/accessorSupport/decorators.js";import c from"../../../../geometry/Extent.js";import{srToRESTValue as p}from"../../../../geometry/support/spatialReferenceUtils.js";import{projectExtent as h}from"../../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{snapImageToSymbolTile as y}from"../../../../layers/support/rasterFunctions/vectorFieldUtils.js";import{RasterVFContainer as u}from"../../engine/imagery/RasterVFContainer.js";import x from"./ImageryVFStrategy.js";let d=class extends i{constructor(){super(...arguments),this.attached=!1,this.container=new u,this.type="imageryVF",this._dataParameters={exportParametersVersion:0,bbox:"",symbolTileSize:0,time:""},this._fetchpixels=async(t,e,r,i)=>{const a=await this._projectFullExtentPromise,{layer:s}=this,{symbolTileSize:o}=s.renderer,{extent:n,width:l,height:m}=y(t,e,r,o,a);if(null!=a&&!a.intersects(t))return{extent:n,pixelBlock:null};const c={bbox:`${n.xmin}, ${n.ymin}, ${n.xmax}, ${n.ymax}`,exportParametersVersion:s.exportImageServiceParameters.version,symbolTileSize:o,time:JSON.stringify(this.timeExtent||"")};if(this._canReuseVectorFieldData(c)){const t=this.getPixelData();if(null!=t){if(`${t.extent.xmin}, ${t.extent.ymin}, ${t.extent.xmax}, ${t.extent.ymax}`===c.bbox)return t}}const{pixelBlock:p}=await s.fetchPixels(n,l,m,{timeExtent:this.timeExtent,interpolation:s.interpolation,signal:i});if(this._dataParameters=c,null==p)return{extent:n,pixelBlock:null};const{dataType:h}=s.rasterInfo;return{extent:n,pixelBlock:"vector-uv"===h&&p?await s.convertVectorFieldData(p,"vector-uv",{signal:i}):p}}}get updating(){return!this.attached||this._strategy.updating}attach(){this._projectFullExtentPromise=this._getProjectedFullExtent(this.view.spatialReference),this._strategy=new x({container:this.container,fetchPixels:this._fetchpixels}),this.addHandles(o(()=>this.layer.renderer,t=>this._updateSymbolizerParams(t),n),"attach")}detach(){this._strategy.destroy(),this.container.children.forEach(t=>t.destroy()),this.container.removeAllChildren(),this.removeHandles("attach"),this._strategy=this.container=this._projectFullExtentPromise=null}getPixelData(){const t=this.container.children[0]?.rawPixelData;if(this.updating||!t)return null;const{extent:e,pixelBlock:r}=t;return{extent:e,pixelBlock:r}}hitTest(t){return new e({attributes:{},geometry:t.clone(),layer:this.layer})}update(t){this._strategy.update(t,this._symbolizerParams).catch(t=>{s(t)||a.getLogger(this).error(t)})}redraw(){const{renderer:t}=this.layer;t&&(this._updateSymbolizerParams(t),this._strategy.redraw(this._symbolizerParams))}_canReuseVectorFieldData(t){const e=this._dataParameters.exportParametersVersion===t.exportParametersVersion,r=this._dataParameters.time===t.time,i=this._dataParameters.symbolTileSize===t.symbolTileSize,a=this._dataParameters.bbox===t.bbox;return e&&r&&i&&a}async _getProjectedFullExtent(t){try{return h(this.layer.fullExtent,t)}catch(e){try{const e=(await r(this.layer.url,{query:{option:"footprints",outSR:p(t),f:"json"}})).data.featureCollection.layers[0].layerDefinition.extent;return e?c.fromJSON(e):null}catch{return null}}}_updateSymbolizerParams(t){"vector-field"===t?.type&&(this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null}))}};t([l()],d.prototype,"attached",void 0),t([l()],d.prototype,"container",void 0),t([l()],d.prototype,"layer",void 0),t([l()],d.prototype,"timeExtent",void 0),t([l()],d.prototype,"type",void 0),t([l()],d.prototype,"view",void 0),t([l()],d.prototype,"updating",null),d=t([m("esri.views.2d.layers.imagery.VectorFieldView2D")],d);export{d as default};
5
+ import{__decorate as t}from"tslib";import e from"../../../../Graphic.js";import r from"../../../../request.js";import i from"../../../../core/Accessor.js";import a from"../../../../core/Logger.js";import{isAbortError as s}from"../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{property as l,subclass as m}from"../../../../core/accessorSupport/decorators.js";import c from"../../../../geometry/Extent.js";import{srToRESTValue as p}from"../../../../geometry/support/spatialReferenceUtils.js";import{projectExtent as h}from"../../../../layers/raster/functions/rasterProjectionHelper.js";import{snapImageToSymbolTile as y}from"../../../../layers/raster/functions/vectorFieldUtils.js";import{RasterVFContainer as x}from"../../engine/imagery/RasterVFContainer.js";import u from"./ImageryVFStrategy.js";let d=class extends i{constructor(){super(...arguments),this.attached=!1,this.container=new x,this.type="imageryVF",this._dataParameters={exportParametersVersion:0,bbox:"",symbolTileSize:0,time:""},this._fetchpixels=async(t,e,r,i)=>{const a=await this._projectFullExtentPromise,{layer:s}=this,{symbolTileSize:o}=s.renderer,{extent:n,width:l,height:m}=y(t,e,r,o,a);if(null!=a&&!a.intersects(t))return{extent:n,pixelBlock:null};const c={bbox:`${n.xmin}, ${n.ymin}, ${n.xmax}, ${n.ymax}`,exportParametersVersion:s.exportImageServiceParameters.version,symbolTileSize:o,time:JSON.stringify(this.timeExtent||"")};if(this._canReuseVectorFieldData(c)){const t=this.getPixelData();if(null!=t){if(`${t.extent.xmin}, ${t.extent.ymin}, ${t.extent.xmax}, ${t.extent.ymax}`===c.bbox)return t}}const{pixelBlock:p}=await s.fetchPixels(n,l,m,{timeExtent:this.timeExtent,interpolation:s.interpolation,signal:i});if(this._dataParameters=c,null==p)return{extent:n,pixelBlock:null};const{dataType:h}=s.rasterInfo;return{extent:n,pixelBlock:"vector-uv"===h&&p?await s.convertVectorFieldData(p,"vector-uv",{signal:i}):p}}}get updating(){return!this.attached||this._strategy.updating}attach(){this._projectFullExtentPromise=this._getProjectedFullExtent(this.view.spatialReference),this._strategy=new u({container:this.container,fetchPixels:this._fetchpixels}),this.addHandles(o(()=>this.layer.renderer,t=>this._updateSymbolizerParams(t),n),"attach")}detach(){this._strategy.destroy(),this.container.children.forEach(t=>t.destroy()),this.container.removeAllChildren(),this.removeHandles("attach"),this._strategy=this.container=this._projectFullExtentPromise=null}getPixelData(){const t=this.container.children[0]?.rawPixelData;if(this.updating||!t)return null;const{extent:e,pixelBlock:r}=t;return{extent:e,pixelBlock:r}}hitTest(t){return new e({attributes:{},geometry:t.clone(),layer:this.layer})}update(t){this._strategy.update(t,this._symbolizerParams).catch(t=>{s(t)||a.getLogger(this).error(t)})}redraw(){const{renderer:t}=this.layer;t&&(this._updateSymbolizerParams(t),this._strategy.redraw(this._symbolizerParams))}_canReuseVectorFieldData(t){const e=this._dataParameters.exportParametersVersion===t.exportParametersVersion,r=this._dataParameters.time===t.time,i=this._dataParameters.symbolTileSize===t.symbolTileSize,a=this._dataParameters.bbox===t.bbox;return e&&r&&i&&a}async _getProjectedFullExtent(t){try{return h(this.layer.fullExtent,t)}catch(e){try{const e=(await r(this.layer.url,{query:{option:"footprints",outSR:p(t),f:"json"}})).data.featureCollection.layers[0].layerDefinition.extent;return e?c.fromJSON(e):null}catch{return null}}}_updateSymbolizerParams(t){"vector-field"===t?.type&&(this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null}))}};t([l()],d.prototype,"attached",void 0),t([l()],d.prototype,"container",void 0),t([l()],d.prototype,"layer",void 0),t([l()],d.prototype,"timeExtent",void 0),t([l()],d.prototype,"type",void 0),t([l()],d.prototype,"view",void 0),t([l()],d.prototype,"updating",null),d=t([m("esri.views.2d.layers.imagery.VectorFieldView2D")],d);export{d 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import"../../../core/has.js";import{whenOnce as i,watch as r,sync as s}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{projectDatasetExtent as n}from"../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{LayerView3D as o}from"./LayerView3D.js";import{TiledLayerView3D as h}from"./TiledLayerView3D.js";import m from"../support/flow/FlowSubViewTiles3D.js";import{RasterTile as d}from"../terrain/RasterTile.js";import{ImageryTileLayerViewMixin as p}from"../../layers/ImageryTileLayerViewMixin.js";import u from"../../layers/LayerView.js";import{RefreshableLayerView as y}from"../../layers/RefreshableLayerView.js";import{createQueryGeometry as c}from"../../support/drapedUtils.js";import{getWebGLCapabilities as f}from"../../webgl/capabilities.js";let b=class extends(p(y(h(o(u))))){constructor(){super(...arguments),this.type="imagery-tile-3d",this._isAlignedMapTile=!0,this._flowSubView=null,this.ignoresMemoryFactor=!1,this.unloadedMemory=0}initialize(){this.layer.increaseRasterJobHandlerUsage(),null==this.fullExtent&&this.addResolvingPromise(Promise.reject(new t("layerview:spatial-reference-incompatible","The layer extent cannot be projected to the view's spatial reference",{layer:this.layer})));const e=i(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{const e=this.view.basemapTerrain.tilingScheme,t=this.layer.tileInfo;this._isAlignedMapTile=["png","png24","png32","jpg","mixed"].includes(t.format)&&e.compatibleWith(t),this.tileInfo=this._isAlignedMapTile?t:e.toTileInfo(),this.addHandles([r(()=>this.layer.renderer,e=>{this._setSubView(e),this._updatingHandles.addPromise(this.doRefresh())},s),r(()=>[this.layer.interpolation,this.layer.bandIds,this.layer.multidimensionalDefinition,this.layer.multidimensionalSubset,this.layer.rasterFunction,this.timeExtent],()=>this._updatingHandles.addPromise(this.doRefresh()),s)])});this._setSubView(this.layer.renderer),this.addResolvingPromise(e)}destroy(){this.layer.decreaseRasterJobHandlerUsage(),this._flowSubView?.destroy()}_setSubView(e){if("wcs"===this.layer.type)return;const t="flow"===e?.type,i=this._flowSubView;t&&null!=i||(i?.destroy(),this._flowSubView=t?new m({layerView:this}):null)}get _blankTile(){const e=document.createElement("canvas"),t=e.getContext("2d"),[i,r]=this.tileInfo.size;return e.width=i,e.height=r,t.clearRect(0,0,i,r),t.getImageData(0,0,i,r)}get _hasFlow(){return null!=this._flowSubView}get imageFormatIsOpaque(){return"jpg"===this.layer.tileInfo.format}get hasMixedImageFormats(){return"mixed"===this.layer.tileInfo.format}get dataLevelRange(){const e=this.layer.tileInfo,t=this.tileInfo.lodAt(0)?.scale,i=e.lodAt(e.lods.length-1)?.scale;return this.levelRangeFromScaleRange(t,i)}get visibleAtCurrentScale(){return this._flowSubView?.visibleAtCurrentScale??this.tilesVisibleAtCurrentScale()}_getFullExtent(){return n(this.layer.serviceRasterInfo,this.view.basemapTerrain?.spatialReference??this.view.spatialReference)}async fetchTile(e,t){const i=this.tileInfo,r=this._canSymbolizeInWebGL(),s={tileInfo:i,requestRawData:r&&!this._hasFlow,signal:t.signal,timeExtent:this.timeExtent,requestAsImageElement:this._isAlignedMapTile,requestProjectedLocalDirections:this._hasFlow,noClip:!1},{layer:a}=this,[l,n,o]=e,h=await a.fetchTile(l,n,o,s);if(h instanceof HTMLImageElement)return h;let m=h?.pixelBlock;if(null==m)return this._blankTile;if(!r&&!this._hasFlow&&(m=await a.applyRenderer(h),null==m))return this._blankTile;const p=new d([l,n,o],m,i.size[0],i.size[1]);return r?(p.symbolizerRenderer=a.symbolizer.rendererJSON,p.symbolizerParameters=a.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(l)),p.transformGrid=h.transformGrid,p.bandIds=a.bandIds):(p.isRendereredSource=!0,p.bandIds=null),p.interpolation=a.interpolation,p}_getSymbolizerOptions(e){const t=this.tileInfo.lodAt(e).resolution;return{pixelBlock:null,isGCS:null!=this.view.basemapTerrain?.spatialReference?this.view.basemapTerrain.spatialReference.isGeographic:this.view.spatialReference.isGeographic,resolution:{x:t,y:t},bandIds:this.layer.bandIds}}ensureSymbolizerParameters(e){this._canSymbolizeInWebGL()&&JSON.stringify(e.symbolizerRenderer)!==JSON.stringify(this.layer.symbolizer.rendererJSON)&&(e.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(e.lij[0])))}createFetchPopupFeaturesQueryGeometry(e,t){return c(e,t,this.view)}async doRefresh(){this.suspended||(this._flowSubView?.doRefresh(),this.emit("data-changed"))}isUpdating(){return this._flowSubView?.updating??!1}_canSymbolizeInWebGL(){const e=f(),{symbolizer:t}=this.layer,i=t.lookup.colormapLut?.indexedColormap,r=!!this.layer.rasterFunction?.hasClipFunction,s=i&&i.length>4*(e.maxTextureSize||4096);return t.canRenderInWebGL&&!s&&!r}get usedMemory(){return this._flowSubView?.usedMemory??0}get test(){}};e([a({readOnly:!0})],b.prototype,"_blankTile",null),e([a()],b.prototype,"_hasFlow",null),e([a({readOnly:!0})],b.prototype,"imageFormatIsOpaque",null),e([a({readOnly:!0})],b.prototype,"hasMixedImageFormats",null),e([a()],b.prototype,"_flowSubView",void 0),e([a({readOnly:!0})],b.prototype,"dataLevelRange",null),e([a({readOnly:!0})],b.prototype,"visibleAtCurrentScale",null),b=e([l("esri.views.3d.layers.ImageryTileLayerView3D")],b);const g=b;export{g as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import"../../../core/has.js";import{whenOnce as i,watch as r,sync as s}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{projectDatasetExtent as n}from"../../../layers/raster/functions/rasterProjectionHelper.js";import{LayerView3D as o}from"./LayerView3D.js";import{TiledLayerView3D as h}from"./TiledLayerView3D.js";import m from"../support/flow/FlowSubViewTiles3D.js";import{RasterTile as d}from"../terrain/RasterTile.js";import{ImageryTileLayerViewMixin as p}from"../../layers/ImageryTileLayerViewMixin.js";import u from"../../layers/LayerView.js";import{RefreshableLayerView as y}from"../../layers/RefreshableLayerView.js";import{createQueryGeometry as c}from"../../support/drapedUtils.js";import{getWebGLCapabilities as f}from"../../webgl/capabilities.js";let b=class extends(p(y(h(o(u))))){constructor(){super(...arguments),this.type="imagery-tile-3d",this._isAlignedMapTile=!0,this._flowSubView=null,this.ignoresMemoryFactor=!1,this.unloadedMemory=0}initialize(){this.layer.increaseRasterJobHandlerUsage(),null==this.fullExtent&&this.addResolvingPromise(Promise.reject(new t("layerview:spatial-reference-incompatible","The layer extent cannot be projected to the view's spatial reference",{layer:this.layer})));const e=i(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{const e=this.view.basemapTerrain.tilingScheme,t=this.layer.tileInfo;this._isAlignedMapTile=["png","png24","png32","jpg","mixed"].includes(t.format)&&e.compatibleWith(t),this.tileInfo=this._isAlignedMapTile?t:e.toTileInfo(),this.addHandles([r(()=>this.layer.renderer,e=>{this._setSubView(e),this._updatingHandles.addPromise(this.doRefresh())},s),r(()=>[this.layer.interpolation,this.layer.bandIds,this.layer.multidimensionalDefinition,this.layer.multidimensionalSubset,this.layer.rasterFunction,this.timeExtent],()=>this._updatingHandles.addPromise(this.doRefresh()),s)])});this._setSubView(this.layer.renderer),this.addResolvingPromise(e)}destroy(){this.layer.decreaseRasterJobHandlerUsage(),this._flowSubView?.destroy()}_setSubView(e){if("wcs"===this.layer.type)return;const t="flow"===e?.type,i=this._flowSubView;t&&null!=i||(i?.destroy(),this._flowSubView=t?new m({layerView:this}):null)}get _blankTile(){const e=document.createElement("canvas"),t=e.getContext("2d"),[i,r]=this.tileInfo.size;return e.width=i,e.height=r,t.clearRect(0,0,i,r),t.getImageData(0,0,i,r)}get _hasFlow(){return null!=this._flowSubView}get imageFormatIsOpaque(){return"jpg"===this.layer.tileInfo.format}get hasMixedImageFormats(){return"mixed"===this.layer.tileInfo.format}get dataLevelRange(){const e=this.layer.tileInfo,t=this.tileInfo.lodAt(0)?.scale,i=e.lodAt(e.lods.length-1)?.scale;return this.levelRangeFromScaleRange(t,i)}get visibleAtCurrentScale(){return this._flowSubView?.visibleAtCurrentScale??this.tilesVisibleAtCurrentScale()}_getFullExtent(){return n(this.layer.serviceRasterInfo,this.view.basemapTerrain?.spatialReference??this.view.spatialReference)}async fetchTile(e,t){const i=this.tileInfo,r=this._canSymbolizeInWebGL(),s={tileInfo:i,requestRawData:r&&!this._hasFlow,signal:t.signal,timeExtent:this.timeExtent,requestAsImageElement:this._isAlignedMapTile,requestProjectedLocalDirections:this._hasFlow,noClip:!1},{layer:a}=this,[l,n,o]=e,h=await a.fetchTile(l,n,o,s);if(h instanceof HTMLImageElement)return h;let m=h?.pixelBlock;if(null==m)return this._blankTile;if(!r&&!this._hasFlow&&(m=await a.applyRenderer(h),null==m))return this._blankTile;const p=new d([l,n,o],m,i.size[0],i.size[1]);return r?(p.symbolizerRenderer=a.symbolizer.rendererJSON,p.symbolizerParameters=a.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(l)),p.transformGrid=h.transformGrid,p.bandIds=a.bandIds):(p.isRendereredSource=!0,p.bandIds=null),p.interpolation=a.interpolation,p}_getSymbolizerOptions(e){const t=this.tileInfo.lodAt(e).resolution;return{pixelBlock:null,isGCS:null!=this.view.basemapTerrain?.spatialReference?this.view.basemapTerrain.spatialReference.isGeographic:this.view.spatialReference.isGeographic,resolution:{x:t,y:t},bandIds:this.layer.bandIds}}ensureSymbolizerParameters(e){this._canSymbolizeInWebGL()&&JSON.stringify(e.symbolizerRenderer)!==JSON.stringify(this.layer.symbolizer.rendererJSON)&&(e.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(e.lij[0])))}createFetchPopupFeaturesQueryGeometry(e,t){return c(e,t,this.view)}async doRefresh(){this.suspended||(this._flowSubView?.doRefresh(),this.emit("data-changed"))}isUpdating(){return this._flowSubView?.updating??!1}_canSymbolizeInWebGL(){const e=f(),{symbolizer:t}=this.layer,i=t.lookup.colormapLut?.indexedColormap,r=!!this.layer.rasterFunction?.hasClipFunction,s=i&&i.length>4*(e.maxTextureSize||4096);return t.canRenderInWebGL&&!s&&!r}get usedMemory(){return this._flowSubView?.usedMemory??0}get test(){}};e([a({readOnly:!0})],b.prototype,"_blankTile",null),e([a()],b.prototype,"_hasFlow",null),e([a({readOnly:!0})],b.prototype,"imageFormatIsOpaque",null),e([a({readOnly:!0})],b.prototype,"hasMixedImageFormats",null),e([a()],b.prototype,"_flowSubView",void 0),e([a({readOnly:!0})],b.prototype,"dataLevelRange",null),e([a({readOnly:!0})],b.prototype,"visibleAtCurrentScale",null),b=e([l("esri.views.3d.layers.ImageryTileLayerView3D")],b);const g=b;export{g 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as r}from"../../../core/maybe.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{initial as o,watch as n,when as a}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as c,subclass as d}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as u,IDENTITY as p}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{i as y,b,t as _}from"../../../chunks/vec32.js";import{freeze as v,create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as j}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as x,getReferenceEllipsoid as M}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as O}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as C}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as E}from"../../../geometry/projection/projectVectorToVector.js";import{create as T}from"../../../geometry/support/aaBoundingRect.js";import{BufferViewVec2f as R,BufferViewVec4f as U,BufferViewVec4u8 as P,BufferViewVec4u16 as H,BufferViewVec3f as V,BufferViewVec3u8 as S,BufferViewVec3u16 as A,BufferViewInt16 as I,BufferViewUint32 as k,BufferViewUint16 as F}from"../../../geometry/support/buffer/BufferView.js";import D from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as L}from"../../../support/elevationInfoUtils.js";import{toWasmModification as B}from"./I3SMeshWorkerHandle.js";import{LayerView3D as G}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as N}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as z,removeLayerViewFromWasm as W,getLyr3DWasm as $}from"./Lyr3DWasm.js";import{LayerElevationProvider as q}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as J,alphaModeConversion as K,faceCullingConversion as Q,wrapModeConversion as X,lyr3DTypeToByteSize as Y}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as Z}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as ee}from"../support/ElevationRange.js";import{toBoundingRect as te}from"../support/extentUtils.js";import{compute as ie,Obb as re}from"../support/orientedBoundingBox.js";import{ObjectParameters as se}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as oe,createVertexBufferLayout as ne,SourceGeometry as ae}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as le}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as ce}from"../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as de}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as he}from"../webgl-engine/lib/Attribute.js";import{ManagedTexture as me}from"../webgl-engine/lib/ManagedTexture.js";import{compressAndTransformNormals as ue}from"../webgl-engine/lib/Normals.js";import{writeAttribute as pe,writeBufferVec2 as fe}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import ge from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as ye,isInEffectiveScaleRange as be,validateScaleRange as _e}from"../../support/layerViewUtils.js";import{TextureCompressionTracker as ve}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as we}from"../../../webscene/support/AlphaCutoff.js";class je{constructor(e,t,i,r,s,o,n,a,l){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=r,this.vboMemoryUsage=s,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.elevationRange=l,this.isVisible=!1,this.usedMemory=this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage;const c=w();n?.getCenter(c),this._obbCenter=c,this._obbRadius=n?.radius??0,this._obbRadiusSquared=this._obbRadius**2}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const i=this._obbCenter,r=i[0]-e[0],s=i[1]-e[1],o=i[2]-e[2],n=r*t[0]+s*t[1]+o*t[2];return r*r+s*s+o*o-n*n<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){if(!this.obb)return!0;const t=e.center,i=this._obbCenter,r=i[0]-t[0],s=i[1]-t[1],o=i[2]-t[2];return r*r+s*s+o*o<=(this._obbRadius+e.radius)**2}}function xe(e){return Math.round(e/1048.576)/1e3}let Me=class extends(G(ge)){get hasModifications(){return this._modifications&&this._modifications.length>0}constructor(e){super(e),this.type="integrated-mesh-3dtiles",this._compressionTracker=new ve,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._suspendedHandle=null,this._dbgFlags=new Set,this._memCache=e.view.resourceController.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e))}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{s(t),this.layer=e}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type}initialize(){this._dbgFlags.add(3),this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw ye("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=z(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new Z(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),o),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._elevationProvider=new q({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),e.elevationProvider.register(1,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),a(()=>this.fullOpacity,()=>this._opacityChange())]),this._suspendedHandle=n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)});this.addResolvingPromise(t)}get fullOpacity(){return this.layer.replacesTerrain&&has("enable-feature:oit-ground")?this.view.map.ground.opacity:1}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateMaterial(t,t=>t.objectOpacity=e))}intersect(e,t,i,r){this._intersectionHandler.intersect(e,t,i,r,null,!1)}get ready(){return!0}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),W(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._usedMemory=this._cacheMemory=0,this._memCache.destroy(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=r(this._visibleGeometryChangedSchedulerHandle)}_modificationsChanged(){const e=this.layer.spatialReference,t=B(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t,e.wkid)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=T();this._layerClippingArea=te(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>this._collection.updateMaterial(t,t=>t.commonMaterialParameters.hasSlicePlane=e))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,L(e))}get _wasm(){return $(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||be(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||_e(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,r=0,s=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isVisible?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,s++):(i+=n.textureMemoryUsage,r+=n.vboMemoryUsage,o++)}),new N(this.usedMemory,s,o,xe(t),xe(e),xe(r),xe(i))}_canProjectWithoutEngine(){if(2===this.view.state.viewingMode){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return L(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new ee(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new ee;return 0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this.forEachVisibleTile(t=>e.expandElevationRange(t.elevationRange))),e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const i of e)for(const e of i.componentObjects)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed){const e=`IntegratedMesh3DTilesLayerView3D[${this.layer?.title}]: createRenderable called on destroyed instance`;throw new Error(e)}let t=0;const{meshData:i}=e;if(null==i.data)throw new Error("meshData.data undefined");if(i.desc=JSON.parse(i.desc),null==i.desc)throw new Error("meshData.desc undefined");const r=v(...i.desc.origin),s=this.view.basemapTerrain.spatialReference;let o,n;if("global"===this.view.viewingMode){const e=f();O(x,r,e,s),o=h(u(),e),n=m(u(),o)}else o=p,n=p;const a=w(),l=Te(i.desc.obb);let c=0,d=0;const g={textureMemoryUsage:0},T=new Array,U=new Map,P=i.desc.prims.length,H=new Array,V=new ee;try{const e="global"===this.view.viewingMode,t=e?M(this.view.spatialReference).radius:0;for(let h=0;h<P;h++){const m=i.desc.prims[h];this._dbg(2,JSON.stringify(m));if(null==J[m.ptype]||null==i.data){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+m.ptype+"). Skipping primitive.");continue}const u=i.desc?.materials&&null!=m.materialId?i.desc.materials[m.materialId]:null,f=null!=u?u.lightingModel:"Unlit",{positionView:v,positionAttr:x,normalsView:M,normalsAttr:O,colorAttr:P,texCoord0Attr:H,indicesView:S}=this.getBufferViews(m,i.data.buffer,o);if(null==x||null==v||null==S)continue;const A=new oe(null!=P,H?1:0,null!=M,this._shadeNormals||this.layer.replacesTerrain,this._applySSAO),I=x.data.length/x.size,k=(e,t)=>!e||e.data.length/e.size===I||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!k(H,"numTexcoord")||!k(P,"numColors")||!k(O,"normals"))continue;const F=ne(A);for(let i=0;i<v.count;i++){v.getVec(i,a),y(a,a,r);const s=e?b(a)-t:a[2];V.expandElevationRangeValues(s,s)}const D=l?.clone()??Ee(x,r);if(o!==p)for(let e=0;e<v.count;e++)v.getVec(e,a),_(a,a,o),v.setVec(e,a);const L=F.createBuffer(x.data.length);if(pe("position",x,null,null,L,0),null!=H){const e=L.getField("uv0",R);fe(H,e,0)}null!=P&&pe("color",P,null,null,L,0),null!=O&&pe("normalCompressed",O,null,null,L,0);const B=new Uint32Array([0,S.typedBuffer.length]),G=new ae({data:L.buffer,count:L.byteLength/F.stride,layoutParameters:A},{positions:v.typedBuffer,indices:S.typedBuffer},S.typedBuffer,B);c+=v.count+S.count;const N=this.view.renderSpatialReference,z=w(),W=[1,1,1];C(r,N,W,s)||this._dbg(3,"Unsupported coordinate system for IM overlay"),E(r,N,z,s);let $=()=>{},q=Promise.resolve(Ue);if(u){const e=e=>this._getTexture(e,i,U,g),t=e(u.baseColorTex),r="Pbr"===f,s=r?e(u.metalTex):null,o=r?e(u.emissiveTex):null,n=r?e(u.occlusionTex):null,a=r?e(u.normalTex):null,l=[t,s,o,n,a].map(e=>e?.loadPromise??null);q=Promise.all(l),$=e=>{e.baseColor=u.baseColorFactor,e.usePBR="Pbr"===f,e.hasParametersFromSource=!1,e.baseColorTexture=t,e.usePBR&&(e.mrrFactors=[u.metallicFactor,u.roughnessFactor,0],e.emissiveBaseColor=u.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=s,e.emissionTexture=o,e.occlusionTexture=n,e.normalTexture=a),e.alphaDiscardMode=K[u.alphaMode],e.objectOpacity=this.fullOpacity,g.textureMemoryUsage+=e.baseColorTexture?.texture?.usedMemory??0,e.usePBR&&(g.textureMemoryUsage+=(e.metallicRoughnessTexture?.texture?.usedMemory??0)+(e.emissionTexture?.texture?.usedMemory??0)+(e.occlusionTexture?.texture?.usedMemory??0)+(e.normalTexture?.texture?.usedMemory??0)),e.commonMaterialParameters.doubleSided=u.isDoubleSided,e.commonMaterialParameters.cullFace=Q[u.faceCulling??"NotSet"],e.commonMaterialParameters.isGround=this.layer.replacesTerrain,e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=0,e.textureAlphaCutoff=u.alphaCutoff??we,e.alphaDiscardMode=K[u.alphaMode],e.isIntegratedMesh=!0,e.sphereDepthInterpolate=this.layer.hasGoogleUrl,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=de(this.view.spatialReference)}}const X=q.then(()=>()=>{if(this.destroyed){const e="Trying to add object to destroyed layer view";throw this._dbg(3,`${e} !== numPos. Skipping primitive.`),new Error(e)}const e=this._collection.createObject(new se(j(z[0],z[1],W[0],W[1]),new le(r,n),D,G,!1));return this._collection.updateMaterial(e,$),d+=this._collection.getObjectGPUMemoryUsage(e),e});T.push(X)}if(H.push(...await Promise.all(T)),this.destroyed){throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable object destroyed during call")}}catch(k){throw U.forEach(e=>this._stage.removeTexture(e)),k}const S=H.map(e=>e()),A=new Array;U.forEach(e=>A.push(e));const I=new je(e.handle,S,A,c,d,g.textureMemoryUsage,l,e.stableNodeId,V);return this._lyrHandleToObjects.set(e.handle,I),this._memCache.put(Re(I.handle),I),t=I.usedMemory,this._cacheMemory+=t,{memUsageBytes:I.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(t.isVisible?(this._visibleObjects.delete(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){const t=Re(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){for(let r=0;r<i;++r){const i=t[r];if(!i)continue;const s=e[r],o=this._lyrHandleToObjects.get(s);if(o){if(o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!0,this._visibleObjects.add(o),this._usedMemory+=o.usedMemory,this._cacheMemory-=o.usedMemory;const{minElevation:e,maxElevation:t}=o.elevationRange;(e<this.visibleElevationRange.minElevation||t>this.visibleElevationRange.maxElevation)&&this._setVisibleElevationRangeDirty(),o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.pop(Re(s))}}for(let r=0;r<i;++r){const i=e[r],s=t[r];if(s)continue;const o=this._lyrHandleToObjects.get(i);if(o){if(!o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!1,this._visibleObjects.delete(o),this._usedMemory-=o.usedMemory,this._cacheMemory+=o.usedMemory;const{minElevation:e,maxElevation:t}=o.elevationRange;e!==this.visibleElevationRange.minElevation&&t!==this.visibleElevationRange.maxElevation||this._setVisibleElevationRangeDirty(),o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,s),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.put(Re(i),o)}}}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_getTexture(e,t,i,r){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const o=i.get(s)??this._createTexture(e,t,i,r);return o?new ce(this._stage.renderView.textures,o.id):null}_createTexture(e,t,i,r){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const o=this._stage,{renderView:n}=o,a=n.renderingContext.parameters.maxMaxAnisotropy,l=!!s.mipCount||a>1,c=X[e.wrapMode??"None"];let d=s.alpha?6408:6407;const h=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let m=null,u=null,p=null;switch(s.format){case"Raw":"R8"===s.pixelFormat?(m=h,d=6403,u=""):"Rgb8"===s.pixelFormat?(m=h,d=6407,u=""):"Rgba8"===s.pixelFormat&&(m=h,d=6408,u="");break;case"Dxt1":m=h,d=6407,u="image/vnd-ms.dds";break;case"Dxt5":m=h,d=6408,u="image/vnd-ms.dds";break;case"Basis":m=h,d=6407,u="image/ktx2";break;case"Png":u="image/png",p=document.createElement("img");break;case"Jpeg":u="image/jpeg",p=document.createElement("img");break;case"Etc2":u="image/ktx",p=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(p&&u){const e=new Blob([h],{type:u});p.src=URL.createObjectURL(e),m=p}if(m&&null!=u){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(r.textureMemoryUsage-=e)}}:void 0,t=new me(m,{mipmap:l,maxAnisotropy:a,encoding:u,wrap:c,pixelFormat:d,compressionOptions:e,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height});return this._stage.addTexture(t),i.set(s,t),t}return null}getBufferViews(e,t,i){let r,s,o,n,a,l,c,d=null;for(let m=0;m<e.atrbs.length;m++){const c=e.atrbs[m],{view:u}=c,p=void 0,f=u.byteOffset+u.byteCount,g=u.byteCount/Y[u.type],y=new(Pe(g))(g);for(let e=0;e<g;++e)y[e]=e;try{switch(c.sem){case"Position":3!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(r=new V(t,u.byteOffset,p,f),s=new he(r.typedBuffer,y,3));break;case"Normal":if(3!==u.ncomp||"F32"!==u.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new V(t,u.byteOffset,p,f),r=ue(e.typedBuffer,i);a=new I(r.buffer),l=new he(a.typedBuffer,y,2)}break;case"TexCoord":2!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===n&&(n=new he(new R(t,u.byteOffset,p,f).typedBuffer,y,2));break;case"Color":4===u.ncomp?("F32"===u.type&&(d=new U(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new P(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new H(t,u.byteOffset,p,f))):3===u.ncomp&&("F32"===u.type&&(d=new V(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new S(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new A(t,u.byteOffset,p,f))),null==d?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new he(d.typedBuffer,y,u.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(h){this._dbg(2,"Error Creating buffer ("+h+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,r=void 0,s=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":c=new F(t,i.byteOffset,r,s);break;case"U32":c=new k(t,i.byteOffset,r,s);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==c&&null!=r){const e=r.count;c=c=e<65535?new F(new Uint16Array(e).buffer):new k(new Uint32Array(e).buffer);for(let t=0;t<e;t++)c.set(t,t)}return{positionView:r,positionAttr:s,colorAttr:o,texCoord0Attr:n,indicesView:c,normalsView:a,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([c()],Me.prototype,"fullOpacity",null),e([c({type:[D]})],Me.prototype,"_modifications",void 0),e([c()],Me.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([c()],Me.prototype,"layer",void 0),e([c({readOnly:!0})],Me.prototype,"visibleAtCurrentScale",null),e([c({readOnly:!0})],Me.prototype,"_collection",null),e([c()],Me.prototype,"elevationOffset",null),e([c({readOnly:!0})],Me.prototype,"visibleElevationRange",null),Me=e([d("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Me);const Oe=Me,Ce=w();function Ee(e,t){const i=ie(e);return y(Ce,i.center,t),i.center=Ce,i}function Te(e){return e?new re(e.center,e.halfSize,g(...e.quaternion)):null}function Re(e){return`${e}`}const Ue=new Array;function Pe(e){return e<256?Uint8Array:e<65536?Uint16Array:Uint32Array}export{Oe as default};
5
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as r}from"../../../core/maybe.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{initial as o,watch as n,when as a}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as c,subclass as d}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as u,IDENTITY as p}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{i as y,b,t as _}from"../../../chunks/vec32.js";import{freeze as v,create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as j}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as x,getReferenceEllipsoid as M}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as O}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as C}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as T}from"../../../geometry/projection/projectVectorToVector.js";import{create as E}from"../../../geometry/support/aaBoundingRect.js";import{BufferViewVec2f as R,BufferViewVec4f as U,BufferViewVec4u8 as P,BufferViewVec4u16 as H,BufferViewVec3f as A,BufferViewVec3u8 as V,BufferViewVec3u16 as S,BufferViewInt16 as I,BufferViewUint32 as L,BufferViewUint16 as k}from"../../../geometry/support/buffer/BufferView.js";import F from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as D}from"../../../support/elevationInfoUtils.js";import{toWasmModification as B}from"./I3SMeshWorkerHandle.js";import{LayerView3D as G}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as N}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as z,removeLayerViewFromWasm as W,getLyr3DWasm as $}from"./Lyr3DWasm.js";import{LayerElevationProvider as q}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as J,alphaModeConversion as K,faceCullingConversion as Q,wrapModeConversion as X,lyr3DTypeToByteSize as Y}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as Z}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as ee}from"../support/ElevationRange.js";import{toBoundingRect as te}from"../support/extentUtils.js";import{compute as ie,Obb as re}from"../support/orientedBoundingBox.js";import{ObjectParameters as se}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as oe,createVertexBufferLayout as ne,SourceGeometry as ae}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as le}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as ce}from"../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as de}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as he}from"../webgl-engine/lib/Attribute.js";import{ManagedTexture as me}from"../webgl-engine/lib/ManagedTexture.js";import{compressAndTransformNormals as ue}from"../webgl-engine/lib/Normals.js";import{writeAttribute as pe,writeBufferVec2 as fe}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import ge from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as ye,isInEffectiveScaleRange as be,validateScaleRange as _e}from"../../support/layerViewUtils.js";import{TextureCompressionTracker as ve}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as we}from"../../../webscene/support/AlphaCutoff.js";class je{constructor(e,t,i,r,s,o,n,a,l){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=r,this.vboMemoryUsage=s,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.elevationRange=l,this.isVisible=!1,this.usedMemory=this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage;const c=w();n?.getCenter(c),this._obbCenter=c,this._obbRadius=n?.radius??0,this._obbRadiusSquared=this._obbRadius**2}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const i=this._obbCenter,r=i[0]-e[0],s=i[1]-e[1],o=i[2]-e[2],n=r*t[0]+s*t[1]+o*t[2];return r*r+s*s+o*o-n*n<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){if(!this.obb)return!0;const t=e.center,i=this._obbCenter,r=i[0]-t[0],s=i[1]-t[1],o=i[2]-t[2];return r*r+s*s+o*o<=(this._obbRadius+e.radius)**2}}function xe(e){return Math.round(e/1048.576)/1e3}let Me=class extends(G(ge)){get hasModifications(){return this._modifications&&this._modifications.length>0}constructor(e){super(e),this.type="integrated-mesh-3dtiles",this._compressionTracker=new ve,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._suspendedHandle=null,this._dbgFlags=new Set,this._memCache=e.view.resourceController.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e))}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{s(t),this.layer=e}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbgFlags.add(3),this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._replacesTerrain=this.layer.replacesTerrain,this._isUsedAsGroundLayer=this.layer.isUsedAsGroundLayer,this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw ye("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=z(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new Z(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),o),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._elevationProvider=new q({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),e.elevationProvider.register(1,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),a(()=>this.fullOpacity,()=>this._opacityChange())]),this._suspendedHandle=n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)});this.addResolvingPromise(t)}get fullOpacity(){return this.layer.replacesTerrain&&has("enable-feature:oit-ground")?this.view.map.ground.opacity:1}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateMaterial(t,t=>t.objectOpacity=e))}intersect(e,t,i,r){this._intersectionHandler.intersect(e,t,i,r,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),W(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._usedMemory=this._cacheMemory=0,this._memCache.destroy(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=r(this._visibleGeometryChangedSchedulerHandle)}_modificationsChanged(){const e=this.layer.spatialReference,t=B(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t,e.wkid)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=E();this._layerClippingArea=te(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>this._collection.updateMaterial(t,t=>t.commonMaterialParameters.hasSlicePlane=e))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,D(e))}get _wasm(){return $(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||be(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||_e(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,r=0,s=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isVisible?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,s++):(i+=n.textureMemoryUsage,r+=n.vboMemoryUsage,o++)}),new N(this.usedMemory,s,o,xe(t),xe(e),xe(r),xe(i))}_canProjectWithoutEngine(){if(2===this.view.state.viewingMode){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return D(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new ee(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new ee;return 0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this.forEachVisibleTile(t=>e.expandElevationRange(t.elevationRange))),e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const i of e)for(const e of i.componentObjects)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed){const e=`IntegratedMesh3DTilesLayerView3D[${this.layer?.title}]: createRenderable called on destroyed instance`;throw new Error(e)}let t=0;const{meshData:i}=e;if(null==i.data)throw new Error("meshData.data undefined");if(i.desc=JSON.parse(i.desc),null==i.desc)throw new Error("meshData.desc undefined");const r=v(...i.desc.origin),s=this.view.basemapTerrain.spatialReference;let o,n;if("global"===this.view.viewingMode){const e=f();O(x,r,e,s),o=h(u(),e),n=m(u(),o)}else o=p,n=p;const a=w(),l=Ee(i.desc.obb);let c=0,d=0;const g={textureMemoryUsage:0},E=new Array,U=new Map,P=i.desc.prims.length,H=new Array,A=new ee;try{const e="global"===this.view.viewingMode,t=e?M(this.view.spatialReference).radius:0;for(let h=0;h<P;h++){const m=i.desc.prims[h];this._dbg(2,JSON.stringify(m));if(null==J[m.ptype]||null==i.data){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+m.ptype+"). Skipping primitive.");continue}const u=i.desc?.materials&&null!=m.materialId?i.desc.materials[m.materialId]:null,f=null!=u?u.lightingModel:"Unlit",{positionView:v,positionAttr:x,normalsView:M,normalsAttr:O,colorAttr:P,texCoord0Attr:H,indicesView:V}=this.getBufferViews(m,i.data.buffer,o);if(null==x||null==v||null==V)continue;const S=new oe(null!=P,H?1:0,null!=M,this._shadeNormals||this.layer.replacesTerrain,this._applySSAO),I=x.data.length/x.size,L=(e,t)=>!e||e.data.length/e.size===I||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!L(H,"numTexcoord")||!L(P,"numColors")||!L(O,"normals"))continue;const k=ne(S);for(let i=0;i<v.count;i++){v.getVec(i,a),y(a,a,r);const s=e?b(a)-t:a[2];A.expandElevationRangeValues(s,s)}const F=l?.clone()??Te(x,r);if(o!==p)for(let e=0;e<v.count;e++)v.getVec(e,a),_(a,a,o),v.setVec(e,a);const D=k.createBuffer(x.data.length);if(pe("position",x,null,null,D,0),null!=H){const e=D.getField("uv0",R);fe(H,e,0)}null!=P&&pe("color",P,null,null,D,0),null!=O&&pe("normalCompressed",O,null,null,D,0);const B=new Uint32Array([0,V.typedBuffer.length]),G=new ae({data:D.buffer,count:D.byteLength/k.stride,layoutParameters:S},{positions:v.typedBuffer,indices:V.typedBuffer},V.typedBuffer,B);c+=v.count+V.count;const N=this.view.renderSpatialReference,z=w(),W=[1,1,1];C(r,N,W,s)||this._dbg(3,"Unsupported coordinate system for IM overlay"),T(r,N,z,s);let $=()=>{},q=Promise.resolve(Ue);if(u){const e=e=>this._getTexture(e,i,U,g),t=e(u.baseColorTex),r="Pbr"===f,s=r?e(u.metalTex):null,o=r?e(u.emissiveTex):null,n=r?e(u.occlusionTex):null,a=r?e(u.normalTex):null,l=[t,s,o,n,a].map(e=>e?.loadPromise??null);q=Promise.all(l),$=e=>{e.baseColor=u.baseColorFactor,e.usePBR="Pbr"===f,e.hasParametersFromSource=!1,e.baseColorTexture=t,e.usePBR&&(e.mrrFactors=[u.metallicFactor,u.roughnessFactor,0],e.emissiveBaseColor=u.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=s,e.emissionTexture=o,e.occlusionTexture=n,e.normalTexture=a),e.alphaDiscardMode=K[u.alphaMode],e.objectOpacity=this.fullOpacity,g.textureMemoryUsage+=e.baseColorTexture?.texture?.usedMemory??0,e.usePBR&&(g.textureMemoryUsage+=(e.metallicRoughnessTexture?.texture?.usedMemory??0)+(e.emissionTexture?.texture?.usedMemory??0)+(e.occlusionTexture?.texture?.usedMemory??0)+(e.normalTexture?.texture?.usedMemory??0)),e.commonMaterialParameters.doubleSided=u.isDoubleSided,e.commonMaterialParameters.cullFace=Q[u.faceCulling??"NotSet"],e.commonMaterialParameters.isGround=this.layer.replacesTerrain,e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=0,e.textureAlphaCutoff=u.alphaCutoff??we,e.alphaDiscardMode=K[u.alphaMode],e.isIntegratedMesh=!0,e.sphereDepthInterpolate=this.layer.hasGoogleUrl,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=de(this.view.spatialReference)}}const X=q.then(()=>()=>{if(this.destroyed){const e="Trying to add object to destroyed layer view";throw this._dbg(3,`${e} !== numPos. Skipping primitive.`),new Error(e)}const e=this._collection.createObject(new se(j(z[0],z[1],W[0],W[1]),new le(r,n),F,G,!1));return this._collection.updateMaterial(e,$),d+=this._collection.getObjectGPUMemoryUsage(e),e});E.push(X)}if(H.push(...await Promise.all(E)),this.destroyed){throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable object destroyed during call")}}catch(L){throw U.forEach(e=>this._stage.removeTexture(e)),L}const V=H.map(e=>e()),S=new Array;U.forEach(e=>S.push(e));const I=new je(e.handle,V,S,c,d,g.textureMemoryUsage,l,e.stableNodeId,A);return this._lyrHandleToObjects.set(e.handle,I),this._memCache.put(Re(I.handle),I),t=I.usedMemory,this._cacheMemory+=t,{memUsageBytes:I.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(t.isVisible?(this._visibleObjects.delete(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){const t=Re(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){for(let r=0;r<i;++r){const i=t[r];if(!i)continue;const s=e[r],o=this._lyrHandleToObjects.get(s);if(o){if(o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!0,this._visibleObjects.add(o),this._usedMemory+=o.usedMemory,this._cacheMemory-=o.usedMemory;const{minElevation:e,maxElevation:t}=o.elevationRange;(e<this.visibleElevationRange.minElevation||t>this.visibleElevationRange.maxElevation)&&this._setVisibleElevationRangeDirty(),o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.pop(Re(s))}}for(let r=0;r<i;++r){const i=e[r],s=t[r];if(s)continue;const o=this._lyrHandleToObjects.get(i);if(o){if(!o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!1,this._visibleObjects.delete(o),this._usedMemory-=o.usedMemory,this._cacheMemory+=o.usedMemory;const{minElevation:e,maxElevation:t}=o.elevationRange;e!==this.visibleElevationRange.minElevation&&t!==this.visibleElevationRange.maxElevation||this._setVisibleElevationRangeDirty(),o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,s),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.put(Re(i),o)}}}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_getTexture(e,t,i,r){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const o=i.get(s)??this._createTexture(e,t,i,r);return o?new ce(this._stage.renderView.textures,o.id):null}_createTexture(e,t,i,r){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const o=this._stage,{renderView:n}=o,a=n.renderingContext.parameters.maxMaxAnisotropy,l=!!s.mipCount||a>1,c=X[e.wrapMode??"None"];let d=s.alpha?6408:6407;const h=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let m=null,u=null,p=null;switch(s.format){case"Raw":"R8"===s.pixelFormat?(m=h,d=6403,u=""):"Rgb8"===s.pixelFormat?(m=h,d=6407,u=""):"Rgba8"===s.pixelFormat&&(m=h,d=6408,u="");break;case"Dxt1":m=h,d=6407,u="image/vnd-ms.dds";break;case"Dxt5":m=h,d=6408,u="image/vnd-ms.dds";break;case"Basis":m=h,d=6407,u="image/ktx2";break;case"Png":u="image/png",p=document.createElement("img");break;case"Jpeg":u="image/jpeg",p=document.createElement("img");break;case"Etc2":u="image/ktx",p=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(p&&u){const e=new Blob([h],{type:u});p.src=URL.createObjectURL(e),m=p}if(m&&null!=u){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(r.textureMemoryUsage-=e)}}:void 0,t=new me(m,{mipmap:l,maxAnisotropy:a,encoding:u,wrap:c,pixelFormat:d,compressionOptions:e,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height});return this._stage.addTexture(t),i.set(s,t),t}return null}getBufferViews(e,t,i){let r,s,o,n,a,l,c,d=null;for(let m=0;m<e.atrbs.length;m++){const c=e.atrbs[m],{view:u}=c,p=void 0,f=u.byteOffset+u.byteCount,g=u.byteCount/Y[u.type],y=new(Pe(g))(g);for(let e=0;e<g;++e)y[e]=e;try{switch(c.sem){case"Position":3!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(r=new A(t,u.byteOffset,p,f),s=new he(r.typedBuffer,y,3));break;case"Normal":if(3!==u.ncomp||"F32"!==u.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new A(t,u.byteOffset,p,f),r=ue(e.typedBuffer,i);a=new I(r.buffer),l=new he(a.typedBuffer,y,2)}break;case"TexCoord":2!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===n&&(n=new he(new R(t,u.byteOffset,p,f).typedBuffer,y,2));break;case"Color":4===u.ncomp?("F32"===u.type&&(d=new U(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new P(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new H(t,u.byteOffset,p,f))):3===u.ncomp&&("F32"===u.type&&(d=new A(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new V(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new S(t,u.byteOffset,p,f))),null==d?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new he(d.typedBuffer,y,u.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(h){this._dbg(2,"Error Creating buffer ("+h+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,r=void 0,s=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":c=new k(t,i.byteOffset,r,s);break;case"U32":c=new L(t,i.byteOffset,r,s);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==c&&null!=r){const e=r.count;c=c=e<65535?new k(new Uint16Array(e).buffer):new L(new Uint32Array(e).buffer);for(let t=0;t<e;t++)c.set(t,t)}return{positionView:r,positionAttr:s,colorAttr:o,texCoord0Attr:n,indicesView:c,normalsView:a,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([c()],Me.prototype,"fullOpacity",null),e([c({readOnly:!0})],Me.prototype,"ready",null),e([c({type:[F]})],Me.prototype,"_modifications",void 0),e([c()],Me.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([c()],Me.prototype,"layer",void 0),e([c({readOnly:!0})],Me.prototype,"visibleAtCurrentScale",null),e([c({readOnly:!0})],Me.prototype,"_collection",null),e([c()],Me.prototype,"elevationOffset",null),e([c({readOnly:!0})],Me.prototype,"visibleElevationRange",null),Me=e([d("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Me);const Oe=Me,Ce=w();function Te(e,t){const i=ie(e);return y(Ce,i.center,t),i.center=Ce,i}function Ee(e){return e?new re(e.center,e.halfSize,g(...e.quaternion)):null}function Re(e){return`${e}`}const Ue=new Array;function Pe(e){return e<256?Uint8Array:e<65536?Uint16Array:Uint32Array}export{Oe as default};