@arcgis/core 4.34.0-next.23 → 4.34.0-next.24

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 (102) hide show
  1. package/arcade/parser.js +1 -1
  2. package/arcade/validation/arcadeValidator.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/026fbeb0ff5b9e6c74df.js +1 -0
  5. package/assets/esri/core/workers/chunks/234cbc290b074eeb5dd6.js +1 -0
  6. package/assets/esri/core/workers/chunks/{00eef04fd026adaf0df8.js → 36a2a8b6547604bad2ab.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{63cc4647b7775ff8aedf.js → 44d28849e59f62616e72.js} +1 -1
  8. package/assets/esri/core/workers/chunks/4c47d327815e281c457e.js +1 -0
  9. package/assets/esri/core/workers/chunks/{6bb1ecaa0afc2c7de79e.js → 4cc3eeb0b824c53793d0.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{19ae76283a0cb0fe4dee.js → 4ea96aff38bb301dc40d.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{cab1a1067f44ce374673.js → 7d7f8f2936ddee65e3da.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{b57c0ef7bc57e3c91257.js → 865fccacf44ae5b70eba.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{f43110391f124b8a179c.js → 909a6218db87cba2c9ba.js} +1 -1
  14. package/assets/esri/core/workers/chunks/a273f80298417edecc07.js +1 -0
  15. package/assets/esri/core/workers/chunks/{496e02cfe3d84010f675.js → a2ed7a3cd518dd136ec7.js} +1 -1
  16. package/assets/esri/core/workers/chunks/b32c1b60896a72e0ae90.js +1 -0
  17. package/assets/esri/core/workers/chunks/{6782114a752b9cc59168.js → b6b8272a74a5c24a6b86.js} +1 -1
  18. package/assets/esri/core/workers/chunks/b9f66d735a7e63417b3d.js +1 -0
  19. package/assets/esri/core/workers/chunks/d2ce360961ca4b58666c.js +1 -0
  20. package/assets/esri/core/workers/chunks/fe1902d63f610cebd947.js +1 -0
  21. package/chunks/Bufferer-Dw9Qi4T1.js +1 -1
  22. package/chunks/Envelope.js +1 -1
  23. package/chunks/MultiPathImpl.js +1 -1
  24. package/chunks/OperatorClip.js +1 -1
  25. package/chunks/ProjectionTransformation.js +1 -1
  26. package/chunks/index.js +1 -1
  27. package/config.js +1 -1
  28. package/core/MemCachePool.js +1 -1
  29. package/core/accessorSupport/overrideDefaultsFrom.js +1 -1
  30. package/geometry/operators/gx/operatorOffset.js +1 -1
  31. package/geometry/operators/support/jsonConverter.js +1 -1
  32. package/interfaces.d.ts +70 -2
  33. package/kernel.js +1 -1
  34. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  35. package/layers/orientedImagery/core/bestImageUtils.js +1 -1
  36. package/layers/support/ControlPointsGeoreference.js +1 -1
  37. package/layers/support/PixelBlock.js +1 -1
  38. package/layers/support/RasterJobHandler.js +1 -1
  39. package/layers/support/RasterWorker.js +1 -1
  40. package/layers/support/rasterFunctions/clipUtils.js +1 -1
  41. package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
  42. package/layers/video/VideoController.js +1 -1
  43. package/networks/support/UtilityNetworkLookupHelper.js +1 -1
  44. package/package.json +1 -1
  45. package/renderers/support/DictionaryControlString.js +1 -1
  46. package/support/revision.js +1 -1
  47. package/symbols/cim/cimAnalyzer.js +1 -1
  48. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterInputEvaluator.js +1 -1
  49. package/views/2d/layers/features/FeatureContainer.js +1 -1
  50. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  51. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  52. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  53. package/views/2d/layers/features/support/FeatureFilterEvaluator.js +1 -1
  54. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  55. package/views/3d/analysis/images/heading-rotate-svg.js +1 -1
  56. package/views/3d/analysis/images/tilt-rotate-svg.js +1 -1
  57. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  58. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  59. package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
  60. package/views/3d/state/ViewStateManager.js +1 -1
  61. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  62. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  63. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  64. package/views/VideoView.js +1 -1
  65. package/views/draw/MultipointDrawAction.js +1 -1
  66. package/views/draw/PointDrawAction.js +1 -1
  67. package/views/draw/PolygonDrawAction.js +1 -1
  68. package/views/draw/PolylineDrawAction.js +1 -1
  69. package/views/magnifier/mask-svg.js +1 -1
  70. package/views/magnifier/overlay-svg.js +1 -1
  71. package/webmap/Bookmark.js +1 -1
  72. package/webscene/spec-certification/spec.js +1 -1
  73. package/widgets/BasemapLayerList.js +1 -1
  74. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  75. package/widgets/Editor/support/SketchController.js +1 -1
  76. package/widgets/Editor/workflowUtils.js +1 -1
  77. package/widgets/Editor.js +1 -1
  78. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  79. package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
  80. package/widgets/LayerList.js +1 -1
  81. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  82. package/widgets/OrientedImageryViewer/components/ImageViewer.js +1 -1
  83. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  84. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  85. package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +1 -1
  86. package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
  87. package/widgets/OrientedImageryViewer/navigation/utils.js +1 -1
  88. package/widgets/OrientedImageryViewer.js +1 -1
  89. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  90. package/widgets/PanoramicViewer.js +1 -1
  91. package/widgets/Print.js +1 -1
  92. package/widgets/Sketch/SketchViewModel.js +1 -1
  93. package/widgets/Slider/SliderViewModel.js +1 -1
  94. package/widgets/support/SelectionList.js +1 -1
  95. package/assets/esri/core/workers/chunks/0ba6177ba118a0f032e2.js +0 -1
  96. package/assets/esri/core/workers/chunks/573a8393bec916dcf16f.js +0 -1
  97. package/assets/esri/core/workers/chunks/81006d9eed65bbb82962.js +0 -1
  98. package/assets/esri/core/workers/chunks/9f91d519da67714f915f.js +0 -1
  99. package/assets/esri/core/workers/chunks/ad3871f497ecea1a08c9.js +0 -1
  100. package/assets/esri/core/workers/chunks/cd64181298d82c8d0e9d.js +0 -1
  101. package/assets/esri/core/workers/chunks/def8a854a05f17d3538e.js +0 -1
  102. package/assets/esri/core/workers/chunks/f3d5d92e0aefc2593208.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import{open as r}from"../../core/workers/workers.js";import o from"./PixelBlock.js";class t{constructor(){this._workerThread=null,this._destroyed=!1}async initialize(){const e=await r("RasterWorker");this._destroyed?e.close():this._workerThread=e}destroy(){this._destroyed=!0,this._workerThread&&(this._workerThread.close(),this._workerThread=null)}async convertVectorFieldData(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=await this._workerThread.invoke("convertVectorFieldData",{pixelBlock:r.pixelBlock.toJSON(),type:r.dataType},t);return n?new o(n):null}computeStatisticsHistograms(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");return this._workerThread.invoke("computeStatisticsHistograms",{pixelBlock:r.pixelBlock.toJSON()},o)}async decode(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=await this._workerThread.invoke("decode",r,t);return n?new o(n):null}async symbolize(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n={extent:r.extent?.toJSON(),pixelBlock:r.pixelBlock?.toJSON(),simpleStretchParams:r.simpleStretchParams,bandIds:r.bandIds},a=await this._workerThread.invoke("symbolize",n,t);return a?new o(a):null}async updateSymbolizer(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const t=r?.rendererJSON?.histograms;await Promise.all(this._workerThread.broadcast("updateSymbolizer",{symbolizerJSON:r.toJSON(),histograms:t},o))}async updateRasterFunction(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");await Promise.all(this._workerThread.broadcast("updateRasterFunction",{rasterFunctionJSON:r.toJSON()},o))}async process(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=await this._workerThread.invoke("process",{extent:r.extent?.toJSON(),primaryPixelSizes:r.primaryPixelSizes?.map(e=>null!=e?e.toJSON():null),primaryPixelBlocks:r.primaryPixelBlocks.map(e=>null!=e?e.toJSON():null),primaryRasterIds:r.primaryRasterIds},t);return n?new o(n):null}async stretch(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(!r?.pixelBlock)return null;const n={srcPixelBlock:r.pixelBlock.toJSON(),stretchParams:r.stretchParams},a=await this._workerThread.invoke("stretch",n,t);return a?new o(a):null}async split(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(!r?.pixelBlock)return null;const n={srcPixelBlock:r.pixelBlock.toJSON(),tileSize:r.tileSize,maximumPyramidLevel:r.maximumPyramidLevel,useBilinear:r.useBilinear},a=await this._workerThread.invoke("split",n,t);return a&&a.forEach((e,r)=>{a.set(r,e?o.fromJSON(e):null)}),a}async clipTile(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(!r?.pixelBlock)return null;const n={...r,pixelBlock:r.pixelBlock.toJSON()},a=await this._workerThread.invoke("clipTile",n,t);return a?o.fromJSON(a):null}async estimateStatisticsHistograms(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(!r?.pixelBlock)return null;const t={srcPixelBlock:r.pixelBlock.toJSON()};return await this._workerThread.invoke("estimateStatisticsHistograms",t,o)}async mosaicAndTransform(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(!r?.srcPixelBlocks?.length)return{pixelBlock:null};const n={...r,srcPixelBlocks:r.srcPixelBlocks.map(e=>null!=e?e.toJSON():null)},a=await this._workerThread.invoke("mosaicAndTransform",n,t);return{pixelBlock:a.pixelBlock?new o(a.pixelBlock):null,localNorthDirections:a.localNorthDirections}}async createFlowMesh(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const t={buffer:r.flowData.data.buffer,maskBuffer:r.flowData.mask.buffer,width:r.flowData.width,height:r.flowData.height},{meshType:n,simulationSettings:a}=r,i=await this._workerThread.invoke("createFlowMesh",{meshType:n,flowData:t,simulationSettings:a},{...o,transferList:[t.buffer,t.maskBuffer]});return{vertexData:new Float32Array(i.vertexBuffer),indexData:new Uint32Array(i.indexBuffer)}}getProjectionOffsetGrid(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const t=null!=r.datumTransformation?r.datumTransformation.steps.map(e=>({wkid:e.wkid,wkt:e.wkt,isInverse:e.isInverse})):null,n=null!=r.rasterTransform?r.rasterTransform.toJSON():null,a={projectedExtent:r.projectedExtent.toJSON(),srcBufferExtent:r.srcBufferExtent.toJSON(),pixelSize:r.pixelSize,hasWrapAround:r.hasWrapAround,spacing:r.spacing,datumTransformationSteps:t,rasterTransform:n,isAdaptive:r.isAdaptive,includeGCSGrid:r.includeGCSGrid};return this._workerThread.invoke("getProjectionOffsetGrid",a,o)}}export{t as default};
5
+ import e from"../../core/Error.js";import{open as r}from"../../core/workers/workers.js";import o from"./PixelBlock.js";class t{constructor(){this._workerThread=null,this._destroyed=!1}async initialize(){const e=await r("RasterWorker");this._destroyed?e.close():this._workerThread=e}destroy(){this._destroyed=!0,this._workerThread&&(this._workerThread.close(),this._workerThread=null)}async convertVectorFieldData(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=r.pixelBlock.getTransferableObject().pixelBlock,a=await this._workerThread.invoke("convertVectorFieldData",{pixelBlock:n,type:r.dataType},t);return a?new o(a):null}computeStatisticsHistograms(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const t=r.pixelBlock.getTransferableObject().pixelBlock;return this._workerThread.invoke("computeStatisticsHistograms",{pixelBlock:t},o)}async decode(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=await this._workerThread.invoke("decode",r,{...t,transferList:[r.data]});return n?new o(n):null}async symbolize(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=r.pixelBlock?.getTransferableObject().pixelBlock,a={extent:r.extent?.toJSON(),pixelBlock:n,simpleStretchParams:r.simpleStretchParams,bandIds:r.bandIds},i=await this._workerThread.invoke("symbolize",a,t);return i?new o(i):null}async updateSymbolizer(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const t=r?.rendererJSON?.histograms;await Promise.all(this._workerThread.broadcast("updateSymbolizer",{symbolizerJSON:r.toJSON(),histograms:t},o))}async updateRasterFunction(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");await Promise.all(this._workerThread.broadcast("updateRasterFunction",{rasterFunctionJSON:r.toJSON()},o))}async process(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=await this._workerThread.invoke("process",{extent:r.extent?.toJSON(),primaryPixelSizes:r.primaryPixelSizes?.map(e=>null!=e?e.toJSON():null),primaryPixelBlocks:r.primaryPixelBlocks.map(e=>e?.getTransferableObject().pixelBlock),primaryRasterIds:r.primaryRasterIds},t);return n?new o(n):null}async stretch(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(!r?.pixelBlock)return null;const n={srcPixelBlock:r.pixelBlock.getTransferableObject().pixelBlock,stretchParams:r.stretchParams},a=await this._workerThread.invoke("stretch",n,t);return a?new o(a):null}async split(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(!r?.pixelBlock)return null;const n={srcPixelBlock:r.pixelBlock.getTransferableObject().pixelBlock,tileSize:r.tileSize,maximumPyramidLevel:r.maximumPyramidLevel,useBilinear:r.useBilinear},a=await this._workerThread.invoke("split",n,t);return a&&a.forEach((e,r)=>{a.set(r,e?o.fromJSON(e):null)}),a}async clipTile(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(!r?.pixelBlock)return null;const n=r.pixelBlock.getTransferableObject().pixelBlock,a={...r,pixelBlock:n},i=await this._workerThread.invoke("clipTile",a,t);return i?o.fromJSON(i):null}async estimateStatisticsHistograms(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(!r?.pixelBlock)return null;const t={srcPixelBlock:r.pixelBlock.getTransferableObject().pixelBlock};return await this._workerThread.invoke("estimateStatisticsHistograms",t,o)}async mosaicAndTransform(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(!r?.srcPixelBlocks?.length)return{pixelBlock:null};const n={...r,srcPixelBlocks:r.srcPixelBlocks.map(e=>e?.getTransferableObject().pixelBlock)},a=await this._workerThread.invoke("mosaicAndTransform",n,t);return{pixelBlock:a.pixelBlock?new o(a.pixelBlock):null,localNorthDirections:a.localNorthDirections}}async createFlowMesh(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const t={buffer:r.flowData.data.buffer,maskBuffer:r.flowData.mask.buffer,width:r.flowData.width,height:r.flowData.height},{meshType:n,simulationSettings:a}=r,i=await this._workerThread.invoke("createFlowMesh",{meshType:n,flowData:t,simulationSettings:a},{...o,transferList:[t.buffer,t.maskBuffer]});return{vertexData:new Float32Array(i.vertexBuffer),indexData:new Uint32Array(i.indexBuffer)}}getProjectionOffsetGrid(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const t=null!=r.datumTransformation?r.datumTransformation.steps.map(e=>({wkid:e.wkid,wkt:e.wkt,isInverse:e.isInverse})):null,n=null!=r.rasterTransform?r.rasterTransform.toJSON():null,a={projectedExtent:r.projectedExtent.toJSON(),srcBufferExtent:r.srcBufferExtent.toJSON(),pixelSize:r.pixelSize,hasWrapAround:r.hasWrapAround,spacing:r.spacing,datumTransformationSteps:t,rasterTransform:n,isAdaptive:r.isAdaptive,includeGCSGrid:r.includeGCSGrid};return this._workerThread.invoke("getProjectionOffsetGrid",a,o)}}export{t as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import r from"../../geometry/Extent.js";import e from"../../geometry/Point.js";import t from"../../geometry/operators/support/GeographicTransformation.js";import s from"./PixelBlock.js";import{decode as o}from"./rasterFormats/RasterCodec.js";import{split as i,clipTile as n,mosaic as a,approximateTransform as l,getLocalArithmeticNorthRotations as m}from"./rasterFunctions/pixelUtils.js";import{create as c}from"./rasterFunctions/rasterFunctionHelper.js";import{load as f,getProjectionOffsetGrid as p}from"./rasterFunctions/rasterProjectionHelper.js";import{computeStatisticsHistograms as u,estimateStatisticsHistograms as S}from"./rasterFunctions/stretchUtils.js";import{convertVectorFieldData as d,convertToLocalDirections as x}from"./rasterFunctions/vectorFieldUtils.js";import{readTransform as y}from"./rasterTransforms/utils.js";import h from"../../renderers/support/RasterSymbolizer.js";import{createFlowMesh as O}from"../../views/2d/engine/flow/dataUtils.js";class N{convertVectorFieldData(r){const e=s.fromJSON(r.pixelBlock),t=d(e,r.type);return Promise.resolve(null!=t?t.toJSON():null)}computeStatisticsHistograms(r){const e=s.fromJSON(r.pixelBlock),t=u(e);return Promise.resolve(t)}async decode(r){const e=await o(r.data,r.options);return e&&e.toJSON()}symbolize(e){e.pixelBlock=s.fromJSON(e.pixelBlock),e.extent=e.extent?r.fromJSON(e.extent):null;const t=this.symbolizer.symbolize(e);return Promise.resolve(null!=t?t.toJSON():null)}async updateSymbolizer(r){this.symbolizer=h.fromJSON(r.symbolizerJSON),r.histograms&&"rasterStretch"===this.symbolizer?.rendererJSON.type&&(this.symbolizer.rendererJSON.histograms=r.histograms)}async updateRasterFunction(r){this.rasterFunction=c(r.rasterFunctionJSON)}async process(t){const o=this.rasterFunction.process({extent:r.fromJSON(t.extent),primaryPixelBlocks:t.primaryPixelBlocks.map(r=>null!=r?s.fromJSON(r):null),primaryPixelSizes:t.primaryPixelSizes?.map(r=>null!=r?e.fromJSON(r):null),primaryRasterIds:t.primaryRasterIds});return null!=o?o.toJSON():null}stretch(r){const e=this.symbolizer.simpleStretch(s.fromJSON(r.srcPixelBlock),r.stretchParams);return Promise.resolve(e?.toJSON())}estimateStatisticsHistograms(r){const e=S(s.fromJSON(r.srcPixelBlock));return Promise.resolve(e)}split(r){const e=i(s.fromJSON(r.srcPixelBlock),r.tileSize,r.maximumPyramidLevel??0,!1===r.useBilinear);return e&&e.forEach((r,t)=>{e.set(t,r?.toJSON())}),Promise.resolve(e)}clipTile(r){const e=s.fromJSON(r.pixelBlock),t=n({...r,pixelBlock:e});return Promise.resolve(t?.toJSON())}async mosaicAndTransform(r){const e=r.srcPixelBlocks.map(r=>r?new s(r):null),t=a(e,r.srcMosaicSize,{blockWidths:r.blockWidths,alignmentInfo:r.alignmentInfo,clipOffset:r.clipOffset,clipSize:r.clipSize});let o,i=t;return r.coefs&&(i=l(t,r.destDimension,r.coefs,r.sampleSpacing,r.interpolation)),r.projectDirections&&r.gcsGrid&&(o=m(r.destDimension,r.gcsGrid),i=x(i,r.isUV?"vector-uv":"vector-magdir",o)),{pixelBlock:i?.toJSON(),localNorthDirections:o}}async createFlowMesh(r,e){const t={data:new Float32Array(r.flowData.buffer),mask:new Uint8Array(r.flowData.maskBuffer),width:r.flowData.width,height:r.flowData.height},{vertexData:s,indexData:o}=await O(r.meshType,r.simulationSettings,t,e.signal);return{result:{vertexBuffer:s.buffer,indexBuffer:o.buffer},transferList:[s.buffer,o.buffer]}}async getProjectionOffsetGrid(e){const s=r.fromJSON(e.projectedExtent),o=r.fromJSON(e.srcBufferExtent);let i=null;e.datumTransformationSteps?.length&&(i=new t({steps:e.datumTransformationSteps})),await f();const n=e.rasterTransform?y(e.rasterTransform):null;return p({...e,projectedExtent:s,srcBufferExtent:o,datumTransformation:i,rasterTransform:n})}}export{N as default};
5
+ import r from"../../geometry/Extent.js";import e from"../../geometry/Point.js";import t from"../../geometry/operators/support/GeographicTransformation.js";import s from"./PixelBlock.js";import{decode as o}from"./rasterFormats/RasterCodec.js";import{split as i,clipTile as n,mosaic as a,approximateTransform as l,getLocalArithmeticNorthRotations as m}from"./rasterFunctions/pixelUtils.js";import{create as c}from"./rasterFunctions/rasterFunctionHelper.js";import{load as f,getProjectionOffsetGrid as p}from"./rasterFunctions/rasterProjectionHelper.js";import{computeStatisticsHistograms as u,estimateStatisticsHistograms as d}from"./rasterFunctions/stretchUtils.js";import{convertVectorFieldData as x,convertToLocalDirections as S}from"./rasterFunctions/vectorFieldUtils.js";import{readTransform as y}from"./rasterTransforms/utils.js";import h from"../../renderers/support/RasterSymbolizer.js";import{createFlowMesh as g}from"../../views/2d/engine/flow/dataUtils.js";function O(r){if(!r)return{result:null,transferList:[]};const{pixelBlock:e,transferList:t}=r.getTransferableObject();return{result:e,transferList:t}}class B{convertVectorFieldData(r){const e=s.fromJSON(r.pixelBlock),t=O(x(e,r.type));return Promise.resolve(t)}computeStatisticsHistograms(r){const e=s.fromJSON(r.pixelBlock),t=u(e);return Promise.resolve(t)}async decode(r){return O(await o(r.data,r.options))}symbolize(e){e.pixelBlock=s.fromJSON(e.pixelBlock),e.extent=e.extent?r.fromJSON(e.extent):null;const t=O(this.symbolizer.symbolize(e));return Promise.resolve(t)}async updateSymbolizer(r){this.symbolizer=h.fromJSON(r.symbolizerJSON),r.histograms&&"rasterStretch"===this.symbolizer?.rendererJSON.type&&(this.symbolizer.rendererJSON.histograms=r.histograms)}async updateRasterFunction(r){this.rasterFunction=c(r.rasterFunctionJSON)}async process(t){return O(this.rasterFunction.process({extent:r.fromJSON(t.extent),primaryPixelBlocks:t.primaryPixelBlocks.map(r=>null!=r?s.fromJSON(r):null),primaryPixelSizes:t.primaryPixelSizes?.map(r=>null!=r?e.fromJSON(r):null),primaryRasterIds:t.primaryRasterIds}))}stretch(r){const e=O(this.symbolizer.simpleStretch(s.fromJSON(r.srcPixelBlock),r.stretchParams));return Promise.resolve(e)}estimateStatisticsHistograms(r){const e=d(s.fromJSON(r.srcPixelBlock));return Promise.resolve(e)}split(r){const e=i(s.fromJSON(r.srcPixelBlock),r.tileSize,r.maximumPyramidLevel??0,!1===r.useBilinear),t=[];let o;return e&&(o=new Map,e.forEach((r,e)=>{if(r){const{pixelBlock:s,transferList:i}=r.getTransferableObject();o.set(e,s),i.forEach(r=>{t.includes(r)||t.push(r)})}})),Promise.resolve({result:o,transferList:t})}clipTile(r){const e=s.fromJSON(r.pixelBlock),t=O(n({...r,pixelBlock:e}));return Promise.resolve(t)}async mosaicAndTransform(r){const e=r.srcPixelBlocks.map(r=>r?new s(r):null),t=a(e,r.srcMosaicSize,{blockWidths:r.blockWidths,alignmentInfo:r.alignmentInfo,clipOffset:r.clipOffset,clipSize:r.clipSize});let o,i=t;r.coefs&&(i=l(t,r.destDimension,r.coefs,r.sampleSpacing,r.interpolation)),r.projectDirections&&r.gcsGrid&&(o=m(r.destDimension,r.gcsGrid),i=S(i,r.isUV?"vector-uv":"vector-magdir",o));const{result:n,transferList:c}=O(i);return{result:{pixelBlock:n,localNorthDirections:o},transferList:c}}async createFlowMesh(r,e){const t={data:new Float32Array(r.flowData.buffer),mask:new Uint8Array(r.flowData.maskBuffer),width:r.flowData.width,height:r.flowData.height},{vertexData:s,indexData:o}=await g(r.meshType,r.simulationSettings,t,e.signal);return{result:{vertexBuffer:s.buffer,indexBuffer:o.buffer},transferList:[s.buffer,o.buffer]}}async getProjectionOffsetGrid(e){const s=r.fromJSON(e.projectedExtent),o=r.fromJSON(e.srcBufferExtent);let i=null;e.datumTransformationSteps?.length&&(i=new t({steps:e.datumTransformationSteps})),await f();const n=e.rasterTransform?y(e.rasterTransform):null;return p({...e,projectedExtent:s,srcBufferExtent:o,datumTransformation:i,rasterTransform:n})}}export{B as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{getMetersPerUnitForSR as t}from"../../../core/unitUtils.js";import e from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import i from"../PixelBlock.js";function a(e,n){if(e.spatialReference.equals(n))return e;const i=t(e.spatialReference),a=t(n);if(i===a)return e;const r=i/a;return{x:e.x*r,y:e.y*r}}async function r(t,e,n){if("extent"===n.type)return m(t,e,n);const{width:a,height:r}=t,x=new Uint8Array(a*r);if(!(await import("../../../geometry/operators/intersectsOperator.js")).execute(e,n))return new i({pixelType:t.pixelType,width:a,height:r,mask:x,maskIsAlpha:!1,pixels:[...t.pixels]});if("polyline"===n.type)return s(t,e,n);return(await import("../../../geometry/operators/containsOperator.js")).execute(n,e)?t:o(t,e,n)}function o(t,e,n){if(!t)return t;const{width:a,height:r}=t,o=x({geometry:n,size:[a,r],srcExtent:e,srcMask:t.mask});return new i({pixelType:t.pixelType,width:a,height:r,mask:o,maskIsAlpha:!1,pixels:[...t.pixels]})}function x(t){const{geometry:e,size:n,srcExtent:i,srcMask:a}=t,[r,o]=n;let x;const m=i.width/r,s=i.height/o,{xmin:l,ymax:p}=i;if("extent"===e.type){const t=(e.xmin-l)/m,n=(e.xmax-l)/m,i=(p-e.ymax)/s,a=(p-e.ymin)/s;x=[[[t,i],[t,a],[n,a],[n,i],[t,i]]]}else x=e.rings.map(t=>t.map(([t,e])=>[(t-l)/m,(p-e)/s]));return h(x,n,a)}function h(t,e,n){const[i,a]=e,r=new OffscreenCanvas(i,a).getContext("2d");r.fillStyle="#f00",r.beginPath(),t.forEach(t=>{r.moveTo(t[0][0],t[0][1]);for(let e=0;e<t.length;e++)r.lineTo(t[e][0],t[e][1]);r.closePath()}),r.fill();const o=r.getImageData(0,0,i,a).data,x=i*a,h=new Uint8Array(x);let m=!1;for(let s=0;s<x;s++)n&&!n[s]||(o[4*s+3]>127?h[s]=255:m=!0);return m||n?h:void 0}function m(t,e,n){const{width:a,height:r}=t,o=new Uint8Array(a*r),x=e.width/a,h=e.height/r;if(n.width/x<.5||n.height/h<.5)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});const{xmin:m,xmax:s,ymin:l,ymax:p}=e,{xmin:f,xmax:c,ymin:y,ymax:u}=n,M=Math.max(m,f),w=Math.min(s,c),d=Math.max(l,y),g=Math.min(p,u),T=.5*x,k=.5*h;if(w-M<T||g-d<k||w<m+T||M>s-T||d>p-k||g<l+k)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});const R=Math.max(0,(M-m)/x),j=Math.min(a,Math.max(0,(w-m)/x)),A=Math.max(0,(p-g)/h),z=Math.min(r,Math.max(0,(p-d)/h)),U=Math.round(R),E=Math.round(j)-1,P=Math.round(A),S=Math.round(z)-1;if(U===E&&R%1>.5&&j%1<.5||P===S&&A%1>.5&&z%1<.5)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});if(0===U&&0===P&&E===a&&S===r)return t;const v=t.mask;for(let i=P;i<=S;i++)for(let t=U;t<=E;t++){const e=i*a+t;o[e]=v?v[e]:255}return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]})}function s(t,e,n){const{width:a,height:r}=t,o=new Uint8Array(a*r),x=e.width/a,h=e.height/r,{xmin:m,ymax:s}=e,{paths:l}=n,p=t.mask;for(let i=0;i<l.length;i++){const t=l[i];for(let e=0;e<t.length-1;e++){const[n,i]=t[e],[l,f]=t[e+1];let c=Math.floor((s-i)/h),y=Math.floor((s-f)/h);if(y<c){const t=c;c=y,y=t}c=Math.max(0,c),y=Math.min(r-1,y);const u=(l-n)/(f-i);for(let t=c;t<=y;t++){const e=t===c?Math.max(i,f):(r+1-t)*h,s=t===y?Math.min(i,f):e-h;let M=f===i?Math.floor((n-m)/x):Math.floor((u*(e-i)+n-m)/x),w=f===i?Math.floor((l-m)/x):Math.floor((u*(s-i)+n-m)/x);if(w<M){const t=M;M=w,w=t}const d=t*a;M=Math.max(0,M),w=Math.min(a-1,w);for(let t=d+M;t<=d+w;t++)o[t]=p?p[t]:255}}}return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]})}function l(t,e){const{extent:i}=p(t,e,new n({x:t.pixelSize.x,y:t.pixelSize.y,spatialReference:t.spatialReference})),{extent:a}=t.extent;if(i.xmax=Math.min(i.xmax,a.xmax),i.ymax=Math.min(i.ymax,a.ymax),i.xmin<i.xmax&&i.ymin<i.ymax){const{x:e,y:n}=t.pixelSize,a=Math.round(i.width/e),r=Math.round(i.height/n);t.extent=i,t.width=a,t.height=r}}function p(t,n,i,r=!0){const{spatialReference:o}=t,{x,y:h}=a(i,o);let m,s,l;const p="extent"===n.type?n:n.extent;let{xmin:f,xmax:c,ymax:y,ymin:u}=p;const{xmin:M,ymax:w}=t.extent;return r?(f=M+(f>M?x*Math.round((f-M)/x):0),y=w-(y<w?h*Math.round((w-y)/h):0),c=M+(c>M?x*Math.round((c-M)/x):0),u=w-(u<w?h*Math.round((w-u)/h):0),m=new e({xmin:f,ymax:y,xmax:c,ymin:u,spatialReference:o}),s=Math.round(m.width/x),l=Math.round(m.height/h)):(s=Math.floor((c-f)/x+.8),l=Math.floor((y-u)/h+.8),f=M+(f>M?x*Math.floor((f-M)/x+.1):0),y=w-(y<w?h*Math.floor((w-y)/h+.1):0),c=f+s*x,u=y-l*h,m=new e({xmin:f,ymax:y,xmax:c,ymin:u,spatialReference:o})),{extent:m,width:s,height:l}}export{r as clip,l as clipRasterInfo,x as convertGeometryToMask,p as snapToRaster};
5
+ import{getMetersPerUnitForSR as t}from"../../../core/unitUtils.js";import e from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import i from"../PixelBlock.js";function a(e,n){if(e.spatialReference.equals(n))return e;const i=t(e.spatialReference),a=t(n);if(i===a)return e;const r=i/a;return{x:e.x*r,y:e.y*r}}async function r(t,e,n){if("extent"===n.type)return m(t,e,n);const{width:a,height:r}=t,h=new Uint8Array(a*r);if(!(await import("../../../geometry/operators/intersectsOperator.js")).execute(e,n))return new i({pixelType:t.pixelType,width:a,height:r,mask:h,maskIsAlpha:!1,pixels:[...t.pixels]});if("polyline"===n.type)return s(t,e,n);return(await import("../../../geometry/operators/containsOperator.js")).execute(n,e)?t:o(t,e,n)}function o(t,e,n){if(!t)return t;const{width:a,height:r}=t,o=h({geometry:n,size:[a,r],srcExtent:e,srcMask:t.mask});return new i({pixelType:t.pixelType,width:a,height:r,mask:o,maskIsAlpha:!1,pixels:[...t.pixels]})}function h(t){const{geometry:e,size:n,srcExtent:i,srcMask:a}=t,[r,o]=n;let h;const m=i.width/r,s=i.height/o,{xmin:l,ymax:p}=i;if("extent"===e.type){const t=(e.xmin-l)/m,n=(e.xmax-l)/m,i=(p-e.ymax)/s,a=(p-e.ymin)/s;h=[[[t,i],[t,a],[n,a],[n,i],[t,i]]]}else h=e.rings.map(t=>t.map(([t,e])=>[(t-l)/m,(p-e)/s]));return x(h,n,a)}function x(t,e,n){const[i,a]=e,r=new OffscreenCanvas(i,a).getContext("2d");r.fillStyle="#f00",r.beginPath(),t.forEach(t=>{r.moveTo(t[0][0],t[0][1]);for(let e=0;e<t.length;e++)r.lineTo(t[e][0],t[e][1]);r.closePath()}),r.fill();const o=r.getImageData(0,0,i,a).data,h=i*a,x=new Uint8Array(h);let m=!1;for(let s=0;s<h;s++)n&&!n[s]||(o[4*s+3]>127?x[s]=255:m=!0);return m||n?x:void 0}function m(t,e,n){const{width:a,height:r}=t,o=new Uint8Array(a*r),h=e.width/a,x=e.height/r;if(n.width/h<.5||n.height/x<.5)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});const{xmin:m,xmax:s,ymin:l,ymax:p}=e,{xmin:f,xmax:c,ymin:y,ymax:M}=n,u=Math.max(m,f),w=Math.min(s,c),d=Math.max(l,y),g=Math.min(p,M),T=.5*h,k=.5*x;if(w-u<T||g-d<k||w<m+T||u>s-T||d>p-k||g<l+k)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});const R=Math.max(0,(u-m)/h),j=Math.min(a,Math.max(0,(w-m)/h)),A=Math.max(0,(p-g)/x),z=Math.min(r,Math.max(0,(p-d)/x)),U=Math.round(R),E=Math.round(j)-1,P=Math.round(A),S=Math.round(z)-1;if(U===E&&R%1>.5&&j%1<.5||P===S&&A%1>.5&&z%1<.5)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});if(0===U&&0===P&&E===a&&S===r)return t;const v=t.mask;for(let i=P;i<=S;i++)for(let t=U;t<=E;t++){const e=i*a+t;o[e]=v?v[e]:255}return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]})}function s(t,e,n){const{width:a,height:r}=t,o=new Uint8Array(a*r),h=e.width/a,x=e.height/r,{xmin:m,ymax:s}=e,{paths:l}=n,p=t.mask;for(let i=0;i<l.length;i++){const t=l[i];for(let e=0;e<t.length-1;e++){const[n,i]=t[e],[l,f]=t[e+1],c=Math.min(i,f),y=Math.max(i,f),M=Math.max(0,Math.floor((s-y)/x)),u=Math.min(r-1,Math.floor((s-c)/x));if(!(u<M))if(M===u){const t=Math.min(n,l),e=Math.max(n,l),i=Math.max(0,Math.floor((t-m)/h)),r=Math.min(a-1,Math.floor((e-m)/h));if(r<i)continue;const x=M*a;for(let n=x+i;n<=x+r;n++)o[n]=p?p[n]:255}else{const t=(n-m)/h,e=(l-n)/(f-i)/h,r=x*e;for(let n=M;n<=u;n++){const h=e*(s-n*x-i)+t,m=Math.max(0,Math.floor(r>0?h-r:h)),l=Math.min(a-1,Math.floor(r>0?h:h-r));if(l<m)continue;const f=n*a;for(let t=f+m;t<=f+l;t++)o[t]=p?p[t]:255}}}}return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]})}function l(t,e){const{extent:i}=p(t,e,new n({x:t.pixelSize.x,y:t.pixelSize.y,spatialReference:t.spatialReference})),{extent:a}=t.extent;if(i.xmax=Math.min(i.xmax,a.xmax),i.ymax=Math.min(i.ymax,a.ymax),i.xmin<i.xmax&&i.ymin<i.ymax){const{x:e,y:n}=t.pixelSize,a=Math.round(i.width/e),r=Math.round(i.height/n);t.extent=i,t.width=a,t.height=r}}function p(t,n,i,r=!0){const{spatialReference:o}=t,{x:h,y:x}=a(i,o);let m,s,l;const p="extent"===n.type?n:n.extent;let{xmin:f,xmax:c,ymax:y,ymin:M}=p;const{xmin:u,ymax:w}=t.extent;return r?(f=u+(f>u?h*Math.round((f-u)/h):0),y=w-(y<w?x*Math.round((w-y)/x):0),c=u+(c>u?h*Math.round((c-u)/h):0),M=w-(M<w?x*Math.round((w-M)/x):0),m=new e({xmin:f,ymax:y,xmax:c,ymin:M,spatialReference:o}),s=Math.round(m.width/h),l=Math.round(m.height/x)):(s=Math.floor((c-f)/h+.8),l=Math.floor((y-M)/x+.8),f=u+(f>u?h*Math.floor((f-u)/h+.1):0),y=w-(y<w?x*Math.floor((w-y)/x+.1):0),c=f+s*h,M=y-l*x,m=new e({xmin:f,ymax:y,xmax:c,ymin:M,spatialReference:o})),{extent:m,width:s,height:l}}export{r as clip,l as clipRasterInfo,h as convertGeometryToMask,p as snapToRaster};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{toRGB as t}from"../../../core/colorUtils.js";import e from"../../../core/Error.js";import{clone as r}from"../../../core/lang.js";import n from"./ArithmeticFunction.js";import o from"./AspectFunction.js";import s from"./BandArithmeticFunction.js";import a from"./ClipFunction.js";import i from"./ColormapFunction.js";import c from"./ColormapToRGBFunction.js";import u from"./CompositeBandFunction.js";import m from"./ComputeChangeFunction.js";import l from"./ContrastBrightnessFunction.js";import p from"./ConvolutionFunction.js";import f from"./CurvatureFunction.js";import d from"./ExtractBandFunction.js";import g from"./GrayscaleFunction.js";import F from"./HillshadeFunction.js";import h from"./LocalFunction.js";import A from"./MaskFunction.js";import y from"./NDVIFunction.js";import b from"./RemapFunction.js";import j from"./ShadedReliefFunction.js";import C from"./SlopeFunction.js";import _ from"./StatisticsFunction.js";import R from"./StatisticsHistogramFunction.js";import N from"./StretchFunction.js";import S from"./TableFunction.js";const v=new Map;function w(t,e){const{rasterFunctionArguments:r}=t;if(!r)return;(r.rasters||[r.raster,r.raster2]).forEach(t=>{t&&"number"!=typeof t&&("string"==typeof t?t.startsWith("http")&&(e.includes(t)||e.push(t)):"rasterFunctionArguments"in t&&w(t,e))})}function T(t,n){n=n??{};try{if("function"in(t=r(t))&&"arguments"in t&&t.arguments){const r=$(t,new Map,n);if(L(r),!r.renderingRule)throw new e("raster-function-helper","Unsupported raster function json.");t=r.renderingRule}if("rasterFunction"in t){const e=k(t=B(t),n);return e.isRoot=!0,e}}catch{}throw new e("raster-function-helper","unsupported raster function json.")}function D(t,e){return"rasters"===e[0]&&Array.isArray(t.rasters)?t.rasters:e.map(e=>t[e])}function V(t){return!!(t&&"object"==typeof t&&t.rasterFunction&&t.rasterFunctionArguments)}function B(t){const{rasterFunction:e,rasterFunctionArguments:r}=t,n={};for(const o in r){let t=r[o];const e=o.toLowerCase();if("rasters"===e&&Array.isArray(t))n.rasters=t.map(t=>V(t)?B(t):t);else switch(V(t)&&(t=B(t)),e){case"dra":n.dra=t;break;case"pspower":n.psPower=t;break;case"pszfactor":n.psZFactor=t;break;case"bandids":n.bandIds=t;break;default:n[o[0].toLowerCase()+o.slice(1)]=t}}return"Local"!==e||n.rasters?.length||(n.rasters=["$$"]),{...t,rasterFunctionArguments:n}}function k(t,r){const{rasterFunction:n,rasterFunctionArguments:o}=t,s=t.outputPixelType?.toLowerCase();if(null==n||!v.has(n))throw new e("raster-function-helper",`unsupported raster function: ${n}`);const a=v.get(n),i=("function"==typeof a.ctor?a.ctor:a.ctor.default).fromJSON({...t,outputPixelType:s}),{rasterArgumentNames:c}=i,u=[],m=D(o,c),l="rasters"===c[0]||c.length>1,p=[];for(let e=0;e<m.length;e++){const t=m[e];let n;null==t||"string"==typeof t&&t.startsWith("$")?u.push(r?.raster):"string"==typeof t?r[t]&&u.push(r[t]):"number"!=typeof t&&"rasterFunction"in t&&(n=k(t,r),l||(i.functionArguments[c[e]]=n),u.push(n)),l&&p.push(n??t)}if(l&&("rasters"===c[0]?i.functionArguments.rasters=p:c.forEach((t,e)=>{i.functionArguments[t]=p[e]})),r){i.sourceRasters=u;const t=r.raster?.url;t&&(i.mainPrimaryRasterId=t)}return i}function x(t,e){if(t&&e)for(const r in t){const n=t[r];n&&"object"==typeof n&&"type"in n&&("RasterFunctionTemplate"===n.type?x(n.arguments,e):"RasterFunctionVariable"===n.type&&null!=e[n.name]&&(n.value=e[n.name]))}}function E(t,r){if(!t||"object"!=typeof t)return t;const{value:n}=t;if(!n||"object"!=typeof n)return t.isDataset?"$$":n;if(Array.isArray(n))return 0===n.length?[]:n.map(t=>t&&"object"==typeof t&&"RasterFunctionVariable"===t.type?E(t,r):t);if("value"in n&&["number","string","boolean"].includes(typeof n.value))return n.value;if(t.isDataset&&"Scalar"!==n.type)return"$$";if(!("type"in n))return n;let o=n;switch(n.type){case"Scalar":o=n.value;break;case"AlgorithmicColorRamp":o=M(n);break;case"MultiPartColorRamp":o={type:"multipart",colorRamps:n.ArrayOfColorRamp.map(M)};break;case"ArgumentArray":if(n.elements?.length&&"RasterStatistics"!==n.elements[0].type){const t=[];for(let o=0;o<n.elements.length;o++){const s=n.elements[o],{type:a}=s;if(a)if("RasterFunctionTemplate"===a){const{renderingRule:e}=$(s,r);t.push(e),null!=s._object_id&&r.set(s._object_id,e)}else{if("RasterFunctionVariable"!==a)throw new e("raster-function-helper","unsupported raster function json.");{const e=E(s,r);t.push(e),null!=s._object_id&&r.set(s._object_id,e)}}else t.push(s)}o=t}else o=n.elements}return null!=n._object_id&&r.set(n._object_id,o),o}function M(e){const r=e.algorithm??"esriHSVAlgorithm";let{FromColor:n,ToColor:o}=e;if(!Array.isArray(n)){const{r:e,g:r,b:o}=t({h:n.Hue,s:n.Saturation,v:n.Value});n=[e,r,o,n.AlphaValue]}if(!Array.isArray(o)){const{r:e,g:r,b:n}=t({h:o.Hue,s:o.Saturation,v:o.Value});o=[e,r,n,o.AlphaValue]}return{type:"algorithmic",algorithm:r,fromColor:n,toColor:o}}function $(t,e,r){r&&x(t,r);const n={renderingRule:{},templates:e};return H(t,n),n}function H(t,e){if(!t||!e.renderingRule)return;const{renderingRule:r,templates:n}=e,{function:o,arguments:s,_object_id:a}=t;if(!o||!s)return;null!=a&&n.set(a,r),r.rasterFunction=o.type.replace("Function",""),r.outputPixelType=o.pixelType;const i={};r.rasterFunctionArguments=i;for(const c in s){if("type"===c||"object_id"===c||"_object_ref_id"===c)continue;const t=s[c];t&&"object"==typeof t&&"type"in t&&("RasterFunctionTemplate"===t.type||"RasterFunctionVariable"===t.type)?("RasterFunctionVariable"===t.type?i[c]=E(t,n):(r.rasterFunctionArguments[c]={},H(t,{renderingRule:r.rasterFunctionArguments[c],templates:n})),null!=t._object_id&&n.set(t._object_id,i[c])):i[c]=t}switch(i.DEM&&!i.Raster&&(i.Raster=i.DEM,delete i.DEM),r.rasterFunction){case"Stretch":O(i);break;case"Colormap":G(i);break;case"Convolution":P(i);break;case"Mask":I(i)}}function L(t){const{renderingRule:r,templates:n}=t;if("object"!=typeof r||!r?.rasterFunctionArguments||!n.size)return;const{rasterFunctionArguments:o}=r;for(const s in o){const t=o[s],r="_object_ref_id"===s?t:t&&"object"==typeof t&&"_object_ref_id"in t?t._object_ref_id:null;if(null==r)t&&"object"==typeof t&&(t.rasterFunctionArguments&&L({renderingRule:t,templates:n}),Array.isArray(t)&&t.forEach((o,s)=>{if(o&&"object"==typeof o)if(null!=o._object_ref_id){if(!n.has(o._object_ref_id))throw new e("raster-function-helper",`unsupported raster function json. _object_ref_id: ${t} does not exist`);const a=n.get(r);a&&"object"==typeof a?Object.assign(o,a):t[s]=a}else L({renderingRule:o,templates:n})}));else{if(!n.has(r))throw new e("raster-function-helper",`unsupported raster function json. _object_ref_id: ${r} does not exist`);const t=n.get(r);"_object_ref_id"!==s?o[s]=t:t&&"object"==typeof t&&Object.assign(o,t)}}}function O(t){t.Statistics?.length&&"object"==typeof t.Statistics&&(t.Statistics=t.Statistics.map(t=>[t.min,t.max,t.mean,t.standardDeviation])),null!=t.NumberOfStandardDeviation&&(t.NumberOfStandardDeviations=t.NumberOfStandardDeviation,delete t.NumberOfStandardDeviation)}function G(t){"randomcolorramp"===t.ColorRamp?.type?.toLowerCase()&&(delete t.ColorRamp,t.ColormapName="Random"),0===t.ColorSchemeType&&delete t.ColorRamp}function P(t){null!=t.ConvolutionType&&(t.Type=t.ConvolutionType,delete t.ConvolutionType)}function I(t){t.NoDataValues?.length&&"string"==typeof t.NoDataValues[0]&&(t.NoDataValues=t.NoDataValues.filter(t=>""!==t).map(t=>Number(t)))}v.set("Arithmetic",{desc:"Arithmetic Function",ctor:n,rasterArgumentNames:["rasters"]}),v.set("Aspect",{desc:"Aspect Function",ctor:o,rasterArgumentNames:["raster"]}),v.set("BandArithmetic",{desc:"Band Arithmetic Function",ctor:s,rasterArgumentNames:["raster"]}),v.set("Colormap",{desc:"Colormap Function",ctor:i,rasterArgumentNames:["raster"]}),v.set("ColormapToRGB",{desc:"ColormapToRGB Function",ctor:c,rasterArgumentNames:["raster"]}),v.set("CompositeBand",{desc:"CompositeBand Function",ctor:u,rasterArgumentNames:["rasters"]}),v.set("ComputeChange",{desc:"ComputeChange Function",ctor:m,rasterArgumentNames:["rasters"]}),v.set("Convolution",{desc:"Convolution Function",ctor:p,rasterArgumentNames:["raster"]}),v.set("ContrastBrightness",{desc:"Contrast Brightness Function",ctor:l,rasterArgumentNames:["raster"]}),v.set("ExtractBand",{desc:"ExtractBand Function",ctor:d,rasterArgumentNames:["raster"]}),v.set("Curvature",{desc:"Curvature Function",ctor:f,rasterArgumentNames:["raster"]}),v.set("Hillshade",{desc:"Hillshade Function",ctor:F,rasterArgumentNames:["raster"]}),v.set("ShadedRelief",{desc:"ShadedRelief Function",ctor:j,rasterArgumentNames:["raster"]}),v.set("Grayscale",{desc:"Grayscale Function",ctor:g,rasterArgumentNames:["raster"]}),v.set("Clip",{desc:"Clip Function",ctor:a,rasterArgumentNames:["raster"]}),v.set("Local",{desc:"Local Function",ctor:h,rasterArgumentNames:["rasters"]}),v.set("Mask",{desc:"Mask Function",ctor:A,rasterArgumentNames:["raster"]}),v.set("NDVI",{desc:"NDVI Function",ctor:y,rasterArgumentNames:["raster"]}),v.set("Remap",{desc:"Remap Function",ctor:b,rasterArgumentNames:["raster"]}),v.set("Slope",{desc:"Slope Function",ctor:C,rasterArgumentNames:["raster"]}),v.set("Statistics",{desc:"Focal Statistics Function",ctor:_,rasterArgumentNames:["raster"]}),v.set("StatisticsHistogram",{desc:"Statistics Histogram Function",ctor:R,rasterArgumentNames:["raster"]}),v.set("Stretch",{desc:"Stretch Function",ctor:N,rasterArgumentNames:["raster"]}),v.set("Table",{desc:"Attribute Table Function",ctor:S,rasterArgumentNames:["raster"]});export{T as create,w as getPrimaryRasterUrls,D as getRasterValues};
5
+ import{toRGB as t}from"../../../core/colorUtils.js";import e from"../../../core/Error.js";import{clone as r}from"../../../core/lang.js";import n from"./ArithmeticFunction.js";import o from"./AspectFunction.js";import s from"./BandArithmeticFunction.js";import a from"./ClipFunction.js";import i from"./ColormapFunction.js";import c from"./ColormapToRGBFunction.js";import u from"./CompositeBandFunction.js";import m from"./ComputeChangeFunction.js";import l from"./ContrastBrightnessFunction.js";import p from"./ConvolutionFunction.js";import f from"./CurvatureFunction.js";import d from"./ExtractBandFunction.js";import g from"./GrayscaleFunction.js";import F from"./HillshadeFunction.js";import h from"./LocalFunction.js";import A from"./MaskFunction.js";import y from"./NDVIFunction.js";import b from"./RemapFunction.js";import j from"./ShadedReliefFunction.js";import C from"./SlopeFunction.js";import _ from"./StatisticsFunction.js";import R from"./StatisticsHistogramFunction.js";import N from"./StretchFunction.js";import S from"./TableFunction.js";const v=new Map;function w(t,e){const{rasterFunctionArguments:r}=t;if(!r)return;(r.rasters||[r.raster,r.raster2]).forEach(t=>{t&&"number"!=typeof t&&("string"==typeof t?t.startsWith("http")&&(e.includes(t)||e.push(t)):"rasterFunctionArguments"in t&&w(t,e))})}function T(t,n){n=n??{};try{if("function"in(t=r(t))&&"arguments"in t&&t.arguments){const r=$(t,new Map,n);if(L(r),!r.renderingRule)throw new e("raster-function-helper","Unsupported raster function json.");t=r.renderingRule}if("rasterFunction"in t){const e=k(t=B(t),n);return e.isRoot=!0,e}}catch{}throw new e("raster-function-helper","unsupported raster function json.")}function D(t,e){return"rasters"===e[0]&&Array.isArray(t.rasters)?t.rasters:e.map(e=>t[e])}function V(t){return!!(t&&"object"==typeof t&&t.rasterFunction&&t.rasterFunctionArguments)}function B(t){const{rasterFunction:e,rasterFunctionArguments:r}=t,n={};for(const o in r){let t=r[o];const e=o.toLowerCase();if("rasters"===e&&Array.isArray(t))n.rasters=t.map(t=>V(t)?B(t):t);else switch(V(t)&&(t=B(t)),e){case"dra":n.dra=t;break;case"pspower":n.psPower=t;break;case"pszfactor":n.psZFactor=t;break;case"bandids":n.bandIds=t;break;default:n[o[0].toLowerCase()+o.slice(1)]=t}}return"Local"!==e||n.rasters?.length||(n.rasters=["$$"]),{...t,rasterFunctionArguments:n}}function k(t,r){const{rasterFunction:n,rasterFunctionArguments:o}=t,s=t.outputPixelType?.toLowerCase();if(null==n||!v.has(n))throw new e("raster-function-helper",`unsupported raster function: ${n}`);const a=v.get(n),i=("function"==typeof a.ctor?a.ctor:a.ctor.default).fromJSON({...t,outputPixelType:s}),{rasterArgumentNames:c}=i,u=[],m=D(o,c),l="rasters"===c[0]||c.length>1,p=[];for(let e=0;e<m.length;e++){const t=m[e];let n;null==t||"string"==typeof t&&t.startsWith("$")?u.push(r?.raster):"string"==typeof t?r[t]&&u.push(r[t]):"number"!=typeof t&&"rasterFunction"in t&&(n=k(t,r),l||(i.functionArguments[c[e]]=n),u.push(n)),l&&p.push(n??t)}if(l&&("rasters"===c[0]?i.functionArguments.rasters=p:c.forEach((t,e)=>{i.functionArguments[t]=p[e]})),r){i.sourceRasters=u;const t=r.raster?.url;t&&(i.mainPrimaryRasterId=t)}return i}function x(t,e){if(t&&e)for(const r in t){const n=t[r];n&&"object"==typeof n&&"type"in n&&("RasterFunctionTemplate"===n.type?x(n.arguments,e):"RasterFunctionVariable"===n.type&&null!=e[n.name]&&(n.value=e[n.name]))}}function E(t,r){if(!t||"object"!=typeof t)return t;const{value:n}=t;if(!n||"object"!=typeof n)return t.isDataset?"$$":n;if(Array.isArray(n))return 0===n.length?[]:n.map(t=>t&&"object"==typeof t&&"RasterFunctionVariable"===t.type?E(t,r):t);if("value"in n&&["number","string","boolean"].includes(typeof n.value))return n.value;if(t.isDataset&&"Scalar"!==n.type)return"$$";if(!("type"in n))return n;let o=n;switch(n.type){case"Scalar":o=n.value;break;case"AlgorithmicColorRamp":o=M(n);break;case"MultiPartColorRamp":o={type:"multipart",colorRamps:n.ArrayOfColorRamp.map(M)};break;case"ArgumentArray":if(n.elements?.length&&"RasterStatistics"!==n.elements[0].type){const t=[];for(let o=0;o<n.elements.length;o++){const s=n.elements[o],{type:a}=s;if(a)if("RasterFunctionTemplate"===a){const{renderingRule:e}=$(s,r);t.push(e),null!=s._object_id&&r.set(s._object_id,e)}else{if("RasterFunctionVariable"!==a)throw new e("raster-function-helper","unsupported raster function json.");{const e=E(s,r);t.push(e),null!=s._object_id&&r.set(s._object_id,e)}}else t.push(s)}o=t}else o=n.elements}return null!=n._object_id&&r.set(n._object_id,o),o}function M(e){const r=e.algorithm??"esriHSVAlgorithm";let{FromColor:n,ToColor:o}=e;if(!Array.isArray(n)){const{r:e,g:r,b:o}=t({h:n.Hue,s:n.Saturation,v:n.Value});n=[e,r,o,n.AlphaValue]}if(!Array.isArray(o)){const{r:e,g:r,b:n}=t({h:o.Hue,s:o.Saturation,v:o.Value});o=[e,r,n,o.AlphaValue]}return{type:"algorithmic",algorithm:r,fromColor:n,toColor:o}}function $(t,e,r){r&&x(t,r);const n={renderingRule:{},templates:e};return H(t,n),n}function H(t,e){if(!t||!e.renderingRule)return;const{renderingRule:r,templates:n}=e,{function:o,arguments:s,_object_id:a}=t;if(!o||!s)return;null!=a&&n.set(a,r),r.rasterFunction=o.type.replace("Function",""),r.outputPixelType=o.pixelType;const i={};r.rasterFunctionArguments=i;for(const c in s){if("type"===c||"object_id"===c||"_object_ref_id"===c)continue;const t=s[c];t&&"object"==typeof t&&"type"in t&&("RasterFunctionTemplate"===t.type||"RasterFunctionVariable"===t.type)?("RasterFunctionVariable"===t.type?i[c]=E(t,n):(r.rasterFunctionArguments[c]={},H(t,{renderingRule:r.rasterFunctionArguments[c],templates:n})),null!=t._object_id&&n.set(t._object_id,i[c])):i[c]=t}switch(i.DEM&&!i.Raster&&(i.Raster=i.DEM,delete i.DEM),r.rasterFunction){case"Stretch":O(i);break;case"Colormap":G(i);break;case"Convolution":P(i);break;case"Mask":I(i)}}function L(t){const{renderingRule:r,templates:n}=t;if("object"!=typeof r||!r?.rasterFunctionArguments||!n.size)return;const{rasterFunctionArguments:o}=r;for(const s in o){const t=o[s],r="_object_ref_id"===s?t:t&&"object"==typeof t&&"_object_ref_id"in t?t._object_ref_id:null;if(null!=r){if(!n.has(r))throw new e("raster-function-helper",`unsupported raster function json. _object_ref_id: ${r} does not exist`);const t=n.get(r);"_object_ref_id"!==s?o[s]=t:t&&"object"==typeof t&&Object.assign(o,t);continue}t&&"object"==typeof t&&(t.rasterFunctionArguments&&L({renderingRule:t,templates:n}),Array.isArray(t)&&t.forEach((o,s)=>{if(o&&"object"==typeof o)if(null!=o._object_ref_id){if(!n.has(o._object_ref_id))throw new e("raster-function-helper",`unsupported raster function json. _object_ref_id: ${t} does not exist`);const a=n.get(r);a&&"object"==typeof a?Object.assign(o,a):t[s]=a}else L({renderingRule:o,templates:n})}))}}function O(t){t.Statistics?.length&&"object"==typeof t.Statistics&&(t.Statistics=t.Statistics.map(t=>[t.min,t.max,t.mean,t.standardDeviation])),null!=t.NumberOfStandardDeviation&&(t.NumberOfStandardDeviations=t.NumberOfStandardDeviation,delete t.NumberOfStandardDeviation)}function G(t){"randomcolorramp"===t.ColorRamp?.type?.toLowerCase()&&(delete t.ColorRamp,t.ColormapName="Random"),0===t.ColorSchemeType&&delete t.ColorRamp}function P(t){null!=t.ConvolutionType&&(t.Type=t.ConvolutionType,delete t.ConvolutionType)}function I(t){t.NoDataValues?.length&&"string"==typeof t.NoDataValues[0]&&(t.NoDataValues=t.NoDataValues.filter(t=>""!==t).map(t=>Number(t)))}v.set("Arithmetic",{desc:"Arithmetic Function",ctor:n,rasterArgumentNames:["rasters"]}),v.set("Aspect",{desc:"Aspect Function",ctor:o,rasterArgumentNames:["raster"]}),v.set("BandArithmetic",{desc:"Band Arithmetic Function",ctor:s,rasterArgumentNames:["raster"]}),v.set("Colormap",{desc:"Colormap Function",ctor:i,rasterArgumentNames:["raster"]}),v.set("ColormapToRGB",{desc:"ColormapToRGB Function",ctor:c,rasterArgumentNames:["raster"]}),v.set("CompositeBand",{desc:"CompositeBand Function",ctor:u,rasterArgumentNames:["rasters"]}),v.set("ComputeChange",{desc:"ComputeChange Function",ctor:m,rasterArgumentNames:["rasters"]}),v.set("Convolution",{desc:"Convolution Function",ctor:p,rasterArgumentNames:["raster"]}),v.set("ContrastBrightness",{desc:"Contrast Brightness Function",ctor:l,rasterArgumentNames:["raster"]}),v.set("ExtractBand",{desc:"ExtractBand Function",ctor:d,rasterArgumentNames:["raster"]}),v.set("Curvature",{desc:"Curvature Function",ctor:f,rasterArgumentNames:["raster"]}),v.set("Hillshade",{desc:"Hillshade Function",ctor:F,rasterArgumentNames:["raster"]}),v.set("ShadedRelief",{desc:"ShadedRelief Function",ctor:j,rasterArgumentNames:["raster"]}),v.set("Grayscale",{desc:"Grayscale Function",ctor:g,rasterArgumentNames:["raster"]}),v.set("Clip",{desc:"Clip Function",ctor:a,rasterArgumentNames:["raster"]}),v.set("Local",{desc:"Local Function",ctor:h,rasterArgumentNames:["rasters"]}),v.set("Mask",{desc:"Mask Function",ctor:A,rasterArgumentNames:["raster"]}),v.set("NDVI",{desc:"NDVI Function",ctor:y,rasterArgumentNames:["raster"]}),v.set("Remap",{desc:"Remap Function",ctor:b,rasterArgumentNames:["raster"]}),v.set("Slope",{desc:"Slope Function",ctor:C,rasterArgumentNames:["raster"]}),v.set("Statistics",{desc:"Focal Statistics Function",ctor:_,rasterArgumentNames:["raster"]}),v.set("StatisticsHistogram",{desc:"Statistics Histogram Function",ctor:R,rasterArgumentNames:["raster"]}),v.set("Stretch",{desc:"Stretch Function",ctor:N,rasterArgumentNames:["raster"]}),v.set("Table",{desc:"Attribute Table Function",ctor:S,rasterArgumentNames:["raster"]});export{T as create,w as getPrimaryRasterUrls,D as getRasterValues};