@arcgis/core 4.33.0-next.20250318 → 4.33.0-next.20250320

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 (179) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0b7331613f91a3258352.js +1 -0
  3. package/assets/esri/core/workers/chunks/2219d970ece5676ca6ee.js +1 -0
  4. package/assets/esri/core/workers/chunks/3fc18638f8799b85001d.js +1 -0
  5. package/assets/esri/core/workers/chunks/630a9afdf0523c27ddb6.js +1 -0
  6. package/assets/esri/core/workers/chunks/657ae4a0461d45044b28.js +1 -0
  7. package/assets/esri/core/workers/chunks/8063e35dacf8f99471d8.js +1 -0
  8. package/assets/esri/core/workers/chunks/{e26e8feabf863350af20.js → 9e11307b4cc3b523d178.js} +66 -73
  9. package/assets/esri/core/workers/chunks/b23d16745674486ddd6c.js +1 -0
  10. package/assets/esri/core/workers/chunks/bfbb118ae3b4a4ce1c74.js +319 -0
  11. package/assets/esri/core/workers/chunks/c528a2ca3b1b73df5a5d.js +1 -0
  12. package/assets/esri/core/workers/chunks/d787474e78360c925fd9.js +1 -0
  13. package/assets/esri/core/workers/chunks/{7ded83eb64eff069b761.js → d8b903b4147b090576f2.js} +1 -1
  14. package/assets/esri/core/workers/chunks/e4290719c8afc2a4ee8c.js +1 -0
  15. package/assets/esri/core/workers/chunks/e5e1f8ac53c70427a60b.js +1 -0
  16. package/assets/esri/core/workers/chunks/fc9758006a7135c7d9c3.js +1 -0
  17. package/assets/esri/core/workers/chunks/fef46b841e8369b30227.js +1 -0
  18. package/assets/esri/libs/dxtEncoder/dxt_encoder.wasm +0 -0
  19. package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationLayers.scss +20 -0
  20. package/assets/esri/themes/dark/main.css +1 -1
  21. package/assets/esri/themes/light/main.css +1 -1
  22. package/assets/esri/themes/light/view.css +1 -1
  23. package/chunks/HUDMaterial.glsl.js +80 -75
  24. package/chunks/RibbonLine.glsl.js +37 -37
  25. package/chunks/ShadowHighlight.glsl.js +2 -2
  26. package/chunks/Terrain.glsl.js +33 -34
  27. package/copyright.txt +29 -0
  28. package/core/typedArrayUtil.js +1 -1
  29. package/geometry/support/HalfFloatArray.js +5 -0
  30. package/geometry/support/buffer/BufferView.js +1 -1
  31. package/geometry/support/buffer/types.js +1 -1
  32. package/interfaces.d.ts +8 -47
  33. package/layers/VoxelWasmPerSceneView.js +1 -1
  34. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  35. package/package.json +3 -2
  36. package/renderers/support/RasterSymbolizer.js +1 -1
  37. package/support/basemapUtils.js +1 -1
  38. package/support/revision.js +1 -1
  39. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  40. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  41. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  42. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  43. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  44. package/views/3d/layers/BuildingSublayerView3D.js +1 -1
  45. package/views/3d/layers/I3SMeshView3D.js +1 -1
  46. package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
  47. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  48. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  49. package/views/3d/layers/MediaLayerView3D.js +1 -1
  50. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  51. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  52. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  53. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  54. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  55. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  56. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  57. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  58. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  59. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  60. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  61. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  62. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  63. package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
  64. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  65. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  66. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  67. package/views/3d/layers/graphics/Labeler.js +1 -1
  68. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  69. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  70. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  71. package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
  72. package/views/3d/layers/graphics/pointUtils.js +1 -1
  73. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  74. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  75. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  76. package/views/3d/layers/i3s/Intersector.js +1 -1
  77. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  78. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  79. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  80. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  81. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  82. package/views/3d/support/buffer/glUtil.js +1 -1
  83. package/views/3d/support/hitTest.js +1 -1
  84. package/views/3d/terrain/OverlayRenderTargets.js +1 -1
  85. package/views/3d/terrain/PatchGeometry.js +1 -1
  86. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  87. package/views/3d/terrain/TerrainAttributes.js +1 -1
  88. package/views/3d/terrain/TerrainRenderer.js +1 -1
  89. package/views/3d/terrain/TerrainSurface.js +1 -1
  90. package/views/3d/webgl/ManagedColorAttachment.js +1 -1
  91. package/views/3d/webgl/ManagedDepthAttachment.js +1 -1
  92. package/views/3d/webgl/ManagedFBO.js +1 -1
  93. package/views/3d/webgl/ManagedFBOAttachment.js +1 -1
  94. package/views/3d/webgl/{ManagedFBObject.js → ManagedFBOResource.js} +1 -1
  95. package/views/3d/webgl/formats.js +1 -1
  96. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  97. package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +1 -1
  98. package/views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js +2 -9
  99. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +1 -1
  100. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +6 -6
  101. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  102. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  103. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  104. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  105. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  106. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  107. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  108. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  109. package/views/3d/webgl-engine/lib/AttributeArray.js +1 -1
  110. package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
  111. package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
  112. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  113. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  114. package/views/3d/webgl-engine/lib/IntersectorInterfaces.js +1 -1
  115. package/views/3d/webgl-engine/lib/IntersectorTarget.js +1 -1
  116. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  117. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  118. package/views/3d/webgl-engine/lib/ObjectAndLayerIdRenderHelper.js +1 -1
  119. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  120. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  121. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  122. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  123. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  124. package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
  125. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  126. package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
  127. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  128. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  129. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  130. package/views/3d/webgl-engine/lib/lodRendering/Intersector.js +1 -1
  131. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  132. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  133. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  134. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  135. package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
  136. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  137. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  138. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  139. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  140. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  141. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  142. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  143. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  144. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  145. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  146. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  147. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  148. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  149. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  150. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  151. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  152. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  153. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  154. package/views/3d/webgl.js +1 -1
  155. package/views/SceneView.js +1 -1
  156. package/views/webgl/FramebufferObject.js +1 -1
  157. package/views/webgl/GLObjectType.js +1 -1
  158. package/views/webgl/Renderbuffer.js +1 -1
  159. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  160. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  161. package/widgets/Editor/UpdateWorkflow.js +1 -1
  162. package/widgets/Editor.js +1 -1
  163. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  164. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  165. package/widgets/support/LabeledSwitch.js +1 -1
  166. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  167. package/assets/esri/core/workers/chunks/048121d433aa9175348c.js +0 -1
  168. package/assets/esri/core/workers/chunks/0f4a2bdf5bb2f4303b7f.js +0 -1
  169. package/assets/esri/core/workers/chunks/147e412de9972da16a1d.js +0 -1
  170. package/assets/esri/core/workers/chunks/1545bd7d6ac7800c71b6.js +0 -1
  171. package/assets/esri/core/workers/chunks/2b21152c7e2d9c170ed7.js +0 -1
  172. package/assets/esri/core/workers/chunks/385dd6466fd967ce3ae9.js +0 -1
  173. package/assets/esri/core/workers/chunks/534f3d7e4300b662191a.js +0 -1
  174. package/assets/esri/core/workers/chunks/8d636075e5aa053940fc.js +0 -1
  175. package/assets/esri/core/workers/chunks/c43c273725b1a33712ec.js +0 -314
  176. package/assets/esri/core/workers/chunks/c8cd9a3175f516624842.js +0 -1
  177. package/assets/esri/core/workers/chunks/d630e64463687090db92.js +0 -1
  178. package/assets/esri/core/workers/chunks/dd6f18bbab50be139d20.js +0 -1
  179. package/assets/esri/core/workers/chunks/de6864e120243cf0bee8.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{numberMaxFloat32 as t}from"../../../core/mathUtils.js";import e from"../PixelBlock.js";import{getPixelValueRange as n}from"../rasterFormats/pixelRangeUtils.js";var l,i;!function(t){t[t.matchAny=0]="matchAny",t[t.matchAll=1]="matchAll"}(l||(l={})),function(t){t[t.bestMatch=0]="bestMatch",t[t.fail=1]="fail"}(i||(i={}));const o=9;function r(t){return null!=t&&"esri.layers.support.PixelBlock"===t.declaredClass&&t.pixels&&t.pixels.length>0}function s(t,e){return e?.length&&r(t)?t.extractBands(e):t}function a(t){if(!t?.length||t.some((t=>!r(t))))return null;if(1===t.length)return t[0]?.clone()??null;const n=t,{width:l,height:i,pixelType:o}=n[0];if(n.some((t=>t.width!==l||t.height!==i)))return null;const s=n.map((({mask:t})=>t)).filter((t=>null!=t));let a=null;s.length&&(a=new Uint8Array(l*i),a.set(s[0]),s.length>1&&y(s.slice(1),a));const h=[];n.forEach((({pixels:t})=>h.push(...t)));const f=n.map((({statistics:t})=>t)).filter((t=>t?.length)),c=[];return f.forEach((t=>c.push(...t))),new e({pixelType:o,width:l,height:i,mask:a,pixels:h,statistics:c.length?c:null})}function h(t){if(!t)return;const e=t.colormap;if(!e||0===e.length)return;const n=e.sort(((t,e)=>t[0]-e[0]));let l=0;n[0][0]<0&&(l=n[0][0]);const i=Math.max(256,n[n.length-1][0]-l+1),o=new Uint8Array(4*i),r=[];let s,a=0,h=0;const f=5===n[0].length;if(i>65536)return n.forEach((t=>{r[t[0]-l]=f?t.slice(1):t.slice(1).concat([255])})),{indexed2DColormap:r,offset:l,alphaSpecified:f};if(t.fillUnspecified)for(s=n[h],a=s[0]-l;a<i;a++)o[4*a]=s[1],o[4*a+1]=s[2],o[4*a+2]=s[3],o[4*a+3]=f?s[4]:255,a===s[0]-l&&(s=h===n.length-1?s:n[++h]);else for(a=0;a<n.length;a++)s=n[a],h=4*(s[0]-l),o[h]=s[1],o[h+1]=s[2],o[h+2]=s[3],o[h+3]=f?s[4]:255;return{indexedColormap:o,offset:l,alphaSpecified:f}}function f(t,e){if(!r(t))return t;if(!e||!e.indexedColormap&&!e.indexed2DColormap)return t;const n=t.clone(),l=n.pixels;let i=n.mask;const o=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:s,indexed2DColormap:a,offset:h,alphaSpecified:f}=e;let c=0;const u=l[0],p=new Uint8Array(u.length),x=new Uint8Array(u.length),m=new Uint8Array(u.length);let d,g=0;if(s){const t=s.length-1;if(null!=i)for(c=0;c<o;c++)i[c]&&(g=4*(u[c]-h),g<h||g>t?i[c]=0:(p[c]=s[g],x[c]=s[g+1],m[c]=s[g+2],i[c]=s[g+3]));else{for(i=new Uint8Array(o),c=0;c<o;c++)g=4*(u[c]-h),g<h||g>t?i[c]=0:(p[c]=s[g],x[c]=s[g+1],m[c]=s[g+2],i[c]=s[g+3]);n.mask=i}}else if(a)if(null!=i)for(c=0;c<o;c++)i[c]&&(d=a[u[c]],p[c]=d[0],x[c]=d[1],m[c]=d[2],i[c]=d[3]);else{for(i=new Uint8Array(o),c=0;c<o;c++)d=a[u[c]],p[c]=d[0],x[c]=d[1],m[c]=d[2],i[c]=d[3];n.mask=i}return n.pixels=[p,x,m],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=f,n}function c(t,n){if(!r(t))return null;const{pixels:l,mask:i}=t,o=l.length;let s=n.lut;const{offset:a}=n;s&&1===s[0].length&&(s=l.map((()=>s)));const h=[],f=n.outputPixelType||"u8";for(let e=0;e<o;e++){const t=u(l[e],i,s[e],a||0,f);h.push(t)}const c=new e({width:t.width,height:t.height,pixels:h,mask:i,pixelType:f});return c.updateStatistics(),c}function u(t,n,l,i,o){const r=t.length,s=e.createEmptyBand(o,r);if(n)for(let e=0;e<r;e++)n[e]&&(s[e]=l[t[e]-i]);else for(let e=0;e<r;e++)s[e]=l[t[e]-i];return s}function p(t,e){if(!r(t))return null;const n=t.clone(),{pixels:l}=n,i=n.width*n.height,o=e.length,s=Math.floor(o/2),a=e[Math.floor(s)],h=l[0];let f,c,u,p,x,m,d=!1;const g=new Uint8Array(i),y=new Uint8Array(i),w=new Uint8Array(i);let k=n.mask;const M=4===e[0].mappedColor.length;for(k||(k=new Uint8Array(i),k.fill(M?255:1),n.mask=k),x=0;x<i;x++)if(k[x]){for(f=h[x],d=!1,m=s,c=a,u=0,p=o-1;p-u>1;){if(f===c.value){d=!0;break}f>c.value?u=m:p=m,m=Math.floor((u+p)/2),c=e[Math.floor(m)]}d||(f===e[u].value?(c=e[u],d=!0):f===e[p].value?(c=e[p],d=!0):f<e[u].value?(d=!1,c=null):f>e[u].value&&(f<e[p].value?(c=e[u],d=!0):p===o-1?(d=!1,c=null):(c=e[p],d=!0))),d?(g[x]=c.mappedColor[0],y[x]=c.mappedColor[1],w[x]=c.mappedColor[2],k[x]=c.mappedColor[3]):g[x]=y[x]=w[x]=k[x]=0}return n.pixels=[g,y,w],n.mask=k,n.pixelType="u8",n.maskIsAlpha=M,n}function x(e,n,l=!1){const i=1e-5,r=new Float32Array(3*o),s=n.length;for(let a=0;a<o;a++)r[3*a]=e[2*a]??t-1,r[3*a+1]=e[2*a+1]??t,r[3*a+2]=n[a]??0,a<s&&(a>0&&(r[3*a]-=i),(a<s-1||!l)&&(r[3*a+1]-=i));return r}function m(t,l){if(!r(t))return null;const{width:i,height:o}=t,{inputRanges:s,outputValues:a,outputPixelType:h,noDataRanges:f,allowUnmatched:c,replacementValue:u,isLastInputRangeInclusive:p}=l,x=t.pixels[0],m=e.createEmptyBand(h,x.length),d=t.mask,g=new Uint8Array(i*o);d?g.set(d):g.fill(255);const y=t.pixelType.startsWith("f")?1e-6:0,w=s.map((t=>t-y));w[0]=s[0],w[w.length-1]=s[s.length-1]+(p?1e-6:0);const k=s.length/2,[M,A]=n(h);for(let e=0;e<o;e++)for(let t=0;t<i;t++){const n=e*i+t;if(g[n]){const t=x[n];let e=!1;for(let l=k-1;l>=0;l--)if(t===w[2*l]||t>w[2*l]&&t<w[2*l+1]){m[n]=a[l],e=!0;break}e||(c?m[n]=t>A?A:t<M?M:u??t:g[n]=0)}}const U=f?.length;if(U)for(let e=0;e<o;e++)for(let t=0;t<i;t++){const n=e*i+t;if(!d||d[n]){const t=x[n];for(let e=0;e<U;e+=2)if(t>=f[e]&&t<=f[e+1]){m[n]=0,g[n]=0;break}}}return new e({width:i,height:o,pixelType:h,pixels:[m],mask:g})}function d(t,e,n,l){const i=null!=n&&n.length>=2?new Set(n):null,o=1===n?.length?n[0]:null,r=!!e?.length;for(let s=0;s<t.length;s++)if(l[s]){const n=t[s];if(r){let t=!1;for(let l=0;l<e.length;l+=2)if(n>=e[l]&&n<=e[l+1]){t=!0;break}t||(l[s]=0)}l[s]&&(n===o||i?.has(n))&&(l[s]=0)}}function g(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(t[e][l]){n=!0;break}n||(e[l]=0)}}function y(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(0===t[e][l]){n=!0;break}n&&(e[l]=0)}}function w(t,n){if(!r(t))return null;const{width:l,height:i,pixels:o}=t,s=l*i,a=new Uint8Array(s);t.mask?a.set(t.mask):a.fill(255);const h=o.length,{includedRanges:f,noDataValues:c,outputPixelType:p,matchAll:x,lookups:m}=n;if(m){const t=[];for(let e=0;e<h;e++){const n=m[e],l=u(o[e],a,n.lut,n.offset||0,"u8");t.push(l)}1===t.length?a.set(t[0]):x?g(t,a):y(t,a)}else if(x){const t=[];for(let e=0;e<h;e++){const n=new Uint8Array(s);n.set(a),d(o[e],f?.slice(2*e,2*e+2),c?.[e],n),t.push(n)}1===t.length?a.set(t[0]):g(t,a)}else for(let e=0;e<h;e++)d(o[e],f?.slice(2*e,2*e+2),c?.[e],a);return new e({width:l,height:i,pixelType:p,pixels:o,mask:a})}function k(t){const{srcPixelType:l,inputRanges:i,outputValues:o,allowUnmatched:r,noDataRanges:s,isLastInputRangeInclusive:a,outputPixelType:h}=t;if("u8"!==l&&"s8"!==l&&"u16"!==l&&"s16"!==l)return null;const f=l.includes("16")?65536:256,c=l.includes("s")?-f/2:0,u=e.createEmptyBand(h,f),p=new Uint8Array(f);r&&p.fill(255);const[x,m]=n(h);if(i?.length&&o?.length){const t=1e-6,e=i.map((e=>e-t));e[0]=i[0],a&&(e[e.length-1]=i[i.length-1]);for(let n=0;n<e.length;n++){const t=o[n]>m?m:o[n]<x?x:o[n],l=Math.ceil(e[2*n]-c),i=Math.floor(e[2*n+1]-c);for(let e=l;e<=i;e++)u[e]=t,p[e]=255}}if(s?.length)for(let e=0;e<s.length;e++){const t=Math.ceil(s[2*e]-c),n=Math.floor(s[2*e+1]-c);for(let e=t;e<=n;e++)p[e]=0}return{lut:u,offset:c,mask:p}}function M(t,e,n){if("u8"!==t&&"s8"!==t&&"u16"!==t&&"s16"!==t)return null;const l=t.includes("16")?65536:256,i=t.includes("s")?-l/2:0,o=new Uint8Array(l);if(e)for(let r=0;r<e.length;r++){const t=Math.ceil(e[2*r]-i),n=Math.floor(e[2*r+1]-i);for(let e=t;e<=n;e++)o[e]=255}else o.fill(255);if(n)for(let r=0;r<n.length;r++)o[n[r]-i]=0;return{lut:o,offset:i}}function A(t,e,n,l,i,o,r,s){return{xmin:i<=n*t?0:i<n*t+t?i-n*t:t,ymin:o<=l*e?0:o<l*e+e?o-l*e:e,xmax:i+r<=n*t?0:i+r<n*t+t?i+r-n*t:t,ymax:o+s<=l*e?0:o+s<l*e+e?o+s-l*e:e}}function U(t,e){if(!t||0===t.length)return null;const n=t.find((t=>t.pixelBlock));if(null==n?.pixelBlock)return null;const l=(n.extent.xmax-n.extent.xmin)/n.pixelBlock.width,i=(n.extent.ymax-n.extent.ymin)/n.pixelBlock.height,o=.01*Math.min(l,i),r=t.sort(((t,e)=>Math.abs(t.extent.ymax-e.extent.ymax)>o?e.extent.ymax-t.extent.ymax:Math.abs(t.extent.xmin-e.extent.xmin)>o?t.extent.xmin-e.extent.xmin:0)),s=Math.min.apply(null,r.map((t=>t.extent.xmin))),a=Math.min.apply(null,r.map((t=>t.extent.ymin))),h=Math.max.apply(null,r.map((t=>t.extent.xmax))),f=Math.max.apply(null,r.map((t=>t.extent.ymax))),c={x:Math.round((e.xmin-s)/l),y:Math.round((f-e.ymax)/i)},u={width:Math.round((h-s)/l),height:Math.round((f-a)/i)},p={width:Math.round((e.xmax-e.xmin)/l),height:Math.round((e.ymax-e.ymin)/i)};if(Math.round(u.width/n.pixelBlock.width)*Math.round(u.height/n.pixelBlock.height)!==r.length||c.x<0||c.y<0||u.width<p.width||u.height<p.height)return null;return{extent:e,pixelBlock:T(r.map((t=>t.pixelBlock)),u,{clipOffset:c,clipSize:p})}}function b(t,e,n,l,i,o){const{width:r,height:s}=n.block,{x:a,y:h}=n.offset,{width:f,height:c}=n.mosaic,u=A(r,s,l,i,a,h,f,c);let p=0,x=0;if(o){const t=o.hasGCSSShiftTransform?360:o.halfWorldWidth??0,e=r*o.resolutionX,n=o.startX+l*e;n<t&&n+e>t?x=o.rightPadding:n>=t&&(p=o.leftMargin-o.rightPadding,x=0)}if(u.xmax-=x,"number"!=typeof e)for(let m=u.ymin;m<u.ymax;m++){const n=(i*s+m-h)*f+(l*r-a)+p,o=m*r;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e[o+l]}else for(let m=u.ymin;m<u.ymax;m++){const n=(i*s+m-h)*f+(l*r-a)+p;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e}}function T(t,n,l={}){const{clipOffset:i,clipSize:o,alignmentInfo:s,blockWidths:a}=l;if(a)return v(t,n,{blockWidths:a});const h=t.find((t=>r(t)));if(null==h)return null;const f=o?o.width:n.width,c=o?o.height:n.height,u=h.width,p=h.height,x=n.width/u,m=n.height/p,d={offset:i||{x:0,y:0},mosaic:o||n,block:{width:u,height:p}},g=h.pixelType,y=e.getPixelArrayConstructor(g),w=h.pixels.length,k=[];let M,A;for(let e=0;e<w;e++){A=new y(f*c);for(let n=0;n<m;n++)for(let l=0;l<x;l++){const i=t[n*x+l];r(i)&&(M=i.pixels[e],b(A,M,d,l,n,s))}k.push(A)}const U=t.some((t=>null==t||null!=t.mask&&t.mask.length>0)),T=t.some((t=>t?.bandMasks&&t.bandMasks.length>1)),B=U?new Uint8Array(f*c):void 0,C=T?[]:void 0;if(B){for(let e=0;e<m;e++)for(let n=0;n<x;n++){const l=t[e*x+n],i=null!=l?l.mask:null;b(B,null!=i?i:l?255:0,d,n,e,s)}if(C)for(let e=0;e<w;e++){const n=new Uint8Array(f*c);for(let l=0;l<m;l++)for(let i=0;i<x;i++){const o=t[l*x+i],r=o?.bandMasks?.[e]??o?.mask;b(n,null!=r?r:o?255:0,d,i,l,s)}C.push(n)}}const S=new e({width:f,height:c,pixels:k,pixelType:g,bandMasks:C,mask:B});return S.updateStatistics(),S}function v(t,n,l){const i=t.find((t=>null!=t));if(null==i)return null;const o=t.some((t=>null==t||!!t.mask)),{width:s,height:a}=n,h=o?new Uint8Array(s*a):null,{blockWidths:f}=l,c=[],u=i.getPlaneCount(),p=e.getPixelArrayConstructor(i.pixelType);if(o)for(let e=0,y=0;e<t.length;y+=f[e],e++){const n=t[e];if(!r(n))continue;const l=n.mask;for(let t=0;t<a;t++)for(let i=0;i<f[e];i++)h[t*s+i+y]=null==l?255:l[t*n.width+i]}const x=t.some((t=>t?.bandMasks&&t.bandMasks.length>1)),m=x?[]:void 0,d=s*a;for(let e=0;e<u;e++){const n=new p(d),l=x?new Uint8Array(d):void 0;for(let i=0,o=0;i<t.length;o+=f[i],i++){const h=t[i];if(!r(h))continue;const c=h.pixels[e];if(null!=c){for(let t=0;t<a;t++)for(let e=0;e<f[i];e++)n[t*s+e+o]=c[t*h.width+e];if(l){const t=h.bandMasks?.[e]??h.mask;for(let e=0;e<a;e++)for(let n=0;n<f[i];n++)l[e*s+n+o]=t?t[e*h.width+n]:255}}}c.push(n),m&&l&&m.push(l)}const g=new e({width:s,height:a,mask:h,bandMasks:m,pixels:c,pixelType:i.pixelType});return g.updateStatistics(),g}function B(t,e,n){if(!r(t))return null;const{width:l,height:i}=t,o=e.x,s=e.y,a=n.width+o,h=n.height+s;if(o<0||s<0||a>l||h>i)return t;if(0===o&&0===s&&a===l&&h===i)return t;t.mask||(t.mask=new Uint8Array(l*i));const f=t.mask;for(let r=0;r<i;r++){const t=r*l;for(let e=0;e<l;e++)f[t+e]=r<s||r>=h||e<o||e>=a?0:1}return t.updateStatistics(),t}function C(t){if(!r(t))return null;const e=t.clone(),{width:n,height:l,pixels:i}=t,o=i[0],s=e.pixels[0],a=t.mask;for(let r=2;r<l-1;r++){const t=new Map;for(let l=r-2;l<r+2;l++)for(let e=0;e<4;e++){const i=l*n+e;_(t,o[i],a?a[i]:1)}s[r*n]=S(t),s[r*n+1]=s[r*n+2]=s[r*n];let e=3;for(;e<n-1;e++){let l=(r-2)*n+e+1;_(t,o[l],a?a[l]:1),l=(r-1)*n+e+1,_(t,o[l],a?a[l]:1),l=r*n+e+1,_(t,o[l],a?a[l]:1),l=(r+1)*n+e+1,_(t,o[l],a?a[l]:1),l=(r-2)*n+e-3,P(t,o[l],a?a[l]:1),l=(r-1)*n+e-3,P(t,o[l],a?a[l]:1),l=r*n+e-3,P(t,o[l],a?a[l]:1),l=(r+1)*n+e-3,P(t,o[l],a?a[l]:1),s[r*n+e]=S(t)}s[r*n+e+1]=s[r*n+e]}for(let r=0;r<n;r++)s[r]=s[n+r]=s[2*n+r],s[(l-1)*n+r]=s[(l-2)*n+r];return e.updateStatistics(),e}function S(t){if(0===t.size)return 0;let e=0,n=-1,l=0;const i=t.keys();let o=i.next();for(;!o.done;)l=t.get(o.value),l>e&&(n=o.value,e=l),o=i.next();return n}function P(t,e,n){if(0===n)return;const l=t.get(e);1===l?t.delete(e):t.set(e,l-1)}function _(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function W(t,n,l){let{x:i,y:o}=n;const{width:s,height:a}=l;if(0===i&&0===o&&a===t.height&&s===t.width)return t;const{width:h,height:f}=t,c=Math.max(0,o),u=Math.max(0,i),p=Math.min(i+s,h),x=Math.min(o+a,f);if(p<0||x<0||!r(t))return null;i=Math.max(0,-i),o=Math.max(0,-o);const{pixels:m}=t,d=s*a,g=m.length,y=[];for(let r=0;r<g;r++){const n=m[r],l=e.createEmptyBand(t.pixelType,d);for(let t=c;t<x;t++){const e=t*h;let r=(t+o-c)*s+i;for(let t=u;t<p;t++)l[r++]=n[e+t]}y.push(l)}const w=new Uint8Array(d),k=t.mask;for(let e=c;e<x;e++){const t=e*h;let n=(e+o-c)*s+i;for(let e=u;e<p;e++)w[n++]=k?k[t+e]:1}const M=new e({width:l.width,height:l.height,pixelType:t.pixelType,pixels:y,mask:w});return M.updateStatistics(),M}function E(t,n=!0){if(!r(t))return null;const{pixels:l,width:i,height:o,mask:s,pixelType:a}=t,h=[],f=Math.round(i/2),c=Math.round(o/2),u=o-1,p=i-1;for(let r=0;r<l.length;r++){const t=l[r],s=e.createEmptyBand(a,f*c);let x=0;for(let e=0;e<o;e+=2)for(let l=0;l<i;l+=2){const o=t[e*i+l];if(n){const n=l===p?o:t[e*i+l+1],r=e===u?o:t[e*i+l+i],a=l===p?r:e===u?n:t[e*i+l+i+1];s[x++]=(o+n+r+a)/4}else s[x++]=o}h.push(s)}let x=null;if(null!=s){x=new Uint8Array(f*c);let t=0;for(let e=0;e<o;e+=2)for(let l=0;l<i;l+=2){const o=s[e*i+l];if(n){const n=l===p?o:s[e*i+l+1],r=e===u?o:s[e*i+l+i],a=l===p?r:e===u?n:s[e*i+l+i+1];x[t++]=o*n*r*a?1:0}else x[t++]=o}}return new e({width:f,height:c,pixelType:a,pixels:h,mask:x})}function I(t,e,n=0,l=!0){if(!r(t))return null;const{width:i,height:o}=e;let{width:s,height:a}=t;const h=new Map,f={x:0,y:0},c=1+n;let u=t;for(let r=0;r<c;r++){const t=Math.ceil(s/i),n=Math.ceil(a/o);for(let l=0;l<n;l++){f.y=l*o;for(let n=0;n<t;n++){f.x=n*i;const t=W(u,f,e);h.set(`${r}/${l}/${n}`,t)}}r<c-1&&(u=E(u,l)),s=Math.round(s/2),a=Math.round(a/2)}return h}function R(t){const{pixelBlock:e,tileSize:n,level:l,row:i,col:o,useBilinear:s}=t;if(!r(e))return null;const{width:a,height:h}=n,f=2**l,c=f*a,u=f*h;let p=W(e,{y:i*u,x:o*c},{width:c,height:u});if(!p)return null;for(let r=l;r>0;r--)p=E(p,s);return p}function F(t,e,n,l,i=0){const{width:o,height:r}=t,{width:s,height:a}=e,h=l.cols,f=l.rows,c=Math.ceil(s/h-.1/h),u=Math.ceil(a/f-.1/f);let p,x,m,d,g,y,w;const k=c*h,M=k*u*f,A=new Float32Array(M),U=new Float32Array(M),b=new Uint32Array(M),T=new Uint32Array(M);let v,B,C=0;for(let S=0;S<u;S++)for(let t=0;t<c;t++){p=12*(S*c+t),x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){C=(S*f+e)*k+t*h,B=(e+.5)/f;for(let t=0;t<e;t++)v=(t+.5)/h,A[C+t]=(x*v+m*B+d)*o+i,U[C+t]=(g*v+y*B+w)*r+i,b[C+t]=Math.floor(A[C+t]),T[C+t]=Math.floor(U[C+t])}p+=6,x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){C=(S*f+e)*k+t*h,B=(e+.5)/f;for(let t=e;t<h;t++)v=(t+.5)/h,A[C+t]=(x*v+m*B+d)*o+i,U[C+t]=(g*v+y*B+w)*r+i,b[C+t]=Math.floor(A[C+t]),T[C+t]=Math.floor(U[C+t])}}return{offsets_x:A,offsets_y:U,offsets_xi:b,offsets_yi:T,gridWidth:k}}function j(t,e){const{coefficients:n,spacing:l}=e,{offsets_x:i,offsets_y:o,gridWidth:r}=F(t,t,n,{rows:l[0],cols:l[1]}),{width:s,height:a}=t,h=new Float32Array(s*a),f=180/Math.PI;for(let c=0;c<a;c++)for(let t=0;t<s;t++){const e=c*r+t,n=0===c?e:e-r,l=c===a-1?e:e+r,u=i[n]-i[l],p=o[l]-o[n];if(isNaN(u)||isNaN(p))h[c*s+t]=90;else{let e=Math.atan2(p,u)*f;e=(360+e)%360,h[c*s+t]=e}}return h}function D(t,n,l,i,o="nearest"){if(!r(t))return null;"majority"===o&&(t=C(t));const{pixels:s,mask:a,bandMasks:h,pixelType:f}=t,c=t.width,u=t.height,p=e.getPixelArrayConstructor(f),x=s.length,{width:m,height:d}=n;let g=!1;for(let e=0;e<l.length;e+=3)-1===l[e]&&-1===l[e+1]&&-1===l[e+2]&&(g=!0);const{offsets_x:y,offsets_y:w,offsets_xi:k,offsets_yi:M,gridWidth:A}=F({width:c,height:u},n,l,i,"majority"===o?.5:0);let U;const b=(t,e,n,l)=>{const i=t instanceof Float32Array||t instanceof Float64Array?0:.5;for(let o=0;o<d;o++){U=o*A;for(let r=0;r<m;r++){if(y[U]<0||w[U]<0)t[o*m+r]=0;else if(l)t[o*m+r]=e[k[U]+M[U]*c];else{const l=Math.floor(y[U]),s=Math.floor(w[U]),a=Math.ceil(y[U]),h=Math.ceil(w[U]),f=y[U]-l,u=w[U]-s;if(!n||n[l+s*c]&&n[a+s*c]&&n[l+h*c]&&n[a+h*c]){const n=(1-f)*e[l+s*c]+f*e[a+s*c],p=(1-f)*e[l+h*c]+f*e[a+h*c];t[o*m+r]=(1-u)*n+u*p+i}else t[o*m+r]=e[k[U]+M[U]*c]}U++}}},T=[];let v;const B=h?.length===x,S=[];for(let e=0;e<x;e++){if(B){const t=new Uint8Array(m*d);b(t,h[e],h[e],!0),S.push(t)}v=new p(m*d),b(v,s[e],B?h[e]:a,"nearest"===o||"majority"===o),T.push(v)}const P=new e({width:m,height:d,pixelType:f,pixels:T,bandMasks:B?S:void 0});if(null!=a)P.mask=new Uint8Array(m*d),b(P.mask,a,a,!0);else if(g){P.mask=new Uint8Array(m*d);for(let t=0;t<m*d;t++)P.mask[t]=y[t]<0||w[t]<0?0:1}return P.updateStatistics(),P}export{i as MissingBandAction,l as NoDataInterpretation,D as approximateTransform,W as clip,R as clipTile,f as colorize,a as compositeBands,h as createColormapLUT,M as createMaskLUT,x as createRangeMaps,k as createRemapLUT,s as extractBands,A as getClipBounds,j as getLocalArithmeticNorthRotations,F as interpolateOffsets,r as isValidPixelBlock,u as lookupBandValues,c as lookupPixels,w as mask,o as maxMapSizeGpu,T as mosaic,U as mosaicPixelData,m as remap,p as remapColor,C as resampleByMajority,B as setValidBoundary,I as split};
5
+ import{numberMaxFloat32 as t}from"../../../core/mathUtils.js";import e from"../PixelBlock.js";import{getPixelValueRange as n}from"../rasterFormats/pixelRangeUtils.js";var l,i;!function(t){t[t.matchAny=0]="matchAny",t[t.matchAll=1]="matchAll"}(l||(l={})),function(t){t[t.bestMatch=0]="bestMatch",t[t.fail=1]="fail"}(i||(i={}));const o=9;function r(t){return null!=t&&t.pixels?.length>0}function s(t,e){return e?.length&&r(t)?t.extractBands(e):t}function a(t){if(!t?.length||t.some((t=>!r(t))))return null;if(1===t.length)return t[0]?.clone()??null;const n=t,{width:l,height:i,pixelType:o}=n[0];if(n.some((t=>t.width!==l||t.height!==i)))return null;const s=n.map((({mask:t})=>t)).filter((t=>null!=t));let a=null;s.length&&(a=new Uint8Array(l*i),a.set(s[0]),s.length>1&&y(s.slice(1),a));const h=[];n.forEach((({pixels:t})=>h.push(...t)));const f=n.map((({statistics:t})=>t)).filter((t=>t?.length)),c=[];return f.forEach((t=>c.push(...t))),new e({pixelType:o,width:l,height:i,mask:a,pixels:h,statistics:c.length?c:null})}function h(t){if(!t)return;const e=t.colormap;if(!e||0===e.length)return;const n=e.sort(((t,e)=>t[0]-e[0])),l=n[0][0]<0?n[0][0]:0,i=Math.max(256,n[n.length-1][0]-l+1),o=new Uint8Array(4*i),r=[],s=5===n[0].length;if(i>65536)return n.forEach((t=>{r[t[0]-l]=s?t.slice(1):t.slice(1).concat([255])})),{indexed2DColormap:r,offset:l,alphaSpecified:s};if(t.fillUnspecified){let t=n[0];for(let e=t[0]-l,r=0;e<i;e++)o[4*e]=t[1],o[4*e+1]=t[2],o[4*e+2]=t[3],o[4*e+3]=s?t[4]:255,e===t[0]-l&&(t=r===n.length-1?t:n[++r])}else for(let a=0;a<n.length;a++){const t=n[a],e=4*(t[0]-l);o[e]=t[1],o[e+1]=t[2],o[e+2]=t[3],o[e+3]=s?t[4]:255}return{indexedColormap:o,offset:l,alphaSpecified:s}}function f(t,e){if(!r(t))return t;if(!e||!e.indexedColormap&&!e.indexed2DColormap)return t;const n=t.clone(),l=n.pixels;let i=n.mask;const o=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:s,indexed2DColormap:a,offset:h,alphaSpecified:f}=e,c=l[0],u=new Uint8Array(c.length),p=new Uint8Array(c.length),x=new Uint8Array(c.length);let m,d=0;if(s){const t=s.length-1;if(null!=i)for(let e=0;e<o;e++)i[e]&&(d=4*(c[e]-h),d<h||d>t?i[e]=0:(u[e]=s[d],p[e]=s[d+1],x[e]=s[d+2],i[e]=s[d+3]));else{i=new Uint8Array(o);for(let e=0;e<o;e++)d=4*(c[e]-h),d<h||d>t?i[e]=0:(u[e]=s[d],p[e]=s[d+1],x[e]=s[d+2],i[e]=s[d+3]);n.mask=i}}else if(a)if(null!=i)for(let r=0;r<o;r++)i[r]&&(m=a[c[r]],u[r]=m[0],p[r]=m[1],x[r]=m[2],i[r]=m[3]);else{i=new Uint8Array(o);for(let t=0;t<o;t++)m=a[c[t]],u[t]=m[0],p[t]=m[1],x[t]=m[2],i[t]=m[3];n.mask=i}return n.pixels=[u,p,x],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=f,n}function c(t,n){if(!r(t))return null;const{pixels:l,mask:i}=t,o=l.length;let s=n.lut;const{offset:a}=n;s&&1===s[0].length&&(s=l.map((()=>s)));const h=[],f=n.outputPixelType||"u8";for(let e=0;e<o;e++){const t=u(l[e],i,s[e],a||0,f);h.push(t)}const c=new e({width:t.width,height:t.height,pixels:h,mask:i,pixelType:f});return c.updateStatistics(),c}function u(t,n,l,i,o){const r=t.length,s=e.createEmptyBand(o,r);if(n)for(let e=0;e<r;e++)n[e]&&(s[e]=l[t[e]-i]);else for(let e=0;e<r;e++)s[e]=l[t[e]-i];return s}function p(t,e){if(!r(t))return null;const n=t.clone(),{pixels:l}=n,i=n.width*n.height,o=e.length,s=Math.floor(o/2),a=e[Math.floor(s)],h=l[0],f=new Uint8Array(i),c=new Uint8Array(i),u=new Uint8Array(i);let p=n.mask;const x=4===e[0].mappedColor.length;p||(p=new Uint8Array(i),p.fill(x?255:1),n.mask=p);for(let r=0;r<i;r++)if(p[r]){const t=h[r];let n=!1,l=s,i=a,x=0,m=o-1;for(;m-x>1;){if(t===i.value){n=!0;break}t>i.value?x=l:m=l,l=Math.floor((x+m)/2),i=e[Math.floor(l)]}n||(t===e[x].value?(i=e[x],n=!0):t===e[m].value?(i=e[m],n=!0):t<e[x].value?n=!1:t>e[x].value&&(t<e[m].value?(i=e[x],n=!0):m===o-1?n=!1:(i=e[m],n=!0))),n?(f[r]=i.mappedColor[0],c[r]=i.mappedColor[1],u[r]=i.mappedColor[2],p[r]=i.mappedColor[3]):f[r]=c[r]=u[r]=p[r]=0}return n.pixels=[f,c,u],n.mask=p,n.pixelType="u8",n.maskIsAlpha=x,n}function x(e,n,l=!1){const i=1e-5,r=new Float32Array(3*o),s=n.length;for(let a=0;a<o;a++)r[3*a]=e[2*a]??t-1,r[3*a+1]=e[2*a+1]??t,r[3*a+2]=n[a]??0,a<s&&(a>0&&(r[3*a]-=i),(a<s-1||!l)&&(r[3*a+1]-=i));return r}function m(t,l){if(!r(t))return null;const{width:i,height:o}=t,{inputRanges:s,outputValues:a,outputPixelType:h,noDataRanges:f,allowUnmatched:c,replacementValue:u,isLastInputRangeInclusive:p}=l,x=t.pixels[0],m=e.createEmptyBand(h,x.length),d=t.mask,g=new Uint8Array(i*o);d?g.set(d):g.fill(255);const y=t.pixelType.startsWith("f")?1e-6:0,w=s.map((t=>t-y));w[0]=s[0],w[w.length-1]=s[s.length-1]+(p?1e-6:0);const k=s.length/2,[M,A]=n(h);for(let e=0;e<o;e++)for(let t=0;t<i;t++){const n=e*i+t;if(g[n]){const t=x[n];let e=!1;for(let l=k-1;l>=0;l--)if(t===w[2*l]||t>w[2*l]&&t<w[2*l+1]){m[n]=a[l],e=!0;break}e||(c?m[n]=t>A?A:t<M?M:u??t:g[n]=0)}}const U=f?.length;if(U)for(let e=0;e<o;e++)for(let t=0;t<i;t++){const n=e*i+t;if(!d||d[n]){const t=x[n];for(let e=0;e<U;e+=2)if(t>=f[e]&&t<=f[e+1]){m[n]=0,g[n]=0;break}}}return new e({width:i,height:o,pixelType:h,pixels:[m],mask:g})}function d(t,e,n,l){const i=null!=n&&n.length>=2?new Set(n):null,o=1===n?.length?n[0]:null,r=!!e?.length;for(let s=0;s<t.length;s++)if(l[s]){const n=t[s];if(r){let t=!1;for(let l=0;l<e.length;l+=2)if(n>=e[l]&&n<=e[l+1]){t=!0;break}t||(l[s]=0)}l[s]&&(n===o||i?.has(n))&&(l[s]=0)}}function g(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(t[e][l]){n=!0;break}n||(e[l]=0)}}function y(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(0===t[e][l]){n=!0;break}n&&(e[l]=0)}}function w(t,n){if(!r(t))return null;const{width:l,height:i,pixels:o}=t,s=l*i,a=new Uint8Array(s);t.mask?a.set(t.mask):a.fill(255);const h=o.length,{includedRanges:f,noDataValues:c,outputPixelType:p,matchAll:x,lookups:m}=n;if(m){const t=[];for(let e=0;e<h;e++){const n=m[e],l=u(o[e],a,n.lut,n.offset||0,"u8");t.push(l)}1===t.length?a.set(t[0]):x?g(t,a):y(t,a)}else if(x){const t=[];for(let e=0;e<h;e++){const n=new Uint8Array(s);n.set(a),d(o[e],f?.slice(2*e,2*e+2),c?.[e],n),t.push(n)}1===t.length?a.set(t[0]):g(t,a)}else for(let e=0;e<h;e++)d(o[e],f?.slice(2*e,2*e+2),c?.[e],a);return new e({width:l,height:i,pixelType:p,pixels:o,mask:a})}function k(t){const{srcPixelType:l,inputRanges:i,outputValues:o,allowUnmatched:r,noDataRanges:s,isLastInputRangeInclusive:a,outputPixelType:h}=t;if("u8"!==l&&"s8"!==l&&"u16"!==l&&"s16"!==l)return null;const f=l.includes("16")?65536:256,c=l.includes("s")?-f/2:0,u=e.createEmptyBand(h,f),p=new Uint8Array(f);r&&p.fill(255);const[x,m]=n(h);if(i?.length&&o?.length){const t=1e-6,e=i.map((e=>e-t));e[0]=i[0],a&&(e[e.length-1]=i[i.length-1]);for(let n=0;n<e.length;n++){const t=o[n]>m?m:o[n]<x?x:o[n],l=Math.ceil(e[2*n]-c),i=Math.floor(e[2*n+1]-c);for(let e=l;e<=i;e++)u[e]=t,p[e]=255}}if(s?.length)for(let e=0;e<s.length;e++){const t=Math.ceil(s[2*e]-c),n=Math.floor(s[2*e+1]-c);for(let e=t;e<=n;e++)p[e]=0}return{lut:u,offset:c,mask:p}}function M(t,e,n){if("u8"!==t&&"s8"!==t&&"u16"!==t&&"s16"!==t)return null;const l=t.includes("16")?65536:256,i=t.includes("s")?-l/2:0,o=new Uint8Array(l);if(e)for(let r=0;r<e.length;r++){const t=Math.ceil(e[2*r]-i),n=Math.floor(e[2*r+1]-i);for(let e=t;e<=n;e++)o[e]=255}else o.fill(255);if(n)for(let r=0;r<n.length;r++)o[n[r]-i]=0;return{lut:o,offset:i}}function A(t,e,n,l,i,o,r,s){return{xmin:i<=n*t?0:i<n*t+t?i-n*t:t,ymin:o<=l*e?0:o<l*e+e?o-l*e:e,xmax:i+r<=n*t?0:i+r<n*t+t?i+r-n*t:t,ymax:o+s<=l*e?0:o+s<l*e+e?o+s-l*e:e}}function U(t,e){if(!t||0===t.length)return null;const n=t.find((t=>t.pixelBlock));if(null==n?.pixelBlock)return null;const l=(n.extent.xmax-n.extent.xmin)/n.pixelBlock.width,i=(n.extent.ymax-n.extent.ymin)/n.pixelBlock.height,o=.01*Math.min(l,i),r=t.sort(((t,e)=>Math.abs(t.extent.ymax-e.extent.ymax)>o?e.extent.ymax-t.extent.ymax:Math.abs(t.extent.xmin-e.extent.xmin)>o?t.extent.xmin-e.extent.xmin:0)),s=Math.min.apply(null,r.map((t=>t.extent.xmin))),a=Math.min.apply(null,r.map((t=>t.extent.ymin))),h=Math.max.apply(null,r.map((t=>t.extent.xmax))),f=Math.max.apply(null,r.map((t=>t.extent.ymax))),c={x:Math.round((e.xmin-s)/l),y:Math.round((f-e.ymax)/i)},u={width:Math.round((h-s)/l),height:Math.round((f-a)/i)},p={width:Math.round((e.xmax-e.xmin)/l),height:Math.round((e.ymax-e.ymin)/i)};if(Math.round(u.width/n.pixelBlock.width)*Math.round(u.height/n.pixelBlock.height)!==r.length||c.x<0||c.y<0||u.width<p.width||u.height<p.height)return null;return{extent:e,pixelBlock:T(r.map((t=>t.pixelBlock)),u,{clipOffset:c,clipSize:p})}}function b(t,e,n,l,i,o){const{width:r,height:s}=n.block,{x:a,y:h}=n.offset,{width:f,height:c}=n.mosaic,u=A(r,s,l,i,a,h,f,c);let p=0,x=0;if(o){const t=o.hasGCSSShiftTransform?360:o.halfWorldWidth??0,e=r*o.resolutionX,n=o.startX+l*e;n<t&&n+e>t?x=o.rightPadding:n>=t&&(p=o.leftMargin-o.rightPadding,x=0)}if(u.xmax-=x,"number"!=typeof e)for(let m=u.ymin;m<u.ymax;m++){const n=(i*s+m-h)*f+(l*r-a)+p,o=m*r;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e[o+l]}else for(let m=u.ymin;m<u.ymax;m++){const n=(i*s+m-h)*f+(l*r-a)+p;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e}}function T(t,n,l={}){const{clipOffset:i,clipSize:o,alignmentInfo:s,blockWidths:a}=l;if(a)return v(t,n,{blockWidths:a});const h=t.find((t=>r(t)));if(null==h)return null;const f=o?o.width:n.width,c=o?o.height:n.height,u=h.width,p=h.height,x=n.width/u,m=n.height/p,d={offset:i||{x:0,y:0},mosaic:o||n,block:{width:u,height:p}},g=h.pixelType,y=e.getPixelArrayConstructor(g),w=h.pixels.length,k=[];let M,A;for(let e=0;e<w;e++){A=new y(f*c);for(let n=0;n<m;n++)for(let l=0;l<x;l++){const i=t[n*x+l];r(i)&&(M=i.pixels[e],b(A,M,d,l,n,s))}k.push(A)}const U=t.some((t=>null==t||null!=t.mask&&t.mask.length>0)),T=t.some((t=>t?.bandMasks&&t.bandMasks.length>1)),B=U?new Uint8Array(f*c):void 0,S=T?[]:void 0;if(B){for(let e=0;e<m;e++)for(let n=0;n<x;n++){const l=t[e*x+n],i=null!=l?l.mask:null;b(B,null!=i?i:l?255:0,d,n,e,s)}if(S)for(let e=0;e<w;e++){const n=new Uint8Array(f*c);for(let l=0;l<m;l++)for(let i=0;i<x;i++){const o=t[l*x+i],r=o?.bandMasks?.[e]??o?.mask;b(n,null!=r?r:o?255:0,d,i,l,s)}S.push(n)}}const C=new e({width:f,height:c,pixels:k,pixelType:g,bandMasks:S,mask:B});return C.updateStatistics(),C}function v(t,n,l){const i=t.find((t=>null!=t));if(null==i)return null;const o=t.some((t=>null==t||!!t.mask)),{width:s,height:a}=n,h=o?new Uint8Array(s*a):null,{blockWidths:f}=l,c=[],u=i.getPlaneCount(),p=e.getPixelArrayConstructor(i.pixelType);if(o)for(let e=0,y=0;e<t.length;y+=f[e],e++){const n=t[e];if(!r(n))continue;const l=n.mask;for(let t=0;t<a;t++)for(let i=0;i<f[e];i++)h[t*s+i+y]=null==l?255:l[t*n.width+i]}const x=t.some((t=>t?.bandMasks&&t.bandMasks.length>1)),m=x?[]:void 0,d=s*a;for(let e=0;e<u;e++){const n=new p(d),l=x?new Uint8Array(d):void 0;for(let i=0,o=0;i<t.length;o+=f[i],i++){const h=t[i];if(!r(h))continue;const c=h.pixels[e];if(null!=c){for(let t=0;t<a;t++)for(let e=0;e<f[i];e++)n[t*s+e+o]=c[t*h.width+e];if(l){const t=h.bandMasks?.[e]??h.mask;for(let e=0;e<a;e++)for(let n=0;n<f[i];n++)l[e*s+n+o]=t?t[e*h.width+n]:255}}}c.push(n),m&&l&&m.push(l)}const g=new e({width:s,height:a,mask:h,bandMasks:m,pixels:c,pixelType:i.pixelType});return g.updateStatistics(),g}function B(t,e,n){if(!r(t))return null;const{width:l,height:i}=t,o=e.x,s=e.y,a=n.width+o,h=n.height+s;if(o<0||s<0||a>l||h>i)return t;if(0===o&&0===s&&a===l&&h===i)return t;t.mask||(t.mask=new Uint8Array(l*i));const f=t.mask;for(let r=0;r<i;r++){const t=r*l;for(let e=0;e<l;e++)f[t+e]=r<s||r>=h||e<o||e>=a?0:1}return t.updateStatistics(),t}function S(t){if(!r(t))return null;const e=t.clone(),{width:n,height:l,pixels:i}=t,o=i[0],s=e.pixels[0],a=t.mask;for(let r=2;r<l-1;r++){const t=new Map;for(let l=r-2;l<r+2;l++)for(let e=0;e<4;e++){const i=l*n+e;_(t,o[i],a?a[i]:1)}s[r*n]=C(t),s[r*n+1]=s[r*n+2]=s[r*n];let e=3;for(;e<n-1;e++){let l=(r-2)*n+e+1;_(t,o[l],a?a[l]:1),l=(r-1)*n+e+1,_(t,o[l],a?a[l]:1),l=r*n+e+1,_(t,o[l],a?a[l]:1),l=(r+1)*n+e+1,_(t,o[l],a?a[l]:1),l=(r-2)*n+e-3,P(t,o[l],a?a[l]:1),l=(r-1)*n+e-3,P(t,o[l],a?a[l]:1),l=r*n+e-3,P(t,o[l],a?a[l]:1),l=(r+1)*n+e-3,P(t,o[l],a?a[l]:1),s[r*n+e]=C(t)}s[r*n+e+1]=s[r*n+e]}for(let r=0;r<n;r++)s[r]=s[n+r]=s[2*n+r],s[(l-1)*n+r]=s[(l-2)*n+r];return e.updateStatistics(),e}function C(t){if(0===t.size)return 0;let e=0,n=-1,l=0;const i=t.keys();let o=i.next();for(;!o.done;)l=t.get(o.value),l>e&&(n=o.value,e=l),o=i.next();return n}function P(t,e,n){if(0===n)return;const l=t.get(e);1===l?t.delete(e):t.set(e,l-1)}function _(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function W(t,n,l){let{x:i,y:o}=n;const{width:s,height:a}=l;if(0===i&&0===o&&a===t.height&&s===t.width)return t;const{width:h,height:f}=t,c=Math.max(0,o),u=Math.max(0,i),p=Math.min(i+s,h),x=Math.min(o+a,f);if(p<0||x<0||!r(t))return null;i=Math.max(0,-i),o=Math.max(0,-o);const{pixels:m}=t,d=s*a,g=m.length,y=[];for(let r=0;r<g;r++){const n=m[r],l=e.createEmptyBand(t.pixelType,d);for(let t=c;t<x;t++){const e=t*h;let r=(t+o-c)*s+i;for(let t=u;t<p;t++)l[r++]=n[e+t]}y.push(l)}const w=new Uint8Array(d),k=t.mask;for(let e=c;e<x;e++){const t=e*h;let n=(e+o-c)*s+i;for(let e=u;e<p;e++)w[n++]=k?k[t+e]:1}const M=new e({width:l.width,height:l.height,pixelType:t.pixelType,pixels:y,mask:w});return M.updateStatistics(),M}function E(t,n=!0){if(!r(t))return null;const{pixels:l,width:i,height:o,mask:s,pixelType:a}=t,h=[],f=Math.round(i/2),c=Math.round(o/2),u=o-1,p=i-1;for(let r=0;r<l.length;r++){const t=l[r],s=e.createEmptyBand(a,f*c);let x=0;for(let e=0;e<o;e+=2)for(let l=0;l<i;l+=2){const o=t[e*i+l];if(n){const n=l===p?o:t[e*i+l+1],r=e===u?o:t[e*i+l+i],a=l===p?r:e===u?n:t[e*i+l+i+1];s[x++]=(o+n+r+a)/4}else s[x++]=o}h.push(s)}let x=null;if(null!=s){x=new Uint8Array(f*c);let t=0;for(let e=0;e<o;e+=2)for(let l=0;l<i;l+=2){const o=s[e*i+l];if(n){const n=l===p?o:s[e*i+l+1],r=e===u?o:s[e*i+l+i],a=l===p?r:e===u?n:s[e*i+l+i+1];x[t++]=o*n*r*a?1:0}else x[t++]=o}}return new e({width:f,height:c,pixelType:a,pixels:h,mask:x})}function I(t,e,n=0,l=!0){if(!r(t))return null;const{width:i,height:o}=e;let{width:s,height:a}=t;const h=new Map,f={x:0,y:0},c=1+n;let u=t;for(let r=0;r<c;r++){const t=Math.ceil(s/i),n=Math.ceil(a/o);for(let l=0;l<n;l++){f.y=l*o;for(let n=0;n<t;n++){f.x=n*i;const t=W(u,f,e);h.set(`${r}/${l}/${n}`,t)}}r<c-1&&(u=E(u,l)),s=Math.round(s/2),a=Math.round(a/2)}return h}function R(t){const{pixelBlock:e,tileSize:n,level:l,row:i,col:o,useBilinear:s}=t;if(!r(e))return null;const{width:a,height:h}=n,f=2**l,c=f*a,u=f*h;let p=W(e,{y:i*u,x:o*c},{width:c,height:u});if(!p)return null;for(let r=l;r>0;r--)p=E(p,s);return p}function F(t,e,n,l,i=0){const{width:o,height:r}=t,{width:s,height:a}=e,h=l.cols,f=l.rows,c=Math.ceil(s/h-.1/h),u=Math.ceil(a/f-.1/f);let p,x,m,d,g,y,w;const k=c*h,M=k*u*f,A=new Float32Array(M),U=new Float32Array(M),b=new Uint32Array(M),T=new Uint32Array(M);let v,B,S=0;for(let C=0;C<u;C++)for(let t=0;t<c;t++){p=12*(C*c+t),x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){S=(C*f+e)*k+t*h,B=(e+.5)/f;for(let t=0;t<e;t++)v=(t+.5)/h,A[S+t]=(x*v+m*B+d)*o+i,U[S+t]=(g*v+y*B+w)*r+i,b[S+t]=Math.floor(A[S+t]),T[S+t]=Math.floor(U[S+t])}p+=6,x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){S=(C*f+e)*k+t*h,B=(e+.5)/f;for(let t=e;t<h;t++)v=(t+.5)/h,A[S+t]=(x*v+m*B+d)*o+i,U[S+t]=(g*v+y*B+w)*r+i,b[S+t]=Math.floor(A[S+t]),T[S+t]=Math.floor(U[S+t])}}return{offsets_x:A,offsets_y:U,offsets_xi:b,offsets_yi:T,gridWidth:k}}function j(t,e){const{coefficients:n,spacing:l}=e,{offsets_x:i,offsets_y:o,gridWidth:r}=F(t,t,n,{rows:l[0],cols:l[1]}),{width:s,height:a}=t,h=new Float32Array(s*a),f=180/Math.PI;for(let c=0;c<a;c++)for(let t=0;t<s;t++){const e=c*r+t,n=0===c?e:e-r,l=c===a-1?e:e+r,u=i[n]-i[l],p=o[l]-o[n];if(isNaN(u)||isNaN(p))h[c*s+t]=90;else{let e=Math.atan2(p,u)*f;e=(360+e)%360,h[c*s+t]=e}}return h}function D(t,n,l,i,o="nearest"){if(!r(t))return null;"majority"===o&&(t=S(t));const{pixels:s,mask:a,bandMasks:h,pixelType:f}=t,c=t.width,u=t.height,p=e.getPixelArrayConstructor(f),x=s.length,{width:m,height:d}=n;let g=!1;for(let e=0;e<l.length;e+=3)-1===l[e]&&-1===l[e+1]&&-1===l[e+2]&&(g=!0);const{offsets_x:y,offsets_y:w,offsets_xi:k,offsets_yi:M,gridWidth:A}=F({width:c,height:u},n,l,i,"majority"===o?.5:0);let U;const b=(t,e,n,l)=>{const i=t instanceof Float32Array||t instanceof Float64Array?0:.5;for(let o=0;o<d;o++){U=o*A;for(let r=0;r<m;r++){if(y[U]<0||w[U]<0)t[o*m+r]=0;else if(l)t[o*m+r]=e[k[U]+M[U]*c];else{const l=Math.floor(y[U]),s=Math.floor(w[U]),a=Math.ceil(y[U]),h=Math.ceil(w[U]),f=y[U]-l,u=w[U]-s;if(!n||n[l+s*c]&&n[a+s*c]&&n[l+h*c]&&n[a+h*c]){const n=(1-f)*e[l+s*c]+f*e[a+s*c],p=(1-f)*e[l+h*c]+f*e[a+h*c];t[o*m+r]=(1-u)*n+u*p+i}else t[o*m+r]=e[k[U]+M[U]*c]}U++}}},T=[];let v;const B=h?.length===x,C=[];for(let e=0;e<x;e++){if(B){const t=new Uint8Array(m*d);b(t,h[e],h[e],!0),C.push(t)}v=new p(m*d),b(v,s[e],B?h[e]:a,"nearest"===o||"majority"===o),T.push(v)}const P=new e({width:m,height:d,pixelType:f,pixels:T,bandMasks:B?C:void 0});if(null!=a)P.mask=new Uint8Array(m*d),b(P.mask,a,a,!0);else if(g){P.mask=new Uint8Array(m*d);for(let t=0;t<m*d;t++)P.mask[t]=y[t]<0||w[t]<0?0:1}return P.updateStatistics(),P}export{i as MissingBandAction,l as NoDataInterpretation,D as approximateTransform,W as clip,R as clipTile,f as colorize,a as compositeBands,h as createColormapLUT,M as createMaskLUT,x as createRangeMaps,k as createRemapLUT,s as extractBands,A as getClipBounds,j as getLocalArithmeticNorthRotations,F as interpolateOffsets,r as isValidPixelBlock,u as lookupBandValues,c as lookupPixels,w as mask,o as maxMapSizeGpu,T as mosaic,U as mosaicPixelData,m as remap,p as remapColor,S as resampleByMajority,B as setValidBoundary,I as split};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.33.0-next.20250318",
3
+ "version": "4.33.0-next.20250320",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -27,7 +27,8 @@
27
27
  "dependencies": {
28
28
  "@esri/arcgis-html-sanitizer": "~4.1.0",
29
29
  "@esri/calcite-components": "^3.0.3",
30
- "@vaadin/grid": "~24.6.6",
30
+ "@petamoriken/float16": "~3.9.2",
31
+ "@vaadin/grid": "~24.7.1",
31
32
  "@zip.js/zip.js": "~2.7.57",
32
33
  "luxon": "~3.5.0",
33
34
  "marked": "~15.0.7"
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/JSONSupport.js";import r from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import o from"../../layers/support/RasterInfo.js";import{colorize as n,remapColor as i,lookupPixels as l,createColormapLUT as u,isValidPixelBlock as c}from"../../layers/support/rasterFunctions/pixelUtils.js";import{stretch as p,getStretchCutoff as d,isStandardU8Histogram as h,createStretchLUT as m,computeGammaValues as f,createHistogramEqualizationLUT as y}from"../../layers/support/rasterFunctions/stretchUtils.js";import{hillshade as g,tintHillshade as b,calculateHillshadeParams as S}from"../../layers/support/rasterFunctions/surfaceUtils.js";import{convertColorRampToColormap as k,createHsvMap as x}from"./colorRampUtils.js";import{isUVRendererSupported as I,isColormapSupportedByWebGL as R,isColormapRendererSupported as C,isShadedReliefRendererSupported as L}from"./rasterRendererChecks.js";let _=class extends t{constructor(e){super(e)}bind(){const{rendererJSON:e}=this;if(!e)return{success:!1};let t;switch(this.lookup={rendererJSON:{}},e.type){case"uniqueValue":t=this._updateUVRenderer(e);break;case"rasterColormap":t=this._updateColormapRenderer(e);break;case"rasterStretch":t=this._updateStretchRenderer(e);break;case"classBreaks":t=this._updateClassBreaksRenderer(e);break;case"rasterShadedRelief":t=this._updateShadedReliefRenderer(e);break;case"vectorField":t=this._updateVectorFieldRenderer();break;case"flowRenderer":t=this._updateFlowRenderer()}return t}symbolize(e){let t=e?.pixelBlock;if(!T(t))return t;if(e.simpleStretchParams&&"rasterStretch"===this.rendererJSON.type)return this.simpleStretch(t,e.simpleStretchParams);try{let r;switch(t.pixels.length>3&&(t=t.extractBands(e.bandIds??[0,1,2])),this.rendererJSON.type){case"uniqueValue":case"rasterColormap":r=this._symbolizeColormap(t);break;case"classBreaks":r=this._symbolizeClassBreaks(t);break;case"rasterStretch":r=this._symbolizeStretch(t,e.bandIds);break;case"rasterShadedRelief":{const s=e.extent,a=s.spatialReference.isGeographic,o={x:(s.xmax-s.xmin)/t.width,y:(s.ymax-s.ymin)/t.height};r=this._symbolizeShadedRelief(t,{isGCS:a,resolution:o});break}}return r}catch(s){return r.getLogger(this).error("symbolize",s.message),t}}simpleStretch(e,t){if(!T(e))return e;try{return e.pixels.length>3&&(e=e.extractBands([0,1,2])),p(e,{...t,isRenderer:!0})}catch(s){return r.getLogger(this).error("symbolize",s.message),e}}generateWebGLParameters(e){if(["uniqueValue","rasterColormap","classBreaks"].includes(this.rendererJSON.type)){const{indexedColormap:e,offset:t}=this.lookup.colormapLut||{};return{colormap:e,colormapOffset:t,isClassBreaks:"classBreaks"===this.rendererJSON.type,type:"lut"}}const{pixelBlock:t,isGCS:r,resolution:s,bandIds:a}=e,{rendererJSON:o}=this;return"rasterStretch"===o.type?this._generateStretchWebGLParams(t,o,a):"rasterShadedRelief"===o.type?this._generateShadedReliefWebGLParams(o,r,s??void 0):"vectorField"===o.type?this._generateVectorFieldWebGLParams(o):null}_isLUTChanged(e){if(!this.lookup||!this.lookup.rendererJSON)return!0;if("colorRamp"in this.rendererJSON){const t=this.rendererJSON.colorRamp;return e?JSON.stringify(t)!==JSON.stringify(this.lookup.rendererJSON.colorRamp):(this.rendererJSON,this.lookup.rendererJSON,JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON))}return JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON)}_symbolizeColormap(e){if(this._isLUTChanged()){if(!this.bind().success)return e}return n(e,this.lookup.colormapLut)}_symbolizeClassBreaks(e){const{canUseIndexedLUT:t}=this._analyzeClassBreaks(this.rendererJSON);if(this._isLUTChanged()){if(!this.bind().success)return e}return t?n(e,this.lookup.colormapLut):i(e,this.lookup.remapLut??[])}_symbolizeStretch(e,t){const{rasterInfo:r}=this,{pixelType:s,bandCount:a}=r,o=this.rendererJSON,i=["u8","u16","s8","s16"].includes(s);let u,c;const{dra:f}=o,{gamma:y}=this.lookup;if("histogramEqualization"===o.stretchType){const s=f?null:this.lookup?.histogramLut,a=d(o,{rasterInfo:r,pixelBlock:e,bandIds:t,returnHistogramLut:!s}),n="u8"===r.pixelType&&!f&&h(r.histograms?.[0])?e:p(e,{...a,gamma:y,isRenderer:!0});c=l(n,{lut:f?a.histogramLut:t?.length?t.map((e=>s[e])):s,offset:0})}else if(i){if(f){const a=d(o,{rasterInfo:r,pixelBlock:e,bandIds:t});u=m({pixelType:s,...a,gamma:y,rounding:"floor"})}else if(this._isLUTChanged()){if(!this.bind().success)return e;u=this.lookup?this.lookup.stretchLut:null}else u=this.lookup?this.lookup.stretchLut:null;if(!u)return e;a>1&&null!=t&&t.length===e?.pixels.length&&u?.lut.length===a&&(u={lut:t.map((e=>u.lut[e])),offset:u.offset}),c=l(e,u)}else{const s=d(o,{rasterInfo:r,pixelBlock:e,bandIds:t});c=p(e,{...s,gamma:y,isRenderer:!0})}if(o.colorRamp){if(this._isLUTChanged(!0)){if(!this.bind().success)return e}c=n(c,this.lookup?.colormapLut)}return c}_symbolizeShadedRelief(e,t){const r=this.rendererJSON,s={...r,...t},a=g(e,s);if(!r.colorRamp)return a;let o;if(this._isLUTChanged(!0)){if(!this.bind().success)return a;o=this.lookup?this.lookup.hsvMap:null}else o=this.lookup?this.lookup.hsvMap:null;if(!o)return a;const n=this.rasterInfo.statistics?.[0]??{min:0,max:8e3};return b(a,e,o,n),a}_isVectorFieldData(){const{bandCount:e,dataType:t}=this.rasterInfo;return 2===e&&("vector-magdir"===t||"vector-uv"===t)}_updateVectorFieldRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; VectorFieldRenderer only supports "vector-magdir" and "vector-uv".`}}_updateFlowRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; FlowRenderer only supports "vector-magdir" and "vector-uv".`}}_updateUVRenderer(e){const{bandCount:t,attributeTable:r,pixelType:s}=this.rasterInfo,a=e.field1;if(!a)return{success:!1,error:"Unsupported renderer; missing UniqueValueRenderer.field."};const o=e.defaultSymbol,n=1===t&&["u8","s8"].includes(s);if(!I(this.rasterInfo,a)&&!n)return{success:!1,error:"Unsupported data; UniqueValueRenderer is only supported on single band data with a valid raster attribute table."};const i=[];if(null!=r){const t=r.fields.find((e=>"value"===e.name.toLowerCase()));if(!t)return{success:!1,error:"Unsupported data; the data's raster attribute table does not have a value field."};r.features.forEach((r=>{const s=e.uniqueValueInfos?.find((e=>String(e.value)===String(r.attributes[a]))),n=s?.symbol?.color;n?i.push([r.attributes[t.name]].concat(n)):o&&i.push([r.attributes[t.name]].concat(o.color))}))}else{if("value"!==a.toLowerCase())return{success:!1,error:'Unsupported renderer; UniqueValueRenderer.field must be "Value" when raster attribute table is not available.'};e.uniqueValueInfos?.forEach((e=>{const t=e?.symbol?.color;t?i.push([parseInt(""+e.value,10)].concat(t)):o&&i.push([parseInt(""+e.value,10)].concat(o?.color))}))}if(0===i.length)return{success:!1,error:"Invalid UniqueValueRenderer. Cannot find matching records in the raster attribute table."};const l=u({colormap:i});return this.lookup={rendererJSON:e,colormapLut:l},this.canRenderInWebGL=R(l?.indexedColormap),{success:!0}}_updateColormapRenderer(e){if(!C(this.rasterInfo))return{success:!1,error:"Unsupported data; the data source does not have a colormap."};const t=e.colormapInfos.map((e=>[e.value].concat(e.color))).sort(((e,t)=>e[0]-t[0]));if(!t||0===t.length)return{success:!1,error:"Unsupported renderer; ColormapRenderer must have meaningful colormapInfos."};const r=u({colormap:t});return this.lookup={rendererJSON:e,colormapLut:r},this.canRenderInWebGL=R(r?.indexedColormap),{success:!0}}_updateShadedReliefRenderer(e){if(!L(this.rasterInfo))return{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; ShadedReliefRenderer only supports "elevation", or single band float/s16 data.`};if(e.colorRamp){const t=k(e.colorRamp,{interpolateAlpha:!0}),r=u({colormap:t}),s=x(r.indexedColormap);this.lookup={rendererJSON:e,colormapLut:r,hsvMap:s}}else this.lookup=null;return this.canRenderInWebGL=!0,{success:!0}}_analyzeClassBreaks(e){const{attributeTable:t,pixelType:r}=this.rasterInfo,s=null!=t?t.fields.find((e=>"value"===e.name.toLowerCase())):null,a=null!=t?t.fields.find((t=>t.name.toLowerCase()===e.field.toLowerCase())):null,o=null!=s&&null!==a;return{canUseIndexedLUT:["u8","u16","s8","s16"].includes(r)||o,tableValueField:s,tableBreakField:a}}_updateClassBreaksRenderer(e){const{attributeTable:t}=this.rasterInfo,{canUseIndexedLUT:r,tableValueField:s,tableBreakField:a}=this._analyzeClassBreaks(e),o=e.classBreakInfos;if(!o?.length)return{success:!1,error:"Unsupported renderer; missing or invalid ClassBreaksRenderer.classBreakInfos."};const n=o.sort(((e,t)=>e.classMaxValue-t.classMaxValue)),i=n[n.length-1];let l=e.minValue;if(!r){const t=[];for(let e=0;e<n.length;e++)t.push({value:n[e].classMinValue??l,mappedColor:n[e].symbol.color}),l=n[e].classMaxValue;return t.push({value:i.classMaxValue,mappedColor:i.symbol.color}),this.lookup={rendererJSON:e,remapLut:t},this.canRenderInWebGL=!1,{success:!0}}const c=[];if(null!=t&&null!=s&&null!==a&&s!==a){const r=s.name,o=a.name,i=n[n.length-1],{classMaxValue:u}=i;l=e.minValue;for(const e of t.features){const t=e.attributes[r],s=e.attributes[o],a=s===u?i:s<l?null:n.find((({classMaxValue:e})=>e>s));a&&c.push([t].concat(a.symbol.color))}}else{l=Math.floor(e.minValue);for(let e=0;e<n.length;e++){const t=n[e];for(let e=l;e<t.classMaxValue;e++)c.push([e].concat(t.symbol.color));l=Math.ceil(t.classMaxValue)}i.classMaxValue===l&&c.push([i.classMaxValue].concat(i.symbol.color))}const p=u({colormap:c,fillUnspecified:!1});return this.lookup={rendererJSON:e,colormapLut:p},this.canRenderInWebGL=R(p?.indexedColormap),{success:!0}}_updateStretchRenderer(e){let{stretchType:t,dra:r}=e;if(!("none"===t||e.statistics?.length||v(this.rasterInfo.statistics)||r))return{success:!1,error:"Unsupported renderer; StretchRenderer.statistics is required when dynamic range adjustment is not used."};const s=e.histograms||this.rasterInfo.histograms;!V(e.stretchType)||s?.length||r||(t="minMax");const{computeGamma:a,useGamma:o,colorRamp:n}=e;let{gamma:i}=e;if(o&&a&&!i?.length){const t=e.statistics?.length?e.statistics:this.rasterInfo.statistics;i=f(this.rasterInfo.pixelType,t)}const l=this.rasterInfo.pixelType,c=!r&&["u8","u16","s8","s16"].includes(l);if("histogramEqualization"===t){const t=s.map((e=>y(e)));this.lookup={rendererJSON:e,histogramLut:t}}else if(c){const t=d(e,{rasterInfo:this.rasterInfo}),r=m({pixelType:l,...t,gamma:o?i:null,rounding:"floor"});this.lookup={rendererJSON:e,stretchLut:r}}if(n&&!U(n)){const t=k(n,{interpolateAlpha:!0});this.lookup||(this.lookup={rendererJSON:e}),this.lookup.colormapLut=u({colormap:t}),this.lookup.rendererJSON=e}return this.lookup.gamma=o&&i?.length?i:null,this.canRenderInWebGL="histogramEqualization"!==t,{success:!0}}_generateStretchWebGLParams(e,t,r){let s=null,a=null;const o=this.lookup?.colormapLut;t.colorRamp&&o&&(s=o.indexedColormap,a=o.offset),"histogramEqualization"===t.stretchType&&(t={...t,stretchType:"minMax"});const{gamma:n}=this.lookup,i=!(!t.useGamma||!n?.some((e=>1!==e))),{minCutOff:l,maxCutOff:u,minOutput:c,maxOutput:p}=d(t,{rasterInfo:this.rasterInfo,pixelBlock:e,bandIds:r});let h=0;null!=e&&(h=e.getPlaneCount(),2===h&&((e=e.clone()).statistics=[e.statistics[0]],e.pixels=[e.pixels[0]]));const{bandCount:m}=this.rasterInfo,f=Math.min(3,r?.length||h||m,m),y=s||i?1:255,g=new Float32Array(f);if(i&&n)for(let d=0;d<f;d++)n[d]>1?n[d]>2?g[d]=6.5+(n[d]-2)**2.5:g[d]=6.5+100*(2-n[d])**4:g[d]=1;1===l.length&&(l[2]=l[1]=l[0]),1===u.length&&(u[2]=u[1]=u[0]);const b=i&&n?[n[0],n[1]??n[0],n[2]??n[0]]:[1,1,1],S=i?[g[0],g[1]??g[0],g[2]??g[0]]:[1,1,1],k=u.map(((e,t)=>u[t]===l[t]?0:(p-c)/(u[t]-l[t])/y));return{bandCount:f,minOutput:c/y,maxOutput:p/y,minCutOff:l,maxCutOff:u,factor:k,useGamma:i,gamma:b,gammaCorrection:S,colormap:s,colormapOffset:a,stretchType:t.stretchType,type:"stretch"}}_generateShadedReliefWebGLParams(e,t=!1,r={x:0,y:0}){let s=null,a=null;const o=this.lookup?.colormapLut;e.colorRamp&&o&&(s=o.indexedColormap,a=o.offset);const n={...e,isGCS:t,resolution:r},i=S(n),l=this.rasterInfo.statistics?.[0];return{...i,minValue:l?.min??0,maxValue:l?.max??8e3,hillshadeType:"traditional"===e.hillshadeType?0:1,type:"hillshade",colormap:s,colormapOffset:a}}_generateVectorFieldWebGLParams(e){const{style:t,inputUnit:r,outputUnit:s,visualVariables:a,symbolTileSize:o,flowRepresentation:n}=e;let i;const l=this.rasterInfo.statistics?.[0].min??0,u=this.rasterInfo.statistics?.[0].max??50,c=a?.find((e=>"sizeInfo"===e.type))??{type:"sizeInfo",field:"Magnitude",maxDataValue:u,maxSize:.8*o,minDataValue:l,minSize:.2*o},p=c.minDataValue??l,d=c.maxDataValue??u,h=null!=c.maxSize&&null!=c.minSize?[c.minSize/o,c.maxSize/o]:[.2,.8];if("wind_speed"===t){const e=(h[0]+h[1])/2;h[0]=h[1]=e}const m=null!=p&&null!=d?[p,d]:null;if("classified_arrow"===t)if(null!=p&&null!=d&&null!=c){i=[];const e=(c.maxDataValue-c.minDataValue)/5;for(let t=0;t<6;t++)i.push(c.minDataValue+e*t)}else i=[0,1e-6,3.5,7,10.5,14];const f="flow_to"===n===("ocean_current_kn"===t||"ocean_current_m"===t)?0:Math.PI,y=a?.find((e=>"rotationInfo"===e.type));return{breakValues:i,dataRange:m,inputUnit:r,outputUnit:s,symbolTileSize:o,symbolPercentRange:h,style:t||"single_arrow",rotation:f,rotationType:this.rasterInfo.storageInfo?.tileInfo&&"vector-uv"===this.rasterInfo.dataType?"geographic":y?.rotationType||e.rotationType,type:"vectorField"}}};e([s({json:{write:!0}})],_.prototype,"rendererJSON",void 0),e([s({type:o,json:{write:!0}})],_.prototype,"rasterInfo",void 0),e([s({json:{write:!0}})],_.prototype,"lookup",void 0),e([s()],_.prototype,"canRenderInWebGL",void 0),_=e([a("esri.renderers.support.RasterSymbolizer")],_);const O=_;function V(e){return"percentClip"===e||"histogramEqualization"===e}function v(e){return null!=e&&e.length>0&&null!=e[0].min&&null!=e[0].max}function T(e){return c(e)&&0!==e.validPixelCount}function U(e){return"algorithmic"===e.type&&["0,0,0,255","0,0,0"].includes(e.fromColor.join(","))&&["255,255,255,255","255,255,255"].includes(e.toColor.join(","))}export{O as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../core/has.js";import t from"../../core/JSONSupport.js";import r from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import o from"../../layers/support/RasterInfo.js";import{colorize as n,remapColor as i,lookupPixels as l,createColormapLUT as u,isValidPixelBlock as c}from"../../layers/support/rasterFunctions/pixelUtils.js";import{stretch as p,getStretchCutoff as d,isStandardU8Histogram as m,createStretchLUT as h,computeGammaValues as f,createHistogramEqualizationLUT as b}from"../../layers/support/rasterFunctions/stretchUtils.js";import{hillshade as g,tintHillshade as y,calculateHillshadeParams as S}from"../../layers/support/rasterFunctions/surfaceUtils.js";import{convertColorRampToColormap as x,createHsvMap as R}from"./colorRampUtils.js";import{isUVRendererSupported as I,isColormapSupportedByWebGL as k,isColormapRendererSupported as C,isShadedReliefRendererSupported as L}from"./rasterRendererChecks.js";let _=class extends t{constructor(e){super(e),this.lookup={rendererJSON:{}},this.canRenderInWebGL=!1}bind(){const{rendererJSON:e}=this;if(!e)return{success:!1};let t;switch(this.lookup={rendererJSON:{}},e.type){case"uniqueValue":t=this._updateUVRenderer(e);break;case"rasterColormap":t=this._updateColormapRenderer(e);break;case"rasterStretch":t=this._updateStretchRenderer(e);break;case"classBreaks":t=this._updateClassBreaksRenderer(e);break;case"rasterShadedRelief":t=this._updateShadedReliefRenderer(e);break;case"vectorField":t=this._updateVectorFieldRenderer();break;case"flowRenderer":t=this._updateFlowRenderer()}return t}symbolize(e){let t=e?.pixelBlock;if(!O(t))return t;if(e.simpleStretchParams&&"rasterStretch"===this.rendererJSON.type)return this.simpleStretch(t,e.simpleStretchParams);try{let r;switch(t.pixels.length>3&&(t=t.extractBands(e.bandIds??[0,1,2])),this.rendererJSON.type){case"uniqueValue":case"rasterColormap":r=this._symbolizeColormap(t);break;case"classBreaks":r=this._symbolizeClassBreaks(t);break;case"rasterStretch":r=this._symbolizeStretch(t,e.bandIds);break;case"rasterShadedRelief":{const s=e.extent,a=s.spatialReference.isGeographic,o={x:(s.xmax-s.xmin)/t.width,y:(s.ymax-s.ymin)/t.height};r=this._symbolizeShadedRelief(t,{isGCS:a,resolution:o});break}}return r}catch(s){return r.getLogger(this).error("symbolize",s.message),t}}simpleStretch(e,t){if(!O(e))return e;try{return e.pixels.length>3&&(e=e.extractBands([0,1,2])),p(e,{...t,isRenderer:!0})}catch(s){return r.getLogger(this).error("symbolize",s.message),e}}generateWebGLParameters(e){const{rendererJSON:t}=this;switch(t.type){case"uniqueValue":case"rasterColormap":case"classBreaks":return this._generateColormapWebGLParams("classBreaks"===t.type);case"rasterStretch":return this._generateStretchWebGLParams(e.pixelBlock,t,e.bandIds);case"rasterShadedRelief":return this._generateShadedReliefWebGLParams(t,e.isGCS,e.resolution??void 0);case"vectorField":return this._generateVectorFieldWebGLParams(t);default:return null}}_isLUTChanged(e){const t=this.lookup.rendererJSON;if(!t)return!0;const{rendererJSON:r}=this;if("colorRamp"in r&&r.colorRamp){const s=r.colorRamp;if(e)return JSON.stringify(s)!==JSON.stringify(t.colorRamp)}return JSON.stringify(r)!==JSON.stringify(t)}_symbolizeColormap(e){if(this._isLUTChanged()){if(!this.bind().success)return e}return n(e,this.lookup.colormapLut)}_symbolizeClassBreaks(e){const{canUseIndexedLUT:t}=this._analyzeClassBreaks(this.rendererJSON);if(this._isLUTChanged()){if(!this.bind().success)return e}return t?n(e,this.lookup.colormapLut):i(e,this.lookup.remapLut??[])}_symbolizeStretch(e,t){if(!e)return null;const{rasterInfo:r,lookup:s}=this,{pixelType:a,bandCount:o}=r,i=this.rendererJSON,u=["u8","u16","s8","s16"].includes(a);let c;const{dra:f}=i,{gamma:b}=s;if("histogramEqualization"===i.stretchType){const a=f?null:s.histogramLut,o=d(i,{rasterInfo:r,pixelBlock:e,bandIds:t,returnHistogramLut:!a}),n="u8"===r.pixelType&&!f&&m(r.histograms?.[0])?e:p(e,{...o,gamma:b,isRenderer:!0});c=l(n,{lut:f?o.histogramLut:t?.length?t.map((e=>a[e])):a,offset:0})}else if(u){let n;if(f){const s=d(i,{rasterInfo:r,pixelBlock:e,bandIds:t});n=h({pixelType:a,...s,gamma:b,rounding:"floor"})}else{if(this._isLUTChanged()){if(!this.bind().success)return e}n=s.stretchLut}if(!n)return e;o>1&&null!=t&&t.length===e?.pixels.length&&n.lut.length===o&&(n={lut:t.map((e=>n.lut[e])),offset:n.offset}),c=l(e,n)}else{const s=d(i,{rasterInfo:r,pixelBlock:e,bandIds:t});c=p(e,{...s,gamma:b,isRenderer:!0})}if(i.colorRamp){if(this._isLUTChanged(!0)){if(!this.bind().success)return e}c=n(c,s.colormapLut)}return c}_symbolizeShadedRelief(e,t){const r=this.rendererJSON,s={...r,...t},a=g(e,s);if(!r.colorRamp)return a;if(this._isLUTChanged(!0)){if(!this.bind().success)return a}const{hsvMap:o}=this.lookup;if(!o)return a;const n=this.rasterInfo.statistics?.[0]??{min:0,max:8e3};return y(a,e,o,n),a}_isVectorFieldData(){const{bandCount:e,dataType:t}=this.rasterInfo;return 2===e&&("vector-magdir"===t||"vector-uv"===t)}_updateVectorFieldRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; VectorFieldRenderer only supports "vector-magdir" and "vector-uv".`}}_updateFlowRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; FlowRenderer only supports "vector-magdir" and "vector-uv".`}}_updateUVRenderer(e){const{bandCount:t,attributeTable:r,pixelType:s}=this.rasterInfo,a=e.field1;if(!a)return{success:!1,error:"Unsupported renderer; missing UniqueValueRenderer.field."};const o=e.defaultSymbol,n=1===t&&["u8","s8"].includes(s);if(!I(this.rasterInfo,a)&&!n)return{success:!1,error:"Unsupported data; UniqueValueRenderer is only supported on single band data with a valid raster attribute table."};const i=[];if(null!=r){const t=r.fields.find((e=>"value"===e.name.toLowerCase()));if(!t)return{success:!1,error:"Unsupported data; the data's raster attribute table does not have a value field."};r.features.forEach((r=>{const s=e.uniqueValueInfos?.find((e=>String(e.value)===String(r.attributes[a]))),n=s?.symbol?.color;n?i.push([r.attributes[t.name]].concat(n)):o&&i.push([r.attributes[t.name]].concat(o.color))}))}else{if("value"!==a.toLowerCase())return{success:!1,error:'Unsupported renderer; UniqueValueRenderer.field must be "Value" when raster attribute table is not available.'};e.uniqueValueInfos?.forEach((e=>{const t=e?.symbol?.color;t?i.push([parseInt(""+e.value,10)].concat(t)):o&&i.push([parseInt(""+e.value,10)].concat(o?.color))}))}if(0===i.length)return{success:!1,error:"Invalid UniqueValueRenderer. Cannot find matching records in the raster attribute table."};const l=u({colormap:i});return this.lookup={rendererJSON:e,colormapLut:l},this.canRenderInWebGL=k(l?.indexedColormap),{success:!0}}_updateColormapRenderer(e){if(!C(this.rasterInfo))return{success:!1,error:"Unsupported data; the data source does not have a colormap."};const t=e.colormapInfos.map((e=>[e.value].concat(e.color))).sort(((e,t)=>e[0]-t[0]));if(!t||0===t.length)return{success:!1,error:"Unsupported renderer; ColormapRenderer must have meaningful colormapInfos."};const r=u({colormap:t});return this.lookup={rendererJSON:e,colormapLut:r},this.canRenderInWebGL=k(r?.indexedColormap),{success:!0}}_updateShadedReliefRenderer(e){if(!L(this.rasterInfo))return{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; ShadedReliefRenderer only supports "elevation", or single band float/s16 data.`};if(e.colorRamp){const t=x(e.colorRamp,{interpolateAlpha:!0}),r=u({colormap:t}),s=R(r.indexedColormap);this.lookup={rendererJSON:e,colormapLut:r,hsvMap:s}}else this.lookup={rendererJSON:e};return this.canRenderInWebGL=!0,{success:!0}}_analyzeClassBreaks(e){const{attributeTable:t,pixelType:r}=this.rasterInfo,s=t?.fields.find((e=>"value"===e.name.toLowerCase())),a=t?.fields.find((t=>t.name.toLowerCase()===e.field.toLowerCase())),o=null!=s&&null!==a;return{canUseIndexedLUT:["u8","u16","s8","s16"].includes(r)||o,tableValueField:s,tableBreakField:a}}_updateClassBreaksRenderer(e){const{attributeTable:t}=this.rasterInfo,{canUseIndexedLUT:r,tableValueField:s,tableBreakField:a}=this._analyzeClassBreaks(e),o=e.classBreakInfos;if(!o?.length)return{success:!1,error:"Unsupported renderer; missing or invalid ClassBreaksRenderer.classBreakInfos."};const n=o.sort(((e,t)=>e.classMaxValue-t.classMaxValue)),i=n[n.length-1];let l=e.minValue;if(!r){const t=[];for(let e=0;e<n.length;e++)t.push({value:n[e].classMinValue??l,mappedColor:n[e].symbol.color}),l=n[e].classMaxValue;return t.push({value:i.classMaxValue,mappedColor:i.symbol.color}),this.lookup={rendererJSON:e,remapLut:t},this.canRenderInWebGL=!1,{success:!0}}const c=[];if(null!=t&&null!=s&&null!==a&&s!==a){const r=s.name,o=a.name,i=n[n.length-1],{classMaxValue:u}=i;l=e.minValue;for(const e of t.features){const t=e.attributes[r],s=e.attributes[o],a=s===u?i:s<l?null:n.find((({classMaxValue:e})=>e>s));a&&c.push([t].concat(a.symbol.color))}}else{l=Math.floor(e.minValue);for(let e=0;e<n.length;e++){const t=n[e];for(let e=l;e<t.classMaxValue;e++)c.push([e].concat(t.symbol.color));l=Math.ceil(t.classMaxValue)}i.classMaxValue===l&&c.push([i.classMaxValue].concat(i.symbol.color))}const p=u({colormap:c,fillUnspecified:!1});return this.lookup={rendererJSON:e,colormapLut:p},this.canRenderInWebGL=k(p?.indexedColormap),{success:!0}}_updateStretchRenderer(e){let{stretchType:t,dra:r}=e;if(!("none"===t||e.statistics?.length||T(this.rasterInfo.statistics)||r))return{success:!1,error:"Unsupported renderer; StretchRenderer.statistics is required when dynamic range adjustment is not used."};const s=e.histograms||this.rasterInfo.histograms;!v(e.stretchType)||s?.length||r||(t="minMax");const{computeGamma:a,useGamma:o,colorRamp:n}=e;let{gamma:i}=e;if(o&&a&&!i?.length){const t=e.statistics?.length?e.statistics:this.rasterInfo.statistics;i=f(this.rasterInfo.pixelType,t)}const l=this.rasterInfo.pixelType,c=!r&&["u8","u16","s8","s16"].includes(l);if("histogramEqualization"===t){const t=s.map((e=>b(e)));this.lookup={rendererJSON:e,histogramLut:t}}else if(c){const t=d(e,{rasterInfo:this.rasterInfo}),r=h({pixelType:l,...t,gamma:o?i:null,rounding:"floor"});this.lookup={rendererJSON:e,stretchLut:r}}else this.lookup={rendererJSON:e};if(n&&!U(n)){const t=x(n,{interpolateAlpha:!0});this.lookup.colormapLut=u({colormap:t}),this.lookup.rendererJSON=e}return this.lookup.gamma=o&&i?.length?i:null,this.canRenderInWebGL="histogramEqualization"!==t,{success:!0}}_generateColormapWebGLParams(e){const{indexedColormap:t,offset:r}=this.lookup.colormapLut||{};return{colormap:t,colormapOffset:r,isClassBreaks:e,type:"lut"}}_generateStretchWebGLParams(e,t,r){const{colormapLut:s}=this.lookup,a=t.colorRamp?s?.indexedColormap:null,o=t.colorRamp?s?.offset:null;"histogramEqualization"===t.stretchType&&(t={...t,stretchType:"minMax"});const{gamma:n}=this.lookup,i=!(!t.useGamma||!n?.some((e=>1!==e))),{minCutOff:l,maxCutOff:u,minOutput:c,maxOutput:p}=d(t,{rasterInfo:this.rasterInfo,pixelBlock:e,bandIds:r});let m=0;null!=e&&(m=e.getPlaneCount(),2===m&&((e=e.clone()).statistics=[e.statistics[0]],e.pixels=[e.pixels[0]]));const{bandCount:h}=this.rasterInfo,f=Math.min(3,r?.length||m||h,h),b=a||i?1:255,g=new Float32Array(f);if(i&&n)for(let d=0;d<f;d++)n[d]>1?n[d]>2?g[d]=6.5+(n[d]-2)**2.5:g[d]=6.5+100*(2-n[d])**4:g[d]=1;1===l.length&&(l[2]=l[1]=l[0]),1===u.length&&(u[2]=u[1]=u[0]);const y=i&&n?[n[0],n[1]??n[0],n[2]??n[0]]:[1,1,1],S=i?[g[0],g[1]??g[0],g[2]??g[0]]:[1,1,1],x=u.map(((e,t)=>u[t]===l[t]?0:(p-c)/(u[t]-l[t])/b));return{bandCount:f,minOutput:c/b,maxOutput:p/b,minCutOff:l,maxCutOff:u,factor:x,useGamma:i,gamma:y,gammaCorrection:S,colormap:a,colormapOffset:o,stretchType:t.stretchType,type:"stretch"}}_generateShadedReliefWebGLParams(e,t=!1,r={x:0,y:0}){const{colormapLut:s}=this.lookup,a=e.colorRamp?s?.indexedColormap:null,o=e.colorRamp?s?.offset:null,n={...e,isGCS:t,resolution:r},i=S(n),l=this.rasterInfo.statistics?.[0];return{...i,minValue:l?.min??0,maxValue:l?.max??8e3,hillshadeType:"traditional"===e.hillshadeType?0:1,type:"hillshade",colormap:a,colormapOffset:o}}_generateVectorFieldWebGLParams(e){const{style:t,inputUnit:r,outputUnit:s,visualVariables:a,symbolTileSize:o,flowRepresentation:n}=e,i=this.rasterInfo.statistics?.[0].min??0,l=this.rasterInfo.statistics?.[0].max??50,u=a?.find((e=>"sizeInfo"===e.type))??{type:"sizeInfo",field:"Magnitude",maxDataValue:l,maxSize:.8*o,minDataValue:i,minSize:.2*o},c=u.minDataValue??i,p=u.maxDataValue??l,d=null!=u.maxSize&&null!=u.minSize?[u.minSize/o,u.maxSize/o]:[.2,.8];if("wind_speed"===t){const e=(d[0]+d[1])/2;d[0]=d[1]=e}const m=null!=c&&null!=p?[c,p]:null;let h=null;if("classified_arrow"===t)if(null!=c&&null!=p&&null!=u){h=[];const e=(u.maxDataValue-u.minDataValue)/5;for(let t=0;t<6;t++)h.push(u.minDataValue+e*t)}else h=[0,1e-6,3.5,7,10.5,14];const f="flow_to"===n===("ocean_current_kn"===t||"ocean_current_m"===t)?0:Math.PI,b=a?.find((e=>"rotationInfo"===e.type));return{breakValues:h,dataRange:m,inputUnit:r,outputUnit:s,symbolTileSize:o,symbolPercentRange:d,style:t||"single_arrow",rotation:f,rotationType:this.rasterInfo.storageInfo?.tileInfo&&"vector-uv"===this.rasterInfo.dataType?"geographic":b?.rotationType||e.rotationType,type:"vectorField"}}};e([s({json:{write:!0}})],_.prototype,"rendererJSON",void 0),e([s({type:o,json:{write:!0}})],_.prototype,"rasterInfo",void 0),e([s({json:{write:!0}})],_.prototype,"lookup",void 0),e([s()],_.prototype,"canRenderInWebGL",void 0),_=e([a("esri.renderers.support.RasterSymbolizer")],_);const V=_;function v(e){return"percentClip"===e||"histogramEqualization"===e}function T(e){return null!=e&&e.length>0&&null!=e[0].min&&null!=e[0].max}function O(e){return c(e)&&0!==e.validPixelCount}function U(e){return"algorithmic"===e.type&&["0,0,0,255","0,0,0"].includes(e.fromColor.join(","))&&["255,255,255,255","255,255,255"].includes(e.toColor.join(","))}export{V as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../core/Collection.js";import{mappedFind as r}from"../core/maybe.js";import{Url as t,makeAbsolute as a,normalize as n}from"../core/urlUtils.js";import{effectEquals as l}from"../layers/effects/utils.js";import{esriBasemapDefinitions as i}from"./basemapDefinitions.js";function s(e){return"Web Scene"===e.portalItem?.type||e.referenceLayers.some((e=>"scene"===e.type))}function u(e){return!!e?.portalItem?.tags?.some((e=>"beta"===e.toLowerCase()))}function c(e,r){return!(!e.basemap?.referenceLayers?.some((e=>e.uid===r))&&!e.basemap?.baseLayers?.some((e=>e.uid===r)))}let o;function f(e){if(o)return o(e);let r=null;const t=v(e),a=!t?.baseLayers.length;for(const n in i){const e=T(t,R(i[n]),{mustMatchReferences:a});if("equal"===e){r=n;break}"base-layers-equal"===e&&(r=n)}return r}function p(e){o=e}function y(e,r){if(e===r)return!0;if(null!=e?.portalItem?.id&&e.portalItem.id===r?.portalItem?.id)return!0;return"equal"===T(v(e),v(r),{mustMatchReferences:!0})}function m(e){return!!e?.baseLayers.concat(e.referenceLayers).some(b)}function b(e){if(S(e.url))return!0;if("vector-tile"===e.type)for(const r in e.sourceNameToSource){const t=e.sourceNameToSource[r];if(S(t?.sourceUrl))return!0}return!1}function d(e,r){if(null==r||null==e)return{spatialReference:null,updating:!1};if("not-loaded"===r.loadStatus)return r.load(),{spatialReference:null,updating:!0};if(r.spatialReference)return{spatialReference:r.spatialReference,updating:!1};if(0===r.baseLayers.length)return{spatialReference:null,updating:!1};const t=r.baseLayers.at(0);switch(t.loadStatus){case"not-loaded":t.load();case"loading":return{spatialReference:null,updating:!0};case"failed":return{spatialReference:null,updating:!1}}const a=(("supportedSpatialReferences"in t?t.supportedSpatialReferences:null)||["tileInfo"in t?t.tileInfo?.spatialReference:t.spatialReference]).filter(Boolean),n=e.spatialReference;return n?{spatialReference:a.find((e=>n.equals(e)))??a[0]??null,updating:!1}:{spatialReference:a[0],updating:!1}}const L=/^(basemaps|ibasemaps).*-api\.arcgis\.com$/i;function S(e){if(!e)return!1;const r=new t(a(e));return!!r.authority&&L.test(r.authority)}function v(e){return e?!e.loaded&&e.resourceInfo?R(e.resourceInfo.data):{baseLayers:g(e.baseLayers),referenceLayers:g(e.referenceLayers)}:null}function g(r){return(e.isCollection(r)?r.toArray():r).map(I)}function I(e){return{type:e.type,effect:"effect"in e?e.effect:void 0,url:M("urlTemplate"in e&&e.urlTemplate||e.url||"styleUrl"in e&&e.styleUrl||""),minScale:"minScale"in e&&null!=e.minScale?e.minScale:0,maxScale:"maxScale"in e&&null!=e.maxScale?e.maxScale:0,opacity:null!=e.opacity?e.opacity:1,visible:null==e.visible||!!e.visible,sublayers:"map-image"!==e.type&&"wms"!==e.type||null==e.sublayers?void 0:e.sublayers?.map((e=>({id:e.id,visible:e.visible}))),activeLayerId:"wmts"===e.type?e.activeLayer?.id:void 0}}function h(e){return e.isReference||"ArcGISSceneServiceLayer"===e.layerType}function R(e){return e?{baseLayers:q((e.baseMapLayers??[]).filter((e=>!h(e)))),referenceLayers:q((e.baseMapLayers??[]).filter((e=>h(e))))}:null}function q(e){return e.map((e=>x(e)))}function x(e){let r;switch(e.layerType){case"VectorTileLayer":r="vector-tile";break;case"ArcGISTiledMapServiceLayer":r="tile";break;case"ArcGISSceneServiceLayer":r="scene";break;default:r="unknown"}return{type:r,effect:e.effect,url:M(e.templateUrl||e.urlTemplate||e.styleUrl||e.url),minScale:e.minScale??0,maxScale:e.maxScale??0,opacity:e.opacity??1,visible:null==e.visibility||!!e.visibility,sublayers:void 0,activeLayerId:void 0}}function T(e,r,t){if(null!=e!=(null!=r))return"not-equal";if(!e||!r)return"equal";if(!U(e.baseLayers,r.baseLayers))return"not-equal";return U(e.referenceLayers,r.referenceLayers)?"equal":t.mustMatchReferences?"not-equal":"base-layers-equal"}function U(e,r){if(e.length!==r.length)return!1;for(let t=0;t<e.length;t++)if(!w(e[t],r[t]))return!1;return!0}function w(e,r){if(e.type!==r.type||e.url!==r.url||e.minScale!==r.minScale||e.maxScale!==r.maxScale||e.visible!==r.visible||e.opacity!==r.opacity)return!1;if(!l(e.effect,r.effect))return!1;if(null!=e.activeLayerId||null!=r.activeLayerId)return e.activeLayerId===r.activeLayerId;if(null!=e.sublayers||null!=r.sublayers){if(null==e.sublayers||null==r.sublayers||e.sublayers.length!==r.sublayers.length)return!1;for(let t=0;t<e.sublayers.length;t++){const a=e.sublayers.at(t),n=r.sublayers.at(t);if(a?.id!==n?.id||a?.visible!==n?.visible)return!1}}return!0}function M(e){return e?n(e).replace(/^\s*https?:/i,"").toLowerCase():""}function j(e){if(!e)return null;const{thumbnailUrl:t}=e;if(t)return t;const a=f(e);return a?i[a].thumbnailUrl:r(e.baseLayers,k)}function k(e){return"portalItem"in e?e.portalItem?.thumbnailUrl:void 0}export{y as contentEquals,d as findSpatialReference,j as getBasemapThumbnailUrl,f as getWellKnownBasemapId,m as hasDeveloperBasemapLayer,s as isBasemap3D,u as isBasemapInBeta,c as isBasemapLayer,b as isDeveloperBasemapLayer,w as layerDefinitionEquals,I as layerToDefinition,p as overrideGetWellKnownBasemapId};
5
+ import e from"../core/Collection.js";import{mappedFind as r}from"../core/maybe.js";import{Url as t,makeAbsolute as a,normalize as n}from"../core/urlUtils.js";import{effectEquals as l}from"../layers/effects/utils.js";import{esriBasemapDefinitions as i}from"./basemapDefinitions.js";function u(e){return"Web Scene"===e.portalItem?.type||e.referenceLayers.some((e=>"scene"===e.type))}function s(e){return!!e?.portalItem?.tags?.some((e=>"beta"===e.toLowerCase()))}function c(e,r){const t=e.allLayerViews.find((e=>e.uid===r));return t?.layer.parent===e.map.basemap}let o;function f(e){if(o)return o(e);let r=null;const t=v(e),a=!t?.baseLayers.length;for(const n in i){const e=x(t,R(i[n]),{mustMatchReferences:a});if("equal"===e){r=n;break}"base-layers-equal"===e&&(r=n)}return r}function p(e){o=e}function y(e,r){if(e===r)return!0;if(null!=e?.portalItem?.id&&e.portalItem.id===r?.portalItem?.id)return!0;return"equal"===x(v(e),v(r),{mustMatchReferences:!0})}function m(e){return!!e?.baseLayers.concat(e.referenceLayers).some(b)}function b(e){if(S(e.url))return!0;if("vector-tile"===e.type)for(const r in e.sourceNameToSource){const t=e.sourceNameToSource[r];if(S(t?.sourceUrl))return!0}return!1}function d(e,r){if(null==r||null==e)return{spatialReference:null,updating:!1};if("not-loaded"===r.loadStatus)return r.load(),{spatialReference:null,updating:!0};if(r.spatialReference)return{spatialReference:r.spatialReference,updating:!1};if(0===r.baseLayers.length)return{spatialReference:null,updating:!1};const t=r.baseLayers.at(0);switch(t.loadStatus){case"not-loaded":t.load();case"loading":return{spatialReference:null,updating:!0};case"failed":return{spatialReference:null,updating:!1}}const a=(("supportedSpatialReferences"in t?t.supportedSpatialReferences:null)||["tileInfo"in t?t.tileInfo?.spatialReference:t.spatialReference]).filter(Boolean),n=e.spatialReference;return n?{spatialReference:a.find((e=>n.equals(e)))??a[0]??null,updating:!1}:{spatialReference:a[0],updating:!1}}const L=/^(basemaps|ibasemaps).*-api\.arcgis\.com$/i;function S(e){if(!e)return!1;const r=new t(a(e));return!!r.authority&&L.test(r.authority)}function v(e){return e?!e.loaded&&e.resourceInfo?R(e.resourceInfo.data):{baseLayers:g(e.baseLayers),referenceLayers:g(e.referenceLayers)}:null}function g(r){return(e.isCollection(r)?r.toArray():r).map(I)}function I(e){return{type:e.type,effect:"effect"in e?e.effect:void 0,url:M("urlTemplate"in e&&e.urlTemplate||e.url||"styleUrl"in e&&e.styleUrl||""),minScale:"minScale"in e&&null!=e.minScale?e.minScale:0,maxScale:"maxScale"in e&&null!=e.maxScale?e.maxScale:0,opacity:null!=e.opacity?e.opacity:1,visible:null==e.visible||!!e.visible,sublayers:"map-image"!==e.type&&"wms"!==e.type||null==e.sublayers?void 0:e.sublayers?.map((e=>({id:e.id,visible:e.visible}))),activeLayerId:"wmts"===e.type?e.activeLayer?.id:void 0}}function h(e){return e.isReference||"ArcGISSceneServiceLayer"===e.layerType}function R(e){return e?{baseLayers:q((e.baseMapLayers??[]).filter((e=>!h(e)))),referenceLayers:q((e.baseMapLayers??[]).filter((e=>h(e))))}:null}function q(e){return e.map((e=>w(e)))}function w(e){let r;switch(e.layerType){case"VectorTileLayer":r="vector-tile";break;case"ArcGISTiledMapServiceLayer":r="tile";break;case"ArcGISSceneServiceLayer":r="scene";break;default:r="unknown"}return{type:r,effect:e.effect,url:M(e.templateUrl||e.urlTemplate||e.styleUrl||e.url),minScale:e.minScale??0,maxScale:e.maxScale??0,opacity:e.opacity??1,visible:null==e.visibility||!!e.visibility,sublayers:void 0,activeLayerId:void 0}}function x(e,r,t){if(null!=e!=(null!=r))return"not-equal";if(!e||!r)return"equal";if(!T(e.baseLayers,r.baseLayers))return"not-equal";return T(e.referenceLayers,r.referenceLayers)?"equal":t.mustMatchReferences?"not-equal":"base-layers-equal"}function T(e,r){if(e.length!==r.length)return!1;for(let t=0;t<e.length;t++)if(!U(e[t],r[t]))return!1;return!0}function U(e,r){if(e.type!==r.type||e.url!==r.url||e.minScale!==r.minScale||e.maxScale!==r.maxScale||e.visible!==r.visible||e.opacity!==r.opacity)return!1;if(!l(e.effect,r.effect))return!1;if(null!=e.activeLayerId||null!=r.activeLayerId)return e.activeLayerId===r.activeLayerId;if(null!=e.sublayers||null!=r.sublayers){if(null==e.sublayers||null==r.sublayers||e.sublayers.length!==r.sublayers.length)return!1;for(let t=0;t<e.sublayers.length;t++){const a=e.sublayers.at(t),n=r.sublayers.at(t);if(a?.id!==n?.id||a?.visible!==n?.visible)return!1}}return!0}function M(e){return e?n(e).replace(/^\s*https?:/i,"").toLowerCase():""}function j(e){if(!e)return null;const{thumbnailUrl:t}=e;if(t)return t;const a=f(e);return a?i[a].thumbnailUrl:r(e.baseLayers,k)}function k(e){return"portalItem"in e?e.portalItem?.thumbnailUrl:void 0}export{y as contentEquals,d as findSpatialReference,j as getBasemapThumbnailUrl,f as getWellKnownBasemapId,m as hasDeveloperBasemapLayer,u as isBasemap3D,s as isBasemapInBeta,c as isBasemapLayerView,b as isDeveloperBasemapLayer,U as layerDefinitionEquals,I as layerToDefinition,p as overrideGetWellKnownBasemapId};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- const c="20250318",e="ef4c9f46abb255c3d3294d88be1c85d1e8676aa2";export{c as buildDate,e as commitHash};
5
+ const b="20250320",e="03eb049d7ffb642209be27a0cb5e4d8f9a34846c";export{b as buildDate,e as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{isFunctionRaster as s}from"../../../../layers/support/rasterDatasets/datasetUtils.js";import{RasterTileContainer as i}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as o}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as n}from"../support/util.js";import a from"../../../layers/support/Geometry.js";let l=class extends o{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;return this.useWebGLForProcessing&&t.canRenderInWebGL&&!s&&!("majority"===this.layer.interpolation&&n(this.layer))}attach(){super.attach(),this.container=new i(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{clips:e,view:t}=this.layerView;null!=this._geometry&&e.remove(this._geometry);const{raster:r,type:i}=this.layer;if(s(r)){const s=r.getClippingGeometry(t.spatialReference);if(s){const t=new a({geometry:s});e.add(t),this._geometry=t}}const{container:o}=this;if("Function"!==r.datasetFormat||"wcs"===i)return o.rasterFunctionChain=null,o.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 n=this._rasterFunctionState,{rasterFunction:l,primaryRasters:c}=r,u=l.supportsGPU&&(!c||c.rasters.length<=1),p=u?l.flatWebGLFunctionChain:null,{renderer:d}=this.layer,h=!u||!p?.functions.length||"raster-stretch"===d?.type&&d.dynamicRangeAdjustment||!this.canUseWebGLForProcessing;o.rasterFunctionChain=h?null:this._addProjection(p);const m=null==l?"na":o.rasterFunctionChain?"gpu":"cpu",y=n===m||"na"===n&&"cpu"===m&&0===p?.functions?.length;o.children.forEach((e=>{const{bitmap:t}=e;t&&(t.suspended=!y,t.processed=!1,t.processedTexture=null)})),this._rasterFunctionState=m}async updateTileSource(e,t){const r=this._getBandIds(),s=this._getLayerInterpolation(),{canUseWebGLForProcessing:i}=this,{source:o,globalSymbolizerParams:n,suspended:a,coords:l,resolution:c}=t,u=this.layerView.hasTilingEffects?n:t.symbolizerParams,{bitmap:p}=e;if([p.x,p.y]=l,p.resolution=c,null!=o?.pixelBlock){const e={extent:o.extent,pixelBlock:o.pixelBlock,srcPixelSize:o.srcTilePixelSize};if(p.rawPixelData=e,i)p.source=o.pixelBlock,p.isRendereredSource=!1;else{const t=await this.layer.applyRenderer(e,"stretch"===n?.type?n:void 0);p.source=t,p.isRendereredSource=!0}p.symbolizerParameters=i?u:null,p.transformGrid=i?o.transformGrid:null}else{const e=this.createEmptyTilePixelBlock();p.source=e,p.symbolizerParameters=i?u:null,p.transformGrid=null}p.bandIds=i?r:null,p.width=this._tileInfoView.tileInfo.size[0],p.height=this._tileInfoView.tileInfo.size[1],p.interpolation=s,p.suspended=a,p.invalidateTexture()}async updateTileSymbolizerParameters(e,t){const{local:r,global:s}=t,i=this._getBandIds(),o=this._getLayerInterpolation(),{canUseWebGLForProcessing:n}=this,{bitmap:a}=e,{rawPixelData:l}=a;n||null==l?(a.isRendereredSource&&null!=l&&(a.source=l.pixelBlock),a.isRendereredSource=!1):(a.source=await this.layer.applyRenderer(l,"stretch"===s?.type?s:void 0),a.isRendereredSource=!0),a.symbolizerParameters=n?this.layerView.hasTilingEffects?s:r:null,a.bandIds=n?i:null,a.interpolation=o,a.suspended=!1}_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([t()],l.prototype,"container",void 0),e([t()],l.prototype,"layer",void 0),e([t()],l.prototype,"type",void 0),l=e([r("esri.views.2d.layers.imagery.ImageryTileView2D")],l);const c=l;export{c as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{isFunctionRaster as s}from"../../../../layers/support/rasterDatasets/datasetUtils.js";import{RasterTileContainer as i}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as o}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as n}from"../support/util.js";import a from"../../../layers/support/Geometry.js";let l=class extends o{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;return this.useWebGLForProcessing&&t.canRenderInWebGL&&!s&&!("majority"===this.layer.interpolation&&n(this.layer))}attach(){super.attach(),this.container=new i(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{clips:e,view:t}=this.layerView;null!=this._geometry&&e.remove(this._geometry);const{raster:r,type:i}=this.layer;if(s(r)){const s=r.getClippingGeometry(t.spatialReference);if(s){const t=new a({geometry:s});e.add(t),this._geometry=t}}const{container:o}=this;if("Function"!==r.datasetFormat||"wcs"===i)return o.rasterFunctionChain=null,o.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 n=this._rasterFunctionState,{rasterFunction:l,primaryRasters:c}=r,u=l.supportsGPU&&(!c||c.rasters.length<=1),p=u?l.flatWebGLFunctionChain:null,{renderer:d}=this.layer,h=!u||!p?.functions.length||"raster-stretch"===d?.type&&d.dynamicRangeAdjustment||!this.canUseWebGLForProcessing;o.rasterFunctionChain=h?null:this._addProjection(p);const m=null==l?"na":o.rasterFunctionChain?"gpu":"cpu",y=n===m||"na"===n&&"cpu"===m&&0===p?.functions?.length;o.children.forEach((e=>{const{bitmap:t}=e;t&&(t.suspended=!y,t.processed=!1,t.processedTexture=null)})),this._rasterFunctionState=m}async updateTileSource(e,t){const r=this._getBandIds(),s=this._getLayerInterpolation(),{canUseWebGLForProcessing:i}=this,{source:o,globalSymbolizerParams:n,suspended:a,coords:l,resolution:c}=t,u=this.layerView.hasTilingEffects?n:t.symbolizerParams,{bitmap:p}=e;if([p.x,p.y]=l,p.resolution=c,null!=o?.pixelBlock){const e={extent:o.extent,pixelBlock:o.pixelBlock,srcPixelSize:o.srcTilePixelSize};if(p.rawPixelData=e,i)p.source=o.pixelBlock,p.isRendereredSource=!1;else{const t=await this.layer.applyRenderer(e,"stretch"===n?.type?n:void 0);p.source=t,p.isRendereredSource=!0}p.symbolizerParameters=i?u:null,p.transformGrid=i?o.transformGrid:null}else{const e=this.createEmptyTilePixelBlock();p.source=e,p.symbolizerParameters=i?u:null,p.transformGrid=null}p.bandIds=i?r:null,p.width=this._tileInfoView.tileInfo.size[0],p.height=this._tileInfoView.tileInfo.size[1],p.interpolation=s,p.suspended=a,p.invalidateTexture()}async updateTileSymbolizerParameters(e,t){const{local:r,global:s}=t,i=this._getBandIds(),o=this._getLayerInterpolation(),{canUseWebGLForProcessing:n}=this,{bitmap:a}=e,{rawPixelData:l}=a;n||null==l?(a.isRendereredSource&&null!=l&&(a.source=l.pixelBlock),a.isRendereredSource=!1):(a.source=await this.layer.applyRenderer(l,"stretch"===s?.type?s:void 0),a.isRendereredSource=!0),a.symbolizerParameters=n?this.layerView.hasTilingEffects?s:r:null,a.bandIds=n?i:null,a.interpolation=o,a.suspended=!1}_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([t()],l.prototype,"container",void 0),e([t()],l.prototype,"layer",void 0),e([t()],l.prototype,"type",void 0),l=e([r("esri.views.2d.layers.imagery.ImageryTileView2D")],l);const c=l;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/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{unitRGBAFromColor as t}from"../../../core/colorUtils.js";import{clamp as r,lerp as s}from"../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{watch as o,syncAndInitial as a}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{set as m}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{i as h,l as c,k as p}from"../../../chunks/vec32.js";import{s as u}from"../../../chunks/vec42.js";import{ZEROS as d}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as f}from"../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as l}from"../webgl.js";import{innerAtmosphereDepth as g,computeInnerAltitudeFade as b}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as _,ChapmanAtmosphereTechnique as P}from"./ChapmanAtmosphereTechnique.js";import{ChapmanAtmosphereTechniqueConfiguration as j}from"./ChapmanAtmosphereTechniqueConfiguration.js";import{ColorFormat as w}from"../webgl/formats.js";import{OpaqueEnvironment as v}from"../webgl-engine/effects/OpaqueEnvironment.js";import{RenderRequestType as q}from"../webgl-engine/lib/basicInterfaces.js";import{createQuadVAO as A,Layout as T}from"../webgl-engine/lib/glUtil3D.js";import{applyTextureResizeModulo as x}from"../webgl-engine/lib/textureUtils.js";import{A as C}from"../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as E}from"../webgl-engine/shaders/AtmosphereCompositingTechnique.js";import{DepthStencilAttachment as R,PrimitiveType as D}from"../../webgl/enums.js";import k from"../../../webscene/background/ColorBackground.js";let y=class extends v{constructor(){super(...arguments),this.requireGeometryDepth=!0,this._compositingPassParameters=new C,this._vao=null,this._passParameters=new _,this._configuration=new j}initialize(){this.techniques.precompile(P,this._configuration),this.techniques.precompile(E),this._configuration.reduced=!0,this.techniques.precompile(P,this._configuration),this._configuration.reduced=!1,this.addHandles([o((()=>this.view.environment.background),(e=>{const r=e instanceof k?t(e.color):d;h(this._passParameters.backgroundColor,r[0]*r[3],r[1]*r[3],r[2]*r[3])}),a),o((()=>this.view.stage?.renderer?.fullResolutionAtmosphere),(e=>this._configuration.reduced=!e),a),o((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),a)])}destroy(){this._vao=i(this._vao)}render(e){const t=e.find((({name:e})=>e===l.OPAQUE_ENVIRONMENT));if(!this.bindParameters.mainDepth)return t;const r=this.renderingContext;this._vao??=A(r,T.Pos2Tex);const i=t.getAttachment(R);this._update();const o=this.techniques.get(P,this._configuration);if(!o.compiled)return this.requestRender(q.UPDATE),t;if(!this._configuration.reduced)return t.detachDepth(),r.bindFramebuffer(t.fbo),r.bindTechnique(o,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(D.TRIANGLE_STRIP,0,4),t.attachDepth(i),t;const a=this.techniques.get(E);if(!a.compiled)return this.requestRender(q.UPDATE),t;const n=r.getViewport(),m=this.bindParameters.camera,h=c(m.eye)-f.radius;let p;const u=f.atmosphereHeight;if(h<u){const e=Math.min(1,Math.max(0,h/u));p=s(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(h-u)/(15*u)));p=s(.3,.6,e)}const d=this.renderingContext.parameters.maxTextureSize,g=x(Math.round(p*m.fullViewport[2]),d),b=x(Math.round(p*m.fullViewport[3]),d);r.setViewport(0,0,g,b);const _=this.fboCache.acquire(g,b,"chapman",w.RGBA);return r.bindFramebuffer(_.fbo),r.clearFramebuffer([0,0,0,1],!0,!0),r.bindTechnique(o,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(D.TRIANGLE_STRIP,0,4),r.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=_.getTexture(),t.detachDepth(),r.bindFramebuffer(t.fbo),r.bindTechnique(a,this.bindParameters,this._compositingPassParameters),r.screen.draw(),t.attachDepth(i),_.release(),t}_update(){const e=this.bindParameters.camera,t=p(e.eye),s=Math.sqrt(t),i=t-this._passParameters.radii[1]**2,o=r((s-this._passParameters.radii[0])/f.atmosphereHeight,0,1);u(this._passParameters.heightParameters,s,t,i,o);const a=this.view.basemapTerrain?.getLowerBoundRadius()??0;m(this._passParameters.radii,a,a+f.atmosphereHeight),this._passParameters.innerFadeDistance=2*Math.sqrt((2*a-g)*g),this._passParameters.altitudeFade=b(s-a)}};y=e([n("esri.views.3d.environment.ChapmanAtmosphere")],y);export{y as ChapmanAtmosphere};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{unitRGBAFromColor as t}from"../../../core/colorUtils.js";import{clamp as r,lerp as s}from"../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{watch as o,syncAndInitial as a}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{set as m}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{i as h,l as c,k as p}from"../../../chunks/vec32.js";import{s as u}from"../../../chunks/vec42.js";import{ZEROS as d}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as f}from"../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as l}from"../webgl.js";import{innerAtmosphereDepth as g,computeInnerAltitudeFade as b}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as _,ChapmanAtmosphereTechnique as P}from"./ChapmanAtmosphereTechnique.js";import{ChapmanAtmosphereTechniqueConfiguration as j}from"./ChapmanAtmosphereTechniqueConfiguration.js";import{ColorFormat as w}from"../webgl/formats.js";import{OpaqueEnvironment as v}from"../webgl-engine/effects/OpaqueEnvironment.js";import{RenderRequestType as q}from"../webgl-engine/lib/basicInterfaces.js";import{createQuadVAO as A,Layout as T}from"../webgl-engine/lib/glUtil3D.js";import{applyTextureResizeModulo as x}from"../webgl-engine/lib/textureUtils.js";import{A as C}from"../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as E}from"../webgl-engine/shaders/AtmosphereCompositingTechnique.js";import{DepthStencilAttachment as R,PrimitiveType as D}from"../../webgl/enums.js";import k from"../../../webscene/background/ColorBackground.js";let y=class extends v{constructor(){super(...arguments),this.requireGeometryDepth=!0,this._compositingPassParameters=new C,this._vao=null,this._passParameters=new _,this._configuration=new j}initialize(){this.techniques.precompile(P,this._configuration),this.techniques.precompile(E),this._configuration.reduced=!0,this.techniques.precompile(P,this._configuration),this._configuration.reduced=!1,this.addHandles([o((()=>this.view.environment.background),(e=>{const r=e instanceof k?t(e.color):d;h(this._passParameters.backgroundColor,r[0]*r[3],r[1]*r[3],r[2]*r[3])}),a),o((()=>this.view.stage?.renderer?.fullResolutionAtmosphere),(e=>this._configuration.reduced=!e),a),o((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),a)])}destroy(){this._vao=i(this._vao)}render(e){const t=e.find((({name:e})=>e===l.OPAQUE_ENVIRONMENT));if(!this.bindParameters.mainDepth)return t;const r=this.renderingContext;this._vao??=A(r,T.Pos2Tex);const i=t.getAttachment(R);this._update();const o=this.techniques.get(P,this._configuration);if(!o.compiled)return this.requestRender(q.UPDATE),t;if(!this._configuration.reduced)return t.detachDepth(),r.bindFramebuffer(t.fbo),r.bindTechnique(o,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(D.TRIANGLE_STRIP,0,4),t.attachDepth(i),t;const a=this.techniques.get(E);if(!a.compiled)return this.requestRender(q.UPDATE),t;const n=r.getViewport(),m=this.bindParameters.camera,h=c(m.eye)-f.radius;let p;const u=f.atmosphereHeight;if(h<u){const e=Math.min(1,Math.max(0,h/u));p=s(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(h-u)/(15*u)));p=s(.3,.6,e)}const d=this.renderingContext.parameters.maxTextureSize,g=x(Math.round(p*m.fullViewport[2]),d),b=x(Math.round(p*m.fullViewport[3]),d);r.setViewport(0,0,g,b);const _=this.fboCache.acquire(g,b,"chapman",w.RGBA8);return r.bindFramebuffer(_.fbo),r.clearFramebuffer([0,0,0,1],!0,!0),r.bindTechnique(o,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(D.TRIANGLE_STRIP,0,4),r.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=_.getTexture(),t.detachDepth(),r.bindFramebuffer(t.fbo),r.bindTechnique(a,this.bindParameters,this._compositingPassParameters),r.screen.draw(),t.attachDepth(i),_.release(),t}_update(){const e=this.bindParameters.camera,t=p(e.eye),s=Math.sqrt(t),i=t-this._passParameters.radii[1]**2,o=r((s-this._passParameters.radii[0])/f.atmosphereHeight,0,1);u(this._passParameters.heightParameters,s,t,i,o);const a=this.view.basemapTerrain?.getLowerBoundRadius()??0;m(this._passParameters.radii,a,a+f.atmosphereHeight),this._passParameters.innerFadeDistance=2*Math.sqrt((2*a-g)*g),this._passParameters.altitudeFade=b(s-a)}};y=e([n("esri.views.3d.environment.ChapmanAtmosphere")],y);export{y as ChapmanAtmosphere};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{fromTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as r,t as s}from"../../../../chunks/vec32.js";import{ZEROS as o,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Object3DVisualElement as n}from"./Object3DVisualElement.js";import{lineStripsToParameters as l,createGeometry as m}from"../../support/engineContent/line.js";import{RenderOccludedFlag as p}from"../../webgl-engine/lib/Material.js";import{RibbonLineMaterial as h}from"../../webgl-engine/materials/RibbonLineMaterial.js";class d extends n{constructor(e,t){super(e),this._hasExternalMaterial=!1,this._hasExternalMaterial=null!=t,this._material=null!=t?t:new h({width:1,color:a(1,0,1,1),stipplePreferContinuous:!0,isClosed:!1,falloff:0,innerWidth:1,hasPolygonOffset:!1,renderOccluded:p.OccludeAndTransparent,isDecoration:!!e.isDecoration,writeDepth:!0}),this.applyProperties(e)}setGeometryFromPoint(e,t=1e3){const r=i();this.view.renderCoordsHelper.toRenderCoords(e,r)&&this.setGeometryFromRenderSpacePoint(r,t)}setGeometryFromRenderSpacePoint(e,t=1e3){this.geometry=[[[e[0]-t,e[1],e[2]],[e[0]+t,e[1],e[2]]],[[e[0],e[1]-t,e[2]],[e[0],e[1]+t,e[2]]],[[e[0],e[1],e[2]-t],[e[0],e[1],e[2]+t]]]}setGeometryFromExtent(e){const t=this.view.spatialReference,s=i(),o=i(),a=100,n=[];r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),r(s,e[2],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),r(s,e[2],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),r(s,e[0],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),this.geometry=[n]}setGeometryFromFrustum(e){const t=[];e.lines.forEach((e=>{t.push([e.origin[0],e.origin[1],e.origin[2]]),t.push([e.endpoint[0],e.endpoint[1],e.endpoint[2]])})),this.geometry=[t]}setGeometryFromBoundedPlane(e){const t=[],r=e.origin,s=e.basis1,o=e.basis2,a=.5,n=i(),l=i(),m=i(),p=i();n[0]=r[0]-s[0]*a-o[0]*a,n[1]=r[1]-s[1]*a-o[1]*a,n[2]=r[2]-s[2]*a-o[2]*a,l[0]=r[0]-s[0]*a+o[0]*a,l[1]=r[1]-s[1]*a+o[1]*a,l[2]=r[2]-s[2]*a+o[2]*a,m[0]=r[0]+s[0]*a+o[0]*a,m[1]=r[1]+s[1]*a+o[1]*a,m[2]=r[2]+s[2]*a+o[2]*a,p[0]=r[0]+s[0]*a-o[0]*a,p[1]=r[1]+s[1]*a-o[1]*a,p[2]=r[2]+s[2]*a-o[2]*a,t.push([n[0],n[1],n[2]]),t.push([l[0],l[1],l[2]]),t.push([m[0],m[1],m[2]]),t.push([p[0],p[1],p[2]]),t.push([n[0],n[1],n[2]]),this.geometry=[t]}setGeometryFromSegment(t){const r=t.endRenderSpace;this.transform=e(f,r);const{points:s}=t.createRenderGeometry(r,this.view.renderCoordsHelper);this.geometry=[s]}setGeometryFromSegments(t,r=o){this.transform=e(f,r),this.geometry=t.map((e=>e.createRenderGeometry(r,this.view.renderCoordsHelper).points))}getTransformedGeometry(){return null==this._geometry?null:this._geometry.map((e=>e.map((e=>s(i(),e,this.transform)))))}get renderOccluded(){return this._material.parameters.renderOccluded}set renderOccluded(e){this._material.setParameters({renderOccluded:e})}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._material.parameters.width}set width(e){this._material.setParameters({width:e})}get color(){return this._material.parameters.color}set color(e){const t=1===e[3];this._material.setParameters({color:e,writeDepth:t})}get innerWidth(){return this._material.parameters.innerWidth}set innerWidth(e){this._material.setParameters({innerWidth:e})}get innerColor(){return this._material.parameters.innerColor}set innerColor(e){this._material.setParameters({innerColor:e})}get stipplePattern(){return this._material.parameters.stipplePattern}set stipplePattern(e){null!=this._material&&this._material.setParameters({stipplePattern:e})}get stippleOffColor(){return this._material.parameters.stippleOffColor}set stippleOffColor(e){this._material.setParameters({stippleOffColor:e})}get stipplePreferContinuous(){return this._material.parameters.stipplePreferContinuous}set stipplePreferContinuous(e){this._material.setParameters({stipplePreferContinuous:e})}get falloff(){return this._material.parameters.falloff}set falloff(e){this._material.setParameters({falloff:e})}get polygonOffset(){return this._material.parameters.hasPolygonOffset}set polygonOffset(e){this._material.setParameters({hasPolygonOffset:e})}createExternalResources(){}destroyExternalResources(){}createGeometries(e){for(const t of l(this.geometry)){const r=m(this._material,t);e.addGeometry(r)}}forEachExternalMaterial(e){this._hasExternalMaterial||e(this._material)}}const f=t();export{d as LineVisualElement};
5
+ import{fromTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as r,t as s}from"../../../../chunks/vec32.js";import{ZEROS as o,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Object3DVisualElement as n}from"./Object3DVisualElement.js";import{lineStripsToParameters as l,createGeometry as m}from"../../support/engineContent/line.js";import{RenderOccludedFlag as p}from"../../webgl-engine/lib/Material.js";import{RibbonLineMaterial as h}from"../../webgl-engine/materials/RibbonLineMaterial.js";class d extends n{constructor(e,t){super(e),this._hasExternalMaterial=!1,this._hasExternalMaterial=null!=t,this._material=t??new h({width:1,color:a(1,0,1,1),stipplePreferContinuous:!0,isClosed:!1,falloff:0,innerWidth:1,hasPolygonOffset:!1,renderOccluded:p.OccludeAndTransparent,isDecoration:!!e.isDecoration,writeDepth:!0}),this.applyProperties(e)}setGeometryFromPoint(e,t=1e3){const r=i();this.view.renderCoordsHelper.toRenderCoords(e,r)&&this.setGeometryFromRenderSpacePoint(r,t)}setGeometryFromRenderSpacePoint(e,t=1e3){this.geometry=[[[e[0]-t,e[1],e[2]],[e[0]+t,e[1],e[2]]],[[e[0],e[1]-t,e[2]],[e[0],e[1]+t,e[2]]],[[e[0],e[1],e[2]-t],[e[0],e[1],e[2]+t]]]}setGeometryFromExtent(e){const t=this.view.spatialReference,s=i(),o=i(),a=100,n=[];r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),r(s,e[2],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),r(s,e[2],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),r(s,e[0],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),this.geometry=[n]}setGeometryFromFrustum(e){const t=[];e.lines.forEach((e=>{t.push([e.origin[0],e.origin[1],e.origin[2]]),t.push([e.endpoint[0],e.endpoint[1],e.endpoint[2]])})),this.geometry=[t]}setGeometryFromBoundedPlane(e){const t=[],r=e.origin,s=e.basis1,o=e.basis2,a=.5,n=i(),l=i(),m=i(),p=i();n[0]=r[0]-s[0]*a-o[0]*a,n[1]=r[1]-s[1]*a-o[1]*a,n[2]=r[2]-s[2]*a-o[2]*a,l[0]=r[0]-s[0]*a+o[0]*a,l[1]=r[1]-s[1]*a+o[1]*a,l[2]=r[2]-s[2]*a+o[2]*a,m[0]=r[0]+s[0]*a+o[0]*a,m[1]=r[1]+s[1]*a+o[1]*a,m[2]=r[2]+s[2]*a+o[2]*a,p[0]=r[0]+s[0]*a-o[0]*a,p[1]=r[1]+s[1]*a-o[1]*a,p[2]=r[2]+s[2]*a-o[2]*a,t.push([n[0],n[1],n[2]]),t.push([l[0],l[1],l[2]]),t.push([m[0],m[1],m[2]]),t.push([p[0],p[1],p[2]]),t.push([n[0],n[1],n[2]]),this.geometry=[t]}setGeometryFromSegment(t){const r=t.endRenderSpace;this.transform=e(f,r);const{points:s}=t.createRenderGeometry(r,this.view.renderCoordsHelper);this.geometry=[s]}setGeometryFromSegments(t,r=o){this.transform=e(f,r),this.geometry=t.map((e=>e.createRenderGeometry(r,this.view.renderCoordsHelper).points))}getTransformedGeometry(){return null==this._geometry?null:this._geometry.map((e=>e.map((e=>s(i(),e,this.transform)))))}get renderOccluded(){return this._material.parameters.renderOccluded}set renderOccluded(e){this._material.setParameters({renderOccluded:e})}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._material.parameters.width}set width(e){this._material.setParameters({width:e})}get color(){return this._material.parameters.color}set color(e){const t=1===e[3];this._material.setParameters({color:e,writeDepth:t})}get innerWidth(){return this._material.parameters.innerWidth}set innerWidth(e){this._material.setParameters({innerWidth:e})}get innerColor(){return this._material.parameters.innerColor}set innerColor(e){this._material.setParameters({innerColor:e})}get stipplePattern(){return this._material.parameters.stipplePattern}set stipplePattern(e){null!=this._material&&this._material.setParameters({stipplePattern:e})}get stippleOffColor(){return this._material.parameters.stippleOffColor}set stippleOffColor(e){this._material.setParameters({stippleOffColor:e})}get stipplePreferContinuous(){return this._material.parameters.stipplePreferContinuous}set stipplePreferContinuous(e){this._material.setParameters({stipplePreferContinuous:e})}get falloff(){return this._material.parameters.falloff}set falloff(e){this._material.setParameters({falloff:e})}get polygonOffset(){return this._material.parameters.hasPolygonOffset}set polygonOffset(e){this._material.setParameters({hasPolygonOffset:e})}createExternalResources(){}destroyExternalResources(){}createGeometries(e){for(const t of l(this.geometry)){const r=m(this._material,t);e.addGeometry(r)}}forEachExternalMaterial(e){this._hasExternalMaterial||e(this._material)}}const f=t();export{d as LineVisualElement};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import t from"../../../core/Error.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as l,throwIfAbortError as a}from"../../../core/promiseUtils.js";import{syncAndInitial as o,initial as n}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../core/sql/WhereClause.js";import"../../../layers/buildingSublayers/BuildingComponentSublayer.js";import h from"../../../layers/support/FeatureFilter.js";import{fixFields as y,unpackFieldNames as c,populateMissingFields as f}from"../../../layers/support/fieldUtils.js";import g from"../../../rest/support/Query.js";import{isNumber as m}from"../../../support/guards.js";import{BuildingSublayerView3DMixin as F}from"./BuildingSublayerView3D.js";import{I3SMeshView3D as b}from"./I3SMeshView3D.js";import{ForAllFeaturesMode as _}from"./II3SMeshView3D.js";import{applyFilterMode as w}from"./i3s/BuildingFilterUtil.js";import{createGetFeatureExtent as E}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as x}from"./i3s/I3SMeshViewFilter.js";import{I3SQueryEngine as S}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as j,I3SQueryFeature as v}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as I}from"./i3s/I3SQueryFeatureStore.js";import{findFieldsCaseInsensitive as Q,getIndexCrs as q}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as R}from"./support/DefinitionExpressionSceneLayerView.js";import{TemporalSceneLayerView as L}from"./support/TemporalSceneLayerView.js";import V from"../../layers/BuildingComponentSublayerView.js";import{hasPopupTemplate as U,getRequiredFields as A,getFetchPopupTemplate as C}from"../../layers/support/popupUtils.js";import{isInEffectiveScaleRange as H}from"../../support/layerViewUtils.js";import{TaskPriority as O}from"../../support/Scheduler.js";let D=class extends(L(R(b(F(V))))){constructor(){super(...arguments),this.type="building-component-sublayer-3d",this.layerView=null,this._elevationContext="scene",this._supportsLabeling=!1,this.requiredFields=[],this.progressiveLoadFactor=1,this._queryEngine=null}get i3slayer(){return this.sublayer}get layerUid(){return this.sublayer.layer.uid}get sublayerUid(){return this.sublayer.uid}get layerId(){return this.sublayer.layer.id}get sublayerId(){return this.sublayer.id}get layerPopupEnabledAndHasTemplate(){return this.sublayer.popupEnabled&&U(this.sublayer,this.layerView?.view.popup?.defaultPopupTemplateEnabled)}initialize(){this._updatingHandles.add((()=>this.mergedFilter),(e=>{null!=e&&x.checkSupport(e)?null==this._i3sFilter?this._i3sFilter=new x({viewFilter:e,layerFieldsIndex:this.sublayer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,r)=>this.addSqlFilter(e,r,this.logError),addTimeFilter:(e,r)=>this.addTimeFilter(e,r)}):this._i3sFilter.viewFilter=e:this._i3sFilter=s(this._i3sFilter)}),o),this._updatingHandles.add((()=>[this.sublayer.renderer,this.definitionExpressionFields,this.filterExpressionFields]),(()=>this._updateRequiredFields())),this._updatingHandles.add((()=>this.sublayer.renderer),(e=>this._rendererChange(e)),n);const e=()=>this._filterChange();this._updatingHandles.add((()=>this.parsedDefinitionExpression),e),this._updatingHandles.add((()=>this._i3sFilter?.sortedObjectIds),e),this._updatingHandles.add((()=>this._i3sFilter?.parsedWhereClause),e),this._updatingHandles.add((()=>this.getTimeFilterDependencies()),e),this._updatingHandles.add((()=>this.mergedFilter),e),this._updatingHandles.add((()=>[this._i3sFilter?.parsedGeometry,this.filter?.spatialRelationship]),(()=>this._geometryFilterChange())),this._updatingHandles.add((()=>this.parsedFilterExpressions),(()=>this._updateSymbologyOverride()),n),this.addResolvingPromise(this._updateRequiredFields())}get lodFactor(){return this.view.qualitySettings.sceneService.object.lodFactor}get parsedFilterExpressions(){return"Overview"!==this.sublayer.modelName&&this.layerView?this.layerView.filterExpressions.map((([e,r])=>{let t;try{t=p.create(e,{fieldsIndex:this.sublayer.fieldsIndex})}catch(a){return i.getLogger(this).error("Failed to parse filterExpression: "+a),null}if(!t.isStandardized)return i.getLogger(this).error("filterExpression is using non standard function"),null;const s=[],l=t.fieldNames;return Q(l,this.sublayer.fields,{missingFields:s}),s.length>0?(i.getLogger(this).error(`filterExpression references unknown fields: ${s.join(", ")}`),null):[t,r]})).filter((e=>null!=e)):[]}get filter(){return this._get("filter")}set filter(e){this._set("filter",x.checkSupport(e)?e:null)}isUpdating(){return super.isUpdating()||(this._i3sFilter?.updating??!1)}_updateSymbologyOverride(){const e=this.parsedFilterExpressions;e.length>0?this._setSymbologyOverride(((r,t)=>{for(const[s,l]of e)try{if(s.testFeature(r))return w(t,l)}catch(i){this.logError(i)}return w(t,null)}),this.filterExpressionFields):this._setSymbologyOverride(null,null)}get filterExpressionFields(){return y(this.sublayer.fieldsIndex,this.parsedFilterExpressions.reduce(((e,[r])=>e.concat(r.fieldNames)),new Array))}get availableFields(){const e=this.sublayer,r=e.fieldsIndex;let t=this.requiredFields;if(e.outFields||e.layer.outFields){const i=[...e.outFields||[],...e.layer.outFields||[]];t=[...c(r,i),...t]}return y(r,t)}_createLayerGraphic(e){return new r({attributes:e,layer:this.sublayer.layer,sourceLayer:this.sublayer})}canResume(){return super.canResume()&&H(this.i3slayer.effectiveScaleRange,this.view.scale)&&(!this._controller||this._controller.rootNodeVisible)}async fetchPopupFeaturesFromGraphics(e,r){const t=this._validateFetchPopupFeatures(r);if(t)throw t;if(0===e.length)return[];const s=[],o=[],n=null!=this.sublayer.associatedLayer?await this.sublayer.associatedLayer.load(r):this.sublayer,u=c(this.sublayer.fieldsIndex,await A(n,C(this.sublayer,r)));l(r);const d=new Set;for(const i of e)f(u,i,d)?o.push(i):s.push(i);return 0===o.length?s:(null!=this.sublayer.associatedLayer&&await this.sublayer.associatedLayer.load().catch((()=>i.getLogger(this).warn("Failed to load associated feature layer. Displaying popup attributes from cached attributes."))),this.whenGraphicAttributes(o,Array.from(d)).catch((e=>(a(e),o))).then((e=>s.concat(e))))}async _updateRequiredFields(){const e=y(this.sublayer.fieldsIndex,[...this.sublayer.renderer?await this.sublayer.renderer.getRequiredFields(this.sublayer.fieldsIndex):[],...this.definitionExpressionFields,...this.filterExpressionFields]);this._set("requiredFields",e)}_validateFetchPopupFeatures(e){const{sublayer:r}=this,{popupEnabled:i}=r;return i?C(r,e)?void 0:new t("buildingscenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{sublayer:r}):new t("buildingscenelayerview3d:fetchPopupFeatures","Popups are disabled",{sublayer:r})}getFilters(){const e=super.getFilters();return this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),this._i3sFilter?.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return null!=this.filter?this.filter.createQuery(e):new g(e)}queryExtent(e,r){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),r?.signal)}queryFeatureCount(e,r){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),r?.signal)}queryFeatures(e,r){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),r?.signal).then((e=>{if(!e?.features)return e;const r=this.sublayer,t=r.layer;for(const i of e.features)i.layer=t,i.sourceLayer=r;return e}))}async queryObjectIds(e,r){return(await this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),r?.signal)).filter(m)}_ensureQueryEngine(){return this._queryEngine??=this._createQueryEngine(),this._queryEngine}_createQueryEngine(){const e=E(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new S({layerView:this,priority:O.FEATURE_QUERY_ENGINE,spatialIndex:new I({featureAdapter:new j({objectIdField:this.sublayer.objectIdField,attributeStorageInfo:this.sublayer.attributeStorageInfo,getFeatureExtent:e}),forAllFeatures:(e,r)=>this._forAllFeatures(((r,t,i)=>e(new v(r,t,i))),r,_.QUERYABLE),getFeatureExtent:e,sourceSpatialReference:q(this.sublayer),viewSpatialReference:this.view.spatialReference})})}_ensureQuery(e){return this._addDefinitionExpressionToQuery(null==e?this.createQuery():g.from(e))}};e([u()],D.prototype,"i3slayer",null),e([u()],D.prototype,"layerView",void 0),e([u()],D.prototype,"lodFactor",null),e([u({readOnly:!0})],D.prototype,"parsedFilterExpressions",null),e([u({type:h})],D.prototype,"filter",null),e([u()],D.prototype,"_i3sFilter",void 0),e([u({type:[String],readOnly:!0})],D.prototype,"filterExpressionFields",null),e([u({type:[String],readOnly:!0})],D.prototype,"requiredFields",void 0),e([u({type:[String],readOnly:!0})],D.prototype,"availableFields",null),D=e([d("esri.views.3d.layers.BuildingComponentSublayerView3D")],D);const G=D;export{G as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import t from"../../../core/Error.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as l,throwIfAbortError as a}from"../../../core/promiseUtils.js";import{syncAndInitial as o,initial as n}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../core/sql/WhereClause.js";import"../../../layers/buildingSublayers/BuildingComponentSublayer.js";import h from"../../../layers/support/FeatureFilter.js";import{fixFields as y,unpackFieldNames as c,populateMissingFields as f}from"../../../layers/support/fieldUtils.js";import m from"../../../rest/support/Query.js";import{isNumber as g}from"../../../support/guards.js";import{BuildingSublayerView3DMixin as F}from"./BuildingSublayerView3D.js";import{I3SMeshView3D as b}from"./I3SMeshView3D.js";import{ForAllFeaturesMode as _}from"./II3SMeshView3D.js";import{applyFilterMode as w}from"./i3s/BuildingFilterUtil.js";import{createGetFeatureExtent as E}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as x}from"./i3s/I3SMeshViewFilter.js";import{I3SQueryEngine as S}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as j,I3SQueryFeature as v}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as I}from"./i3s/I3SQueryFeatureStore.js";import{findFieldsCaseInsensitive as Q,getIndexCrs as q}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as R}from"./support/DefinitionExpressionSceneLayerView.js";import{TemporalSceneLayerView as L}from"./support/TemporalSceneLayerView.js";import V from"../../layers/BuildingComponentSublayerView.js";import{hasPopupTemplate as U,getRequiredFields as A,getFetchPopupTemplate as C}from"../../layers/support/popupUtils.js";import{isInEffectiveScaleRange as H}from"../../support/layerViewUtils.js";import{TaskPriority as O}from"../../support/Scheduler.js";let D=class extends(L(R(b(F(V))))){constructor(e){super(e),this.type="building-component-sublayer-3d",this._elevationContext="scene",this._supportsLabeling=!1,this.requiredFields=[],this.progressiveLoadFactor=1,this._queryEngine=null}get i3slayer(){return this.sublayer}get layerViewUid(){return this.layerView.uid}get layerId(){return this.sublayer.layer.id}get sublayerId(){return this.sublayer.id}get layerPopupEnabledAndHasTemplate(){return this.sublayer.popupEnabled&&U(this.sublayer,this.layerView.view.popup?.defaultPopupTemplateEnabled)}initialize(){this._updatingHandles.add((()=>this.mergedFilter),(e=>{null!=e&&x.checkSupport(e)?null==this._i3sFilter?this._i3sFilter=new x({viewFilter:e,layerFieldsIndex:this.sublayer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,r)=>this.addSqlFilter(e,r,this.logError),addTimeFilter:(e,r)=>this.addTimeFilter(e,r)}):this._i3sFilter.viewFilter=e:this._i3sFilter=s(this._i3sFilter)}),o),this._updatingHandles.add((()=>[this.sublayer.renderer,this.definitionExpressionFields,this.filterExpressionFields]),(()=>this._updateRequiredFields())),this._updatingHandles.add((()=>this.sublayer.renderer),(e=>this._rendererChange(e)),n);const e=()=>this._filterChange();this._updatingHandles.add((()=>this.parsedDefinitionExpression),e),this._updatingHandles.add((()=>this._i3sFilter?.sortedObjectIds),e),this._updatingHandles.add((()=>this._i3sFilter?.parsedWhereClause),e),this._updatingHandles.add((()=>this.getTimeFilterDependencies()),e),this._updatingHandles.add((()=>this.mergedFilter),e),this._updatingHandles.add((()=>[this._i3sFilter?.parsedGeometry,this.filter?.spatialRelationship]),(()=>this._geometryFilterChange())),this._updatingHandles.add((()=>this.parsedFilterExpressions),(()=>this._updateSymbologyOverride()),n),this.addResolvingPromise(this._updateRequiredFields())}get lodFactor(){return this.view.qualitySettings.sceneService.object.lodFactor}get parsedFilterExpressions(){return"Overview"===this.sublayer.modelName?[]:this.layerView.filterExpressions.map((([e,r])=>{let t;try{t=p.create(e,{fieldsIndex:this.sublayer.fieldsIndex})}catch(a){return i.getLogger(this).error("Failed to parse filterExpression: "+a),null}if(!t.isStandardized)return i.getLogger(this).error("filterExpression is using non standard function"),null;const s=[],l=t.fieldNames;return Q(l,this.sublayer.fields,{missingFields:s}),s.length>0?(i.getLogger(this).error(`filterExpression references unknown fields: ${s.join(", ")}`),null):[t,r]})).filter((e=>null!=e))}get filter(){return this._get("filter")}set filter(e){this._set("filter",x.checkSupport(e)?e:null)}isUpdating(){return super.isUpdating()||(this._i3sFilter?.updating??!1)}_updateSymbologyOverride(){const e=this.parsedFilterExpressions;e.length>0?this._setSymbologyOverride(((r,t)=>{for(const[s,l]of e)try{if(s.testFeature(r))return w(t,l)}catch(i){this.logError(i)}return w(t,null)}),this.filterExpressionFields):this._setSymbologyOverride(null,null)}get filterExpressionFields(){return y(this.sublayer.fieldsIndex,this.parsedFilterExpressions.reduce(((e,[r])=>e.concat(r.fieldNames)),new Array))}get availableFields(){const e=this.sublayer,r=e.fieldsIndex;let t=this.requiredFields;if(e.outFields||e.layer.outFields){const i=[...e.outFields||[],...e.layer.outFields||[]];t=[...c(r,i),...t]}return y(r,t)}_createLayerGraphic(e){return new r({attributes:e,layer:this.sublayer.layer,sourceLayer:this.sublayer})}canResume(){return super.canResume()&&H(this.i3slayer.effectiveScaleRange,this.view.scale)&&(!this._controller||this._controller.rootNodeVisible)}async fetchPopupFeaturesFromGraphics(e,r){const t=this._validateFetchPopupFeatures(r);if(t)throw t;if(0===e.length)return[];const s=[],o=[],n=null!=this.sublayer.associatedLayer?await this.sublayer.associatedLayer.load(r):this.sublayer,u=c(this.sublayer.fieldsIndex,await A(n,C(this.sublayer,r)));l(r);const d=new Set;for(const i of e)f(u,i,d)?o.push(i):s.push(i);return 0===o.length?s:(null!=this.sublayer.associatedLayer&&await this.sublayer.associatedLayer.load().catch((()=>i.getLogger(this).warn("Failed to load associated feature layer. Displaying popup attributes from cached attributes."))),this.whenGraphicAttributes(o,Array.from(d)).catch((e=>(a(e),o))).then((e=>s.concat(e))))}async _updateRequiredFields(){const e=y(this.sublayer.fieldsIndex,[...this.sublayer.renderer?await this.sublayer.renderer.getRequiredFields(this.sublayer.fieldsIndex):[],...this.definitionExpressionFields,...this.filterExpressionFields]);this._set("requiredFields",e)}_validateFetchPopupFeatures(e){const{sublayer:r}=this,{popupEnabled:i}=r;return i?C(r,e)?void 0:new t("buildingscenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{sublayer:r}):new t("buildingscenelayerview3d:fetchPopupFeatures","Popups are disabled",{sublayer:r})}getFilters(){const e=super.getFilters();return this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),this._i3sFilter?.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return null!=this.filter?this.filter.createQuery(e):new m(e)}queryExtent(e,r){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),r?.signal)}queryFeatureCount(e,r){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),r?.signal)}queryFeatures(e,r){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),r?.signal).then((e=>{if(!e?.features)return e;const r=this.sublayer,t=r.layer;for(const i of e.features)i.layer=t,i.sourceLayer=r;return e}))}async queryObjectIds(e,r){return(await this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),r?.signal)).filter(g)}_ensureQueryEngine(){return this._queryEngine??=this._createQueryEngine(),this._queryEngine}_createQueryEngine(){const e=E(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new S({layerView:this,priority:O.FEATURE_QUERY_ENGINE,spatialIndex:new I({featureAdapter:new j({objectIdField:this.sublayer.objectIdField,attributeStorageInfo:this.sublayer.attributeStorageInfo,getFeatureExtent:e}),forAllFeatures:(e,r)=>this._forAllFeatures(((r,t,i)=>e(new v(r,t,i))),r,_.QUERYABLE),getFeatureExtent:e,sourceSpatialReference:q(this.sublayer),viewSpatialReference:this.view.spatialReference})})}_ensureQuery(e){return this._addDefinitionExpressionToQuery(null==e?this.createQuery():m.from(e))}};e([u()],D.prototype,"i3slayer",null),e([u()],D.prototype,"layerView",void 0),e([u()],D.prototype,"lodFactor",null),e([u({readOnly:!0})],D.prototype,"parsedFilterExpressions",null),e([u({type:h})],D.prototype,"filter",null),e([u()],D.prototype,"_i3sFilter",void 0),e([u({type:[String],readOnly:!0})],D.prototype,"filterExpressionFields",null),e([u({type:[String],readOnly:!0})],D.prototype,"requiredFields",void 0),e([u({type:[String],readOnly:!0})],D.prototype,"availableFields",null),D=e([d("esri.views.3d.layers.BuildingComponentSublayerView3D")],D);const G=D;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/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import t from"../../../core/Collection.js";import{handlesGroup as s}from"../../../core/handleUtils.js";import i from"../../../core/Logger.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{abortMaybe as n}from"../../../core/maybe.js";import{isAbortError as l,allSettledValues as a,throwIfAborted as u,createResolver as p}from"../../../core/promiseUtils.js";import{watch as h,syncAndInitial as c}from"../../../core/reactiveUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import"../../../layers/buildingSublayers/BuildingGroupSublayer.js";import{isQuery as g,isGraphic as f}from"../../../support/guards.js";import m from"./BuildingComponentSublayerView3D.js";import{BuildingSublayerView3DMixin as w}from"./BuildingSublayerView3D.js";import{LayerView3D as b}from"./LayerView3D.js";import{parseFilterMode as V}from"./i3s/BuildingFilterUtil.js";import{checkSpatialReference as j}from"./i3s/I3SUtil.js";import{emptyHighlightHandle as C,normalizeHighlightTargetExceptQuery as _}from"./support/highlightUtils.js";import{LayerViewPerformanceInfo as S}from"./support/LayerViewPerformanceInfo.js";import{updatingProgress as v}from"../support/updatingProperties.js";import B from"../../layers/BuildingSceneLayerView.js";import{isInEffectiveScaleRange as L}from"../../support/layerViewUtils.js";const F=w(r);let M=class extends(b(B)){constructor(e){super(e),this.type="building-scene-3d",this.sublayerViews=new t,this._abortController=new AbortController,this._loadingComponents=0,this._pendingWhenSublayerViews=new Map,this.ignoresMemoryFactor=!1}get filterExpression(){const e=this.layer.activeFilterId,r=null!=e?this.layer.filters.find((r=>r.id===e)):null,t=null!=r?r.filterBlocks?.find((e=>"solid"===e.filterMode.type)):null;return t?t.filterExpression:null}get filterExpressions(){const e=this.layer.activeFilterId,r=null!=e?this.layer.filters.find((r=>r.id===e)):null;return r?.filterBlocks?r.filterBlocks.toArray().map((e=>[e.filterExpression??"",V(e)])):[]}get updatingProgressValue(){const e=this.sublayerViews,r=this._loadingComponents+(e?e.length:0);return e.reduce(((e,r)=>e+r.updatingProgress),0)/r}get visibleAtCurrentScale(){return L(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){return this._loadingComponents>0||this.sublayerViews&&this.sublayerViews.some((e=>e.updating))}initialize(){j(this.layer.spatialReference,this.view.spatialReference,this.view.viewingMode),this._initializeSubLayerViews(this.layer.sublayers,this)}destroy(){this.sublayerViews&&(this.sublayerViews.forEach((e=>e.destroy())),this.sublayerViews=null),this._abortController=n(this._abortController)}_initializeSubLayerViews(e,r){const t=this,s=this.view;e.forEach((e=>{if(!e.isEmpty)if("building-group"===e.type){const t=new F({sublayer:e,view:s,parent:r});this._initializeSubLayerViews(e.sublayers,t)}else"mesh"===e.geometryType&&(this._loadingComponents++,e.load({signal:this._abortController.signal}).then((()=>{const i=new m({sublayer:e,layerView:t,view:s,parent:r});this.sublayerViews.push(i);const o=this._pendingWhenSublayerViews.get(e);if(o){for(const e of o)e.resolve(i);this._pendingWhenSublayerViews.delete(e)}this.addHandles([h((()=>i.updating),(()=>this.notifyChange("updating")),c),h((()=>i.updatingProgress),(()=>this.notifyChange("updatingProgressValue")),c)])})).catch((r=>{l(r)||i.getLogger(this).error(`Error while creating view for sublayer ${e.id}\nLayer: ${this.layer.url}\n`,r)})).then((()=>{this._loadingComponents--,this.notifyChange("updating"),this.notifyChange("updatingProgressValue")})))}))}getGraphicFromIntersectorTarget(e){for(const r of this.sublayerViews.items)if(r.sublayer.uid===e.sublayerUid)return r.getGraphicFromIntersectorTarget(e);return null}async fetchPopupFeaturesFromGraphics(e,r){if(0===e.length)return[];const t=P(e,(e=>e.sourceLayer)),s=[];for(const[o,n]of t){const e=this._findComponent(o);null!=e&&s.push(e.fetchPopupFeaturesFromGraphics(n,r))}const i=await a(s);return u(r),i.flat()}whenGraphicBounds(e){const r=this._findComponent(e.sourceLayer);return null==r?Promise.reject():r.whenGraphicBounds(e)}getAABBFromIntersectorTarget(e){for(const r of this.sublayerViews.items)if(r.sublayer.uid===e.sublayerUid)return r.getAABBFromIntersectorTarget(e);return null}async whenSublayerView(e){const r=this._findComponent(e);if(null!=r)return r;const t=this._pendingWhenSublayerViews.get(e),s=p();return t?t.push(s):this._pendingWhenSublayerViews.set(e,[s]),s.promise}_findComponent(e){return this.sublayerViews.find((r=>e===r.sublayer))}highlight(e,r){if(g(e))return C;const t=_(e);if(0===t.length)return C;if(f(t[0])){const e=t,i=new Map;for(const r of e)o(i,r.sourceLayer,(()=>[])).push(r);const n=[];return this.sublayerViews.forEach((e=>{const t=i.get(e.sublayer);t&&n.push(e.highlight(t,r))})),s(n)}return C}get usedMemory(){return this.sublayerViews.reduce(((e,r)=>e+r.usedMemory),0)}get unloadedMemory(){return this.sublayerViews.reduce(((e,r)=>e+r.unloadedMemory),0)}get performanceInfo(){return new S(this.usedMemory)}};function P(e,r){const t=new Map,s=e.length;for(let i=0;i<s;i++){const s=e[i],o=r(s,i,e),n=t.get(o);n?n.push(s):t.set(o,[s])}return t}e([y()],M.prototype,"sublayerViews",void 0),e([y({readOnly:!0})],M.prototype,"filterExpression",null),e([y({readOnly:!0})],M.prototype,"filterExpressions",null),e([y(v)],M.prototype,"updatingProgress",void 0),e([y({readOnly:!0,dependsOn:[]})],M.prototype,"updatingProgressValue",null),e([y({readOnly:!0})],M.prototype,"visibleAtCurrentScale",null),M=e([d("esri.views.3d.layers.BuildingSceneLayerView3D")],M);const E=M;export{E as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import t from"../../../core/Collection.js";import{handlesGroup as s}from"../../../core/handleUtils.js";import i from"../../../core/Logger.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{abortMaybe as n}from"../../../core/maybe.js";import{isAbortError as l,allSettledValues as a,throwIfAborted as u,createResolver as p}from"../../../core/promiseUtils.js";import{watch as h,syncAndInitial as c}from"../../../core/reactiveUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import"../../../layers/buildingSublayers/BuildingGroupSublayer.js";import{isQuery as g,isGraphic as f}from"../../../support/guards.js";import m from"./BuildingComponentSublayerView3D.js";import{BuildingSublayerView3DMixin as w}from"./BuildingSublayerView3D.js";import{LayerView3D as b}from"./LayerView3D.js";import{parseFilterMode as V}from"./i3s/BuildingFilterUtil.js";import{checkSpatialReference as j}from"./i3s/I3SUtil.js";import{emptyHighlightHandle as C,normalizeHighlightTargetExceptQuery as _}from"./support/highlightUtils.js";import{LayerViewPerformanceInfo as S}from"./support/LayerViewPerformanceInfo.js";import{updatingProgress as v}from"../support/updatingProperties.js";import B from"../../layers/BuildingSceneLayerView.js";import{isInEffectiveScaleRange as L}from"../../support/layerViewUtils.js";const F=w(r);let M=class extends(b(B)){constructor(e){super(e),this.type="building-scene-3d",this.sublayerViews=new t,this._abortController=new AbortController,this._loadingComponents=0,this._pendingWhenSublayerViews=new Map,this.ignoresMemoryFactor=!1}get filterExpression(){const e=this.layer.activeFilterId,r=null!=e?this.layer.filters.find((r=>r.id===e)):null,t=null!=r?r.filterBlocks?.find((e=>"solid"===e.filterMode.type)):null;return t?t.filterExpression:null}get filterExpressions(){const e=this.layer.activeFilterId,r=null!=e?this.layer.filters.find((r=>r.id===e)):null;return r?.filterBlocks?r.filterBlocks.toArray().map((e=>[e.filterExpression??"",V(e)])):[]}get updatingProgressValue(){const e=this.sublayerViews,r=this._loadingComponents+(e?e.length:0);return e.reduce(((e,r)=>e+r.updatingProgress),0)/r}get visibleAtCurrentScale(){return L(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){return this._loadingComponents>0||this.sublayerViews&&this.sublayerViews.some((e=>e.updating))}initialize(){j(this.layer.spatialReference,this.view.spatialReference,this.view.viewingMode),this._initializeSubLayerViews(this.layer.sublayers,this)}destroy(){this.sublayerViews&&(this.sublayerViews.forEach((e=>e.destroy())),this.sublayerViews=null),this._abortController=n(this._abortController)}_initializeSubLayerViews(e,r){const t=this,s=this.view;e.forEach((e=>{if(!e.isEmpty)if("building-group"===e.type){const t=new F({sublayer:e,view:s,parent:r});this._initializeSubLayerViews(e.sublayers,t)}else"mesh"===e.geometryType&&(this._loadingComponents++,e.load({signal:this._abortController.signal}).then((()=>{const i=new m({sublayer:e,layerView:t,view:s,parent:r});this.sublayerViews.push(i);const o=this._pendingWhenSublayerViews.get(e);if(o){for(const e of o)e.resolve(i);this._pendingWhenSublayerViews.delete(e)}this.addHandles([h((()=>i.updating),(()=>this.notifyChange("updating")),c),h((()=>i.updatingProgress),(()=>this.notifyChange("updatingProgressValue")),c)])})).catch((r=>{l(r)||i.getLogger(this).error(`Error while creating view for sublayer ${e.id}\nLayer: ${this.layer.url}\n`,r)})).then((()=>{this._loadingComponents--,this.notifyChange("updating"),this.notifyChange("updatingProgressValue")})))}))}getGraphicFromIntersectorTarget(e){for(const r of this.sublayerViews.items)if(r.sublayer.id===e.sublayerId)return r.getGraphicFromIntersectorTarget(e);return null}async fetchPopupFeaturesFromGraphics(e,r){if(0===e.length)return[];const t=P(e,(e=>e.sourceLayer)),s=[];for(const[o,n]of t){const e=this._findComponent(o);null!=e&&s.push(e.fetchPopupFeaturesFromGraphics(n,r))}const i=await a(s);return u(r),i.flat()}whenGraphicBounds(e){const r=this._findComponent(e.sourceLayer);return null==r?Promise.reject():r.whenGraphicBounds(e)}getAABBFromIntersectorTarget(e){for(const r of this.sublayerViews.items)if(r.sublayer.id===e.sublayerId)return r.getAABBFromIntersectorTarget(e);return null}async whenSublayerView(e){const r=this._findComponent(e);if(null!=r)return r;const t=this._pendingWhenSublayerViews.get(e),s=p();return t?t.push(s):this._pendingWhenSublayerViews.set(e,[s]),s.promise}_findComponent(e){return this.sublayerViews.find((r=>e===r.sublayer))}highlight(e,r){if(g(e))return C;const t=_(e);if(0===t.length)return C;if(f(t[0])){const e=t,i=new Map;for(const r of e)o(i,r.sourceLayer,(()=>[])).push(r);const n=[];return this.sublayerViews.forEach((e=>{const t=i.get(e.sublayer);t&&n.push(e.highlight(t,r))})),s(n)}return C}get usedMemory(){return this.sublayerViews.reduce(((e,r)=>e+r.usedMemory),0)}get unloadedMemory(){return this.sublayerViews.reduce(((e,r)=>e+r.unloadedMemory),0)}get performanceInfo(){return new S(this.usedMemory)}};function P(e,r){const t=new Map,s=e.length;for(let i=0;i<s;i++){const s=e[i],o=r(s,i,e),n=t.get(o);n?n.push(s):t.set(o,[s])}return t}e([y()],M.prototype,"sublayerViews",void 0),e([y({readOnly:!0})],M.prototype,"filterExpression",null),e([y({readOnly:!0})],M.prototype,"filterExpressions",null),e([y(v)],M.prototype,"updatingProgress",void 0),e([y({readOnly:!0,dependsOn:[]})],M.prototype,"updatingProgressValue",null),e([y({readOnly:!0})],M.prototype,"visibleAtCurrentScale",null),M=e([d("esri.views.3d.layers.BuildingSceneLayerView3D")],M);const E=M;export{E as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Evented.js";import r from"../../../core/Identifiable.js";import i from"../../../core/Promise.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";const p=(p,n)=>{let l=class extends(i.EsriPromiseMixin(r.IdentifiableMixin(t.EventedMixin(p)))){constructor(e){super(e),this.sublayer=null,this.parent=null,this.view=null}initialize(){}get suspended(){return!this.canResume()}get updating(){return!this.suspended&&this.isUpdating()}get visible(){return!!this.sublayer?.visible}set visible(e){this._overrideIfSome("visible",e)}get fullOpacity(){const e=e=>null!=e?e:1;return e(this.sublayer?.opacity)*e(this.parent?.fullOpacity)}canResume(){return!this.parent?.suspended&&this.view?.ready&&this.visible||!1}isUpdating(){return!1}};return e([s()],l.prototype,"sublayer",void 0),e([s()],l.prototype,"parent",void 0),e([s({readOnly:!0})],l.prototype,"suspended",null),e([s({type:Boolean,readOnly:!0})],l.prototype,"updating",null),e([s()],l.prototype,"view",void 0),e([s()],l.prototype,"visible",null),e([s()],l.prototype,"fullOpacity",null),l=e([o("esri.views.3d.layers.BuildingSublayerView3D")],l),l};export{p as BuildingSublayerView3DMixin};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import t from"../../../core/Identifiable.js";import i from"../../../core/Promise.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";const p=(p,n)=>{let l=class extends(i.EsriPromiseMixin(t.IdentifiableMixin(r.EventedMixin(p)))){constructor(e){super(e)}initialize(){}get suspended(){return!this.canResume()}get updating(){return!this.suspended&&this.isUpdating()}get visible(){return!!this.sublayer?.visible}set visible(e){this._overrideIfSome("visible",e)}get fullOpacity(){const e=e=>null!=e?e:1;return e(this.sublayer?.opacity)*e(this.parent?.fullOpacity)}canResume(){return!this.parent?.suspended&&this.view?.ready&&this.visible||!1}isUpdating(){return!1}};return e([s()],l.prototype,"sublayer",void 0),e([s()],l.prototype,"parent",void 0),e([s()],l.prototype,"view",void 0),e([s({readOnly:!0})],l.prototype,"suspended",null),e([s({type:Boolean,readOnly:!0})],l.prototype,"updating",null),e([s()],l.prototype,"visible",null),e([s()],l.prototype,"fullOpacity",null),l=e([o("esri.views.3d.layers.BuildingSublayerView3D")],l),l};export{p as BuildingSublayerView3DMixin};