@arcgis/core 5.1.0-next.52 → 5.1.0-next.53

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 (113) hide show
  1. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/009db7b459b18f6a668b.js +1 -0
  4. package/assets/esri/core/workers/chunks/{386435341e949f5573b4.js → 0fc60b4c44c4e865b699.js} +2 -2
  5. package/assets/esri/core/workers/chunks/199f70c0373f6008a545.js +1 -0
  6. package/assets/esri/core/workers/chunks/{d2af5342fbe80e2d8c60.js → 20f9f3470cad47d01803.js} +1 -1
  7. package/assets/esri/core/workers/chunks/2757cf54656b5d318b11.js +1 -0
  8. package/assets/esri/core/workers/chunks/2aaeaf022af8493281dc.js +1 -0
  9. package/assets/esri/core/workers/chunks/34fe4570eef9e73839b8.js +1 -0
  10. package/assets/esri/core/workers/chunks/{7480bd6f892abf444cac.js → 3c9e1ec94bbcbf494916.js} +3 -3
  11. package/assets/esri/core/workers/chunks/40bcfc4f8efe7de7ec9d.js +1 -0
  12. package/assets/esri/core/workers/chunks/{cc1f3a2f281a2f6e0f94.js → 4d54beab8ae5ff31e7b0.js} +1 -1
  13. package/assets/esri/core/workers/chunks/55bb5b7817c2963c8bfa.js +1 -0
  14. package/assets/esri/core/workers/chunks/{39f3bea123f20c816ab2.js → 662932d2effd2b384b9e.js} +1 -1
  15. package/assets/esri/core/workers/chunks/7d56b2ac5030dd8b748e.js +1 -0
  16. package/assets/esri/core/workers/chunks/{720a33a7f118d2769133.js → 851dd71d28681d4eccfd.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{88c6cc90606409b5c884.js → 87d2021e91d025a2a142.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{fe7dec83e40014c55a6b.js → 96e799ca97989a6ed448.js} +1 -1
  19. package/assets/esri/core/workers/chunks/9db2ff1d4cbb5d1b623e.js +1 -0
  20. package/assets/esri/core/workers/chunks/a462aa1c7b68efad6906.js +1 -0
  21. package/assets/esri/core/workers/chunks/{f5fd59291cb161fdc05b.js → a787fe09d3df9d4254ba.js} +1 -1
  22. package/assets/esri/core/workers/chunks/a971e61336f455b953d5.js +1 -0
  23. package/assets/esri/core/workers/chunks/b2b77598048818c957b7.js +1 -0
  24. package/assets/esri/core/workers/chunks/{3fa5f102b6f77c523a76.js → b3e5dcb530cef678c8f8.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{daf65bccc45dc5c400ae.js → c460ca93ed8e20d8b53a.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{3fcc8c455af56ae89030.js → ccf845ac0ac354507a25.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{c48d1ee37c207bfb0aac.js → dd319d5fe89b275e93cf.js} +1 -1
  28. package/assets/esri/core/workers/chunks/ec91d5081f423755cb07.js +1 -0
  29. package/assets/esri/core/workers/chunks/{eb36417edc11fa80e312.js → ee8cd91c27e9cdfc3b2e.js} +1 -1
  30. package/assets/esri/core/workers/chunks/f8eb14170f927aecfbc8.js +1 -0
  31. package/assets/esri/core/workers/chunks/{792219a079c28bcdc003.js → fcfaaced184f8da3e28d.js} +1 -1
  32. package/config.js +1 -1
  33. package/core/arrayUtils.js +1 -1
  34. package/core/maybe.js +1 -1
  35. package/kernel.js +1 -1
  36. package/layers/FeatureLayer.js +1 -1
  37. package/layers/OrientedImageryLayer.js +1 -1
  38. package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
  39. package/layers/graphics/sources/OGCFeatureSource.js +1 -1
  40. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  41. package/layers/knowledgeGraph/nodeMovementUtils.js +1 -1
  42. package/layers/mixins/ArcGISImageService.js +1 -1
  43. package/layers/mixins/FeatureLayerBase.js +1 -1
  44. package/layers/raster/datasets/FunctionRaster.js +1 -1
  45. package/layers/raster/functions/AspectFunction.js +1 -1
  46. package/layers/raster/functions/BaseRasterFunction.js +1 -1
  47. package/layers/raster/functions/ConvolutionFunction.js +1 -1
  48. package/layers/raster/functions/CurvatureFunction.js +1 -1
  49. package/layers/raster/functions/HillshadeFunction.js +1 -1
  50. package/layers/raster/functions/ShadedReliefFunction.js +1 -1
  51. package/layers/raster/functions/SlopeFunction.js +1 -1
  52. package/layers/raster/functions/StatisticsFunction.js +1 -1
  53. package/layers/raster/functions/pixelUtils.js +1 -1
  54. package/layers/support/capabilities.js +1 -1
  55. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  56. package/package.json +3 -3
  57. package/support/revision.js +1 -1
  58. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  59. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  60. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  61. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  62. package/views/3d/layers/I3SMeshView3D.js +1 -1
  63. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  64. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  65. package/views/3d/support/ResourceController.js +1 -1
  66. package/views/3d/terrain/OverlayRenderer.js +1 -1
  67. package/views/3d/webgl/ManagedFBO.d.ts +1 -0
  68. package/views/3d/webgl/ManagedFBOResource.d.ts +1 -0
  69. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  70. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
  71. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  72. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  73. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  74. package/views/3d/webgl-engine/core/FBOCacheUsage.js +1 -1
  75. package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
  76. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  77. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  78. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  79. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  80. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  81. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  82. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  83. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  84. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  85. package/views/3d/webgl-engine/materials/PolygonOffset.js +1 -1
  86. package/views/3d/webgl-engine/materials/TriangleTechniqueConfiguration.js +1 -1
  87. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  88. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  89. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  90. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  91. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  92. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +1 -1
  93. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  94. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  95. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  96. package/views/3d/webgl.js +1 -1
  97. package/views/webgl/Program.js +1 -1
  98. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  99. package/assets/esri/core/workers/chunks/0b661b90f7ee3ae23425.js +0 -1
  100. package/assets/esri/core/workers/chunks/167e4ff7cbc88b42db71.js +0 -1
  101. package/assets/esri/core/workers/chunks/1a481f3ae3146682eb00.js +0 -1
  102. package/assets/esri/core/workers/chunks/30654845ca1334f1c206.js +0 -1
  103. package/assets/esri/core/workers/chunks/34207774bc371e95ba3c.js +0 -1
  104. package/assets/esri/core/workers/chunks/35dbe1eeb6932b03aea2.js +0 -1
  105. package/assets/esri/core/workers/chunks/380bb57bccc266d6442a.js +0 -1
  106. package/assets/esri/core/workers/chunks/5351e71ce7839636d06d.js +0 -1
  107. package/assets/esri/core/workers/chunks/55edd712c6d2d044e550.js +0 -1
  108. package/assets/esri/core/workers/chunks/64da1ad9df9094ef5c12.js +0 -1
  109. package/assets/esri/core/workers/chunks/666f201d222c50ab8428.js +0 -1
  110. package/assets/esri/core/workers/chunks/7380177f16d914fdbc63.js +0 -1
  111. package/assets/esri/core/workers/chunks/7dba4121cdd20dbc4b20.js +0 -1
  112. package/assets/esri/core/workers/chunks/bb659dcd297b895830df.js +0 -1
  113. /package/assets/esri/core/workers/chunks/{386435341e949f5573b4.js.LICENSE.txt → 0fc60b4c44c4e865b699.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{property as e,subclass as r}from"../../../core/accessorSupport/decorators.js";import s from"./BaseRasterFunction.js";import o from"./CurvatureFunctionArguments.js";import{gcsFactor as i,curvature as n}from"./surfaceUtils.js";let u=class extends s{constructor(){super(...arguments),this.functionName="Curvature",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,t.bandCount=1,this._removeStatsHistColormapVAT(t),this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{zFactor:r,curvatureType:s}=this.functionArguments,{extent:o,primaryPixelSizes:u}=t,a=u?.[0],c=a??(o?{x:o.width/e.width,y:o.height/e.height}:{x:1,y:1}),p=this.isGCS&&r>=1?r*i:r;return n(e,{zFactor:p,curvatureType:s,resolution:c})}_getWebGLParameters(){const{zFactor:t,curvatureType:e}=this.functionArguments;return{curvatureType:e,zFactor:this.isGCS&&t>=1?t*i:t}}};t([e({json:{write:!0,name:"rasterFunction"}})],u.prototype,"functionName",void 0),t([e({type:o,json:{write:!0,name:"rasterFunctionArguments"}})],u.prototype,"functionArguments",void 0),t([e()],u.prototype,"rasterArgumentNames",void 0),t([e({json:{write:!0}})],u.prototype,"isGCS",void 0),u=t([r("esri.layers.raster.functions.CurvatureFunction")],u);const a=u;export{a as default};
2
+ import{__decorate as t}from"tslib";import{property as e,subclass as r}from"../../../core/accessorSupport/decorators.js";import s from"./BaseRasterFunction.js";import o from"./CurvatureFunctionArguments.js";import{gcsFactor as i,curvature as n}from"./surfaceUtils.js";let u=class extends s{constructor(){super(...arguments),this.functionName="Curvature",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,t.bandCount=1,this._removeStatsHistColormapVAT(t),this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{zFactor:r,curvatureType:s}=this.functionArguments,{extent:o,primaryPixelSizes:u}=t,a=u?.[0],c=a??(o?{x:o.width/e.width,y:o.height/e.height}:{x:1,y:1}),p=this.isGCS&&r>=1?r*i:r;return n(e,{zFactor:p,curvatureType:s,resolution:c})}_getWebGLParameters(){const{zFactor:t,curvatureType:e}=this.functionArguments;return{curvatureType:e,zFactor:this.isGCS&&t>=1?t*i:t}}_getNeighborhoodSize(){return{rows:3,cols:3}}};t([e({json:{write:!0,name:"rasterFunction"}})],u.prototype,"functionName",void 0),t([e({type:o,json:{write:!0,name:"rasterFunctionArguments"}})],u.prototype,"functionArguments",void 0),t([e()],u.prototype,"rasterArgumentNames",void 0),t([e({json:{write:!0}})],u.prototype,"isGCS",void 0),u=t([r("esri.layers.raster.functions.CurvatureFunction")],u);const a=u;export{a as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{property as e,subclass as s}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as i}from"../formats/pixelRangeUtils.js";import r from"./BaseRasterFunction.js";import o from"./HillshadeFunctionArguments.js";import{getHillshadeOptions as n,hillshade as u,calculateHillshadeParams as a,gcsFactor as p}from"./surfaceUtils.js";let c=class extends r{constructor(){super(...arguments),this.functionName="Hillshade",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"hillshade-function: source data must be single band"};this.outputPixelType=this._getOutputPixelType("u8");const e=t.clone();return this._removeStatsHistColormapVAT(e),e.pixelType=this.outputPixelType,e.bandCount=1,e.statistics=[{min:0,max:255,avg:60,stddev:10}],this.rasterInfo=e,this.isGCS=e.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(!e)return null;const{extent:s,primaryPixelSizes:i}=t,r=i?.[0],o=r??(s?{x:s.width/e.width,y:s.height/e.height}:{x:1,y:1}),a=n(this.functionArguments,o,this.isGCS),p=u(e,a);return p.pixelType=this.outputPixelType,p}_getWebGLParameters(){const t=n(this.functionArguments,{x:1,y:1},this.isGCS),e=a(t),{slopeType:s,zFactor:r,pixelSizeFactor:o,pixelSizePower:u}=this.functionArguments,c="scaled"===s,l=i(this.outputPixelType);return{...e,zFactor:r,gcsFactor:this.isGCS?p:1,pixelSizeFactor:c?o:0,pixelSizePower:c?u:0,isOutputRounded:l}}};t([e({json:{write:!0,name:"rasterFunction"}})],c.prototype,"functionName",void 0),t([e({type:o,json:{write:!0,name:"rasterFunctionArguments"}})],c.prototype,"functionArguments",void 0),t([e()],c.prototype,"rasterArgumentNames",void 0),t([e({json:{write:!0}})],c.prototype,"isGCS",void 0),c=t([s("esri.layers.raster.functions.HillshadeFunction")],c);const l=c;export{l as default};
2
+ import{__decorate as t}from"tslib";import{property as e,subclass as s}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as i}from"../formats/pixelRangeUtils.js";import r from"./BaseRasterFunction.js";import o from"./HillshadeFunctionArguments.js";import{getHillshadeOptions as n,hillshade as u,calculateHillshadeParams as a,gcsFactor as p}from"./surfaceUtils.js";let c=class extends r{constructor(){super(...arguments),this.functionName="Hillshade",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"hillshade-function: source data must be single band"};this.outputPixelType=this._getOutputPixelType("u8");const e=t.clone();return this._removeStatsHistColormapVAT(e),e.pixelType=this.outputPixelType,e.bandCount=1,e.statistics=[{min:0,max:255,avg:60,stddev:10}],this.rasterInfo=e,this.isGCS=e.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(!e)return null;const{extent:s,primaryPixelSizes:i}=t,r=i?.[0],o=r??(s?{x:s.width/e.width,y:s.height/e.height}:{x:1,y:1}),a=n(this.functionArguments,o,this.isGCS),p=u(e,a);return p.pixelType=this.outputPixelType,p}_getWebGLParameters(){const t=n(this.functionArguments,{x:1,y:1},this.isGCS),e=a(t),{slopeType:s,zFactor:r,pixelSizeFactor:o,pixelSizePower:u}=this.functionArguments,c="scaled"===s,l=i(this.outputPixelType);return{...e,zFactor:r,gcsFactor:this.isGCS?p:1,pixelSizeFactor:c?o:0,pixelSizePower:c?u:0,isOutputRounded:l}}_getNeighborhoodSize(){return{rows:3,cols:3}}};t([e({json:{write:!0,name:"rasterFunction"}})],c.prototype,"functionName",void 0),t([e({type:o,json:{write:!0,name:"rasterFunctionArguments"}})],c.prototype,"functionArguments",void 0),t([e()],c.prototype,"rasterArgumentNames",void 0),t([e({json:{write:!0}})],c.prototype,"isGCS",void 0),c=t([s("esri.layers.raster.functions.HillshadeFunction")],c);const l=c;export{l as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as r}from"../formats/pixelRangeUtils.js";import o from"./BaseRasterFunction.js";import{createColormapLUT as i}from"./pixelUtils.js";import n from"./ShadedReliefFunctionArguments.js";import{getHillshadeOptions as a,hillshade as p,tintHillshade as u,calculateHillshadeParams as c,gcsFactor as l}from"./surfaceUtils.js";import{convertColorRampToColormap as m,createHsvMap as d}from"../../../renderers/support/colorRampUtils.js";import{isColormapSupportedByWebGL as f}from"../../../renderers/support/rasterRendererChecks.js";let h=class extends o{constructor(){super(...arguments),this.functionName="ShadedRelief",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const e=this.sourceRasterInfos[0];if(e.bandCount>1)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: source data must be single band"};let{colorRamp:t,colormap:s}=this.functionArguments;if(!t&&!s?.length)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: a color ramp argument must be specified"};this.outputPixelType=this._getOutputPixelType("u8");const r=e.clone();this._removeStatsHistColormapVAT(r),r.pixelType=this.outputPixelType,r.bandCount=3,r.statistics=[{min:0,max:255,avg:60,stddev:10},{min:0,max:255,avg:60,stddev:10},{min:0,max:255,avg:60,stddev:10}],this.rasterInfo=r,this.isGCS=r.spatialReference?.isGeographic??!1,s?.length||(s=m(t,{interpolateAlpha:!0}));const{indexedColormap:o,offset:n}=i({colormap:s});if(!o?.length)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: a valid colorramp is required"};const a=d(o);return this.lookup={indexedColormap:o,offset:n,hsvMap:a},{success:!0,supportsGPU:f(o)}}_processPixels(e){const t=e.pixelBlocks?.[0];if(!t||!this.lookup)return null;let s=e.primaryPixelSizes?.[0];if(null==s){const{extent:r}=e;s=r?{x:r.width/t.width,y:r.height/t.height}:{x:1,y:1}}const r=a(this.functionArguments,s,this.isGCS),o=p(t,r),i=this.sourceRasterInfos[0].statistics?.[0]??{min:0,max:8e3};return u(o,t,this.lookup.hsvMap,i),o.pixelType=this.outputPixelType,o}_getWebGLParameters(){const e=a(this.functionArguments,{x:1,y:1},this.isGCS),t=c(e),{slopeType:s,zFactor:o,pixelSizeFactor:i,pixelSizePower:n}=this.functionArguments,p="scaled"===s,{indexedColormap:u,offset:m}=this.lookup,d=this.sourceRasterInfos[0].statistics?.[0],f=r(this.outputPixelType);return{...t,indexedColormap:u,offset:m,zFactor:o,gcsFactor:this.isGCS?l:1,pixelSizeFactor:p?i:0,pixelSizePower:p?n:0,minValue:d?.min??0,maxValue:d?.max??8e3,isOutputRounded:f}}};e([t({json:{write:!0,name:"rasterFunction"}})],h.prototype,"functionName",void 0),e([t({type:n,json:{write:!0,name:"rasterFunctionArguments"}})],h.prototype,"functionArguments",void 0),e([t()],h.prototype,"rasterArgumentNames",void 0),e([t({json:{write:!0}})],h.prototype,"isGCS",void 0),e([t({json:{write:!0}})],h.prototype,"lookup",void 0),h=e([s("esri.layers.raster.functions.ShadedReliefFunction")],h);const x=h;export{x as default};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as o}from"../formats/pixelRangeUtils.js";import r from"./BaseRasterFunction.js";import{createColormapLUT as i}from"./pixelUtils.js";import n from"./ShadedReliefFunctionArguments.js";import{getHillshadeOptions as a,hillshade as p,tintHillshade as u,calculateHillshadeParams as c,gcsFactor as l}from"./surfaceUtils.js";import{convertColorRampToColormap as m,createHsvMap as d}from"../../../renderers/support/colorRampUtils.js";import{isColormapSupportedByWebGL as f}from"../../../renderers/support/rasterRendererChecks.js";let h=class extends r{constructor(){super(...arguments),this.functionName="ShadedRelief",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const e=this.sourceRasterInfos[0];if(e.bandCount>1)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: source data must be single band"};let{colorRamp:t,colormap:s}=this.functionArguments;if(!t&&!s?.length)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: a color ramp argument must be specified"};this.outputPixelType=this._getOutputPixelType("u8");const o=e.clone();this._removeStatsHistColormapVAT(o),o.pixelType=this.outputPixelType,o.bandCount=3,o.statistics=[{min:0,max:255,avg:60,stddev:10},{min:0,max:255,avg:60,stddev:10},{min:0,max:255,avg:60,stddev:10}],this.rasterInfo=o,this.isGCS=o.spatialReference?.isGeographic??!1,s?.length||(s=m(t,{interpolateAlpha:!0}));const{indexedColormap:r,offset:n}=i({colormap:s});if(!r?.length)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: a valid colorramp is required"};const a=d(r);return this.lookup={indexedColormap:r,offset:n,hsvMap:a},{success:!0,supportsGPU:f(r)}}_processPixels(e){const t=e.pixelBlocks?.[0];if(!t||!this.lookup)return null;let s=e.primaryPixelSizes?.[0];if(null==s){const{extent:o}=e;s=o?{x:o.width/t.width,y:o.height/t.height}:{x:1,y:1}}const o=a(this.functionArguments,s,this.isGCS),r=p(t,o),i=this.sourceRasterInfos[0].statistics?.[0]??{min:0,max:8e3};return u(r,t,this.lookup.hsvMap,i),r.pixelType=this.outputPixelType,r}_getWebGLParameters(){const e=a(this.functionArguments,{x:1,y:1},this.isGCS),t=c(e),{slopeType:s,zFactor:r,pixelSizeFactor:i,pixelSizePower:n}=this.functionArguments,p="scaled"===s,{indexedColormap:u,offset:m}=this.lookup,d=this.sourceRasterInfos[0].statistics?.[0],f=o(this.outputPixelType);return{...t,indexedColormap:u,offset:m,zFactor:r,gcsFactor:this.isGCS?l:1,pixelSizeFactor:p?i:0,pixelSizePower:p?n:0,minValue:d?.min??0,maxValue:d?.max??8e3,isOutputRounded:f}}_getNeighborhoodSize(){return{rows:3,cols:3}}};e([t({json:{write:!0,name:"rasterFunction"}})],h.prototype,"functionName",void 0),e([t({type:n,json:{write:!0,name:"rasterFunctionArguments"}})],h.prototype,"functionArguments",void 0),e([t()],h.prototype,"rasterArgumentNames",void 0),e([t({json:{write:!0}})],h.prototype,"isGCS",void 0),e([t({json:{write:!0}})],h.prototype,"lookup",void 0),h=e([s("esri.layers.raster.functions.ShadedReliefFunction")],h);const x=h;export{x as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{property as e,subclass as s}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as i}from"../formats/pixelRangeUtils.js";import o from"./BaseRasterFunction.js";import r from"./SlopeFunctionArguments.js";import{slope as n,gcsFactor as p}from"./surfaceUtils.js";let u=class extends o{constructor(){super(...arguments),this.functionName="Slope",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(t),t.statistics="percent-rise"!==this.functionArguments.slopeType?[{min:0,max:90,avg:1,stddev:1}]:null,t.bandCount=1,this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{zFactor:s,slopeType:i,pixelSizePower:o,pixelSizeFactor:r}=this.functionArguments,{isGCS:p}=this,{extent:u,primaryPixelSizes:a}=t,c=a?.[0],l=c??(u?{x:u.width/e.width,y:u.height/e.height}:{x:1,y:1});return n(e,{zFactor:s,slopeType:i,pixelSizePower:o,pixelSizeFactor:r,isGCS:p,resolution:l})}_getWebGLParameters(){const{zFactor:t,slopeType:e,pixelSizeFactor:s,pixelSizePower:o}=this.functionArguments;return{zFactor:this.isGCS&&t>=1?t*p:t,slopeType:e,pixelSizeFactor:s??0,pixelSizePower:o??0,isOutputRounded:i(this.outputPixelType)}}};t([e({json:{write:!0,name:"rasterFunction"}})],u.prototype,"functionName",void 0),t([e({type:r,json:{write:!0,name:"rasterFunctionArguments"}})],u.prototype,"functionArguments",void 0),t([e()],u.prototype,"rasterArgumentNames",void 0),t([e({json:{write:!0}})],u.prototype,"isGCS",void 0),u=t([s("esri.layers.raster.functions.SlopeFunction")],u);const a=u;export{a as default};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as i}from"../formats/pixelRangeUtils.js";import o from"./BaseRasterFunction.js";import r from"./SlopeFunctionArguments.js";import{slope as n,gcsFactor as p}from"./surfaceUtils.js";let u=class extends o{constructor(){super(...arguments),this.functionName="Slope",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const e=this.sourceRasterInfos[0].clone();return e.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(e),e.statistics="percent-rise"!==this.functionArguments.slopeType?[{min:0,max:90,avg:1,stddev:1}]:null,e.bandCount=1,this.rasterInfo=e,this.isGCS=e.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(e){const t=e.pixelBlocks?.[0];if(null==t)return null;const{zFactor:s,slopeType:i,pixelSizePower:o,pixelSizeFactor:r}=this.functionArguments,{isGCS:p}=this,{extent:u,primaryPixelSizes:a}=e,c=a?.[0],l=c??(u?{x:u.width/t.width,y:u.height/t.height}:{x:1,y:1});return n(t,{zFactor:s,slopeType:i,pixelSizePower:o,pixelSizeFactor:r,isGCS:p,resolution:l})}_getWebGLParameters(){const{zFactor:e,slopeType:t,pixelSizeFactor:s,pixelSizePower:o}=this.functionArguments;return{zFactor:this.isGCS&&e>=1?e*p:e,slopeType:t,pixelSizeFactor:s??0,pixelSizePower:o??0,isOutputRounded:i(this.outputPixelType)}}_getNeighborhoodSize(){return{rows:3,cols:3}}};e([t({json:{write:!0,name:"rasterFunction"}})],u.prototype,"functionName",void 0),e([t({type:r,json:{write:!0,name:"rasterFunctionArguments"}})],u.prototype,"functionArguments",void 0),e([t()],u.prototype,"rasterArgumentNames",void 0),e([t({json:{write:!0}})],u.prototype,"isGCS",void 0),u=e([s("esri.layers.raster.functions.SlopeFunction")],u);const a=u;export{a as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{property as s,subclass as e}from"../../../core/accessorSupport/decorators.js";import{getPixelValueRange as o}from"../formats/pixelRangeUtils.js";import r from"./BaseRasterFunction.js";import{computeFocalStatistics as i}from"./focalStatUtils.js";import n from"./StatisticsFunctionArguments.js";let u=class extends r{constructor(){super(...arguments),this.functionName="Statistics",this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{type:t}=this.functionArguments.toJSON();if(t<1||t>7)return{success:!1,supportsGPU:!1,error:`statistics-function: the given statistics type is not supported ${t}`};const s=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(s.pixelType);const e=s.clone();e.pixelType=this.outputPixelType;const{statisticsType:o}=this.functionArguments;"stddev"===o&&this._removeStatsHistColormapVAT(e),this.rasterInfo=e;return{success:!0,supportsGPU:e.bandCount<=3&&t<5}}_processPixels(t){const s=t.pixelBlocks?.[0];if(null==s)return s;const{statisticsType:e,rows:o,cols:r,fillNoDataOnly:n}=this.functionArguments;return i(s,{kernelRows:o,kernelCols:r,fillNoDataOnly:n,outputPixelType:this.outputPixelType,statisticsType:e,mirrorEdges:!0})}_getWebGLParameters(){const{rows:t,cols:s,statisticsType:e,fillNoDataOnly:r}=this.functionArguments;return{fillNoDataOnly:r,kernelRows:t,kernelCols:s,statisticsType:e,clampRange:o(this.outputPixelType)}}};t([s({json:{write:!0,name:"rasterFunction"}})],u.prototype,"functionName",void 0),t([s({type:n,json:{write:!0,name:"rasterFunctionArguments"}})],u.prototype,"functionArguments",void 0),t([s()],u.prototype,"rasterArgumentNames",void 0),u=t([e("esri.layers.raster.functions.StatisticsFunction")],u);const a=u;export{a as default};
2
+ import{__decorate as t}from"tslib";import{property as s,subclass as e}from"../../../core/accessorSupport/decorators.js";import{getPixelValueRange as o}from"../formats/pixelRangeUtils.js";import r from"./BaseRasterFunction.js";import{computeFocalStatistics as i}from"./focalStatUtils.js";import n from"./StatisticsFunctionArguments.js";let c=class extends r{constructor(){super(...arguments),this.functionName="Statistics",this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{type:t}=this.functionArguments.toJSON();if(t<1||t>7)return{success:!1,supportsGPU:!1,error:`statistics-function: the given statistics type is not supported ${t}`};const s=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(s.pixelType);const e=s.clone();e.pixelType=this.outputPixelType;const{statisticsType:o}=this.functionArguments;"stddev"===o&&this._removeStatsHistColormapVAT(e),this.rasterInfo=e;return{success:!0,supportsGPU:e.bandCount<=3&&t<5}}_processPixels(t){const s=t.pixelBlocks?.[0];if(null==s)return s;const{statisticsType:e,rows:o,cols:r,fillNoDataOnly:n}=this.functionArguments;return i(s,{kernelRows:o,kernelCols:r,fillNoDataOnly:n,outputPixelType:this.outputPixelType,statisticsType:e,mirrorEdges:!0})}_getWebGLParameters(){const{rows:t,cols:s,statisticsType:e,fillNoDataOnly:r}=this.functionArguments;return{fillNoDataOnly:r,kernelRows:t,kernelCols:s,statisticsType:e,clampRange:o(this.outputPixelType)}}_getNeighborhoodSize(){const{rows:t,cols:s}=this.functionArguments;return{rows:t,cols:s}}};t([s({json:{write:!0,name:"rasterFunction"}})],c.prototype,"functionName",void 0),t([s({type:n,json:{write:!0,name:"rasterFunctionArguments"}})],c.prototype,"functionArguments",void 0),t([s()],c.prototype,"rasterArgumentNames",void 0),c=t([e("esri.layers.raster.functions.StatisticsFunction")],c);const u=c;export{u as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{numberMaxFloat32 as t}from"../../../core/mathUtils.js";import{getPixelValueRange as e}from"../formats/pixelRangeUtils.js";import n from"../../support/PixelBlock.js";const l=9,i="PixelID";function o(t){return null!=t&&t.pixels?.length>0}function r(t,e){return e?.length&&o(t)?t.extractBands(e):t}function s(t){if(!t?.length||t.some(t=>!o(t)))return null;if(1===t.length)return t[0]?.clone()??null;const e=t,{width:l,height:i,pixelType:r}=e[0];if(e.some(t=>t.width!==l||t.height!==i))return null;const s=e.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&&k(s.slice(1),a));const f=[];e.forEach(({pixels:t})=>f.push(...t));const h=null!=a&&f.length===e.length?e.map(({width:t,height:e,mask:n})=>n??new Uint8Array(t*e).fill(255)):null,c=e.map(({statistics:t})=>t).filter(t=>t?.length),u=[];return c.forEach(t=>u.push(...t)),new n({pixelType:r,width:l,height:i,mask:a,bandMasks:h,pixels:f,statistics:u.length?u:null})}function a(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(!o(t))return t;if(!e||!e.indexedColormap&&!e.indexed2DColormap)return t;const n=t.clone(),l=n.pixels;let i=n.mask;const r=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:s,indexed2DColormap:a,offset:f,alphaSpecified:h}=e,c=l[0],u=new Uint8Array(c.length),p=new Uint8Array(c.length),d=new Uint8Array(c.length);let x,g=0;if(s){const t=s.length-1;if(null!=i)for(let e=0;e<r;e++)i[e]&&(g=4*(c[e]-f),g<f||g>t?i[e]=0:(u[e]=s[g],p[e]=s[g+1],d[e]=s[g+2],i[e]=s[g+3]));else{i=new Uint8Array(r);for(let e=0;e<r;e++)g=4*(c[e]-f),g<f||g>t?i[e]=0:(u[e]=s[g],p[e]=s[g+1],d[e]=s[g+2],i[e]=s[g+3]);n.mask=i}}else if(a)if(null!=i)for(let o=0;o<r;o++)i[o]&&(x=a[c[o]],u[o]=x[0],p[o]=x[1],d[o]=x[2],i[o]=x[3]);else{i=new Uint8Array(r);for(let t=0;t<r;t++)x=a[c[t]],u[t]=x[0],p[t]=x[1],d[t]=x[2],i[t]=x[3];n.mask=i}return n.pixels=[u,p,d],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=h,n}function h(t,e){if(!o(t))return null;const{pixels:l,mask:i}=t,r=l.length;let s=e.lut;const{offset:a}=e;s&&1===s[0].length&&(s=l.map(()=>s));const f=[],h=e.outputPixelType||"u8";for(let n=0;n<r;n++){const t=c(l[n],i,s[n],a||0,h);f.push(t)}const u=new n({width:t.width,height:t.height,pixels:f,mask:i,pixelType:h});return u.updateStatistics(),u}function c(t,e,l,i,o){const r=t.length,s=n.createEmptyBand(o,r);if(e)for(let n=0;n<r;n++)e[n]&&(s[n]=l[t[n]-i]);else for(let n=0;n<r;n++)s[n]=l[t[n]-i];return s}function u(t,e,n,l){const{width:i,height:o,pixels:r,mask:s}=t,a=i*o,{bandId:f,ranges:h}=n,c=r[f];if(!c)return;const u=1===h.length,[p,d]=h[0];for(let x=0;x<a;x++)if(!s||s[x]){const t=c[x];if(u)t>=p&&t<=d&&(e[x]=l);else for(let n=0;n<h.length;n++){const[i,o]=h[n];if(t>=i&&t<=o){e[x]=l;break}}}}function p(t,e,n,l){const{width:i,height:o,xyMask:r,xBandId:s,yBandId:a,xBandRange:f,yBandRange:h}=n,{pixels:c,mask:u}=t,p=c[s],d=c[a],[x,g]=f,[m,y]=h,w=(g-x)/i,k=(y-m)/o;for(let M=0;M<p.length;M++)if(!u||u[M]){let t=p[M],n=d[M];if(t<x||t>g||n<m||n>y)continue;r?(t=(t-x)*w,t=t>i-1?i-1:t<0?0:255&t,n=(y-n)*k,n=n>o-1?o-1:n<0?0:255&n,r[n*i+t]&&(e[M]=l)):e[M]=l}}function d(t){const{pixelBlock:e,renderedPixelBlock:n,highlightOptions:l}=t;if(!o(e))return;const{width:i,height:r}=e,s=i*r,a=new Uint8Array(s);for(let o=1;o<=l.length;o++){const t=l[o-1];"bandId"in t?u(e,a,t,o):p(e,a,t,o)}const{pixels:f}=n;1===f.length&&(f[1]=f[0].slice(),f[2]=f[0].slice());const h=l.map(t=>t.color),[c,d,x]=f;if(n.mask){const t=n.mask;for(let e=0;e<s;e++)if(t[e]){t[e]=255;const n=a[e];if(n){const l=h[n-1];c[e]=l[0],d[e]=l[1],x[e]=l[2],t[e]=l[3]}}}else{const t=new Uint8Array(s).fill(255);for(let e=0;e<s;e++){const n=a[e];if(n){const l=h[n-1];c[e]=l[0],d[e]=l[1],x[e]=l[2],t[e]=l[3]}}n.mask=t}n.maskIsAlpha=!0}function x(t,e){if(!o(t))return null;const n=t.clone(),{pixels:l}=n,i=n.width*n.height,r=e.length,s=Math.floor(r/2),a=e[Math.floor(s)],f=l[0],h=new Uint8Array(i),c=new Uint8Array(i),u=new Uint8Array(i);let p=n.mask;const d=4===e[0].mappedColor.length;p||(p=new Uint8Array(i),p.fill(d?255:1),n.mask=p);for(let o=0;o<i;o++)if(p[o]){const t=f[o];let n=!1,l=s,i=a,d=0,x=r-1;for(;x-d>1;){if(t===i.value){n=!0;break}t>i.value?d=l:x=l,l=Math.floor((d+x)/2),i=e[Math.floor(l)]}n||(t===e[d].value?(i=e[d],n=!0):t===e[x].value?(i=e[x],n=!0):t<e[d].value?n=!1:t>e[d].value&&(t<e[x].value?(i=e[d],n=!0):x===r-1?n=!1:(i=e[x],n=!0))),n?(h[o]=i.mappedColor[0],c[o]=i.mappedColor[1],u[o]=i.mappedColor[2],p[o]=i.mappedColor[3]):h[o]=c[o]=u[o]=p[o]=0}return n.pixels=[h,c,u],n.mask=p,n.pixelType="u8",n.maskIsAlpha=d,n}function g(e,n,i=!1){const o=1e-5,r=new Float32Array(3*l),s=n.length;for(let a=0;a<l;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]-=o),e[2*a+1]!==e[2*a]&&(a<s-1||!i)&&(r[3*a+1]-=o));return r}function m(t,l){if(!o(t))return null;const{width:i,height:r}=t,{inputRanges:s,outputValues:a,outputPixelType:f,noDataRanges:h,allowUnmatched:c,replacementValue:u,isLastInputRangeInclusive:p}=l,d=t.pixels[0],x=n.createEmptyBand(f,d.length),g=t.mask,m=new Uint8Array(i*r);g?m.set(g):m.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]=e(f);for(let e=0;e<r;e++)for(let t=0;t<i;t++){const n=e*i+t;if(m[n]){const t=d[n];let e=!1;for(let l=k-1;l>=0;l--)if(t===s[2*l]||t>w[2*l]&&t<w[2*l+1]){x[n]=a[l],e=!0;break}e||(c?x[n]=t>A?A:t<M?M:u??t:m[n]=0)}}const U=h?.length;if(U)for(let e=0;e<r;e++)for(let t=0;t<i;t++){const n=e*i+t;if(!g||g[n]){const t=d[n];for(let e=0;e<U;e+=2)if(t>=h[e]&&t<=h[e+1]){x[n]=0,m[n]=0;break}}}return new n({width:i,height:r,pixelType:f,pixels:[x],mask:m})}function y(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 w(t,e){const n=t[0].length;e??=new Uint8Array(n).fill(255);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)}return e}function k(t,e){const n=t[0].length;e??=new Uint8Array(n).fill(255);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)}return e}function M(t,e){if(!o(t))return null;const{width:l,height:i,pixels:r}=t,s=l*i,a=new Uint8Array(s);t.mask?a.set(t.mask):a.fill(255);const f=r.length,{includedRanges:h,noDataValues:u,outputPixelType:p,matchAll:d,lookups:x}=e;if(x){const t=[];for(let e=0;e<f;e++){const n=x[e],l=c(r[e],a,n.lut,n.offset||0,"u8");t.push(l)}1===t.length?a.set(t[0]):d?w(t,a):k(t,a)}else if(d){const t=[];for(let e=0;e<f;e++){const n=new Uint8Array(s);n.set(a),y(r[e],h?.slice(2*e,2*e+2),u?.[e],n),t.push(n)}1===t.length?a.set(t[0]):w(t,a)}else for(let n=0;n<f;n++)y(r[n],h?.slice(2*n,2*n+2),u?.[n],a);return new n({width:l,height:i,pixelType:p,pixels:r,mask:a})}function A(t){const{srcPixelType:l,inputRanges:i,outputValues:o,allowUnmatched:r,noDataRanges:s,isLastInputRangeInclusive:a,outputPixelType:f}=t;if("u8"!==l&&"s8"!==l&&"u16"!==l&&"s16"!==l)return null;const h=l.includes("16")?65536:256,c=l.includes("s")?-h/2:0,u=n.createEmptyBand(f,h),p=new Uint8Array(h);r&&p.fill(255);const[d,x]=e(f);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]>x?x:o[n]<d?d:o[n],l=Math.ceil(e[2*n]-c),r=i[2*n+1]===i[2*n]?l:Math.floor(e[2*n+1]-c);for(let e=l;e<=r;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 U(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 b(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 T(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)),f=Math.max.apply(null,r.map(t=>t.extent.xmax)),h=Math.max.apply(null,r.map(t=>t.extent.ymax)),c={x:Math.round((e.xmin-s)/l),y:Math.round((h-e.ymax)/i)},u={width:Math.round((f-s)/l),height:Math.round((h-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:S(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:f}=n.offset,{width:h,height:c}=n.mosaic,u=b(r,s,l,i,a,f,h,c);let p=0,d=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?d=o.rightPadding:n>=t&&(p=o.leftMargin-o.rightPadding,d=0)}if(u.xmax-=d,"number"!=typeof e)for(let x=u.ymin;x<u.ymax;x++){const n=(i*s+x-f)*h+(l*r-a)+p,o=x*r;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e[o+l]}else for(let x=u.ymin;x<u.ymax;x++){const n=(i*s+x-f)*h+(l*r-a)+p;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e}}function S(t,e,l={}){const{clipOffset:i,clipSize:r,alignmentInfo:s,blockWidths:a}=l;if(a)return v(t,e,{blockWidths:a});const f=t.find(t=>o(t));if(null==f)return null;const h=r?r.width:e.width,c=r?r.height:e.height,u=f.width,p=f.height,d=e.width/u,x=e.height/p,g={offset:i||{x:0,y:0},mosaic:r||e,block:{width:u,height:p}},m=f.pixelType,y=n.getPixelArrayConstructor(m),w=f.pixels.length,k=[];let M,A;for(let n=0;n<w;n++){A=new y(h*c);for(let e=0;e<x;e++)for(let l=0;l<d;l++){const i=t[e*d+l];o(i)&&(M=i.pixels[n],B(A,M,g,l,e,s))}k.push(A)}const U=t.some(t=>null==t||null!=t.mask&&t.mask.length>0),b=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),T=U?new Uint8Array(h*c):void 0,S=b?[]:void 0;if(T){for(let e=0;e<x;e++)for(let n=0;n<d;n++){const l=t[e*d+n],i=null!=l?l.mask:null;B(T,null!=i?i:l?255:0,g,n,e,s)}if(S)for(let e=0;e<w;e++){const n=new Uint8Array(h*c);for(let l=0;l<x;l++)for(let i=0;i<d;i++){const o=t[l*d+i],r=o?.bandMasks?.[e]??o?.mask;B(n,null!=r?r:o?255:0,g,i,l,s)}S.push(n)}}const C=new n({width:h,height:c,pixels:k,pixelType:m,bandMasks:S,mask:T});return C.updateStatistics(),C}function v(t,e,l){const i=t.find(t=>null!=t);if(null==i)return null;const r=t.some(t=>null==t||!!t.mask),{width:s,height:a}=e,f=r?new Uint8Array(s*a):null,{blockWidths:h}=l,c=[],u=i.getPlaneCount(),p=n.getPixelArrayConstructor(i.pixelType);if(r)for(let n=0,y=0;n<t.length;y+=h[n],n++){const e=t[n];if(!o(e))continue;const l=e.mask;for(let t=0;t<a;t++)for(let i=0;i<h[n];i++)f[t*s+i+y]=null==l?255:l[t*e.width+i]}const d=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),x=d?[]:void 0,g=s*a;for(let n=0;n<u;n++){const e=new p(g),l=d?new Uint8Array(g):void 0;for(let i=0,r=0;i<t.length;r+=h[i],i++){const f=t[i];if(!o(f))continue;const c=f.pixels[n];if(null!=c){for(let t=0;t<a;t++)for(let n=0;n<h[i];n++)e[t*s+n+r]=c[t*f.width+n];if(l){const t=f.bandMasks?.[n]??f.mask;for(let e=0;e<a;e++)for(let n=0;n<h[i];n++)l[e*s+n+r]=t?t[e*f.width+n]:255}}}c.push(e),x&&l&&x.push(l)}const m=new n({width:s,height:a,mask:f,bandMasks:x,pixels:c,pixelType:i.pixelType});return m.updateStatistics(),m}function C(t,e,n){if(!o(t))return null;const{width:l,height:i}=t,r=e.x,s=e.y,a=n.width+r,f=n.height+s;if(r<0||s<0||a>l||f>i)return t;if(0===r&&0===s&&a===l&&f===i)return t;t.mask||(t.mask=new Uint8Array(l*i));const h=t.mask;for(let o=0;o<i;o++){const t=o*l;for(let e=0;e<l;e++)h[t+e]=o<s||o>=f||e<r||e>=a?0:1}return t.updateStatistics(),t}function I(t){if(!o(t))return null;const e=t.clone(),{width:n,height:l,pixels:i}=t,r=i[0],s=e.pixels[0],a=t.mask;for(let o=2;o<l-1;o++){const t=new Map;for(let l=o-2;l<o+2;l++)for(let e=0;e<4;e++){const i=l*n+e;_(t,r[i],a?a[i]:1)}s[o*n]=R(t),s[o*n+1]=s[o*n+2]=s[o*n];let e=3;for(;e<n-1;e++){let l=(o-2)*n+e+1;_(t,r[l],a?a[l]:1),l=(o-1)*n+e+1,_(t,r[l],a?a[l]:1),l=o*n+e+1,_(t,r[l],a?a[l]:1),l=(o+1)*n+e+1,_(t,r[l],a?a[l]:1),l=(o-2)*n+e-3,P(t,r[l],a?a[l]:1),l=(o-1)*n+e-3,P(t,r[l],a?a[l]:1),l=o*n+e-3,P(t,r[l],a?a[l]:1),l=(o+1)*n+e-3,P(t,r[l],a?a[l]:1),s[o*n+e]=R(t)}s[o*n+e+1]=s[o*n+e]}for(let o=0;o<n;o++)s[o]=s[n+o]=s[2*n+o],s[(l-1)*n+o]=s[(l-2)*n+o];return e.updateStatistics(),e}function R(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 F(t,e,l){let{x:i,y:r}=e;const{width:s,height:a}=l;if(0===i&&0===r&&a===t.height&&s===t.width)return t;const{width:f,height:h}=t,c=Math.max(0,r),u=Math.max(0,i),p=Math.min(i+s,f),d=Math.min(r+a,h);if(p<0||d<0||!o(t))return null;i=Math.max(0,-i),r=Math.max(0,-r);const{pixels:x}=t,g=s*a,m=x.length,y=[];for(let o=0;o<m;o++){const e=x[o],l=n.createEmptyBand(t.pixelType,g);for(let t=c;t<d;t++){const n=t*f;let o=(t+r-c)*s+i;for(let t=u;t<p;t++)l[o++]=e[n+t]}y.push(l)}const w=new Uint8Array(g),k=t.mask;for(let n=c;n<d;n++){const t=n*f;let e=(n+r-c)*s+i;for(let n=u;n<p;n++)w[e++]=k?k[t+n]:1}const M=new n({width:l.width,height:l.height,pixelType:t.pixelType,pixels:y,mask:w});return M.updateStatistics(),M}function W(t,e=!0){if(!o(t))return null;const{pixels:l,width:i,height:r,mask:s,pixelType:a}=t,f=[],h=Math.round(i/2),c=Math.round(r/2),u=r-1,p=i-1;for(let o=0;o<l.length;o++){const t=l[o],s=n.createEmptyBand(a,h*c);let d=0;for(let n=0;n<r;n+=2)for(let l=0;l<i;l+=2){const o=t[n*i+l];if(e){const e=l===p?o:t[n*i+l+1],r=n===u?o:t[n*i+l+i],a=l===p?r:n===u?e:t[n*i+l+i+1];s[d++]=(o+e+r+a)/4}else s[d++]=o}f.push(s)}let d=null;if(null!=s){d=new Uint8Array(h*c);let t=0;for(let n=0;n<r;n+=2)for(let l=0;l<i;l+=2){const o=s[n*i+l];if(e){const e=l===p?o:s[n*i+l+1],r=n===u?o:s[n*i+l+i],a=l===p?r:n===u?e:s[n*i+l+i+1];d[t++]=o*e*r*a?1:0}else d[t++]=o}}return new n({width:h,height:c,pixelType:a,pixels:f,mask:d})}function E(t,e,n=0,l=!0){if(!o(t))return null;const{width:i,height:r}=e;let{width:s,height:a}=t;const f=new Map,h={x:0,y:0},c=1+n;let u=t;for(let o=0;o<c;o++){const t=Math.ceil(s/i),n=Math.ceil(a/r);for(let l=0;l<n;l++){h.y=l*r;for(let n=0;n<t;n++){h.x=n*i;const t=F(u,h,e);f.set(`${o}/${l}/${n}`,t)}}o<c-1&&(u=W(u,l)),s=Math.round(s/2),a=Math.round(a/2)}return f}function D(t){const{pixelBlock:e,tileSize:n,level:l,row:i,col:r,useBilinear:s}=t;if(!o(e))return null;const{width:a,height:f}=n,h=2**l,c=h*a,u=h*f;let p=F(e,{y:i*u,x:r*c},{width:c,height:u});if(!p)return null;for(let o=l;o>0;o--)p=W(p,s);return p}function N(t,e,n,l,i=0){const{width:o,height:r}=t,{width:s,height:a}=e,f=l.cols,h=l.rows,c=Math.ceil(s/f-.1/f),u=Math.ceil(a/h-.1/h);let p,d,x,g,m,y,w;const k=c*f,M=k*u*h,A=new Float32Array(M),U=new Float32Array(M),b=new Uint32Array(M),T=new Uint32Array(M);let B,S,v=0;for(let C=0;C<u;C++)for(let t=0;t<c;t++){p=12*(C*c+t),d=n[p],x=n[p+1],g=n[p+2],m=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<h;e++){v=(C*h+e)*k+t*f,S=(e+.5)/h;for(let t=0;t<e;t++)B=(t+.5)/f,A[v+t]=(d*B+x*S+g)*o+i,U[v+t]=(m*B+y*S+w)*r+i,b[v+t]=Math.floor(A[v+t]),T[v+t]=Math.floor(U[v+t])}p+=6,d=n[p],x=n[p+1],g=n[p+2],m=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<h;e++){v=(C*h+e)*k+t*f,S=(e+.5)/h;for(let t=e;t<f;t++)B=(t+.5)/f,A[v+t]=(d*B+x*S+g)*o+i,U[v+t]=(m*B+y*S+w)*r+i,b[v+t]=Math.floor(A[v+t]),T[v+t]=Math.floor(U[v+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}=N(t,t,n,{rows:l[0],cols:l[1]}),{width:s,height:a}=t,f=new Float32Array(s*a),h=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))f[c*s+t]=90;else{let e=Math.atan2(p,u)*h;e=(360+e)%360,f[c*s+t]=e}}return f}function O(t,e,l,i,r="nearest"){if(!o(t))return null;"majority"===r&&(t=I(t));const{pixels:s,mask:a,bandMasks:f,pixelType:h}=t,c=t.width,u=t.height,p=n.getPixelArrayConstructor(h),d=s.length,{width:x,height:g}=e;let m=!1;for(let n=0;n<l.length;n+=3)-1===l[n]&&-1===l[n+1]&&-1===l[n+2]&&(m=!0);const{offsets_x:y,offsets_y:w,offsets_xi:k,offsets_yi:M,gridWidth:A}=N({width:c,height:u},e,l,i,"majority"===r?.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<g;o++){U=o*A;for(let r=0;r<x;r++){if(y[U]<0||w[U]<0)t[o*x+r]=0;else if(l)t[o*x+r]=e[k[U]+M[U]*c];else{const l=Math.floor(y[U]),s=Math.floor(w[U]),a=Math.ceil(y[U]),f=Math.ceil(w[U]),h=y[U]-l,u=w[U]-s;if(!n||n[l+s*c]&&n[a+s*c]&&n[l+f*c]&&n[a+f*c]){const n=(1-h)*e[l+s*c]+h*e[a+s*c],p=(1-h)*e[l+f*c]+h*e[a+f*c];t[o*x+r]=(1-u)*n+u*p+i}else t[o*x+r]=e[k[U]+M[U]*c]}U++}}},T=[];let B;const S=f?.length===d,v=[];for(let n=0;n<d;n++){if(S){const t=new Uint8Array(x*g);b(t,f[n],f[n],!0),v.push(t)}B=new p(x*g),b(B,s[n],S?f[n]:a,"nearest"===r||"majority"===r),T.push(B)}const C=new n({width:x,height:g,pixelType:h,pixels:T,bandMasks:S?v:void 0});if(null!=a)C.mask=new Uint8Array(x*g),b(C.mask,a,a,!0);else if(m){C.mask=new Uint8Array(x*g);for(let t=0;t<x*g;t++)C.mask[t]=y[t]<0||w[t]<0?0:1}return C.updateStatistics(),C}function z(t){const{pixelBlock:e,extent:n,fieldNames:l,skipFactor:o,skipSpatialReference:r=!1,pixelIdOffset:s=0}=t,a=[],{width:f,height:h,pixels:c,mask:u}=e,p=t.imageRowSize??f,d=n.width/f,x=n.height/h,g=c.length,m=Math.floor(o/2),{xmin:y,ymax:w}=n,k=r?void 0:n.spatialReference.toJSON();for(let M=m;M<h;M+=o)for(let t=m;t<f;t+=o){const e=M*f+t;if(!u||u[e]){const n={x:y+(t+.5)*d,y:w-(M+.5)*x,spatialReference:k},o={[i]:s+M*p+t};for(let t=0;t<g;t++)o[l[t+1]]=c[t][e];a.push({geometry:n,attributes:o})}}return a}function L(t,e){const{width:n,height:l,pixels:i,mask:o}=t,r=i[0];let s=0;for(let a=0;a<l;a++){let t=a*n;for(let l=0;l<n;l++,t++)o&&!o[t]||(e[r[t]]++,s++)}return s}function V(t,e){const{width:n,height:l,pixels:i,mask:o}=t,r=e.width/n,s=e.height/l,{xmin:a,ymax:f}=e,h=e.spatialReference.toJSON(),c=[];for(let u=0;u<l;u++)for(let t=0;t<n;t++){const e=u*n+t;if(!o||o[e]){const n={x:a+(t+.5)*r,y:f-(u+.5)*s,spatialReference:h},l=i.map(t=>t[e]);c.push({location:n,value:l})}}return c}function $(t,e,l){const{attributeTable:i}=e;if(!i)return t;const o=i.fields.find(t=>t.name.toLowerCase()===l.toLowerCase()),r=i.fields.find(t=>"value"===t.name.toLowerCase());if(!o||!r)return t;const[s]=t.pixels,a="single"===o.type?"f32":"double"===o.type||"big-integer"===o.type?"f64":"small-integer"===o.type?"s16":"s32",f=s.length,h=new("f32"===a?Float32Array:"f64"===a?Float64Array:"s16"===a?Int16Array:Int32Array)(f),c=new Map;for(const n of i.features){const t=n.attributes[r.name],e=n.attributes[o.name];c.set(t,e)}const u=t.mask??new Uint8Array(f).fill(255);for(let n=0;n<f;n++)if(u[n]){const t=c.get(s[n]);null==t?u[n]=0:h[n]=t}return new n({width:t.width,height:t.height,pixels:[h],mask:u,pixelType:a})}export{O as approximateTransform,F as clip,D as clipTile,f as colorize,s as compositeBands,z as convertPixelBlockToFeatures,L as countCategoricalPixels,a as createColormapLUT,U as createMaskLUT,g as createRangeMaps,A as createRemapLUT,r as extractBands,b as getClipBounds,j as getLocalArithmeticNorthRotations,V as getValidPixels,d as highlightPixels,N as interpolateOffsets,o as isValidPixelBlock,c as lookupBandValues,h as lookupPixels,$ as mapPixelValueToAttribute,M as mask,k as matchAnyMask,l as maxMapSizeGpu,S as mosaic,T as mosaicPixelData,i as pixelIdFieldName,m as remap,x as remapColor,I as resampleByMajority,u as selectBySingleBandRange,p as selectByXYMask,C as setValidBoundary,E as split};
2
+ import{numberMaxFloat32 as t}from"../../../core/mathUtils.js";import{getPixelValueRange as e}from"../formats/pixelRangeUtils.js";import n from"../../support/PixelBlock.js";const l=9,i="PixelID";function o(t){return null!=t&&t.pixels?.length>0}function r(t,e){return e?.length&&o(t)?t.extractBands(e):t}function s(t){if(!t?.length||t.some(t=>!o(t)))return null;if(1===t.length)return t[0]?.clone()??null;const e=t,{width:l,height:i,pixelType:r}=e[0];if(e.some(t=>t.width!==l||t.height!==i))return null;const s=e.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&&k(s.slice(1),a));const h=[];e.forEach(({pixels:t})=>h.push(...t));const f=null!=a&&h.length===e.length?e.map(({width:t,height:e,mask:n})=>n??new Uint8Array(t*e).fill(255)):null,c=e.map(({statistics:t})=>t).filter(t=>t?.length),u=[];return c.forEach(t=>u.push(...t)),new n({pixelType:r,width:l,height:i,mask:a,bandMasks:f,pixels:h,statistics:u.length?u:null})}function a(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 h(t,e){if(!o(t))return t;if(!e||!e.indexedColormap&&!e.indexed2DColormap)return t;const n=t.clone(),l=n.pixels;let i=n.mask;const r=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 d,m=0;if(s){const t=s.length-1;if(null!=i)for(let e=0;e<r;e++)i[e]&&(m=4*(c[e]-h),m<h||m>t?i[e]=0:(u[e]=s[m],p[e]=s[m+1],x[e]=s[m+2],i[e]=s[m+3]));else{i=new Uint8Array(r);for(let e=0;e<r;e++)m=4*(c[e]-h),m<h||m>t?i[e]=0:(u[e]=s[m],p[e]=s[m+1],x[e]=s[m+2],i[e]=s[m+3]);n.mask=i}}else if(a)if(null!=i)for(let o=0;o<r;o++)i[o]&&(d=a[c[o]],u[o]=d[0],p[o]=d[1],x[o]=d[2],i[o]=d[3]);else{i=new Uint8Array(r);for(let t=0;t<r;t++)d=a[c[t]],u[t]=d[0],p[t]=d[1],x[t]=d[2],i[t]=d[3];n.mask=i}return n.pixels=[u,p,x],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=f,n}function f(t,e){if(!o(t))return null;const{pixels:l,mask:i}=t,r=l.length;let s=e.lut;const{offset:a}=e;s&&1===s[0].length&&(s=l.map(()=>s));const h=[],f=e.outputPixelType||"u8";for(let n=0;n<r;n++){const t=c(l[n],i,s[n],a||0,f);h.push(t)}const u=new n({width:t.width,height:t.height,pixels:h,mask:i,pixelType:f});return u.updateStatistics(),u}function c(t,e,l,i,o){const r=t.length,s=n.createEmptyBand(o,r);if(e)for(let n=0;n<r;n++)e[n]&&(s[n]=l[t[n]-i]);else for(let n=0;n<r;n++)s[n]=l[t[n]-i];return s}function u(t,e,n,l){const{width:i,height:o,pixels:r,mask:s}=t,a=i*o,{bandId:h,ranges:f}=n,c=r[h];if(!c)return;const u=1===f.length,[p,x]=f[0];for(let d=0;d<a;d++)if(!s||s[d]){const t=c[d];if(u)t>=p&&t<=x&&(e[d]=l);else for(let n=0;n<f.length;n++){const[i,o]=f[n];if(t>=i&&t<=o){e[d]=l;break}}}}function p(t,e,n,l){const{width:i,height:o,xyMask:r,xBandId:s,yBandId:a,xBandRange:h,yBandRange:f}=n,{pixels:c,mask:u}=t,p=c[s],x=c[a],[d,m]=h,[g,y]=f,w=(m-d)/i,k=(y-g)/o;for(let M=0;M<p.length;M++)if(!u||u[M]){let t=p[M],n=x[M];if(t<d||t>m||n<g||n>y)continue;r?(t=(t-d)*w,t=t>i-1?i-1:t<0?0:255&t,n=(y-n)*k,n=n>o-1?o-1:n<0?0:255&n,r[n*i+t]&&(e[M]=l)):e[M]=l}}function x(t){const{pixelBlock:e,renderedPixelBlock:n,highlightOptions:l}=t;if(!o(e))return;const{width:i,height:r}=e,s=i*r,a=new Uint8Array(s);for(let o=1;o<=l.length;o++){const t=l[o-1];"bandId"in t?u(e,a,t,o):p(e,a,t,o)}const{pixels:h}=n;1===h.length&&(h[1]=h[0].slice(),h[2]=h[0].slice());const f=l.map(t=>t.color),[c,x,d]=h;if(n.mask){const t=n.mask;for(let e=0;e<s;e++)if(t[e]){t[e]=255;const n=a[e];if(n){const l=f[n-1];c[e]=l[0],x[e]=l[1],d[e]=l[2],t[e]=l[3]}}}else{const t=new Uint8Array(s).fill(255);for(let e=0;e<s;e++){const n=a[e];if(n){const l=f[n-1];c[e]=l[0],x[e]=l[1],d[e]=l[2],t[e]=l[3]}}n.mask=t}n.maskIsAlpha=!0}function d(t,e){if(!o(t))return null;const n=t.clone(),{pixels:l}=n,i=n.width*n.height,r=e.length,s=Math.floor(r/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 o=0;o<i;o++)if(p[o]){const t=h[o];let n=!1,l=s,i=a,x=0,d=r-1;for(;d-x>1;){if(t===i.value){n=!0;break}t>i.value?x=l:d=l,l=Math.floor((x+d)/2),i=e[Math.floor(l)]}n||(t===e[x].value?(i=e[x],n=!0):t===e[d].value?(i=e[d],n=!0):t<e[x].value?n=!1:t>e[x].value&&(t<e[d].value?(i=e[x],n=!0):d===r-1?n=!1:(i=e[d],n=!0))),n?(f[o]=i.mappedColor[0],c[o]=i.mappedColor[1],u[o]=i.mappedColor[2],p[o]=i.mappedColor[3]):f[o]=c[o]=u[o]=p[o]=0}return n.pixels=[f,c,u],n.mask=p,n.pixelType="u8",n.maskIsAlpha=x,n}function m(e,n,i=!1){const o=1e-5,r=new Float32Array(3*l),s=n.length;for(let a=0;a<l;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]-=o),e[2*a+1]!==e[2*a]&&(a<s-1||!i)&&(r[3*a+1]-=o));return r}function g(t,l){if(!o(t))return null;const{width:i,height:r}=t,{inputRanges:s,outputValues:a,outputPixelType:h,noDataRanges:f,allowUnmatched:c,replacementValue:u,isLastInputRangeInclusive:p}=l,x=t.pixels[0],d=n.createEmptyBand(h,x.length),m=t.mask,g=new Uint8Array(i*r);m?g.set(m):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]=e(h);for(let e=0;e<r;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===s[2*l]||t>w[2*l]&&t<w[2*l+1]){d[n]=a[l],e=!0;break}e||(c?d[n]=t>A?A:t<M?M:u??t:g[n]=0)}}const U=f?.length;if(U)for(let e=0;e<r;e++)for(let t=0;t<i;t++){const n=e*i+t;if(!m||m[n]){const t=x[n];for(let e=0;e<U;e+=2)if(t>=f[e]&&t<=f[e+1]){d[n]=0,g[n]=0;break}}}return new n({width:i,height:r,pixelType:h,pixels:[d],mask:g})}function y(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 w(t,e){const n=t[0].length;e??=new Uint8Array(n).fill(255);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)}return e}function k(t,e){const n=t[0].length;e??=new Uint8Array(n).fill(255);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)}return e}function M(t,e){if(!o(t))return null;const{width:l,height:i,pixels:r}=t,s=l*i,a=new Uint8Array(s);t.mask?a.set(t.mask):a.fill(255);const h=r.length,{includedRanges:f,noDataValues:u,outputPixelType:p,matchAll:x,lookups:d}=e;if(d){const t=[];for(let e=0;e<h;e++){const n=d[e],l=c(r[e],a,n.lut,n.offset||0,"u8");t.push(l)}1===t.length?a.set(t[0]):x?w(t,a):k(t,a)}else if(x){const t=[];for(let e=0;e<h;e++){const n=new Uint8Array(s);n.set(a),y(r[e],f?.slice(2*e,2*e+2),u?.[e],n),t.push(n)}1===t.length?a.set(t[0]):w(t,a)}else for(let n=0;n<h;n++)y(r[n],f?.slice(2*n,2*n+2),u?.[n],a);return new n({width:l,height:i,pixelType:p,pixels:r,mask:a})}function A(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=n.createEmptyBand(h,f),p=new Uint8Array(f);r&&p.fill(255);const[x,d]=e(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]>d?d:o[n]<x?x:o[n],l=Math.ceil(e[2*n]-c),r=i[2*n+1]===i[2*n]?l:Math.floor(e[2*n+1]-c);for(let e=l;e<=r;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 U(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 b(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 T(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:S(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=b(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 d=u.ymin;d<u.ymax;d++){const n=(i*s+d-h)*f+(l*r-a)+p,o=d*r;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e[o+l]}else for(let d=u.ymin;d<u.ymax;d++){const n=(i*s+d-h)*f+(l*r-a)+p;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e}}function S(t,e,l={}){const{clipOffset:i,clipSize:r,alignmentInfo:s,blockWidths:a}=l;if(a)return v(t,e,{blockWidths:a});const h=t.find(t=>o(t));if(null==h)return null;const f=r?r.width:e.width,c=r?r.height:e.height,u=h.width,p=h.height,x=e.width/u,d=e.height/p,m={offset:i||{x:0,y:0},mosaic:r||e,block:{width:u,height:p}},g=h.pixelType,y=n.getPixelArrayConstructor(g),w=h.pixels.length,k=[];let M,A;for(let n=0;n<w;n++){A=new y(f*c);for(let e=0;e<d;e++)for(let l=0;l<x;l++){const i=t[e*x+l];o(i)&&(M=i.pixels[n],B(A,M,m,l,e,s))}k.push(A)}const U=t.some(t=>null==t||null!=t.mask&&t.mask.length>0),b=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),T=U?new Uint8Array(f*c):void 0,S=b?[]:void 0;if(T){for(let e=0;e<d;e++)for(let n=0;n<x;n++){const l=t[e*x+n],i=null!=l?l.mask:null;B(T,null!=i?i:l?255:0,m,n,e,s)}if(S)for(let e=0;e<w;e++){const n=new Uint8Array(f*c);for(let l=0;l<d;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,m,i,l,s)}S.push(n)}}const C=new n({width:f,height:c,pixels:k,pixelType:g,bandMasks:S,mask:T});return C.updateStatistics(),C}function v(t,e,l){const i=t.find(t=>null!=t);if(null==i)return null;const r=t.some(t=>null==t||!!t.mask),{width:s,height:a}=e,h=r?new Uint8Array(s*a):null,{blockWidths:f}=l,c=[],u=i.getPlaneCount(),p=n.getPixelArrayConstructor(i.pixelType);if(r)for(let n=0,y=0;n<t.length;y+=f[n],n++){const e=t[n];if(!o(e))continue;const l=e.mask;for(let t=0;t<a;t++)for(let i=0;i<f[n];i++)h[t*s+i+y]=null==l?255:l[t*e.width+i]}const x=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),d=x?[]:void 0,m=s*a;for(let n=0;n<u;n++){const e=new p(m),l=x?new Uint8Array(m):void 0;for(let i=0,r=0;i<t.length;r+=f[i],i++){const h=t[i];if(!o(h))continue;const c=h.pixels[n];if(null!=c){for(let t=0;t<a;t++)for(let n=0;n<f[i];n++)e[t*s+n+r]=c[t*h.width+n];if(l){const t=h.bandMasks?.[n]??h.mask;for(let e=0;e<a;e++)for(let n=0;n<f[i];n++)l[e*s+n+r]=t?t[e*h.width+n]:255}}}c.push(e),d&&l&&d.push(l)}const g=new n({width:s,height:a,mask:h,bandMasks:d,pixels:c,pixelType:i.pixelType});return g.updateStatistics(),g}function C(t,e,n){if(!o(t))return null;const{width:l,height:i}=t,r=e.x,s=e.y,a=n.width+r,h=n.height+s;if(r<0||s<0||a>l||h>i)return t;if(0===r&&0===s&&a===l&&h===i)return t;t.mask||(t.mask=new Uint8Array(l*i));const f=t.mask;for(let o=0;o<i;o++){const t=o*l;for(let e=0;e<l;e++)f[t+e]=o<s||o>=h||e<r||e>=a?0:1}return t.updateStatistics(),t}function I(t){if(!o(t))return null;const e=t.clone(),{width:n,height:l,pixels:i}=t,r=i[0],s=e.pixels[0],a=t.mask;for(let o=2;o<l-1;o++){const t=new Map;for(let l=o-2;l<o+2;l++)for(let e=0;e<4;e++){const i=l*n+e;D(t,r[i],a?a[i]:1)}s[o*n]=R(t),s[o*n+1]=s[o*n+2]=s[o*n];let e=3;for(;e<n-1;e++){let l=(o-2)*n+e+1;D(t,r[l],a?a[l]:1),l=(o-1)*n+e+1,D(t,r[l],a?a[l]:1),l=o*n+e+1,D(t,r[l],a?a[l]:1),l=(o+1)*n+e+1,D(t,r[l],a?a[l]:1),l=(o-2)*n+e-3,P(t,r[l],a?a[l]:1),l=(o-1)*n+e-3,P(t,r[l],a?a[l]:1),l=o*n+e-3,P(t,r[l],a?a[l]:1),l=(o+1)*n+e-3,P(t,r[l],a?a[l]:1),s[o*n+e]=R(t)}s[o*n+e+1]=s[o*n+e]}for(let o=0;o<n;o++)s[o]=s[n+o]=s[2*n+o],s[(l-1)*n+o]=s[(l-2)*n+o];return e.updateStatistics(),e}function R(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 D(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function _(t,e,l){let{x:i,y:r}=e;const{width:s,height:a}=l;if(0===i&&0===r&&a===t.height&&s===t.width)return t;const{width:h,height:f}=t,c=Math.max(0,r),u=Math.max(0,i),p=Math.min(i+s,h),x=Math.min(r+a,f);if(p<0||x<0||!o(t))return null;i=Math.max(0,-i),r=Math.max(0,-r);const{pixels:d}=t,m=s*a,g=d.length,y=[];for(let o=0;o<g;o++){const e=d[o],l=n.createEmptyBand(t.pixelType,m);for(let t=c;t<x;t++){const n=t*h;let o=(t+r-c)*s+i;for(let t=u;t<p;t++)l[o++]=e[n+t]}y.push(l)}const w=new Uint8Array(m),k=t.mask;for(let n=c;n<x;n++){const t=n*h;let e=(n+r-c)*s+i;for(let n=u;n<p;n++)w[e++]=k?k[t+n]:1}const M=new n({width:l.width,height:l.height,pixelType:t.pixelType,pixels:y,mask:w});return M.updateStatistics(),M}function F(t,e=!0){if(!o(t))return null;const{pixels:l,width:i,height:r,mask:s,pixelType:a}=t,h=[],f=Math.round(i/2),c=Math.round(r/2),u=r-1,p=i-1;for(let o=0;o<l.length;o++){const t=l[o],s=n.createEmptyBand(a,f*c);let x=0;for(let n=0;n<r;n+=2)for(let l=0;l<i;l+=2){const o=t[n*i+l];if(e){const e=l===p?o:t[n*i+l+1],r=n===u?o:t[n*i+l+i],a=l===p?r:n===u?e:t[n*i+l+i+1];s[x++]=(o+e+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 n=0;n<r;n+=2)for(let l=0;l<i;l+=2){const o=s[n*i+l];if(e){const e=l===p?o:s[n*i+l+1],r=n===u?o:s[n*i+l+i],a=l===p?r:n===u?e:s[n*i+l+i+1];x[t++]=o*e*r*a?1:0}else x[t++]=o}}return new n({width:f,height:c,pixelType:a,pixels:h,mask:x})}function W(t,e,n=0,l=!0){if(!o(t))return null;const{width:i,height:r}=e;let{width:s,height:a}=t;const h=new Map,f={x:0,y:0},c=1+n;let u=t;for(let o=0;o<c;o++){const t=Math.ceil(s/i),n=Math.ceil(a/r);for(let l=0;l<n;l++){f.y=l*r;for(let n=0;n<t;n++){f.x=n*i;const t=_(u,f,e);h.set(`${o}/${l}/${n}`,t)}}o<c-1&&(u=F(u,l)),s=Math.round(s/2),a=Math.round(a/2)}return h}function E(t){const{pixelBlock:e,tileSize:n,level:l,row:i,col:r,useBilinear:s}=t;if(!o(e))return null;const{width:a,height:h}=n,f=2**l,c=f*a,u=f*h;let p=_(e,{y:i*u,x:r*c},{width:c,height:u});if(!p)return null;for(let o=l;o>0;o--)p=F(p,s);return p}function N(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,d,m,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 B,S,v=0;for(let C=0;C<u;C++)for(let t=0;t<c;t++){p=12*(C*c+t),x=n[p],d=n[p+1],m=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){v=(C*f+e)*k+t*h,S=(e+.5)/f;for(let t=0;t<e;t++)B=(t+.5)/h,A[v+t]=(x*B+d*S+m)*o+i,U[v+t]=(g*B+y*S+w)*r+i,b[v+t]=Math.floor(A[v+t]),T[v+t]=Math.floor(U[v+t])}p+=6,x=n[p],d=n[p+1],m=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){v=(C*f+e)*k+t*h,S=(e+.5)/f;for(let t=e;t<h;t++)B=(t+.5)/h,A[v+t]=(x*B+d*S+m)*o+i,U[v+t]=(g*B+y*S+w)*r+i,b[v+t]=Math.floor(A[v+t]),T[v+t]=Math.floor(U[v+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}=N(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 z(t,e,l,i,r="nearest"){if(!o(t))return null;"majority"===r&&(t=I(t));const{pixels:s,mask:a,bandMasks:h,pixelType:f}=t,c=t.width,u=t.height,p=n.getPixelArrayConstructor(f),x=s.length,{width:d,height:m}=e;let g=!1;for(let n=0;n<l.length;n+=3)-1===l[n]&&-1===l[n+1]&&-1===l[n+2]&&(g=!0);const{offsets_x:y,offsets_y:w,offsets_xi:k,offsets_yi:M,gridWidth:A}=N({width:c,height:u},e,l,i,"majority"===r?.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<m;o++){U=o*A;for(let r=0;r<d;r++){if(y[U]<0||w[U]<0)t[o*d+r]=0;else if(l)t[o*d+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*d+r]=(1-u)*n+u*p+i}else t[o*d+r]=e[k[U]+M[U]*c]}U++}}},T=[];let B;const S=h?.length===x,v=[];for(let n=0;n<x;n++){if(S){const t=new Uint8Array(d*m);b(t,h[n],h[n],!0),v.push(t)}B=new p(d*m),b(B,s[n],S?h[n]:a,"nearest"===r||"majority"===r),T.push(B)}const C=new n({width:d,height:m,pixelType:f,pixels:T,bandMasks:S?v:void 0});if(null!=a)C.mask=new Uint8Array(d*m),b(C.mask,a,a,!0);else if(g){C.mask=new Uint8Array(d*m);for(let t=0;t<d*m;t++)C.mask[t]=y[t]<0||w[t]<0?0:1}return C.updateStatistics(),C}function O(t){const{pixelBlock:e,extent:n,fieldNames:l,skipFactor:o,skipSpatialReference:r=!1,pixelIdOffset:s=0}=t,a=[],{width:h,height:f,pixels:c,mask:u}=e,p=t.imageRowSize??h,x=n.width/h,d=n.height/f,m=c.length,g=Math.floor(o/2),{xmin:y,ymax:w}=n,k=r?void 0:n.spatialReference.toJSON();for(let M=g;M<f;M+=o)for(let t=g;t<h;t+=o){const e=M*h+t;if(!u||u[e]){const n={x:y+(t+.5)*x,y:w-(M+.5)*d,spatialReference:k},o={[i]:s+M*p+t};for(let t=0;t<m;t++)o[l[t+1]]=c[t][e];a.push({geometry:n,attributes:o})}}return a}function L(t,e){const{width:n,height:l,pixels:i,mask:o}=t,r=i[0];let s=0;for(let a=0;a<l;a++){let t=a*n;for(let l=0;l<n;l++,t++)o&&!o[t]||(e[r[t]]++,s++)}return s}function G(t,e){const{width:n,height:l,pixels:i,mask:o}=t,r=e.width/n,s=e.height/l,{xmin:a,ymax:h}=e,f=e.spatialReference.toJSON(),c=[];for(let u=0;u<l;u++)for(let t=0;t<n;t++){const e=u*n+t;if(!o||o[e]){const n={x:a+(t+.5)*r,y:h-(u+.5)*s,spatialReference:f},l=i.map(t=>t[e]);c.push({location:n,value:l})}}return c}function V(t,e,l){const{attributeTable:i}=e;if(!i)return t;const o=i.fields.find(t=>t.name.toLowerCase()===l.toLowerCase()),r=i.fields.find(t=>"value"===t.name.toLowerCase());if(!o||!r)return t;const[s]=t.pixels,a="single"===o.type?"f32":"double"===o.type||"big-integer"===o.type?"f64":"small-integer"===o.type?"s16":"s32",h=s.length,f=new("f32"===a?Float32Array:"f64"===a?Float64Array:"s16"===a?Int16Array:Int32Array)(h),c=new Map;for(const n of i.features){const t=n.attributes[r.name],e=n.attributes[o.name];c.set(t,e)}const u=t.mask??new Uint8Array(h).fill(255);for(let n=0;n<h;n++)if(u[n]){const t=c.get(s[n]);null==t?u[n]=0:f[n]=t}return new n({width:t.width,height:t.height,pixels:[f],mask:u,pixelType:a})}function $(t){const{srcDimensions:e,destDimension:n,transformGrid:{coefficients:l,spacing:i},bias:o=0,pos:{x:r,y:s}}=t;if(!l?.length)return null;const{width:a,height:h}=e,{width:f}=n,[c,u]=i,p=Math.ceil(f/c-.1/c),x=Math.floor(r/c),d=Math.floor(s/u),m=Math.floor(r-x*c),g=Math.floor(s-d*u),y=12*(d*p+x)+(m>=g?6:0),w=(g+.5)/u,k=(m+.5)/c;return{x:(l[y]*k+l[y+1]*w+l[y+2])*a+o,y:(l[y+3]*k+l[y+4]*w+l[y+5])*h+o}}function J(t){const{pos:e,pixelData:n,pixelSize:l,transformGrid:i}=t;if(!n.pixelBlock)return null;const{xmin:o,xmax:r,ymin:s,ymax:a}=n.extent;let h=Math.floor((e.x-o)/l.x),f=Math.floor((a-e.y)/l.y);const c={width:Math.round((r-o)/l.x),height:Math.round((a-s)/l.y)},{width:u,height:p,mask:x}=n.pixelBlock;if(i){const t=$({pos:{x:h,y:f},transformGrid:i,srcDimensions:{width:u,height:p},destDimension:c});if(!t||t.x<0||t.x>=u||t.y<0||t.y>=p)return null;h=t.x,f=t.y}const d=Math.floor(f),m=Math.floor(h),g=d*u+m,y=x&&!x[g]?null:n.pixelBlock.pixels.map(t=>t[g]);return{x:h,y:f,row:d,col:m,position:g,value:y}}export{z as approximateTransform,_ as clip,E as clipTile,h as colorize,s as compositeBands,O as convertPixelBlockToFeatures,L as countCategoricalPixels,a as createColormapLUT,U as createMaskLUT,m as createRangeMaps,A as createRemapLUT,r as extractBands,b as getClipBounds,j as getLocalArithmeticNorthRotations,J as getPixelLocationAndValue,$ as getPixelOffset,G as getValidPixels,x as highlightPixels,N as interpolateOffsets,o as isValidPixelBlock,c as lookupBandValues,f as lookupPixels,V as mapPixelValueToAttribute,M as mask,k as matchAnyMask,l as maxMapSizeGpu,S as mosaic,T as mosaicPixelData,i as pixelIdFieldName,g as remap,d as remapColor,I as resampleByMajority,u as selectBySingleBandRange,p as selectByXYMask,C as setValidBoundary,W as split};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- const s={supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1,supportedStatistics:void 0,supportedNormalizationTypes:void 0},t={analytics:{supportsCacheHint:!1},attachment:{supportsContentType:!1,supportsExifInfo:!1,supportsKeywords:!1,supportsName:!1,supportsSize:!1,supportsCacheHint:!1,supportsOrderByFields:!1,supportsResize:!1,supportsTypeWildcard:!1},data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:!1,supportsTrueCurve:!1,supportsZ:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsAsyncApplyEdits:!1,zDefault:void 0},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:s,query:{maxRecordCount:0,maxRecordCountFactor:0,maxUniqueIDCount:0,relativeTimeBinWindow:0,standardMaxRecordCount:0,supportsCacheHint:!1,supportsCentroid:!1,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCompactGeometry:!1,supportsCurrentUser:!1,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsDistinct:!1,supportsExtent:!1,supportsFormatPBF:!1,supportsFormatPBFWithCurves:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:!1,supportsPagination:!1,supportsPaginationOnAggregatedQueries:!1,supportsPercentileStatistics:!1,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsSqlExpression:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsTrueCurve:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsStatistics:!1,tileMaxRecordCount:0}};export{t as zeroCapabilities,s as zeroQueryBins};
2
+ const s={supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1,supportedStatistics:void 0,supportedNormalizationTypes:void 0},t={analytics:{supportsCacheHint:!1},attachment:{supportsContentType:!1,supportsExifInfo:!1,supportsKeywords:!1,supportsName:!1,supportsSize:!1,supportsCacheHint:!1,supportsOrderByFields:!1,supportsResize:!1,supportsTypeWildcard:!1},data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:!1,supportsTrueCurve:!1,supportsZ:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsAsyncApplyEdits:!1,zDefault:void 0},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:s,query:{maxRecordCount:0,maxRecordCountFactor:0,maxUniqueIDCount:0,relativeTimeBinWindow:0,standardMaxRecordCount:0,standardMaxRecordCountNoGeometry:0,supportsCacheHint:!1,supportsCentroid:!1,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCompactGeometry:!1,supportsCurrentUser:!1,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsDistinct:!1,supportsExtent:!1,supportsFormatPBF:!1,supportsFormatPBFWithCurves:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:!1,supportsPagination:!1,supportsPaginationOnAggregatedQueries:!1,supportsPercentileStatistics:!1,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsSqlExpression:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsTrueCurve:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsStatistics:!1,tileMaxRecordCount:0}};export{t as zeroCapabilities,s as zeroQueryBins};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{isSome as t}from"../../core/arrayUtils.js";import has from"../../core/has.js";import{curveTypeDict as s}from"../../geometry/support/typeUtils.js";import{isHostedAgolService as e,parse as r}from"./arcgisLayerUrl.js";import{getGltfQueryFormat as p}from"./infoFor3D.js";import{getRelativeTimeQueryBinWindowSize as o}from"./relativeTimeQueryUtils.js";import{readNumber as u,readBoolean as i}from"../../rest/support/jsonUtils.js";const a={name:"supportsName",size:"supportsSize",contentType:"supportsContentType",keywords:"supportsKeywords",exifInfo:"supportsExifInfo"},n=["cubic-bezier","circular-arc","elliptic-arc"];function c(t){const s=t?.supportedSpatialAggregationStatistics?.map(t=>t.toLowerCase());return{envelope:!!s?.includes("envelopeaggregate"),centroid:!!s?.includes("centroidaggregate"),convexHull:!!s?.includes("convexhullaggregate")}}function l(t,s){const e=t?.supportedOperationsWithCacheHint?.map(t=>t.toLowerCase());return!!e?.includes(s.toLowerCase())}function d(t){const s=t?.supportedStatisticTypes?.map(t=>t.toLowerCase());return{count:!!s?.includes("count"),sum:!!s?.includes("sum"),min:!!s?.includes("min"),max:!!s?.includes("max"),avg:!!s?.includes("avg"),var:!!s?.includes("var"),stddev:!!s?.includes("stddev"),percentileContinuous:!!s?.includes("percentile_cont"),percentileDiscrete:!!s?.includes("percentile_disc"),envelope:!!s?.includes("envelopeaggregate"),centroid:!!s?.includes("centroidaggregate"),convexHull:!!s?.includes("convexhullaggregate")}}function y(t){const s=t?.supportedNormalizationTypes?.map(t=>t.toLowerCase());return{field:!!s?.includes("field"),log:!!s?.includes("log"),naturalLog:!!s?.includes("naturallog"),percentOfTotal:!!s?.includes("percentoftotal"),squareRoot:!!s?.includes("squareroot")}}function m(t){if(!has("featurelayer-pbf-true-curves"))return!1;return(t.supportedTrueCurvePbfFeatureEncodings??[]).includes("esriDefault")}function C(t,s){return{analytics:v(t),attachment:g(t),data:f(t),metadata:h(t),operations:Q(t.capabilities,t,s),query:A(t,s),queryAttributeBins:F(t),queryRelated:S(t),queryTopFeatures:T(t),editing:x(t)}}function v(t){return{supportsCacheHint:l(t.advancedQueryCapabilities,"queryAnalytics")}}function g(t){const s=t.attachmentProperties,e={supportsName:!1,supportsSize:!1,supportsContentType:!1,supportsKeywords:!1,supportsExifInfo:!1,supportsCacheHint:l(t.advancedQueryCapabilities,"queryAttachments"),supportsOrderByFields:i(t.advancedQueryCapabilities,"supportsQueryAttachmentOrderByFields",!1),supportsResize:i(t,"supportsAttachmentsResizing",!1),supportsTypeWildcard:i(t.advancedQueryCapabilities,"supportsQueryAttachmentWithTypeWildcard",!1)};return s&&Array.isArray(s)&&s.forEach(t=>{const s=a[t.name];s&&(e[s]=!!t.isEnabled)}),e}function f(t){const s=i(t.advancedQueryCapabilities,"supportsTrueCurve",!1);return{isVersioned:i(t,"isDataVersioned",!1),isBranchVersioned:i(t,"isDataBranchVersioned",!1),supportsAttachment:i(t,"hasAttachments",!1),supportsM:i(t,"hasM",!1),supportsTrueCurve:s,supportedCurveTypes:B(t,s),supportsZ:i(t,"hasZ",!1)}}function h(t){return{supportsAdvancedFieldProperties:i(t,"supportsFieldDescriptionProperty",!1)}}function Q(t,s,p){const o=e(p),u=t?.toLowerCase().split(",").map(t=>t.trim())??[],a=p?r(p):null,n=u.includes("MapServer"===a?.serverType?"data":"query"),c=u.includes("editing")&&!s.datesInUnknownTimezone&&!(!0===s.uniqueIdInfo?.OIDFieldContainsHashValue);let l=c&&u.includes("create"),d=c&&u.includes("delete"),y=c&&u.includes("update");const m=u.includes("changetracking"),C=s.advancedQueryCapabilities;let v=i(s,"supportsExceedsLimitStatistics",!1);if(!o){i(C,"supportsUseEstimateForExceedsLimit",!1)||(v=!1)}return c&&!(l||d||y)&&(l=d=y=!0),{supportsCalculate:i(s,"supportsCalculate",!1),supportsTruncate:i(s,"supportsTruncate",!1),supportsValidateSql:i(s,"supportsValidateSql",!1),supportsAdd:l,supportsDelete:d,supportsEditing:c,supportsChangeTracking:m,supportsQuery:n,supportsQueryAnalytics:i(C,"supportsQueryAnalytic",!1),supportsQueryAttachments:i(C,"supportsQueryAttachments",!1),supportsQueryBins:i(C,"supportsQueryBins",!1)||!!s.queryBinsCapabilities,supportsQueryPivot:i(C,"supportsQueryPivot",!1),supportsQueryTopFeatures:i(C,"supportsTopFeaturesQuery",!1),supportsResizeAttachments:i(s,"supportsAttachmentsResizing",!1),supportsSync:u.includes("sync"),supportsUpdate:y,supportsExceedsLimitStatistics:v,supportsAsyncConvert3D:i(s,"supportsAsyncConvert3D",!1)}}function A(t,s){const r=t.advancedQueryCapabilities,a=t.ownershipBasedAccessControlForFeatures,n=t.archivingInfo,d=t.currentVersion,y=o(s,t.cacheMaxAge),C=s?.includes("MapServer"),v=!C||d>=has("mapserver-pbf-version-support"),g=e(s),f=new Set((t.supportedQueryFormats??"").split(",").map(t=>t.toLowerCase().trim())),h=v&&m(t);return{maxRecordCount:u(t,"maxRecordCount",void 0),maxRecordCountFactor:u(t,"maxRecordCountFactor",void 0),maxUniqueIDCount:u(t,"maxUniqueIDCount",void 0),relativeTimeBinWindow:y,standardMaxRecordCount:u(t,"standardMaxRecordCount",void 0),supportedSpatialAggregationStatistics:c(r),supportsCacheHint:i(r,"supportsQueryWithCacheHint",!1)||l(r,"query"),supportsCentroid:i(r,"supportsReturningGeometryCentroid",!1),supportsCentroidOnDegeneratedQuantizedGeometry:g||null==s,supportsCompactGeometry:g,supportsCurrentUser:i(r,"supportsCurrentUserQueries",!1),supportsDefaultSpatialReference:i(r,"supportsDefaultSR",!1),supportsDegeneratedQuantizedGeometry:i(r,"supportsDegeneratedQuantizedGeometry",!1),supportsDisjointSpatialRelationship:i(r,"supportsDisjointSpatialRel",!1),supportsDistance:i(r,"supportsQueryWithDistance",!1),supportsDistinct:i(r,"supportsDistinct",t.supportsAdvancedQueries),supportsExtent:i(r,"supportsReturningQueryExtent",!1),supportsFormatPBF:v&&f.has("pbf"),supportsFormatPBFWithCurves:h,supportsFullTextSearch:i(r,"supportsFullTextSearch",!1),supportsGeometryProperties:i(r,"supportsReturningGeometryProperties",!1),supportsHavingClause:i(r,"supportsHavingClause",!1),supportsHistoricMoment:i(n,"supportsQueryWithHistoricMoment",!1),supportsMaxRecordCountFactor:i(r,"supportsMaxRecordCountFactor",!1),supportsOrderBy:i(r,"supportsOrderBy",t.supportsAdvancedQueries),supportsPagination:i(r,"supportsPagination",!1),supportsPaginationOnAggregatedQueries:i(r,"supportsPaginationOnAggregatedQueries",!1),supportsPercentileStatistics:i(r,"supportsPercentileStatistics",!1),supportsQuantization:i(t,"supportsCoordinatesQuantization",!1),supportsQuantizationEditMode:i(t,"supportsQuantizationEditMode",!1),supportsQueryByAnonymous:i(a,"allowAnonymousToQuery",!0),supportsQueryByOthers:i(a,"allowOthersToQuery",!0),supportsQueryGeometry:i(t,"supportsReturningQueryGeometry",!1),supportsResultType:i(r,"supportsQueryWithResultType",!1),supportsReturnMesh:!!p(t.infoFor3D),supportsSpatialAggregationStatistics:i(r,"supportsSpatialAggregationStatistics",!1),supportsSqlExpression:i(r,"supportsSqlExpression",!1),supportsStandardizedQueriesOnly:i(t,"useStandardizedQueries",!1),supportsStatistics:i(r,"supportsStatistics",t.supportsStatistics),supportsTopFeaturesQuery:i(r,"supportsTopFeaturesQuery",!1),supportsTrueCurve:i(r,"supportsTrueCurve",!1),tileMaxRecordCount:u(t,"tileMaxRecordCount",void 0)}}function S(t){const s=t.advancedQueryCapabilities,e=i(s,"supportsAdvancedQueryRelated",!1);return{supportsPagination:i(s,"supportsQueryRelatedPagination",!1),supportsCount:e,supportsOrderBy:e,supportsCacheHint:l(s,"queryRelated")}}function T(t){return{supportsCacheHint:l(t.advancedQueryCapabilities,"queryTopFilter")}}function F(t){const s=t?t.queryBinsCapabilities:void 0;return{supportsDate:i(s,"supportsDateBin",!1),supportsFixedInterval:i(s,"supportsFixedIntervalBin",!1),supportsAutoInterval:i(s,"supportsAutoIntervalBin",!1),supportsFixedBoundaries:i(s,"supportsFixedBoundariesBin",!1),supportsStackBy:i(s,"supportsStackBy",!1),supportsSplitBy:i(s,"supportsSplitBy",!1),supportsSnapToData:i(s,"supportsSnapToData",!1),supportsReturnFullIntervalBin:i(s,"supportsReturnFullIntervalBin",!1),supportsFirstDayOfWeek:i(s,"supportsFirstDayOfWeek",!1),supportsNormalization:i(s,"supportsNormalization",!1),supportedStatistics:d(s),supportedNormalizationTypes:y(s)}}function x(t){const s=t.ownershipBasedAccessControlForFeatures,e=t?t.advancedEditingCapabilities:void 0;return{supportsGeometryUpdate:i(t,"allowGeometryUpdates",!0),supportsGlobalId:i(t,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:i(t,"supportsReturnServiceEditsInSourceSR",!1),supportsRollbackOnFailure:i(t,"supportsRollbackOnFailureParameter",!1),supportsTrueCurveUpdate:i(t,"allowTrueCurvesUpdates",!0),supportsTrueCurveUpdateByTrueCurveClientsOnly:i(t,"onlyAllowTrueCurveUpdatesByTrueCurveClients",!0),supportsUpdateWithoutM:i(t,"allowUpdateWithoutMValues",!1),supportsUploadWithItemId:i(t,"supportsAttachmentsByUploadId",!1),supportsDeleteByAnonymous:i(s,"allowAnonymousToDelete",!0),supportsDeleteByOthers:i(s,"allowOthersToDelete",!0),supportsUpdateByAnonymous:i(s,"allowAnonymousToUpdate",!0),supportsUpdateByOthers:i(s,"allowOthersToUpdate",!0),supportsAsyncApplyEdits:i(e,"supportsAsyncApplyEdits",!1),zDefault:u(t,"zDefault",void 0)}}function B(e,r){const p=e.supportedCurveTypes??e.advancedQueryCapabilities?.supportedCurveTypes;return Array.isArray(p)?p.map(t=>s.fromJSON(t)).filter(t):r?n:[]}function R(t){return{operations:{supportsAppend:i(t,"supportsAppend",!1),supportsCoverageQuery:t?.playbackInfo?.klv["0601"]??!1,supportsExportClip:i(t,"supportsExportClip",!1),supportsExportFrameset:i(t,"supportsExportFrameset",!1),supportsMensuration:i(t,"supportsMensuration",!1),supportsPreviews:i(t,"supportsPreviews",!1),supportsUpdate:i(t,"supportsUpdate",!1)}}}export{n as allCurveTypes,C as getFeatureLayerCapabilities,R as getVideoLayerCapabilities};
2
+ import{isSome as t}from"../../core/arrayUtils.js";import has from"../../core/has.js";import{curveTypeDict as e}from"../../geometry/support/typeUtils.js";import{isHostedAgolService as s,parse as r}from"./arcgisLayerUrl.js";import{getGltfQueryFormat as p}from"./infoFor3D.js";import{getRelativeTimeQueryBinWindowSize as o}from"./relativeTimeQueryUtils.js";import{readNumber as u,readBoolean as i}from"../../rest/support/jsonUtils.js";const a={name:"supportsName",size:"supportsSize",contentType:"supportsContentType",keywords:"supportsKeywords",exifInfo:"supportsExifInfo"},n=["cubic-bezier","circular-arc","elliptic-arc"];function c(t){const e=t?.supportedSpatialAggregationStatistics?.map(t=>t.toLowerCase());return{envelope:!!e?.includes("envelopeaggregate"),centroid:!!e?.includes("centroidaggregate"),convexHull:!!e?.includes("convexhullaggregate")}}function d(t,e){const s=t?.supportedOperationsWithCacheHint?.map(t=>t.toLowerCase());return!!s?.includes(e.toLowerCase())}function l(t){const e=t?.supportedStatisticTypes?.map(t=>t.toLowerCase());return{count:!!e?.includes("count"),sum:!!e?.includes("sum"),min:!!e?.includes("min"),max:!!e?.includes("max"),avg:!!e?.includes("avg"),var:!!e?.includes("var"),stddev:!!e?.includes("stddev"),percentileContinuous:!!e?.includes("percentile_cont"),percentileDiscrete:!!e?.includes("percentile_disc"),envelope:!!e?.includes("envelopeaggregate"),centroid:!!e?.includes("centroidaggregate"),convexHull:!!e?.includes("convexhullaggregate")}}function y(t){const e=t?.supportedNormalizationTypes?.map(t=>t.toLowerCase());return{field:!!e?.includes("field"),log:!!e?.includes("log"),naturalLog:!!e?.includes("naturallog"),percentOfTotal:!!e?.includes("percentoftotal"),squareRoot:!!e?.includes("squareroot")}}function m(t){if(!has("featurelayer-pbf-true-curves"))return!1;return(t.supportedTrueCurvePbfFeatureEncodings??[]).includes("esriDefault")}function C(t,e){return{analytics:v(t),attachment:g(t),data:f(t),metadata:h(t),operations:Q(t.capabilities,t,e),query:A(t,e),queryAttributeBins:x(t),queryRelated:S(t),queryTopFeatures:T(t),editing:F(t)}}function v(t){return{supportsCacheHint:d(t.advancedQueryCapabilities,"queryAnalytics")}}function g(t){const e=t.attachmentProperties,s={supportsName:!1,supportsSize:!1,supportsContentType:!1,supportsKeywords:!1,supportsExifInfo:!1,supportsCacheHint:d(t.advancedQueryCapabilities,"queryAttachments"),supportsOrderByFields:i(t.advancedQueryCapabilities,"supportsQueryAttachmentOrderByFields",!1),supportsResize:i(t,"supportsAttachmentsResizing",!1),supportsTypeWildcard:i(t.advancedQueryCapabilities,"supportsQueryAttachmentWithTypeWildcard",!1)};return e&&Array.isArray(e)&&e.forEach(t=>{const e=a[t.name];e&&(s[e]=!!t.isEnabled)}),s}function f(t){const e=i(t.advancedQueryCapabilities,"supportsTrueCurve",!1);return{isVersioned:i(t,"isDataVersioned",!1),isBranchVersioned:i(t,"isDataBranchVersioned",!1),supportsAttachment:i(t,"hasAttachments",!1),supportsM:i(t,"hasM",!1),supportsTrueCurve:e,supportedCurveTypes:R(t,e),supportsZ:i(t,"hasZ",!1)}}function h(t){return{supportsAdvancedFieldProperties:i(t,"supportsFieldDescriptionProperty",!1)}}function Q(t,e,p){const o=s(p),u=t?.toLowerCase().split(",").map(t=>t.trim())??[],a=p?r(p):null,n=u.includes("MapServer"===a?.serverType?"data":"query"),c=u.includes("editing")&&!e.datesInUnknownTimezone&&!(!0===e.uniqueIdInfo?.OIDFieldContainsHashValue);let d=c&&u.includes("create"),l=c&&u.includes("delete"),y=c&&u.includes("update");const m=u.includes("changetracking"),C=e.advancedQueryCapabilities;let v=i(e,"supportsExceedsLimitStatistics",!1);if(!o){i(C,"supportsUseEstimateForExceedsLimit",!1)||(v=!1)}return c&&!(d||l||y)&&(d=l=y=!0),{supportsCalculate:i(e,"supportsCalculate",!1),supportsTruncate:i(e,"supportsTruncate",!1),supportsValidateSql:i(e,"supportsValidateSql",!1),supportsAdd:d,supportsDelete:l,supportsEditing:c,supportsChangeTracking:m,supportsQuery:n,supportsQueryAnalytics:i(C,"supportsQueryAnalytic",!1),supportsQueryAttachments:i(C,"supportsQueryAttachments",!1),supportsQueryBins:i(C,"supportsQueryBins",!1)||!!e.queryBinsCapabilities,supportsQueryPivot:i(C,"supportsQueryPivot",!1),supportsQueryTopFeatures:i(C,"supportsTopFeaturesQuery",!1),supportsResizeAttachments:i(e,"supportsAttachmentsResizing",!1),supportsSync:u.includes("sync"),supportsUpdate:y,supportsExceedsLimitStatistics:v,supportsAsyncConvert3D:i(e,"supportsAsyncConvert3D",!1)}}function A(t,e){const r=t.advancedQueryCapabilities,a=t.ownershipBasedAccessControlForFeatures,n=t.archivingInfo,l=t.currentVersion,y=o(e,t.cacheMaxAge),C=e?.includes("MapServer"),v=!C||l>=has("mapserver-pbf-version-support"),g=s(e),f=new Set((t.supportedQueryFormats??"").split(",").map(t=>t.toLowerCase().trim())),h=v&&m(t);return{maxRecordCount:u(t,"maxRecordCount",void 0),maxRecordCountFactor:u(t,"maxRecordCountFactor",void 0),maxUniqueIDCount:u(t,"maxUniqueIDCount",void 0),relativeTimeBinWindow:y,standardMaxRecordCount:u(t,"standardMaxRecordCount",void 0),standardMaxRecordCountNoGeometry:u(t,"standardMaxRecordCountNoGeometry",void 0),supportedSpatialAggregationStatistics:c(r),supportsCacheHint:i(r,"supportsQueryWithCacheHint",!1)||d(r,"query"),supportsCentroid:i(r,"supportsReturningGeometryCentroid",!1),supportsCentroidOnDegeneratedQuantizedGeometry:g||null==e,supportsCompactGeometry:g,supportsCurrentUser:i(r,"supportsCurrentUserQueries",!1),supportsDefaultSpatialReference:i(r,"supportsDefaultSR",!1),supportsDegeneratedQuantizedGeometry:i(r,"supportsDegeneratedQuantizedGeometry",!1),supportsDisjointSpatialRelationship:i(r,"supportsDisjointSpatialRel",!1),supportsDistance:i(r,"supportsQueryWithDistance",!1),supportsDistinct:i(r,"supportsDistinct",t.supportsAdvancedQueries),supportsExtent:i(r,"supportsReturningQueryExtent",!1),supportsFormatPBF:v&&f.has("pbf"),supportsFormatPBFWithCurves:h,supportsFullTextSearch:i(r,"supportsFullTextSearch",!1),supportsGeometryProperties:i(r,"supportsReturningGeometryProperties",!1),supportsHavingClause:i(r,"supportsHavingClause",!1),supportsHistoricMoment:i(n,"supportsQueryWithHistoricMoment",!1),supportsMaxRecordCountFactor:i(r,"supportsMaxRecordCountFactor",!1),supportsOrderBy:i(r,"supportsOrderBy",t.supportsAdvancedQueries),supportsPagination:i(r,"supportsPagination",!1),supportsPaginationOnAggregatedQueries:i(r,"supportsPaginationOnAggregatedQueries",!1),supportsPercentileStatistics:i(r,"supportsPercentileStatistics",!1),supportsQuantization:i(t,"supportsCoordinatesQuantization",!1),supportsQuantizationEditMode:i(t,"supportsQuantizationEditMode",!1),supportsQueryByAnonymous:i(a,"allowAnonymousToQuery",!0),supportsQueryByOthers:i(a,"allowOthersToQuery",!0),supportsQueryGeometry:i(t,"supportsReturningQueryGeometry",!1),supportsResultType:i(r,"supportsQueryWithResultType",!1),supportsReturnMesh:!!p(t.infoFor3D),supportsSpatialAggregationStatistics:i(r,"supportsSpatialAggregationStatistics",!1),supportsSqlExpression:i(r,"supportsSqlExpression",!1),supportsStandardizedQueriesOnly:i(t,"useStandardizedQueries",!1),supportsStatistics:i(r,"supportsStatistics",t.supportsStatistics),supportsTopFeaturesQuery:i(r,"supportsTopFeaturesQuery",!1),supportsTrueCurve:i(r,"supportsTrueCurve",!1),tileMaxRecordCount:u(t,"tileMaxRecordCount",void 0)}}function S(t){const e=t.advancedQueryCapabilities,s=i(e,"supportsAdvancedQueryRelated",!1);return{supportsPagination:i(e,"supportsQueryRelatedPagination",!1),supportsCount:s,supportsOrderBy:s,supportsCacheHint:d(e,"queryRelated")}}function T(t){return{supportsCacheHint:d(t.advancedQueryCapabilities,"queryTopFilter")}}function x(t){const e=t?t.queryBinsCapabilities:void 0;return{supportsDate:i(e,"supportsDateBin",!1),supportsFixedInterval:i(e,"supportsFixedIntervalBin",!1),supportsAutoInterval:i(e,"supportsAutoIntervalBin",!1),supportsFixedBoundaries:i(e,"supportsFixedBoundariesBin",!1),supportsStackBy:i(e,"supportsStackBy",!1),supportsSplitBy:i(e,"supportsSplitBy",!1),supportsSnapToData:i(e,"supportsSnapToData",!1),supportsReturnFullIntervalBin:i(e,"supportsReturnFullIntervalBin",!1),supportsFirstDayOfWeek:i(e,"supportsFirstDayOfWeek",!1),supportsNormalization:i(e,"supportsNormalization",!1),supportedStatistics:l(e),supportedNormalizationTypes:y(e)}}function F(t){const e=t.ownershipBasedAccessControlForFeatures,s=t?t.advancedEditingCapabilities:void 0;return{supportsGeometryUpdate:i(t,"allowGeometryUpdates",!0),supportsGlobalId:i(t,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:i(t,"supportsReturnServiceEditsInSourceSR",!1),supportsRollbackOnFailure:i(t,"supportsRollbackOnFailureParameter",!1),supportsTrueCurveUpdate:i(t,"allowTrueCurvesUpdates",!0),supportsTrueCurveUpdateByTrueCurveClientsOnly:i(t,"onlyAllowTrueCurveUpdatesByTrueCurveClients",!0),supportsUpdateWithoutM:i(t,"allowUpdateWithoutMValues",!1),supportsUploadWithItemId:i(t,"supportsAttachmentsByUploadId",!1),supportsDeleteByAnonymous:i(e,"allowAnonymousToDelete",!0),supportsDeleteByOthers:i(e,"allowOthersToDelete",!0),supportsUpdateByAnonymous:i(e,"allowAnonymousToUpdate",!0),supportsUpdateByOthers:i(e,"allowOthersToUpdate",!0),supportsAsyncApplyEdits:i(s,"supportsAsyncApplyEdits",!1),zDefault:u(t,"zDefault",void 0)}}function R(s,r){const p=s.supportedCurveTypes??s.advancedQueryCapabilities?.supportedCurveTypes;return Array.isArray(p)?p.map(t=>e.fromJSON(t)).filter(t):r?n:[]}function B(t){return{operations:{supportsAppend:i(t,"supportsAppend",!1),supportsCoverageQuery:t?.playbackInfo?.klv["0601"]??!1,supportsExportClip:i(t,"supportsExportClip",!1),supportsExportFrameset:i(t,"supportsExportFrameset",!1),supportsMensuration:i(t,"supportsMensuration",!1),supportsPreviews:i(t,"supportsPreviews",!1),supportsUpdate:i(t,"supportsUpdate",!1)}}}export{n as allCurveTypes,C as getFeatureLayerCapabilities,B as getVideoLayerCapabilities};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.1.0-next.52",
3
+ "version": "5.1.0-next.53",
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": [
@@ -19,10 +19,10 @@
19
19
  "license": "SEE LICENSE IN LICENSE.md",
20
20
  "dependencies": {
21
21
  "@amcharts/amcharts5": "~5.16.2",
22
- "@arcgis/toolkit": "^5.1.0-next.52",
22
+ "@arcgis/toolkit": "^5.1.0-next.54",
23
23
  "@esri/arcgis-html-sanitizer": "~4.1.0",
24
24
  "@esri/calcite-components": "^5.0.2",
25
- "@vaadin/grid": "~25.0.8",
25
+ "@vaadin/grid": "~25.1.0",
26
26
  "@zip.js/zip.js": "~2.8.23",
27
27
  "luxon": "~3.7.2",
28
28
  "marked": "~17.0.5",
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- const e="20260325",a="1e66e2a8073eeea2c5658235955210ae03e9fa90";export{e as buildDate,a as commitHash};
2
+ const d="20260326",c="a1dbd5ef847c3242f011779e1f09d599a909cd21";export{d as buildDate,c as commitHash};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{screenPointObjectToArray as r}from"../../../../core/screenUtils.js";import{property as i,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{copy as o,normalize as s,scaleAndAdd as a,scale as l,add as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as m,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import u from"../../../../geometry/Point.js";import{copy as d,fromPoints as f,create as g}from"../../../../geometry/support/ray.js";import{sv2d as y}from"../../../../geometry/support/vectorStacks.js";import{LineOfSightIntersectionResult as w,lineOfSightIntersectionContextGround as h,LineOfSightIntersectionContextGraphic as v}from"./LineOfSightIntersectionResult.js";import{fromScreen as j}from"../../support/geometryUtils/ray.js";import{isTerrainIntersectorResult as I,isIntegratedMeshIntersectorResult as b}from"../../terrain/Intersector.js";import{Intersector as P}from"../../webgl-engine/lib/Intersector.js";import{toGraphic as x}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as U}from"../../webgl-engine/lib/verticalOffsetUtils.js";import{isIntegratedMeshLayerView as L}from"../../../support/layerViewUtils.js";let R=class extends t{constructor(e){super(e)}initialize(){this.intersector=new P(this.view.state.viewingMode),this.intersector.options.hud=!1,this.intersector.options.store=0}get _integratedMeshLayerViews(){return this.view.allLayerViews.items.filter(L)}get _terrainIntersectionOptionsLayerUids(){return new Set([U,...this._integratedMeshLayerViews.map(e=>e.uid)])}getScreenPointIntersection(e){const t=r(e,y.get()),i=j(this.view.state.camera,t,M);return this._getRayIntersection(i)}_getRayIntersection(e,t){const{view:r,intersector:i}=this;if(null==e||null==r.sceneIntersectionHelper)return null;i.options.store=0,r.sceneIntersectionHelper.intersectToolIntersectorRay(e,i,t);const n=i.results.min;if(null==n.target)return null;const o=p();if(!n.getIntersectionPoint(o))return null;if(null!=t?.maxDistance&&!n.withinDistance(t.maxDistance))return null;const s=r.renderCoordsHelper.fromRenderCoords(o,new u({spatialReference:r.spatialReference})),a=m(n.normal);if(I(n))return new w({context:h,id:n.target.lij.slice(),mapPoint:s,renderPoint:o,normal:a,ray:d(e)});if(b(r,n))return new w({context:h,id:`${n.target.layerViewUid}`,mapPoint:s,renderPoint:o,normal:a,ray:d(e)});const l=x(n,r);if(null!=l){const{layer:t}=l,r=l.getObjectId()??l.uid;return new w({context:new v(l),id:`${t?.uid}/${r}`,mapPoint:s,renderPoint:o,normal:a,ray:d(e)})}const c="layerViewUid"in n.target?`${n.target.layerViewUid}`:"";return new w({context:null,id:c,mapPoint:s,renderPoint:o,normal:a,ray:d(e)})}updateFromGroundIntersection(e,t,r){const i=V,n=_,p=O;o(n,e),this.view.renderCoordsHelper.worldUpAtPosition(n,p),s(p,p);const u=this.view.groundView?.visibleElevationRange,d=(t>=0?1:-1)*((u?Math.abs(u.maxElevation-u.minElevation):100)+Math.abs(t)),g=.001*d;a(i,n,p,d-g),a(n,n,p,g),f(i,n,M);const y=this._getRayIntersection(M,{include:this._terrainIntersectionOptionsLayerUids,maxDistance:d});if(null!=y){const e=S;return l(e,p,t),c(r,y.renderPoint,e),m(y.normal)}return o(r,e),null}};e([i()],R.prototype,"view",void 0),e([i()],R.prototype,"intersector",void 0),e([i()],R.prototype,"_integratedMeshLayerViews",null),e([i()],R.prototype,"_terrainIntersectionOptionsLayerUids",null),R=e([n("esri.views.3d.analysis.LineOfSight.LineOfSightRayIntersector")],R);const V=p(),_=p(),O=p(),S=p(),M=g();export{R as LineOfSightRayIntersector};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{screenPointObjectToArray as r}from"../../../../core/screenUtils.js";import{property as i,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{copy as o,normalize as s,scaleAndAdd as a,scale as l,add as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as m,clone as p,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import d from"../../../../geometry/Point.js";import{fromPoints as f,copy as g,create as y}from"../../../../geometry/support/ray.js";import{sv2d as w}from"../../../../geometry/support/vectorStacks.js";import{LineOfSightIntersectionResult as h,lineOfSightIntersectionContextGround as v,LineOfSightIntersectionContextGraphic as I}from"./LineOfSightIntersectionResult.js";import{fromScreen as j}from"../../support/geometryUtils/ray.js";import{isTerrainIntersectorResult as P,isIntegratedMeshIntersectorResult as b}from"../../terrain/Intersector.js";import{Intersector as x}from"../../webgl-engine/lib/Intersector.js";import{toGraphic as R}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as U}from"../../webgl-engine/lib/verticalOffsetUtils.js";import{isIntegratedMeshLayerView as L}from"../../../support/layerViewUtils.js";let _=class extends t{constructor(e){super(e)}initialize(){this.intersector=new x(this.view.state.viewingMode),this.intersector.options.hud=!1,this.intersector.options.store=0}get _integratedMeshLayerViews(){return this.view.allLayerViews.items.filter(L)}get _terrainIntersectionOptionsLayerUids(){return new Set([U,...this._integratedMeshLayerViews.map(e=>e.uid)])}getScreenPointIntersection(e){const t=r(e,w.get()),i=j(this.view.state.camera,t,C);return this._getRayIntersection(i)}getMapPointIntersection(e){const t=m(e.x,e.y,e.z??0);if(!this.view.renderCoordsHelper.toRenderCoords(t,e.spatialReference,t))return null;const r=this.view.state.camera.eye;return f(r,t,C),this._getRayIntersection(C)}_getRayIntersection(e,t){const{view:r,intersector:i}=this;if(null==e||null==r.sceneIntersectionHelper)return null;i.options.store=0,r.sceneIntersectionHelper.intersectToolIntersectorRay(e,i,t);const n=i.results.min;if(null==n.target)return null;const o=u();if(!n.getIntersectionPoint(o))return null;if(null!=t?.maxDistance&&!n.withinDistance(t.maxDistance))return null;const s=r.renderCoordsHelper.fromRenderCoords(o,new d({spatialReference:r.spatialReference})),a=p(n.normal);if(P(n))return new h({context:v,id:n.target.lij.slice(),mapPoint:s,renderPoint:o,normal:a,ray:g(e)});if(b(r,n))return new h({context:v,id:`${n.target.layerViewUid}`,mapPoint:s,renderPoint:o,normal:a,ray:g(e)});const l=R(n,r);if(null!=l){const{layer:t}=l,r=l.getObjectId()??l.uid;return new h({context:new I(l),id:`${t?.uid}/${r}`,mapPoint:s,renderPoint:o,normal:a,ray:g(e)})}const c="layerViewUid"in n.target?`${n.target.layerViewUid}`:"";return new h({context:null,id:c,mapPoint:s,renderPoint:o,normal:a,ray:g(e)})}updateFromGroundIntersection(e,t,r){const i=V,n=O,m=M;o(n,e),this.view.renderCoordsHelper.worldUpAtPosition(n,m),s(m,m);const u=this.view.groundView?.visibleElevationRange,d=(t>=0?1:-1)*((u?Math.abs(u.maxElevation-u.minElevation):100)+Math.abs(t)),g=.001*d;a(i,n,m,d-g),a(n,n,m,g),f(i,n,C);const y=this._getRayIntersection(C,{include:this._terrainIntersectionOptionsLayerUids,maxDistance:d});if(null!=y){const e=S;return l(e,m,t),c(r,y.renderPoint,e),p(y.normal)}return o(r,e),null}};e([i()],_.prototype,"view",void 0),e([i()],_.prototype,"intersector",void 0),e([i()],_.prototype,"_integratedMeshLayerViews",null),e([i()],_.prototype,"_terrainIntersectionOptionsLayerUids",null),_=e([n("esri.views.3d.analysis.LineOfSight.LineOfSightRayIntersector")],_);const V=u(),O=u(),M=u(),S=u(),C=y();export{_ as LineOfSightRayIntersector};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../analysis/LineOfSightAnalysisObserver.js";import i from"../../../../analysis/LineOfSightAnalysisTarget.js";import a from"../../../../core/Handles.js";import"../../../../core/has.js";import n from"../../../../core/Logger.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{when as s,syncAndInitial as o,initial as l}from"../../../../core/reactiveUtils.js";import{property as u,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../../core/support/UpdatingHandles.js";import{create as d,fromPoints as p}from"../../../../geometry/support/lineSegment.js";import{getGraphicEffectiveElevationInfo as g,getConvertedElevation as _}from"../../../../support/elevationInfoUtils.js";import m from"../../../../symbols/support/ElevationInfo.js";import{getLaserLineColors as v,laserLineConfiguration as b}from"./LineOfSightConfiguration.js";import{LineOfSightTargetManipulator as y,LineOfSightObserverManipulator as f}from"./LineOfSightManipulators.js";import{LineOfSightRayIntersector as T}from"./LineOfSightRayIntersector.js";import{LaserlineVisualElement as L}from"../../interactive/visualElements/LaserlineVisualElement.js";import{mouseButtons as M}from"../../../input/mouseButtons.js";import{AnalysisToolBase as w}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as k}from"../../../interactive/dragEventPipeline.js";import{createScreenPointFromEvent as C}from"../../../support/screenUtils.js";let H=class extends w{constructor(e){super(e),this._creationMode=!1,this.removeIncompleteOnCancel=!1,this.analysisViewData=null,this._latestPointerMovePointerType=null,this._laserlineVisualElement=null,this._grabbedManipulator=null,this._analysisHandles=new a,this._updatingHandles=new c,this._manipulatorHandles=new a,this._targetTrackerManipulator=null}initialize(){this._intersector=new T({view:this.view}),this.addHandles(s(()=>"created"===this.state,()=>this.finishToolCreation(),o)),this._observerManipulator=this._createObserverManipulator(),this._createLaserLine(),this.addHandles([this._updatingHandles.add(()=>this.analysisViewData?.elevationAlignedObserver,e=>this._onObserverLocationChange(e),l),this._updatingHandles.add(()=>v(this.view.effectiveTheme),({glowColor:e,innerColor:t,globalAlpha:i})=>this._updateLaserLineStyle(e,t,i),l),this._updatingHandles.add(()=>this._laserLineRendererDependencies(),e=>this._updateLaserLineRenderer(e)),this._connectComputations(),this._updatingHandles.addWhen(()=>!this._shouldRenderTracker,()=>this._clearCursorTracker(),l),this._updatingHandles.add(()=>({active:this.active,hasGrabbedManipulators:this.hasGrabbedManipulators}),({active:e,hasGrabbedManipulators:t})=>{this._creationMode=!!e&&(this._creationMode||!t)},l)])}destroy(){this._updatingHandles=r(this._updatingHandles),this._manipulatorHandles=r(this._manipulatorHandles),this._analysisHandles=r(this._analysisHandles),this._observerManipulator=null,this._clearCursorTracker(),this._removeLaserLine(),this._intersector=null,this._set("analysis",null)}get state(){return this.active?!this.hasGrabbedManipulators||this._creationMode?"creating":"created":null!=this.analysis.observer?.position?"created":"ready"}get cursor(){return this.active&&this._showTracker?"crosshair":null}get updating(){return null!=this.analysisViewData&&this.analysisViewData.updating||this._updatingHandles.updating}get _showTracker(){return this.active&&"mouse"===this._latestPointerMovePointerType}get _shouldRenderTracker(){return this._showTracker&&null!=this.analysis.observer?.position&&!this.hasGrabbedManipulators}continue(){this.view.activeTool=this}stop(){this.view.activeTool=null}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onInputEventAfter(e){if("immediate-click"===e.type)this._clickHandler(e)}onShow(){}onHide(){}onDeactivate(){this._clearCursorTracker()}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this.analysisViewData.computations,e=>this._onComputationsCollectionChange(e),{initial:!0,final:!0})}_onComputationsCollectionChange({added:e,removed:t}){for(const i of t)this._disconnectComputation(i);for(const i of e)this._connectComputation(i)}_connectComputation(e){if(this.destroyed)return void n.getLogger(this).warn("Attempting to connect an analysis to a destroyed LineOfSight tool. Ignoring.");const t=this._analysisHandles;if(t.has(e))return;const i=this._createTargetManipulator(e.target);null==this._targetTrackerManipulator&&i.metadata.target===this.analysisViewData.cursorTarget&&(this._targetTrackerManipulator=i,this._targetTrackerManipulator.available=!1,this._targetTrackerManipulator.interactive=!1,this._updateLaserLineRenderer()),t.add([this._updatingHandles.add(()=>O(e),()=>P(i,e),l),this._updatingHandles.add(()=>e.elevationAlignedTargetLocation,e=>this._onTargetLocationChange(e,i),l)],e)}_disconnectComputation(e){if(this.destroyed)return void n.getLogger(this).warn("Attempting to disconnect an analysis from a destroyed LineOfSight tool. Ignoring.");this._analysisHandles.remove(e);const t=this._getTargetManipulator(e.target);null!=t&&(this.manipulators.remove(t),this._manipulatorHandles.remove(t),null!=this._targetTrackerManipulator&&this._targetTrackerManipulator===t&&(this._targetTrackerManipulator=null))}_clearCursorTracker(){this.analysisViewData.cursorTarget=r(this.analysisViewData.cursorTarget)}_createTargetManipulator(e){const t={target:e,type:"target"},i=new y(this.view,t);return this._manipulatorHandles.add([this._createTargetManipulatorDragPipeline(i),i.events.on("grab-changed",e=>this._manipulatorGrabChanged(i,e)),i.events.on("immediate-click",e=>this._manipulatorClick(i,e))],i),this.manipulators.add(i),null!=e.position?i.elevationAlignedLocation=e.position:i.available=!1,i}_getTargetManipulator(e){let t=null;return this.manipulators.forEach(i=>{const a=i.manipulator;null==t&&"target"===a.metadata.type&&a.metadata.target===e&&(t=a)}),t}_createObserverManipulator(){const e=new f(this.view,{type:"observer",intersection:null});return this._manipulatorHandles.add([this._createObserverManipulatorDragPipeline(e),e.events.on("grab-changed",t=>this._manipulatorGrabChanged(e,t)),e.events.on("immediate-click",t=>this._manipulatorClick(e,t))],e),this.manipulators.add(e),e}_screenToIntersection(){return e=>{const t=this._intersector.getScreenPointIntersection(e.screenEnd);return null==t?null:{...e,intersection:t}}}_createTargetManipulatorDragPipeline(e){return k(e,(t,i,a)=>{i.next(this._screenToIntersection()).next(this._updateTargetDragStep(e)).next(()=>this._updateLaserLineRenderer()),a.next(V(e.metadata.target)).next(()=>this._updateLaserLineRenderer())})}_createObserverManipulatorDragPipeline(e){return k(e,(e,t,i)=>{t.next(this._screenToIntersection()).next(this._updateObserverDragStep()).next(()=>this._updateLaserLineRenderer()),i.next(this._cancelObserverDragStep()).next(()=>this._updateLaserLineRenderer())})}_updateObserverDragStep(){return e=>(null!=e.intersection.mapPoint?(null==this.analysis.observer&&(this.analysis.observer=new t),this._updateFromIntersection(this.analysis.observer,e.intersection)):this.analysis.observer=null,e)}_cancelObserverDragStep(){const e=null!=this.analysis.observer?.position?this.analysis.observer.clone():null;return t=>(this.analysis.observer=e,t)}_updateTargetDragStep(e){return t=>{this._updateFromIntersection(e.metadata.target,t.intersection);const i=t.intersection.mapPoint;return null!=i&&(e.elevationAlignedLocation=i),t}}_manipulatorGrabChanged(e,t){switch(t.action){case"start":this._grabbedManipulator=e;break;case"end":this._grabbedManipulator===e&&(this._grabbedManipulator=null)}}_laserLineRendererDependencies(){return{laserlineVisualElement:this._laserlineVisualElement,grabbedManipulator:this._grabbedManipulator,shouldRenderTracker:this._shouldRenderTracker,observerPosition:null!=this.analysis.observer?this.analysis.observer.position:null,visible:this.visible}}_updateLaserLineRenderer(e=this._laserLineRendererDependencies()){const{laserlineVisualElement:t,grabbedManipulator:i,shouldRenderTracker:a,observerPosition:n,visible:r}=e;if(null==t)return;const s=null!=i?i:a&&null!=n?this._targetTrackerManipulator:null;null!=s&&r?(t.visible=!0,t.heightManifoldTarget=s.renderLocation,s!==this._observerManipulator?t.lineVerticalPlaneSegment=p(this._observerManipulator.renderLocation,s.renderLocation,D):t.lineVerticalPlaneSegment=null):(t.visible=!1,t.heightManifoldTarget=null,t.lineVerticalPlaneSegment=null)}_createLaserLine(){this._removeLaserLine();const{glowWidth:e,innerWidth:t}=b;this._laserlineVisualElement=new L({view:this.view,attached:!0,visible:this.visible,style:{glowWidth:e,innerWidth:t},isDecoration:!0})}_removeLaserLine(){null!=this._laserlineVisualElement&&(this._laserlineVisualElement.destroy(),this._laserlineVisualElement=null)}_updateLaserLineStyle(e,t,i){const a=this._laserlineVisualElement;if(null==a)return;const n=a.style;a.style={...n,glowColor:e.toUnitRGB(),innerColor:t.toUnitRGB(),globalAlpha:i}}_onObserverLocationChange(e){null!=e?(this._observerManipulator.metadata.intersection=null,this._observerManipulator.available=!0,this._observerManipulator.elevationAlignedLocation=e):this._observerManipulator.available=!1}_onTargetLocationChange(e,t){null!=e?(t.elevationAlignedLocation=e,t!==this._targetTrackerManipulator&&(t.available=!0)):t.available=!1}_addPointFromClickEvent(e){const a=this._intersector.getScreenPointIntersection(e);if(null!=a?.mapPoint)if(null!=this.analysis.observer?.position){this._clearCursorTracker();const e=new i;this._updateFromIntersection(e,a),this.analysis.targets.add(e)}else{const e=new t;this._updateFromIntersection(e,a),this.analysis.observer=e}}_clickHandler(e){this.active&&e.button!==M.Right&&(this._addPointFromClickEvent(C(e)),e.stopPropagation())}_doubleClickHandler(e){this.active&&e.button!==M.Right&&(this.stop(),e.stopPropagation())}_pointerMoveHandler(e){if(this.hasGrabbedManipulators)return;if(this._latestPointerMovePointerType=e.pointerType,this._updateLaserLineRenderer(),!this._showTracker||null==this.analysis.observer?.position)return;const t=C(e),a=this._intersector.getScreenPointIntersection(t);null!=a?.mapPoint&&(null==this.analysisViewData.cursorTarget&&(this.analysisViewData.cursorTarget=new i),this._updateFromIntersection(this.analysisViewData.cursorTarget,a),this._updateLaserLineRenderer())}_updateFromIntersection(e,t){if(null==t.mapPoint)return e.position=null,e.elevationInfo=null,void(e.feature=null);switch(t.context?.type){case"graphic":{const i=t.context.graphic,a=g(i);"on-the-ground"===a.mode&&(a.mode="relative-to-ground",a.offset=0),e.elevationInfo=new m(a),e.feature=i}break;case"ground":e.elevationInfo=new m({mode:"on-the-ground"}),e.feature=null;break;default:e.elevationInfo=null,e.feature=null}const i=t.mapPoint.clone();i.z=_(this.view,i,{mode:"absolute-height",offset:0},e.elevationInfo),e.position=i}_manipulatorClick(e,t){if("observer"===e.metadata.type||e.grabbing||e.dragging||t.button!==M.Right||this.analysis.targets.length<=1)return;const{target:i}=e.metadata;this.analysis.targets.remove(i),t.stopPropagation()}get testInfo(){}};function V(e){const t=e.position?.clone();return i=>(e.position=t,i)}function P(e,t){const{isValid:i,isTargetVisible:a}=t.computationResult;e.state=i?a?16:32:64}function O(e){const{isValid:t,isTargetVisible:i}=e.computationResult;return{isValid:t,isTargetVisible:i}}e([u({constructOnly:!0})],H.prototype,"view",void 0),e([u({constructOnly:!0})],H.prototype,"analysis",void 0),e([u()],H.prototype,"_creationMode",void 0),e([u({readOnly:!0})],H.prototype,"state",null),e([u({readOnly:!0})],H.prototype,"cursor",null),e([u()],H.prototype,"removeIncompleteOnCancel",void 0),e([u({readOnly:!0})],H.prototype,"updating",null),e([u({constructOnly:!0})],H.prototype,"analysisViewData",void 0),e([u({readOnly:!0})],H.prototype,"_showTracker",null),e([u()],H.prototype,"_latestPointerMovePointerType",void 0),e([u()],H.prototype,"_shouldRenderTracker",null),e([u()],H.prototype,"_laserlineVisualElement",void 0),e([u()],H.prototype,"_grabbedManipulator",void 0),H=e([h("esri.views.3d.analysis.LineOfSight.LineOfSightTool")],H);const D=d();export{H as LineOfSightTool};
2
+ import{__decorate as e}from"tslib";import t from"../../../../analysis/LineOfSightAnalysisObserver.js";import n from"../../../../analysis/LineOfSightAnalysisTarget.js";import i from"../../../../core/Handles.js";import"../../../../core/has.js";import a from"../../../../core/Logger.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{memoize as s}from"../../../../core/memoize.js";import{ignoreAbortErrors as o}from"../../../../core/promiseUtils.js";import{when as l,syncAndInitial as p,initial as u}from"../../../../core/reactiveUtils.js";import{property as c,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as d}from"../../../../core/support/UpdatingHandles.js";import{create as g,fromPoints as _}from"../../../../geometry/support/lineSegment.js";import{hydrateGeometry as m,clonePoint as v}from"../../../../layers/graphics/hydratedFeatures.js";import{absoluteHeightElevationInfo as b,getGraphicEffectiveElevationInfo as y,getConvertedElevation as f}from"../../../../support/elevationInfoUtils.js";import M from"../../../../symbols/support/ElevationInfo.js";import{getLaserLineColors as T,laserLineConfiguration as P}from"./LineOfSightConfiguration.js";import{LineOfSightTargetManipulator as w,LineOfSightObserverManipulator as S}from"./LineOfSightManipulators.js";import{LineOfSightRayIntersector as L}from"./LineOfSightRayIntersector.js";import{SnappingVisualizer3D as k}from"../../interactive/SnappingVisualizer3D.js";import{LaserlineVisualElement as C}from"../../interactive/visualElements/LaserlineVisualElement.js";import{mouseButtons as O}from"../../../input/mouseButtons.js";import{AnalysisToolBase as H}from"../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as I}from"../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as R}from"../../../interactive/dragEventPipeline.js";import{EditGeometry as j}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as E}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as V}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as D}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as x}from"../../../interactive/snapping/SnappingManagerPool.js";import{SnappingOperation as G}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as A}from"../../../interactive/snapping/snappingUtils.js";import{createScreenPointFromEvent as F}from"../../../support/screenUtils.js";let U=class extends H{constructor(e){super(e),this._creationMode=!1,this.removeIncompleteOnCancel=!1,this.analysisViewData=null,this._latestPointerMovePointerType=null,this._laserlineVisualElement=null,this._grabbedManipulator=null,this._trackerIntersection=null,this._trackerMapPoint=null,this._snappingManagerResult=null,this._analysisHandles=new i,this._updatingHandles=new d,this._manipulatorHandles=new i,this._targetTrackerManipulator=null,this._getSnappingContext=s(e=>new V({elevationInfo:b,pointer:e,editGeometryOperations:new E(new j("point",I(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new k}))}initialize(){this._intersector=new L({view:this.view}),this._snappingOperation=new G({view:this.view}),A(this,()=>{const e=this.view.inputManager.latestPointerInfo?.type??"mouse",t=this._getSnappingContext(e);this._updatingHandles.consumePromise(o(this._snappingOperation.snapAgainNearPreviousMapPoint(this._ensureSnappingManager(),t)))}),this.addHandles(l(()=>"created"===this.state,()=>this.finishToolCreation(),p)),this._observerManipulator=this._createObserverManipulator(),this._createLaserLine(),this.addHandles([this._updatingHandles.add(()=>this.analysisViewData?.elevationAlignedObserver,e=>this._onObserverLocationChange(e),u),this._updatingHandles.add(()=>T(this.view.effectiveTheme),({glowColor:e,innerColor:t,globalAlpha:n})=>this._updateLaserLineStyle(e,t,n),u),this._updatingHandles.add(()=>this._laserLineRendererDependencies(),e=>this._updateLaserLineRenderer(e)),this._connectComputations(),this._updatingHandles.addWhen(()=>!this._shouldRenderTracker,()=>this._clearCursorTracker(),u),this._updatingHandles.add(()=>({active:this.active,hasGrabbedManipulators:this.hasGrabbedManipulators}),({active:e,hasGrabbedManipulators:t})=>{this._creationMode=!!e&&(this._creationMode||!t)},u),this._updatingHandles.add(()=>({observerPosition:this.analysis.observer?.position,showTracker:this._showTracker,hasGrabbedManipulators:this.hasGrabbedManipulators,stagedPoint:this._snappingOperation.stagedPoint,trackerIntersection:this._trackerIntersection}),({observerPosition:e,showTracker:t,hasGrabbedManipulators:i,stagedPoint:a,trackerIntersection:r})=>{if(null==e||!t||i||null==r?.mapPoint)return;this.analysisViewData.cursorTarget??=new n;const s=null!=a?m(a):r.mapPoint,o=this._resolveIntersection(r,s);this._updateFromIntersection(this.analysisViewData.cursorTarget,o,s),this._updateLaserLineRenderer()},u)])}destroy(){this._updatingHandles=r(this._updatingHandles),this._manipulatorHandles=r(this._manipulatorHandles),this._analysisHandles=r(this._analysisHandles),this._observerManipulator=null,this._clearCursorTracker(),this._snappingOperation=r(this._snappingOperation),this._removeLaserLine(),this._intersector=null,this._set("analysis",null)}get state(){return this.active?!this.hasGrabbedManipulators||this._creationMode?"creating":"created":null!=this.analysis.observer?.position?"created":"ready"}get cursor(){return this.active&&this._showTracker?"crosshair":null}get updating(){return!!this.analysisViewData?.updating||!!this._snappingManager?.updating}get _showTracker(){return this.active&&"mouse"===this._latestPointerMovePointerType}get _shouldRenderTracker(){return this._showTracker&&null!=this.analysis.observer?.position&&!this.hasGrabbedManipulators}get _snappingManager(){return this._snappingManagerResult?.snappingManager}get snappingOptions(){return this._snappingManager?.options}continue(){this.view.activeTool=this}stop(){this.view.activeTool=null}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onInputEventAfter(e){if("immediate-click"===e.type)this._clickHandler(e)}onShow(){}onHide(){}onDeactivate(){this._clearCursorTracker()}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this.analysisViewData.computations,e=>this._onComputationsCollectionChange(e),{initial:!0,final:!0})}_onComputationsCollectionChange({added:e,removed:t}){for(const n of t)this._disconnectComputation(n);for(const n of e)this._connectComputation(n)}_connectComputation(e){if(this.destroyed)return void a.getLogger(this).warn("Attempting to connect an analysis to a destroyed LineOfSight tool. Ignoring.");const t=this._analysisHandles;if(t.has(e))return;const n=this._createTargetManipulator(e.target);null==this._targetTrackerManipulator&&n.metadata.target===this.analysisViewData.cursorTarget&&(this._targetTrackerManipulator=n,this._targetTrackerManipulator.available=!1,this._targetTrackerManipulator.interactive=!1,this._updateLaserLineRenderer()),t.add([this._updatingHandles.add(()=>B(e),()=>W(n,e),u),this._updatingHandles.add(()=>e.elevationAlignedTargetLocation,e=>this._onTargetLocationChange(e,n),u)],e)}_disconnectComputation(e){if(this.destroyed)return void a.getLogger(this).warn("Attempting to disconnect an analysis from a destroyed LineOfSight tool. Ignoring.");this._analysisHandles.remove(e);const t=this._getTargetManipulator(e.target);null!=t&&(this.manipulators.remove(t),this._manipulatorHandles.remove(t),null!=this._targetTrackerManipulator&&this._targetTrackerManipulator===t&&(this._targetTrackerManipulator=null))}_clearCursorTracker(){this._trackerIntersection=null,this._trackerMapPoint=null,this._resetSnappingState(),this.analysisViewData.cursorTarget=r(this.analysisViewData.cursorTarget)}_ensureSnappingManager(){if(null==this._snappingManagerResult){const e=x(this.view);this._snappingManagerResult=e,this.addHandles(e)}return this._snappingManagerResult.snappingManager}_createTargetManipulator(e){const t={target:e,type:"target"},n=new w(this.view,t);return this._manipulatorHandles.add([this._createTargetManipulatorDragPipeline(n),n.events.on("grab-changed",e=>this._manipulatorGrabChanged(n,e)),n.events.on("immediate-click",e=>this._manipulatorClick(n,e))],n),this.manipulators.add(n),null!=e.position?n.elevationAlignedLocation=e.position:n.available=!1,n}_getTargetManipulator(e){let t=null;return this.manipulators.forEach(n=>{const i=n.manipulator;null==t&&"target"===i.metadata.type&&i.metadata.target===e&&(t=i)}),t}_createObserverManipulator(){const e=new S(this.view,{type:"observer",intersection:null});return this._manipulatorHandles.add([this._createObserverManipulatorDragPipeline(e),e.events.on("grab-changed",t=>this._manipulatorGrabChanged(e,t)),e.events.on("immediate-click",t=>this._manipulatorClick(e,t))],e),this.manipulators.add(e),e}_createTargetManipulatorDragPipeline(e){return R(e,(t,n,i,a)=>{const r=this._ensureSnappingManager(),{snappingStep:s,cancelSnapping:o}=D({snappingManager:r,snappingContext:this._getSnappingContext(a),updatingHandles:this._updatingHandles});n.next(this._screenToSnappingDragEvent()).next(...s).next(this._updateIntersectionFromSnappedPoint()).next(this._updateTargetDragStep(e)).next(()=>this._updateLaserLineRenderer()),i.next(z(e.metadata.target)).next(o).next(()=>this._updateLaserLineRenderer())})}_createObserverManipulatorDragPipeline(e){return R(e,(e,t,n,i)=>{const a=this._ensureSnappingManager(),{snappingStep:r,cancelSnapping:s}=D({snappingManager:a,snappingContext:this._getSnappingContext(i),updatingHandles:this._updatingHandles});t.next(this._screenToSnappingDragEvent()).next(...r).next(this._updateIntersectionFromSnappedPoint()).next(this._updateObserverDragStep()).next(()=>this._updateLaserLineRenderer()),n.next(this._cancelObserverDragStep()).next(s).next(()=>this._updateLaserLineRenderer())})}_screenToSnappingDragEvent(){let e=null;return t=>{"start"===t.action&&(e=this._intersector.getScreenPointIntersection(t.screenStart));const n=this._intersector.getScreenPointIntersection(t.screenEnd);return null==e?.mapPoint||null==n?.mapPoint?null:{...t,intersection:n,mapStart:v(e.mapPoint),mapEnd:v(n.mapPoint)}}}_updateIntersectionFromSnappedPoint(){return e=>(e.intersection=this._resolveIntersection(e.intersection,e.mapEnd),e)}_updateObserverDragStep(){return e=>(this.analysis.observer??=new t,this._updateFromIntersection(this.analysis.observer,e.intersection,e.mapEnd),e)}_cancelObserverDragStep(){const e=null!=this.analysis.observer?.position?this.analysis.observer.clone():null;return t=>(this.analysis.observer=e,t)}_updateTargetDragStep(e){return t=>(this._updateFromIntersection(e.metadata.target,t.intersection,t.mapEnd),e.elevationAlignedLocation=t.mapEnd,t)}_manipulatorGrabChanged(e,t){switch(t.action){case"start":this._grabbedManipulator=e;break;case"end":this._grabbedManipulator===e&&(this._grabbedManipulator=null)}}_laserLineRendererDependencies(){return{laserlineVisualElement:this._laserlineVisualElement,grabbedManipulator:this._grabbedManipulator,shouldRenderTracker:this._shouldRenderTracker,observerPosition:null!=this.analysis.observer?this.analysis.observer.position:null,visible:this.visible}}_updateLaserLineRenderer(e=this._laserLineRendererDependencies()){const{laserlineVisualElement:t,grabbedManipulator:n,shouldRenderTracker:i,observerPosition:a,visible:r}=e;if(null==t)return;const s=null!=n?n:i&&null!=a?this._targetTrackerManipulator:null;null!=s&&r?(t.visible=!0,t.heightManifoldTarget=s.renderLocation,s!==this._observerManipulator?t.lineVerticalPlaneSegment=_(this._observerManipulator.renderLocation,s.renderLocation,q):t.lineVerticalPlaneSegment=null):(t.visible=!1,t.heightManifoldTarget=null,t.lineVerticalPlaneSegment=null)}_createLaserLine(){this._removeLaserLine();const{glowWidth:e,innerWidth:t}=P;this._laserlineVisualElement=new C({view:this.view,attached:!0,visible:this.visible,style:{glowWidth:e,innerWidth:t},isDecoration:!0})}_removeLaserLine(){null!=this._laserlineVisualElement&&(this._laserlineVisualElement.destroy(),this._laserlineVisualElement=null)}_updateLaserLineStyle(e,t,n){const i=this._laserlineVisualElement;if(null==i)return;const a=i.style;i.style={...a,glowColor:e.toUnitRGB(),innerColor:t.toUnitRGB(),globalAlpha:n}}_onObserverLocationChange(e){null!=e?(this._observerManipulator.metadata.intersection=null,this._observerManipulator.available=!0,this._observerManipulator.elevationAlignedLocation=e):this._observerManipulator.available=!1}_onTargetLocationChange(e,t){null!=e?(t.elevationAlignedLocation=e,t!==this._targetTrackerManipulator&&(t.available=!0)):t.available=!1}_addPointFromClickEvent(e,i){const a=this._getPlacementLocation(e,i);if(null==a)return;const{intersection:r,point:s}=a;if(null!=this.analysis.observer?.position){this._clearCursorTracker();const e=new n;this._updateFromIntersection(e,r,s),this.analysis.targets.add(e)}else{const e=new t;this._updateFromIntersection(e,r,s),this.analysis.observer=e}}_clickHandler(e){this.active&&e.button!==O.Right&&(this._addPointFromClickEvent(F(e),e.pointerType),e.stopPropagation())}_doubleClickHandler(e){this.active&&e.button!==O.Right&&(this.stop(),e.stopPropagation())}_pointerMoveHandler(e){if(this.hasGrabbedManipulators)return;if(this._latestPointerMovePointerType=e.pointerType,this._updateLaserLineRenderer(),!this._showTracker)return void this._clearCursorTracker();const t=F(e),n=this._intersector.getScreenPointIntersection(t),i=n?.mapPoint;null!=n?.mapPoint&&null!=i?(this._trackerIntersection=n,this._trackerMapPoint=i,this._updateHoverSnapping(i,e.pointerType)):this._clearCursorTracker()}_getPlacementLocation(e,t){const n=this._intersector.getScreenPointIntersection(e);if(null==n?.mapPoint)return null;const i=n.mapPoint;if(!this._shouldUsePlacementSnapping(t))return{intersection:n,point:i};const a=n.mapPoint,r=this._trackerMapPoint?.equals(a)?this._snappingOperation.stagedPoint:null,s=m(r??this._snappingOperation.update({point:a},this._ensureSnappingManager(),this._getSnappingContext(t)));return{intersection:this._resolveIntersection(n,s),point:s}}_shouldUsePlacementSnapping(e){return"touch"!==e}_updateHoverSnapping(e,t){const n=this._getSnappingContext(t);this._updatingHandles.consumePromise(o(this._snappingOperation.snap({point:e},this._ensureSnappingManager(),n)))}_updateFromIntersection(e,t,n=t.mapPoint){if(null==n)return e.position=null,e.elevationInfo=null,void(e.feature=null);const i=!t.mapPoint?.equals(n);switch(t.context?.type){case"graphic":{const n=t.context.graphic,i=y(n);"on-the-ground"===i.mode&&(i.mode="relative-to-ground",i.offset=0),e.elevationInfo=new M(i),e.feature=n}break;case"ground":e.elevationInfo=new M({mode:"on-the-ground"}),e.feature=null;break;default:e.elevationInfo=null,e.feature=null}i&&(e.elevationInfo=null);const a=n.clone();a.z=f(this.view,a,{mode:"absolute-height",offset:0},e.elevationInfo),e.position=a}_manipulatorClick(e,t){if("observer"===e.metadata.type||e.grabbing||e.dragging||t.button!==O.Right||this.analysis.targets.length<=1)return;const{target:n}=e.metadata;this.analysis.targets.remove(n),t.stopPropagation()}get testInfo(){}_resetSnappingState(){this._snappingManager?.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_resolveIntersection(e,t){return e.mapPoint?.equals(t)?e:this._intersector.getMapPointIntersection(t)??e}};function z(e){const t=e.position?.clone();return n=>(e.position=t,n)}function W(e,t){const{isValid:n,isTargetVisible:i}=t.computationResult;e.state=n?i?16:32:64}function B(e){const{isValid:t,isTargetVisible:n}=e.computationResult;return{isValid:t,isTargetVisible:n}}e([c({constructOnly:!0})],U.prototype,"view",void 0),e([c({constructOnly:!0})],U.prototype,"analysis",void 0),e([c()],U.prototype,"_creationMode",void 0),e([c({readOnly:!0})],U.prototype,"state",null),e([c({readOnly:!0})],U.prototype,"cursor",null),e([c()],U.prototype,"removeIncompleteOnCancel",void 0),e([c({readOnly:!0})],U.prototype,"updating",null),e([c({constructOnly:!0})],U.prototype,"analysisViewData",void 0),e([c({readOnly:!0})],U.prototype,"_showTracker",null),e([c()],U.prototype,"_latestPointerMovePointerType",void 0),e([c()],U.prototype,"_shouldRenderTracker",null),e([c()],U.prototype,"_laserlineVisualElement",void 0),e([c()],U.prototype,"_grabbedManipulator",void 0),e([c()],U.prototype,"_trackerIntersection",void 0),e([c()],U.prototype,"_trackerMapPoint",void 0),e([c()],U.prototype,"_snappingManagerResult",void 0),U=e([h("esri.views.3d.analysis.LineOfSight.LineOfSightTool")],U);const q=g();export{U as LineOfSightTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{debounce as i}from"../../../../core/promiseUtils.js";import{createVolume as n}from"../../../../core/quantity.js";import{whenOnce as s,watch as a,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{property as u,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{e as m}from"../../../../chunks/earcut.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scaleAndAdd as d,sqrDist as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as g,clone as f,create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as _}from"../../../../core/support/UpdatingHandles.js";import v from"../../../../geometry/Multipoint.js";import{projectOrLoad as w}from"../../../../geometry/projectionUtils.js";import{e as j}from"../../../../chunks/containsOperator.js";import{e as R}from"../../../../chunks/convexHullOperator.js";import{e as b}from"../../../../chunks/simplifyOperator.js";import{e as E}from"../../../../chunks/unionOperator.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as x}from"../../../../geometry/projection/projectBoundingRect.js";import{fromExtent as T,intersects as G,create as L,empty as O}from"../../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as I}from"../../../../geometry/support/DoubleArray.js";import{t as D}from"../../../../chunks/vec3.js";import H from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as M}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as P}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementInsufficientDataError as V,VolumeMeasurementPerimeterTooLargeError as U,VolumeMeasurementUnsupportedCoordinateSystemError as N,VolumeMeasurementUnsupportedLayerTransparencyError as k}from"./volumeMeasurementErrors.js";import{VolumeMeasurementRawResult as A}from"./VolumeMeasurementRawResult.js";import S from"./VolumeMeasurementResult.js";import{ElevationContext as F}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as W}from"../../support/ElevationProvider.js";import{polygonToRenderInfo as z}from"../../support/renderInfoUtils/polygon.js";import{IteratorPreorder as q}from"../../terrain/tileUtils.js";import{CutFillComputationRenderNode as B,TargetGeometryRenderInfo as Z}from"../../webgl-engine/lib/CutFillComputationRenderNode.js";import{isIntegratedMeshLayerView as J}from"../../../support/layerViewUtils.js";import{MeasurementWorkerHandle as K}from"../../../support/MeasurementWorkerHandle.js";let Q=class extends r{constructor(e){super(e),this._measurementWorkerHandle=new K,this._getElevationProvider=()=>this.view.elevationProvider,this.depthExtremaPositions=null,this._updatingHandles=new _,this._rawResult=null,this._sufficientDataCoverage=!0,this._tileIterator=new q,this._intersectingObbs=[],this._intersectingTiles=[],this._debouncedUpdate=i(async(e,t,r,o)=>{if(!this._computationRenderNode.done)return;const{renderCoordsHelper:i}=this.view,n=new P({extent:t,localOrigin:r,renderCoordsHelper:i});this._computationRenderNode.update(n,o),this._determineDataCoverage(n);const[a]=await Promise.allSettled([this._measurementWorkerHandle.areaHorizontal(e,{returnLength:!0}),s(()=>this._computationRenderNode.done).then(()=>{this._updateDepthExtremaPositions(n,this._computationRenderNode.getResult())})]);if(this.error)return void(this._rawResult=null);const l=this._computationRenderNode.getResult();this._updateResult(n,l,"fulfilled"===a.status?a.value:null)}),this._determineDataCoverage=e=>{const{elevationAlignedGeometry:t}=this,{frustum:r}=this._computationRenderNode,{cameraDimensions:o}=e;t&&r&&(this._intersectingObbs.length=0,this._imLayerViewsAffectingMeasurement.forEach(e=>{this._findIntersectingObbs(e,r)}),this._intersectingObbs.length?this._sufficientDataCoverage=this._sufficientIntegratedMeshCoverage(t,o):(this._findIntersectingTerrainTiles(t),this._sufficientDataCoverage=this._sufficientTerrainCoverage(o)))}}initialize(){const e=this.view;this._computationRenderNode=new B({view:e}),this.addHandles([this._createElevationUpdateHandle(),a(()=>({projectedGeometry:this._projectedGeometry,localOrigin:this._localOrigin,targetGeometryRenderInfos:this._targetGeometryRenderInfos}),({projectedGeometry:e,localOrigin:t,targetGeometryRenderInfos:r})=>{const o=e?.extent;if(!(e&&o&&t&&r))return this._rawResult=null,void(this._sufficientDataCoverage=!0);this._updatingHandles.consumePromise(this._debouncedUpdate(e,o,t,r))},l)])}destroy(){this._updatingHandles.destroy(),this._computationRenderNode.destroy(),this._measurementWorkerHandle.destroy()}get _projectedGeometry(){const e=this.analysis.geometry;if(!e||!this.analysis.valid)return null;const t=b(e),r=w(t,this.view.spatialReference);return r.pending?(this._updatingHandles.consumePromise(r.pending),null):(t&&!r.geometry&&M(this.analysis,e.spatialReference,o.getLogger(this)),r.geometry)}get _localOrigin(){const e=this._projectedGeometry?.extent;return e?g(e.center.x,e.center.y,0):null}get elevationAlignedGeometry(){const e=this._projectedGeometry;if(!e)return null;const t=e.clone();return X(this._getElevationProvider(),t),t}get targetGeometry(){const{elevationAlignedGeometry:e}=this;if(!e)return null;const t=this.analysis.measureType,{effectiveTargetElevation:r}=this.analysisViewData;if("stockpile"===t||null==r)return e;const o=e.clone();return o.rings.forEach(e=>e.forEach(e=>e[2]=r)),o}get _targetGeometryRenderInfos(){const e=this.targetGeometry,t=this._projectedGeometry?.extent,r=this._localOrigin;if(!e||!t||!r)return null;const{elevationProvider:o,renderCoordsHelper:i}=this.view,n=z(e,o,i,F.fromElevationInfo(new H({mode:"absolute-height"}))),{polygons:s}=n;return s.map(e=>{const o=m(e.position,e.holeIndices,3),n=I(3*e.count),s=c(),a=c();return C(t.spatialReference,r,s,i.spatialReference),a[12]=-s[12],a[13]=-s[13],a[14]=-s[14],D(n,e.position,a),new Z(n,o)})}get updating(){return this._computationRenderNode.updating||this._updatingHandles.updating}get result(){const e=this._rawResult,{volume:t,area:r,length:o}=this.analysisViewData.effectiveDisplayUnits;return e?new S({measureType:this.analysis.measureType,rawResult:e,volumeUnit:t,areaUnit:r,lengthUnit:o}):null}get error(){return this._unsupportedCoordinateSystemError??this._unsupportedLayerTransparencyError??this._perimeterTooLargeError??this._insufficientDataError}get _imLayerViewsAffectingMeasurement(){return this.view.allLayerViews.filter(e=>J(e)).filter(e=>e.visible&&!e.suspended)}get _insufficientDataError(){return this._sufficientDataCoverage?null:new V}get _perimeterTooLargeError(){return this._perimeterTooLargeLocalError??this._perimeterTooLargeGlobalError}get _perimeterTooLargeLocalError(){const{spatialReference:e,state:{isLocal:r}}=this.view;if(!r||!e.isWebMercator)return null;const o=this._perimeter,{maxPerimeterLocalWebMercator:i}=t;return null!=o&&o>i?new U:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;const e=this._perimeter,{maxPerimeterGlobal:r}=t;return null!=e&&e>r?new U:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new N:null}get _unsupportedLayerTransparencyError(){return this.view.map.ground&&this.view.map.ground.opacity<1?new k:null}get _perimeter(){if(!this._targetGeometryRenderInfos)return null;let e=null;for(const t of this._targetGeometryRenderInfos){const r=$(ee(t.positions));e=r?Math.max(e??0,r):e}return null!=e?e/this.view.renderCoordsHelper.unitInMeters:null}_createElevationUpdateHandle(){const e=e=>{const t=this._projectedGeometry?.extent;"ground"===e.context&&t&&(x(e.extent,e.spatialReference,re,this.view.spatialReference),T(t,oe),G(re,oe)&&(this._getElevationProvider=()=>this.view.elevationProvider))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_updateResult(e,t,r){const{unitInMeters:o}=this.view.renderCoordsHelper,{dimensions:{width:i,height:s},cameraNearFar:{near:a,far:l}}=e,u=i/t.width*(s/t.height),p=Y(t.cut.totalDepth,a,l)*u,m=Y(t.fill.totalDepth,a,l)*u,c=o**3;this._rawResult=new A({cutVolume:n(Math.abs(p*c),"cubic-meters"),fillVolume:n(m*c,"cubic-meters"),area:r?.area,perimeter:r?.length})}_updateDepthExtremaPositions(e,t){const{dimensions:{width:r,height:o},cameraNearFar:{near:i,far:n},cameraPositionRenderSpace:s,northVector:a,eastVector:l,upVector:u}=e,p=e=>{const{depthExtremum:p,depthExtremumCoords:[m,c],totalDepth:h}=e,g=f(s);return 0!==h&&(d(g,g,l,r*(m/t.width-.5)),d(g,g,a,o*(c/t.height-.5))),d(g,g,u,-Y(p,i,n)),g};this.depthExtremaPositions={cut:p(t.cut),fill:p(t.fill)}}_findIntersectingObbs(e,t){const r=this._intersectingObbs;"integrated-mesh-3d"===e.type&&e.getVisibleNodes().forEach(o=>{e.isNodeLoaded(o.index)&&o.geometryObbInRenderSR?.intersectsFrustum(t)&&r.push(o.geometryObbInRenderSR)}),"integrated-mesh-3dtiles"===e.type&&e.forEachVisibleComponentObject(({obb:e})=>{e.intersectsFrustum(t)&&r.push(e)})}_sufficientIntegratedMeshCoverage(e,t){const{renderCoordsHelper:r,spatialReference:o}=this.view,i=[],n=new v({spatialReference:o});if(this._intersectingObbs.forEach(e=>{if(te(e.radius,t)&&(e.getCorners(ne),n.points.length=0,ne.forEach(e=>{const t=r.fromRenderCoords(e,se,o);t&&n.addPoint([t[0],t[1]])}),n.points.length)){const e=R(n);"polygon"===e?.type&&i.push(e)}}),!i.length)return!1;const s=E(i);return!!s&&j(s,e)}_findIntersectingTerrainTiles(e){const{basemapTerrain:t}=this.view;if(this._intersectingTiles.length=0,!e.extent)return;T(e.extent,ie);const r=this._tileIterator;r.reset(t.rootTiles);for(let o=r.next();o;o=r.next())o.intersectsExtent(ie)?o.rendered&&this._intersectingTiles.push(o):r.skipSubtree()}_sufficientTerrainCoverage(e){const{basemapTerrain:{tilingScheme:t}}=this.view,r=256/t.pixelSize;return this._intersectingTiles.every(t=>te(t.radius*r,e))}};function X(e,t){t.hasZ=!0,t.rings.forEach(t=>t.forEach(t=>t[2]=W(e,t,"ground")??0))}function Y(e,t,r){return e*(r-t)+t}function $(e){if(!e)return null;let t=null,r=null,o=0;for(const i of e)t||(t=[i[0],i[1],i[2]??0]),r?o+=h(r,i):r=[0,0,0],r[0]=i[0],r[1]=i[1],r[2]=i[2];return t&&r&&(o+=h(r,t)),Math.sqrt(o)}function*ee(e){const t=y();for(let r=0;r<e.length;r+=3)t[0]=e[r],t[1]=e[r+1],t[2]=e[r+2],yield t}e([u()],Q.prototype,"_projectedGeometry",null),e([u()],Q.prototype,"_localOrigin",null),e([u()],Q.prototype,"_getElevationProvider",void 0),e([u()],Q.prototype,"elevationAlignedGeometry",null),e([u()],Q.prototype,"targetGeometry",null),e([u()],Q.prototype,"_targetGeometryRenderInfos",null),e([u({constructOnly:!0})],Q.prototype,"analysis",void 0),e([u({constructOnly:!0})],Q.prototype,"analysisViewData",void 0),e([u({constructOnly:!0})],Q.prototype,"view",void 0),e([u()],Q.prototype,"updating",null),e([u()],Q.prototype,"result",null),e([u()],Q.prototype,"depthExtremaPositions",void 0),e([u()],Q.prototype,"error",null),e([u()],Q.prototype,"_imLayerViewsAffectingMeasurement",null),e([u()],Q.prototype,"_insufficientDataError",null),e([u()],Q.prototype,"_perimeterTooLargeError",null),e([u()],Q.prototype,"_perimeterTooLargeLocalError",null),e([u()],Q.prototype,"_perimeterTooLargeGlobalError",null),e([u()],Q.prototype,"_unsupportedCoordinateSystemError",null),e([u()],Q.prototype,"_unsupportedLayerTransparencyError",null),e([u()],Q.prototype,"_perimeter",null),e([u()],Q.prototype,"_computationRenderNode",void 0),e([u({readOnly:!0})],Q.prototype,"_updatingHandles",void 0),e([u()],Q.prototype,"_rawResult",void 0),e([u()],Q.prototype,"_sufficientDataCoverage",void 0),Q=e([p("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],Q);const te=(e,t)=>e<(t.width+t.height)/2,re=O(),oe=O(),ie=L(),ne=new Array(8).fill(0).map(()=>y()),se=y();export{Q as VolumeMeasurementCutFillController};
2
+ import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{debounce as i}from"../../../../core/promiseUtils.js";import{createVolume as n}from"../../../../core/quantity.js";import{whenOnce as s,watch as a,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{property as u,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{e as m}from"../../../../chunks/earcut.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scaleAndAdd as d,sqrDist as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as g,clone as f,create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as _}from"../../../../core/support/UpdatingHandles.js";import v from"../../../../geometry/Multipoint.js";import{projectOrLoad as w}from"../../../../geometry/projectionUtils.js";import{e as j}from"../../../../chunks/containsOperator.js";import{e as R}from"../../../../chunks/convexHullOperator.js";import{e as b}from"../../../../chunks/simplifyOperator.js";import{e as E}from"../../../../chunks/unionOperator.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as x}from"../../../../geometry/projection/projectBoundingRect.js";import{fromExtent as T,intersects as G,create as L,empty as O}from"../../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as I}from"../../../../geometry/support/DoubleArray.js";import{t as D}from"../../../../chunks/vec3.js";import H from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as M}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as P}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementInsufficientDataError as V,VolumeMeasurementPerimeterTooLargeError as U,VolumeMeasurementUnsupportedCoordinateSystemError as N,VolumeMeasurementUnsupportedLayerTransparencyError as k}from"./volumeMeasurementErrors.js";import{VolumeMeasurementRawResult as A}from"./VolumeMeasurementRawResult.js";import S from"./VolumeMeasurementResult.js";import{ElevationContext as F}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as W}from"../../support/ElevationProvider.js";import{polygonToRenderInfo as z}from"../../support/renderInfoUtils/polygon.js";import{IteratorPreorder as q}from"../../terrain/tileUtils.js";import{CutFillComputationRenderNode as B,TargetGeometryRenderInfo as Z}from"../../webgl-engine/lib/CutFillComputationRenderNode.js";import{isIntegratedMeshLayerView as J}from"../../../support/layerViewUtils.js";import{MeasurementWorkerHandle as K}from"../../../support/MeasurementWorkerHandle.js";let Q=class extends r{constructor(e){super(e),this._measurementWorkerHandle=new K,this._getElevationProvider=()=>this.view.elevationProvider,this.depthExtremaPositions=null,this._updatingHandles=new _,this._rawResult=null,this._sufficientDataCoverage=!0,this._tileIterator=new q,this._intersectingObbs=[],this._intersectingTiles=[],this._debouncedUpdate=i(async(e,t,r,o)=>{if(!this._computationRenderNode.done)return;const{renderCoordsHelper:i}=this.view,n=new P({extent:t,localOrigin:r,renderCoordsHelper:i});this._computationRenderNode.update(n,o),this._determineDataCoverage(n);const[a]=await Promise.allSettled([this._measurementWorkerHandle.areaHorizontal(e,{returnLength:!0}),s(()=>this._computationRenderNode.done).then(()=>{this._updateDepthExtremaPositions(n,this._computationRenderNode.getResult())})]);if(this.error)return void(this._rawResult=null);const l=this._computationRenderNode.getResult();this._updateResult(n,l,"fulfilled"===a.status?a.value:null)}),this._determineDataCoverage=e=>{const{elevationAlignedGeometry:t}=this,{frustum:r}=this._computationRenderNode,{cameraDimensions:o}=e;t&&r&&(this._intersectingObbs.length=0,this._imLayerViewsAffectingMeasurement.forEach(e=>{this._findIntersectingObbs(e,r)}),this._intersectingObbs.length?this._sufficientDataCoverage=this._sufficientIntegratedMeshCoverage(t,o):(this._findIntersectingTerrainTiles(t),this._sufficientDataCoverage=this._sufficientTerrainCoverage(o)))}}initialize(){const e=this.view;this._computationRenderNode=new B({view:e}),this.addHandles([this._createElevationUpdateHandle(),a(()=>({projectedGeometry:this._projectedGeometry,localOrigin:this._localOrigin,targetGeometryRenderInfos:this._targetGeometryRenderInfos}),({projectedGeometry:e,localOrigin:t,targetGeometryRenderInfos:r})=>{const o=e?.extent;if(!(e&&o&&t&&r))return this._rawResult=null,void(this._sufficientDataCoverage=!0);this._updatingHandles.consumePromise(this._debouncedUpdate(e,o,t,r))},l)])}destroy(){this._updatingHandles.destroy(),this._computationRenderNode.destroy(),this._measurementWorkerHandle.destroy()}get _projectedGeometry(){const e=this.analysis.geometry;if(!e||!this.analysis.valid)return null;const t=b(e),r=w(t,this.view.spatialReference);return r.pending?(this._updatingHandles.consumePromise(r.pending),null):(t&&!r.geometry&&M(this.analysis,e.spatialReference,o.getLogger(this)),r.geometry)}get _localOrigin(){const e=this._projectedGeometry?.extent;return e?g(e.center.x,e.center.y,0):null}get elevationAlignedGeometry(){const e=this._projectedGeometry;if(!e)return null;const t=e.clone();return X(this._getElevationProvider(),t),t}get targetGeometry(){const{elevationAlignedGeometry:e}=this;if(!e)return null;const t=this.analysis.measureType,{effectiveTargetElevation:r}=this.analysisViewData;if("stockpile"===t||null==r)return e;const o=e.clone();return o.rings.forEach(e=>e.forEach(e=>e[2]=r)),o}get _targetGeometryRenderInfos(){const e=this.targetGeometry,t=this._projectedGeometry?.extent,r=this._localOrigin;if(!e||!t||!r)return null;const{elevationProvider:o,renderCoordsHelper:i}=this.view,n=z(e,o,i,F.fromElevationInfo(new H({mode:"absolute-height"}))),{polygons:s}=n;return s.map(e=>{const o=m(e.position,e.holeIndices,3),n=I(3*e.count),s=c(),a=c();return C(t.spatialReference,r,s,i.spatialReference),a[12]=-s[12],a[13]=-s[13],a[14]=-s[14],D(n,e.position,a),new Z(n,o)})}get updating(){return this._computationRenderNode.updating||this._updatingHandles.updating}get result(){const e=this._rawResult,{volume:t,area:r,length:o}=this.analysisViewData.effectiveDisplayUnits;return e?new S({measureType:this.analysis.measureType,rawResult:e,volumeUnit:t,areaUnit:r,lengthUnit:o}):null}get error(){return this._unsupportedCoordinateSystemError??this._unsupportedLayerTransparencyError??this._perimeterTooLargeError??this._insufficientDataError}get _imLayerViewsAffectingMeasurement(){return this.view.allLayerViews.filter(e=>J(e)).filter(e=>e.visible&&!e.suspended)}get _insufficientDataError(){return this._sufficientDataCoverage?null:new V}get _perimeterTooLargeError(){return this._perimeterTooLargeLocalError??this._perimeterTooLargeGlobalError}get _perimeterTooLargeLocalError(){const{spatialReference:e,state:{isLocal:r}}=this.view;if(!r||!e.isWebMercator)return null;const o=this._perimeter,{maxPerimeterLocalWebMercator:i}=t;return null!=o&&o>i?new U:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;const e=this._perimeter,{maxPerimeterGlobal:r}=t;return null!=e&&e>r?new U:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new N:null}get _unsupportedLayerTransparencyError(){return this.view.map.ground&&this.view.map.ground.opacity<1?new k:null}get _perimeter(){if(!this._targetGeometryRenderInfos)return null;let e=null;for(const t of this._targetGeometryRenderInfos){const r=$(ee(t.positions));e=r?Math.max(e??0,r):e}return null!=e?e/this.view.renderCoordsHelper.unitInMeters:null}_createElevationUpdateHandle(){const e=e=>{const t=this._projectedGeometry?.extent;"ground"===e.context&&t&&(x(e.extent,e.spatialReference,re,this.view.spatialReference),T(t,oe),G(re,oe)&&(this._getElevationProvider=()=>this.view.elevationProvider))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_updateResult(e,t,r){const{unitInMeters:o}=this.view.renderCoordsHelper,{dimensions:{width:i,height:s},cameraNearFar:{near:a,far:l}}=e,u=i/t.width*(s/t.height),p=Y(t.cut.totalDepth,a,l)*u,m=Y(t.fill.totalDepth,a,l)*u,c=o**3;this._rawResult=new A({cutVolume:n(Math.abs(p*c),"cubic-meters"),fillVolume:n(m*c,"cubic-meters"),area:r?.area,perimeter:r?.length})}_updateDepthExtremaPositions(e,t){const{dimensions:{width:r,height:o},cameraNearFar:{near:i,far:n},cameraPositionRenderSpace:s,northVector:a,eastVector:l,upVector:u}=e,p=e=>{const{depthExtremum:p,depthExtremumCoords:[m,c],totalDepth:h}=e,g=f(s);return 0!==h&&(d(g,g,l,r*(m/t.width-.5)),d(g,g,a,o*(c/t.height-.5))),d(g,g,u,-Y(p,i,n)),g};this.depthExtremaPositions={cut:p(t.cut),fill:p(t.fill)}}_findIntersectingObbs(e,t){const r=this._intersectingObbs;"integrated-mesh-3d"===e.type&&e.getVisibleNodes().forEach(o=>{e.isNodeLoaded(o.index)&&o.geometryObbInRenderSR?.intersectsFrustum(t)&&r.push(o.geometryObbInRenderSR)}),"integrated-mesh-3dtiles"===e.type&&e.forEachVisibleComponentObject(({obb:e})=>{e.intersectsFrustum(t)&&r.push(e)})}_sufficientIntegratedMeshCoverage(e,t){const{renderCoordsHelper:r,spatialReference:o}=this.view,i=[],n=new v({spatialReference:o});if(this._intersectingObbs.forEach(e=>{if(te(e.radius,t)&&(e.getCorners(ne),n.points.length=0,ne.forEach(e=>{const t=r.fromRenderCoords(e,se,o);t&&n.addPoint([t[0],t[1]])}),n.points.length)){const e=R(n);"polygon"===e?.type&&i.push(e)}}),!i.length)return!1;const s=E(i);return!!s&&j(s,e)}_findIntersectingTerrainTiles(e){const{basemapTerrain:t}=this.view;if(this._intersectingTiles.length=0,!e.extent)return;T(e.extent,ie);const r=this._tileIterator;r.reset(t.rootTiles);for(let o=r.next();o;o=r.next())o.intersectsExtent(ie)?o.rendered&&this._intersectingTiles.push(o):r.skipSubtree()}_sufficientTerrainCoverage(e){const{basemapTerrain:{tilingScheme:t}}=this.view;if(!this._intersectingTiles.length)return!1;const r=256/t.pixelSize;return this._intersectingTiles.every(t=>te(t.radius*r,e))}};function X(e,t){t.hasZ=!0,t.rings.forEach(t=>t.forEach(t=>t[2]=W(e,t,"ground")??0))}function Y(e,t,r){return e*(r-t)+t}function $(e){if(!e)return null;let t=null,r=null,o=0;for(const i of e)t||(t=[i[0],i[1],i[2]??0]),r?o+=h(r,i):r=[0,0,0],r[0]=i[0],r[1]=i[1],r[2]=i[2];return t&&r&&(o+=h(r,t)),Math.sqrt(o)}function*ee(e){const t=y();for(let r=0;r<e.length;r+=3)t[0]=e[r],t[1]=e[r+1],t[2]=e[r+2],yield t}e([u()],Q.prototype,"_projectedGeometry",null),e([u()],Q.prototype,"_localOrigin",null),e([u()],Q.prototype,"_getElevationProvider",void 0),e([u()],Q.prototype,"elevationAlignedGeometry",null),e([u()],Q.prototype,"targetGeometry",null),e([u()],Q.prototype,"_targetGeometryRenderInfos",null),e([u({constructOnly:!0})],Q.prototype,"analysis",void 0),e([u({constructOnly:!0})],Q.prototype,"analysisViewData",void 0),e([u({constructOnly:!0})],Q.prototype,"view",void 0),e([u()],Q.prototype,"updating",null),e([u()],Q.prototype,"result",null),e([u()],Q.prototype,"depthExtremaPositions",void 0),e([u()],Q.prototype,"error",null),e([u()],Q.prototype,"_imLayerViewsAffectingMeasurement",null),e([u()],Q.prototype,"_insufficientDataError",null),e([u()],Q.prototype,"_perimeterTooLargeError",null),e([u()],Q.prototype,"_perimeterTooLargeLocalError",null),e([u()],Q.prototype,"_perimeterTooLargeGlobalError",null),e([u()],Q.prototype,"_unsupportedCoordinateSystemError",null),e([u()],Q.prototype,"_unsupportedLayerTransparencyError",null),e([u()],Q.prototype,"_perimeter",null),e([u()],Q.prototype,"_computationRenderNode",void 0),e([u({readOnly:!0})],Q.prototype,"_updatingHandles",void 0),e([u()],Q.prototype,"_rawResult",void 0),e([u()],Q.prototype,"_sufficientDataCoverage",void 0),Q=e([p("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],Q);const te=(e,t)=>e<(t.width+t.height)/2,re=O(),oe=O(),ie=L(),ne=new Array(8).fill(0).map(()=>y()),se=y();export{Q as VolumeMeasurementCutFillController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{getTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{copy as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{subtract as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as o,copy as a}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Object3DVisualElement as l}from"./Object3DVisualElement.js";import{Attribute as n}from"../../webgl-engine/lib/Attribute.js";import{Geometry as d}from"../../webgl-engine/lib/Geometry.js";import{CheckerBoardMaterial as h}from"../../webgl-engine/materials/CheckerBoardMaterial.js";class m extends l{constructor(e){super(e),this._checkerBoardMaterial=null,this._renderOccluded=4,this._transparentRenderOrder=0,this._geometry=null,this._size=t(1,1),this._color1=c(1,.5,0,.5),this._color2=c(1,1,1,.5),this.applyProperties(e)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get testsTransparentRenderOrder(){return this._transparentRenderOrder}set testsTransparentRenderOrder(e){e!==this._transparentRenderOrder&&(this._transparentRenderOrder=e,this._updateMaterial())}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get size(){return this._size}set size(e){r(this._size,e),this._updateMaterial()}get color1(){return this._color1}set color1(e){o(e,this._color1)||(a(this._color1,e),this._updateMaterial())}get color2(){return this._color2}set color2(e){o(e,this._color2)||(a(this._color2,e),this._updateMaterial())}_updateMaterial(){this._checkerBoardMaterial?.setParameters({size:this._size,color1:this._color1,color2:this._color2,renderOccluded:this._renderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder})}createExternalResources(){this._checkerBoardMaterial=new h({size:this._size,color1:this._color1,color2:this._color2,writeDepth:!1,polygonOffset:1,renderOccluded:this._renderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration})}destroyExternalResources(){this._checkerBoardMaterial=null}forEachMaterial(e){e(this._checkerBoardMaterial)}createGeometries(r){if(null==this._geometry||null==this._checkerBoardMaterial)return;const t=_;e(t,this.transform);const o=this._geometry,a=[],c=i();o.position.forEach(e=>{s(c,e,t),a.push(c[0],c[1],c[2])});const l=[];o.uv.forEach(e=>{l.push(e[0],e[1])});const h=new d(this._checkerBoardMaterial,[["position",new n(a,o.triangleIndices,3,!0)],["uv0",new n(l,o.triangleIndices,2,!0)]]);r.addGeometry(h)}}const _=i();export{m as MeasurementAreaVisualElement};
2
+ import{getTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{copy as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{subtract as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as o,copy as a}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Object3DVisualElement as l}from"./Object3DVisualElement.js";import{Attribute as n}from"../../webgl-engine/lib/Attribute.js";import{Geometry as d}from"../../webgl-engine/lib/Geometry.js";import{CheckerBoardMaterial as h}from"../../webgl-engine/materials/CheckerBoardMaterial.js";class m extends l{constructor(e){super(e),this._checkerBoardMaterial=null,this._renderOccluded=4,this._transparentRenderOrder=0,this._geometry=null,this._size=t(1,1),this._color1=c(1,.5,0,.5),this._color2=c(1,1,1,.5),this.applyProperties(e)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get testsTransparentRenderOrder(){return this._transparentRenderOrder}set testsTransparentRenderOrder(e){e!==this._transparentRenderOrder&&(this._transparentRenderOrder=e,this._updateMaterial())}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get size(){return this._size}set size(e){r(this._size,e),this._updateMaterial()}get color1(){return this._color1}set color1(e){o(e,this._color1)||(a(this._color1,e),this._updateMaterial())}get color2(){return this._color2}set color2(e){o(e,this._color2)||(a(this._color2,e),this._updateMaterial())}_updateMaterial(){this._checkerBoardMaterial?.setParameters({size:this._size,color1:this._color1,color2:this._color2,renderOccluded:this._renderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder})}createExternalResources(){this._checkerBoardMaterial=new h({size:this._size,color1:this._color1,color2:this._color2,writeDepth:!1,renderOccluded:this._renderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration})}destroyExternalResources(){this._checkerBoardMaterial=null}forEachMaterial(e){e(this._checkerBoardMaterial)}createGeometries(r){if(null==this._geometry||null==this._checkerBoardMaterial)return;const t=_;e(t,this.transform);const o=this._geometry,a=[],c=i();o.position.forEach(e=>{s(c,e,t),a.push(c[0],c[1],c[2])});const l=[];o.uv.forEach(e=>{l.push(e[0],e[1])});const h=new d(this._checkerBoardMaterial,[["position",new n(a,o.triangleIndices,3,!0)],["uv0",new n(l,o.triangleIndices,2,!0)]]);r.addGeometry(h)}}const _=i();export{m as MeasurementAreaVisualElement};