@arcgis/core 4.27.0-next.20230516 → 4.27.0-next.20230518
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.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/03dba2a2bbc363369a0f.js +1 -0
- package/assets/esri/core/workers/chunks/12714d64a0154688072e.js +1 -0
- package/assets/esri/core/workers/chunks/{a507135977d83aea4421.js → 1827a3da6b5b9272ffe1.js} +1 -1
- package/assets/esri/core/workers/chunks/1edc5c06874cb12c5478.js +1 -0
- package/assets/esri/core/workers/chunks/{395ef46b635f9e9a5643.js → 20e8e18e4bd2fd5da47c.js} +1 -1
- package/assets/esri/core/workers/chunks/23f73f81aea461c0c6e6.js +1 -0
- package/assets/esri/core/workers/chunks/{15dda462b979e90b58fe.js → 3cebdd77a8401495097f.js} +1 -1
- package/assets/esri/core/workers/chunks/3eb75b6c3c4b3aea2325.js +1 -0
- package/assets/esri/core/workers/chunks/48cb634255e39711a720.js +1 -0
- package/assets/esri/core/workers/chunks/4d5f71d84c85f45c97ea.js +1 -0
- package/assets/esri/core/workers/chunks/55ca6ba8b40921025181.js +2 -0
- package/assets/esri/core/workers/chunks/{ef141014ed21a7fd1ff3.js.LICENSE.txt → 55ca6ba8b40921025181.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/6312783626bacf52df7a.js +1 -0
- package/assets/esri/core/workers/chunks/{a3822a97701890c12d63.js → 6b3b277a21de7c434717.js} +1 -1
- package/assets/esri/core/workers/chunks/6d80f81bf6ad97a7e69e.js +1 -0
- package/assets/esri/core/workers/chunks/887a630c5c980c5028e1.js +1 -0
- package/assets/esri/core/workers/chunks/{522660da4589739a70c3.js → c7fb48ea5d907883bcce.js} +1 -1
- package/assets/esri/core/workers/chunks/d0ff968e42116f592065.js +1 -0
- package/assets/esri/core/workers/chunks/{fdf64f23529a22c79fbd.js → d52c920acf08c95277c3.js} +19 -19
- package/assets/esri/core/workers/chunks/d64c271c173797d98286.js +1 -0
- package/assets/esri/core/workers/chunks/e1b2076d0040fcb7d864.js +1 -0
- package/assets/esri/core/workers/chunks/e3397036e060dac3b4d5.js +1 -0
- package/assets/esri/core/workers/chunks/e6836c84470fb6bd25bf.js +1 -0
- package/assets/esri/core/workers/chunks/f3f6035a17f7dcd19675.js +1 -0
- package/assets/esri/core/workers/chunks/{bff317b08e91414f6edc.js → f720967ba8c5486a26a2.js} +1 -1
- package/assets/esri/themes/base/widgets/_BasemapGallery.scss +20 -11
- package/assets/esri/themes/base/widgets/_Editor.scss +0 -9
- package/assets/esri/themes/base/widgets/_FeatureForm.scss +4 -2
- package/assets/esri/themes/base/widgets/_ItemList.scss +0 -49
- package/assets/esri/themes/base/widgets/_ValuePicker.scss +27 -10
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ar.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bg.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bs.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ca.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_cs.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_da.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_de.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_el.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_es.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_et.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fi.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fr.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_he.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hr.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hu.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_id.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_it.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ja.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ko.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lt.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lv.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nb.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nl.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pl.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-BR.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-PT.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ro.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ru.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sk.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sl.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sr.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sv.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_th.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_tr.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_uk.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_vi.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-CN.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-HK.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-TW.json +1 -1
- package/chunks/DefaultMaterial.glsl.js +4 -4
- package/chunks/HUDMaterial.glsl.js +22 -22
- package/chunks/HeatmapDensity.glsl.js +5 -5
- package/chunks/LineMarker.glsl.js +35 -35
- package/chunks/RibbonLine.glsl.js +47 -47
- package/chunks/ShadowCastVisualize.glsl.js +2 -2
- package/core/Queue.js +1 -1
- package/core/a11yUtils.js +5 -0
- package/interfaces.d.ts +769 -25
- package/intl/date.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/attributeSupport.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/support/RasterBandInfo.d.ts +4 -0
- package/layers/support/RasterSensorInfo.d.ts +4 -0
- package/layers/support/infoFor3D.js +1 -1
- package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
- package/package.json +2 -2
- package/popup/FieldInfo.js +1 -1
- package/popup/support/FieldInfoFormat.js +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/support/BaseImageMeasureParameters.d.ts +4 -0
- package/rest/support/BaseImageMeasureParameters.js +1 -1
- package/rest/support/ImageHistogramParameters.js +1 -1
- package/rest/support/ImageIdentifyParameters.js +1 -1
- package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
- package/smartMapping/raster/support/adapters/ImageryTileLayerAdapter.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/vectorTiles/GlyphMosaic.js +1 -1
- package/views/2d/engine/vectorTiles/GlyphSource.js +1 -1
- package/views/2d/engine/vectorTiles/TextShaping.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
- package/views/2d/engine/webgl/GlyphSource.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/support/cimSymbolUtils.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/support/DisplayQualityProfile.js +1 -1
- package/views/3d/support/QualitySettings.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/terrain/Overlay.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +13 -13
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +18 -18
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js +8 -8
- package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
- package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
- package/views/3d/webgl-engine/lib/RenderTargetHelper.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultBufferWriter.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/lineStippleUtils.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/LineCalloutTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/PopupView.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/webgl/ValidatedTextureDescriptor.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/CreateWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/Upload.js +1 -1
- package/widgets/Editor/Workflow.js +1 -1
- package/widgets/Editor/modelUploadUtils.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/FeatureForm/InputField.js +5 -0
- package/widgets/FeatureForm/InputFieldGroup.js +5 -0
- package/widgets/FeatureForm/css.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/FeatureTemplates/ItemList.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/ValuePicker/ValuePickerBaseComponent.js +1 -1
- package/widgets/ValuePicker/ValuePickerCollection.js +1 -1
- package/widgets/ValuePicker/ValuePickerCombobox.js +1 -1
- package/widgets/ValuePicker/ValuePickerLabel.js +1 -1
- package/widgets/ValuePicker/ValuePickerSlider.js +1 -1
- package/widgets/ValuePicker/ValuePickerViewModel.js +1 -1
- package/widgets/ValuePicker.js +1 -1
- package/assets/esri/core/workers/chunks/009026614cae60e9505c.js +0 -1
- package/assets/esri/core/workers/chunks/415c326d268b1a8fd03f.js +0 -1
- package/assets/esri/core/workers/chunks/504e929b686570ee858d.js +0 -1
- package/assets/esri/core/workers/chunks/5c811527898eb1c04e67.js +0 -1
- package/assets/esri/core/workers/chunks/6164a9c654c38f9cb64e.js +0 -1
- package/assets/esri/core/workers/chunks/6dd99db0adce09ac9794.js +0 -1
- package/assets/esri/core/workers/chunks/7cec069db0598431829e.js +0 -1
- package/assets/esri/core/workers/chunks/8bb3b10a777ae19f57f9.js +0 -1
- package/assets/esri/core/workers/chunks/91971a76a4ae0474a878.js +0 -1
- package/assets/esri/core/workers/chunks/9ed9e2ad50816a4f937a.js +0 -1
- package/assets/esri/core/workers/chunks/b3013a5a39d038b2d748.js +0 -1
- package/assets/esri/core/workers/chunks/b81bb096ccfcea182cc1.js +0 -1
- package/assets/esri/core/workers/chunks/cf3dd5aad1d60ff1b0b6.js +0 -1
- package/assets/esri/core/workers/chunks/d05d9ddf244bb3dcbcaa.js +0 -1
- package/assets/esri/core/workers/chunks/d3a6504fbaf555707c58.js +0 -1
- package/assets/esri/core/workers/chunks/ef141014ed21a7fd1ff3.js +0 -2
- package/assets/esri/core/workers/chunks/f4933025edecdc1aae76.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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import{isSome as t}from"../../../core/arrayUtils.js";import r from"../../../core/Error.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../RasterInfo.js";import n from"../RasterStorageInfo.js";import o from"./BaseRaster.js";import
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import{isSome as t}from"../../../core/arrayUtils.js";import r from"../../../core/Error.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../RasterInfo.js";import n from"../RasterStorageInfo.js";import o from"./BaseRaster.js";import f from"./DBFParser.js";import{parseSpatialReference as l,parsePAMInfo as u}from"./pamParser.js";import{parseSignature as c,getPyramidIFDs as p,getMaskIFDs as h,getImageInfo as m,parseIFD as d,parseFieldValues as y,isBSQConfig as g}from"../rasterFormats/TiffDecoder.js";import T from"../rasterFormats/TiffTags.js";import{estimateStatisticsFromHistograms as x}from"../rasterFunctions/stretchUtils.js";import I from"../rasterTransforms/PolynomialTransform.js";import w from"../../../rest/support/FeatureSet.js";import R from"../../../geometry/SpatialReference.js";import _ from"../../../geometry/Extent.js";import b from"../../../geometry/Point.js";const F=(e,t)=>e.get(t)?.values,E=(e,t)=>e.get(t)?.values?.[0];let S=class extends o{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this.datasetFormat="TIFF"}async open(e){await this.init();const t=e?e.signal:null,{data:i}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:t});if(!i)throw new r("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));const{littleEndian:s,firstIFDPos:a,isBigTiff:n}=c(i),o=[];await this._readIFDs(o,i,s,a,0,n?8:4,t);const{imageInfo:f,rasterInfo:l}=this._parseIFDs(o),u=p(o),m=h(o);if(this._headerInfo={littleEndian:s,isBigTiff:n,ifds:o,pyramidIFDs:u,maskIFDs:m,...f},this._set("rasterInfo",l),!f.isSupported)throw new r("tiffraster:open","this tiff is not supported: "+f.message);if(!f.tileWidth)throw new r("tiffraster:open","none-tiled tiff is not optimized for access, convert to COG and retry.");const d=o[0].get("PREDICTOR")?.values?.[0],y=o[0].get("SAMPLEFORMAT")?.values?.[0];if(3===y&&2===d)throw new r("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floatting point data");const{skipExtensions:g=[]}=this.ioConfig;if(!g.includes("aux.xml")){const t=await this._fetchAuxiliaryMetaData(e);null!=t&&this._processPAMInfo(t,l)}g.includes("vat.dbf")||1!==l.bandCount||"u8"!==l.pixelType||(l.attributeTable=await this._fetchAuxiliaryTable(e),null!=l.attributeTable&&(l.keyProperties.DataType="thematic")),this.updateTileInfo()}async fetchRawTile(e,t,r,i={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,r))return null;const s=await this._fetchRawTiffTile(e,t,r,!1,i);if(null!=s&&this._headerInfo.hasMaskBand){const a=await this._fetchRawTiffTile(e,t,r,!0,i);null!=a&&a.pixels[0]instanceof Uint8Array&&(s.mask=a.pixels[0])}return s}_parseIFDs(e){const t=m(e),{width:r,height:i,tileWidth:s,tileHeight:o,planes:f,pixelType:u,compression:c,firstPyramidLevel:p,maximumPyramidLevel:h,pyramidBlockWidth:d,pyramidBlockHeight:y,tileBoundary:g,affine:T,metadata:x}=t,w=t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid;let S=l(w),v=!!t.isPseudoGeographic;null==S&&(v=!0,S=new R({wkid:3857}));const D=new _({...t.extent,spatialReference:S}),P=new b(D?{x:D.xmin,y:D.ymax,spatialReference:S}:{x:0,y:0}),k=new n({blockWidth:s,blockHeight:o,pyramidBlockWidth:d,pyramidBlockHeight:y,compression:c,origin:P,firstPyramidLevel:p,maximumPyramidLevel:h,blockBoundary:g}),O=new b({x:(D.xmax-D.xmin)/r,y:(D.ymax-D.ymin)/i,spatialReference:S}),j=x?{BandProperties:x.bandProperties,DataType:x.dataType}:{};let B=null;const L=E(e[0],"PHOTOMETRICINTERPRETATION"),A=F(e[0],"COLORMAP");if(L<=3&&A?.length>3&&A.length%3==0){B=[];const e=A.length/3;for(let t=0;t<e;t++)B.push([t,A[t]>>>8,A[t+e]>>>8,A[t+2*e]>>>8])}const z=new a({width:r,height:i,bandCount:f,pixelType:u,pixelSize:O,storageInfo:k,spatialReference:S,isPseudoSpatialReference:v,keyProperties:j,extent:D,colormap:B,statistics:x?x.statistics:null});return T?.length&&(z.nativeExtent=new _({xmin:-.5,ymin:.5-i,xmax:r-.5,ymax:.5,spatialReference:S}),z.transform=new I({polynomialOrder:1,forwardCoefficients:[T[2]+T[0]/2,T[5]-T[3]/2,T[0],T[3],-T[1],-T[4]]}),z.extent=z.transform.forwardTransform(z.nativeExtent),z.pixelSize=new b({x:(D.xmax-D.xmin)/r,y:(D.ymax-D.ymin)/i,spatialReference:S}),k.origin.x=-.5,k.origin.y=.5),{imageInfo:t,rasterInfo:z}}_processPAMInfo(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=x(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;const r=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new b({x:(r.xmax-r.xmin)/t.width,y:(r.ymax-r.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=r}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}async _readIFDs(e,t,r,i,s,a=4,n){if(!i)return null;if(i>=t.byteLength||i<0){t=(await this.request(this.url,{range:{from:i+s,to:i+s+this._bufferSize},responseType:"array-buffer",signal:n})).data,s=i+s,i=0}const o=await this._readIFD(t,r,i,s,T.TIFF_TAGS,a,n);if(e.push(o.ifd),!o.nextIFD)return null;await this._readIFDs(e,t,r,o.nextIFD-s,s,a,n)}async _readIFD(e,r,i,s,a=T.TIFF_TAGS,n=4,o){if(!e)return null;const f=d(e,r,i,s,a,n);if(f.success){const i=[];if(f.ifd?.forEach((e=>{e.values||i.push(e)})),i.length>0){const a=i.map((e=>e.offlineOffsetSize)).filter(t),n=Math.min.apply(null,a.map((e=>e[0])));if(Math.min.apply(null,a.map((e=>e[0]+e[1])))-n<=this._bufferSize){const{data:t}=await this.request(this.url,{range:{from:n,to:n+this._bufferSize},responseType:"array-buffer",signal:o});e=t,s=n,i.forEach((t=>y(e,r,t,s)))}}if(f.ifd?.has("GEOKEYDIRECTORY")){const t=f.ifd.get("GEOKEYDIRECTORY"),i=t?.values;if(i&&i.length>4){const a=i[0]+"."+i[1]+"."+i[2],n=await this._readIFD(e,r,t.valueOffset+6-s,s,T.GEO_KEYS,2,o);t.data=n.ifd,t.data&&t.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[a]})}}return f}if(f.requiredBufferSize&&f.requiredBufferSize!==e.byteLength){const t=await this.request(this.url,{range:{from:s,to:s+f.requiredBufferSize+4},responseType:"array-buffer",signal:o});return(e=t.data).byteLength<f.requiredBufferSize?null:this._readIFD(e,r,0,s,T.TIFF_TAGS,4,o)}}async _fetchRawTiffTile(e,t,r,i,s={}){const a=this._getTileLocation(e,t,r,i);if(!a)return null;const{ranges:n,actualTileWidth:o,actualTileHeight:f,ifd:l}=a,u=n.map((e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:s.signal}))),c=await Promise.all(u),p=c.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),h=1===c.length?c[0].data:new ArrayBuffer(p),m=[0],d=[0];if(c.length>1){const e=new Uint8Array(h);for(let t=0,r=0;t<c.length;t++){const i=c[t].data;e.set(new Uint8Array(i),r),m[t]=r,r+=i.byteLength,d[t]=i.byteLength}}const{blockWidth:y,blockHeight:g}=this.getBlockWidthHeight(e),T=await this.decodePixelBlock(h,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:l,offsets:m,sizes:d},width:y,height:g,planes:null,pixelType:null});if(null==T)return null;let x,I,w;if(o!==y||f!==g){let e=T.mask;if(e)for(x=0;x<g;x++)if(w=x*y,x<f)for(I=o;I<y;I++)e[w+I]=0;else for(I=0;I<y;I++)e[w+I]=0;else for(e=new Uint8Array(y*g),T.mask=e,x=0;x<f;x++)for(w=x*y,I=0;I<o;I++)e[w+I]=1}return T}_getTileLocation(e,t,r,i=!1){const{firstPyramidLevel:s,blockBoundary:a}=this.rasterInfo.storageInfo,n=0===e?0:e-(s-1),{_headerInfo:o}=this;if(!o)return null;const f=i?o.maskIFDs[n]:0===n?o?.ifds[0]:o?.pyramidIFDs[n-1];if(!f)return null;const l=g(f,o),u=F(f,"TILEOFFSETS");if(void 0===u)return null;const c=F(f,"TILEBYTECOUNTS"),{minRow:p,minCol:h,maxRow:m,maxCol:d}=a[n];if(t>m||r>d||t<p||r<h)return null;const y=E(f,"IMAGEWIDTH"),T=E(f,"IMAGELENGTH"),x=E(f,"TILEWIDTH"),I=E(f,"TILELENGTH"),w=[];if(l){const{bandCount:e}=this.rasterInfo;for(let i=0;i<e;i++){const e=i*(m+1)*(d+1)+t*(d+1)+r;w[i]={from:u[e],to:u[e]+c[e]-1}}}else{const e=t*(d+1)+r;w.push({from:u[e],to:u[e]+c[e]-1})}for(let g=0;g<w.length;g++)if(null==w[g].from||!w[g].to)return null;return{ranges:w,ifd:f,actualTileWidth:r===d&&y%x||x,actualTileHeight:t===m&&T%I||I}}async _fetchAuxiliaryMetaData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return u(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{const{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),r=f.parse(t);return r?.recordSet?w.fromJSON(r.recordSet):null}catch{return null}}};e([i()],S.prototype,"_files",void 0),e([i()],S.prototype,"_headerInfo",void 0),e([i()],S.prototype,"_bufferSize",void 0),e([i({type:String,json:{write:!0}})],S.prototype,"datasetFormat",void 0),S=e([s("esri.layers.support.rasterDatasets.TIFFRaster")],S);const v=S;export{v as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{bytesToUTF8 as e}from"../rasterDatasets/byteStreamUtils.js";import{J as t}from"../../../chunks/Jpg.js";import{load as n,decode as a}from"./Lerc.js";import{decode as i}from"./Lzw.js";import{convertNoDataToMask as s}from"./pixelRangeUtils.js";import r from"./TiffTags.js";import{isPlatformLittleEndian as l}from"./utils.js";import{Z as o}from"../../../chunks/Zlib.js";const f=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],u=4294967296,c=new Set([1,5,6,7,8,34712,34887]);function h(e,t){let n="unknown";return 3===e?n=64===t?"f64":"f32":1===e?1===t?n="u1":2===t?n="u2":4===t?n="u4":t<=8?n="u8":t<=16?n="u16":t<=32&&(n="u32"):2===e&&(t<=8?n="s8":t<=16?n="s16":t<=32&&(n="s32")),n}function g(e){let t=null;switch(e?e.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":t=Uint8Array;break;case"u16":t=Uint16Array;break;case"u32":t=Uint32Array;break;case"s8":t=Int8Array;break;case"s16":t=Int16Array;break;case"s32":t=Int32Array;break;case"f64":t=Float64Array;break;default:t=Float32Array}return t}function E(e,t){return{x:t[0]*e.x+t[1]*e.y+t[2],y:t[3]*e.x+t[4]*e.y+t[5]}}function T(e,t){return e.get(t)?.values}function I(e,t){return e.get(t)?.values}function p(e,t){return e.get(t)?.values?.[0]}function d(e,t){return e.get(t)?.values?.[0]}function w(e,t,n,a=0,i=r.TIFF_TAGS,s=4){const l=8===s,o=l?G(new DataView(e,n,8),0,t):new DataView(e,n,2).getUint16(0,t),f=4+2*s,u=l?8:2,c=u+o*f;if(n+c>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:c};const h=n+c+4<=e.byteLength?C(new DataView(e,n+c,8===s?8:4),0,t,8===s):null,g=n+u,E=new Map;let T,I,p,d,w,S=0,m=0;for(let y=0;y<o;y++){I=new DataView(e,g+f*y,f),p=I.getUint16(0,t),w=I.getUint16(2,t),d=r.getTagName(p,i);const n=[];2===s?(S=I.getUint16(4,t),m=I.getUint16(6,t)):4===s?(S=I.getUint32(4,t),m=I.getUint32(8,t)):8===s&&(S=C(I,4,t,!0),m=C(I,12,t,!0),n.push(I.getUint32(12,t)),n.push(I.getUint32(16,t))),T={id:p,type:w,valueCount:S,valueOffset:m,valueOffsets:n,values:null},L(e,t,T,a,!1,s),E.set(d,T)}return{success:!0,ifd:E,nextIFD:h,requiredBufferSize:c}}const S=(e,t)=>a(e,{inputOffset:t}).pixels[0];function m(e,t){if(1!==t&&2!==t&&4!==t)return e;const n=new Uint8Array(e),a=8/t,i=new Uint8Array(e.byteLength*a);let s=0;const r=2**t-1;for(let l=0;l<n.length;l++){const e=n[l];for(let n=0;n<a;n++)i[s++]=e<<t*n>>>8-t&r}return i.buffer}function y(e,n,a){const i=new t;i.parse(e),i.colorTransform=6===a?-1:0;const s=i.getData(i.width,i.height,1!==n);return new Uint8Array(s.buffer)}function A(e){const t=new o(e).getBytes(),n=new ArrayBuffer(t.length),a=new Uint8Array(n);return a.set(t),a}async function M(e,t,a,s,r){const o=l===t,f=d(a,"BITSPERSAMPLE"),u=d(a,"SAMPLESPERPIXEL"),c=d(a,"PHOTOMETRICINTERPRETATION"),E=h(d(a,"SAMPLEFORMAT")??1,f),T=d(a,"COMPRESSION")??1,I=g(E);let p,w,M;if(34887===T)return await n(),S(e,s);if(1===T)p=e.slice(s,s+r),w=new Uint8Array(p);else if(8===T||32946===T)w=new Uint8Array(e,s,r),w=A(w),p=w.buffer;else if(6===T)w=new Uint8Array(e,s,r),w=y(w,u,c),p=w.buffer;else if(7===T){const t=a.get("JPEGTABLES").values,n=t.length-2;w=new Uint8Array(n+r-2);for(let e=0;e<n;e++)w[e]=t[e];const i=new Uint8Array(e,s+2,r-2);for(let e=0;e<i.length;e++)w[n+e]=i[e];w=y(w,u,c),p=w.buffer}else{if(5!==T)throw new Error("tiff-decode: unsupport compression "+T);w=i(e,s,r,t),p=w.buffer}if(p=m(p,f),"u8"===E||"s8"===E||o)M=new I(p);else{p=new ArrayBuffer(w.length);const e=new Uint8Array(p);switch(E){case"u16":case"s16":for(let t=0;t<w.length;t+=2)e[t]=w[t+1],e[t+1]=w[t];break;case"u32":case"s32":case"f32":for(let t=0;t<w.length;t+=4)e[t]=w[t+3],e[t+1]=w[t+2],e[t+2]=w[t+1],e[t+3]=w[t]}M=new I(p)}return M}async function P(e,t,n){const a=I(n,"TILEOFFSETS");if(void 0===a)return null;const i=I(n,"TILEBYTECOUNTS"),{width:s,height:r,pixelType:l,tileWidth:o,tileHeight:f}=R([n]),u=D(n,t),c=d(n,"SAMPLESPERPIXEL")||t.planes,h=s*r,E=d(n,"BITSPERSAMPLE"),T=34887===(d(n,"COMPRESSION")??1),p=g(l),w=[];for(let g=0;g<c;g++)w.push(new p(h));let S,m,y,A,P,O,b,x,L,N,U,k,G;const F=Math.ceil(s/o);if(E%8==0)if(T&&u&&c>1){const l=Math.round(a.length/c);for(S=0;S<l;S++){O=Math.floor(S/F)*f,b=S%F*o,x=O*s+b;for(let l=0;l<c;l++){const u=S*c+l;if(0!==i[u])for(y=await M(e,t.littleEndian,n,a[u],i[u]),N=0,L=x,k=Math.min(o,s-b),U=Math.min(f,r-O),G=w[l],A=0;A<U;A++)for(L=x+A*s,N=A*o,P=0;P<k;P++,L++,N++)G[L]=y[N]}}}else for(S=0;S<a.length;S++)if(0!==i[S])for(O=Math.floor(S/F)*f,b=S%F*o,x=O*s+b,y=await M(e,t.littleEndian,n,a[S],i[S]),N=0,L=x,k=Math.min(o,s-b),U=Math.min(f,r-O),m=0;m<c;m++)if(G=w[m],u||T)for(A=0;A<U;A++)for(L=x+A*s,N=o*f*m+A*o,P=0;P<k;P++,L++,N++)G[L]=y[N];else for(A=0;A<U;A++)for(L=x+A*s,N=A*o*c+m,P=0;P<k;P++,L++,N+=c)G[L]=y[N];return{width:s,height:r,pixelType:l,pixels:w}}const O=(e,t,n)=>{const a=l===t.littleEndian,s=I(n,"STRIPOFFSETS");if(void 0===s)return null;const{width:r,height:o,pixelType:f}=R([n]),u=d(n,"SAMPLESPERPIXEL")||t.planes,c=d(n,"PHOTOMETRICINTERPRETATION"),h=r*o,E=d(n,"BITSPERSAMPLE"),T=g(f),p=new T(h*u),w=I(n,"STRIPBYTECOUNTS"),S=d(n,"ROWSPERSTRIP"),M=d(n,"COMPRESSION")??1;let P,O,b,x,L,D,N,U,k,G=S;if(E%8==0)for(P=0;P<s.length;P++){if(L=P*(S*r)*u,G=(P+1)*S>o?o-P*S:S,"u8"===f||"s8"===f||a)8===M||32946===M?(N=new Uint8Array(e,s[P],w[P]),N=A(N),D=N.buffer):6===M?(N=new Uint8Array(e,s[P],w[P]),N=y(N,u,c),D=N.buffer):5===M?(N=i(e,s[P],w[P],t.littleEndian),D=N.buffer):(w[P]!==G*r*u*E/8&&console.log("strip byte counts is different than expected"),D=e.slice(s[P],s[P]+w[P])),D=m(D,E),x=new T(D);else{switch(6===M||8===M||32946===M?(N=new Uint8Array(e,s[P],w[P]),U=A(N),D=U.buffer):(w[P]!==G*r*u*E/8&&console.log("strip byte counts is different than expected"),D=new ArrayBuffer(w[P]),N=new Uint8Array(e,s[P],w[P]),U=new Uint8Array(D)),f){case"u16":case"s16":for(b=0;b<N.length;b+=2)U[b]=N[b+1],U[b+1]=N[b];break;case"u32":case"s32":case"f32":for(b=0;b<N.length;b+=4)U[b]=N[b+3],U[b+1]=N[b+2],U[b+2]=N[b+1],U[b+3]=N[b]}D=m(D,E),x=new T(D)}p.set(x,L)}const F=[];if(1===u)F.push(p);else for(P=0;P<u;P++){for(k=new T(h),O=0;O<h;O++)k[O]=p[O*u+P];F.push(k)}return{width:r,height:o,pixelType:f,pixels:F}},b=(e,t,n)=>{if(!(e&&e.length>0&&t&&n))return null;let a,i,s;const r=e[0].length,l=e.length,o=new Uint8Array(r);for(let f=0;f<l;f++)if(a=e[f],i=t[f],s=n[f],0===f)for(let e=0;e<r;e++)o[e]=a[e]<i||a[e]>s?0:1;else for(let e=0;e<r;e++)o[e]&&(o[e]=a[e]<i||a[e]>s?0:1);return o},x=e=>{if(!e)return null;const t=e.match(/<Item(.*?)Item>/gi);if(!t||0===t.length)return null;const n=new Map;let a,i,s,r,l;for(let p=0;p<t.length;p++)a=t[p],i=a.slice(6,a.indexOf(">")),r=a.indexOf("sample="),r>-1&&(l=a.slice(r+8,a.indexOf('"',r+8))),r=a.indexOf("name="),r>-1&&(i=a.slice(r+6,a.indexOf('"',r+6))),i&&(s=a.slice(a.indexOf(">")+1,a.indexOf("</Item>")).trim(),null!=l?n.has(i)?n.get(i)[l]=s:n.set(i,[s]):n.set(i,s)),l=null;const o=n.get("STATISTICS_MINIMUM"),f=n.get("STATISTICS_MAXIMUM"),u=n.get("STATISTICS_MEAN"),c=n.get("STATISTICS_STDDEV");let h=null;if(o&&f){h=[];for(let e=0;e<o.length;e++)h.push({min:parseFloat(o[e]),max:parseFloat(f[e]),avg:u&&parseFloat(u[e]),stddev:c&&parseFloat(c[e])})}const g=n.get("BandName"),E=n.get("WavelengthMin"),T=n.get("WavelengthMax");let I=null;if(g){I=[];for(let e=0;e<g.length;e++)I.push({BandName:g[e],WavelengthMin:E&&parseFloat(E[e]),WavelengthMax:T&&parseFloat(T[e])})}return{statistics:h,bandProperties:I,dataType:n.get("DataType"),rawMetadata:n}};function L(e,t,n,a=0,i=!1,s=4){if(n.values)return!0;const r=n.type,l=n.valueCount;let o=n.valueOffset,c=[];const h=f[r],g=8*h,E=l*h,T=l*f[r]*8;let I,p;const d=8===s?64:32,w=n.valueOffsets;if(T>d){if(E>(i?e.byteLength:e?e.byteLength-o+a:0))return n.offlineOffsetSize=[o,E],n.values=null,!1}if(T<=d){if(!t)if(d<=32)o>>>=32-T;else{const e=w?.length?w[0]:o>>>0,t=w?.length?w[1]:Math.round((o-e)/u);T<=32?(o=e>>>32-T,w[0]=o):(o=e*2**(32-T)+(t>>>32-T),w[0]=e,w[1]=t>>>32-T)}if(1===l&&g===d)c=[o];else if(64===d){const e=w?.length?w[0]:o>>>0,t=w?.length?w[1]:Math.round((o-e)/u);let n=e,a=32;for(p=1;p<=l;p++){const e=32-g*p%32;if(a<g){const i=n<<e>>>32-a,s=t<<32-a>>>32-a;n=t,c.push(i+s*2**(g-a)),a-=32-(g-a)}else c.push(n<<e>>>32-g),a-=g;0===a&&(a=32,n=t)}}else for(p=1;p<=l;p++){const e=32-g*p;c.push(o<<e>>>32-g)}}else{o-=a,i&&(o=0);for(let n=o;n<o+E;n+=h){switch(r){case 1:case 2:case 7:I=new DataView(e,n,1).getUint8(0);break;case 3:I=new DataView(e,n,2).getUint16(0,t);break;case 4:case 13:I=new DataView(e,n,4).getUint32(0,t);break;case 5:I=new DataView(e,n,4).getUint32(0,t)/new DataView(e,n+4,4).getUint32(0,t);break;case 6:I=new DataView(e,n,1).getInt8(0);break;case 8:I=new DataView(e,n,2).getInt16(0,t);break;case 9:I=new DataView(e,n,4).getInt32(0,t);break;case 10:I=new DataView(e,n,4).getInt32(0,t)/new DataView(e,n+4,4).getInt32(0,t);break;case 11:I=new DataView(e,n,4).getFloat32(0,t);break;case 12:I=new DataView(e,n,8).getFloat64(0,t);break;case 16:case 18:I=G(new DataView(e,n,8),0,t);break;case 17:I=F(new DataView(e,n,8),0,t);break;default:I=null}c.push(I)}}if(2===r){let e="";const t=c;for(c=[],p=0;p<t.length;p++)0===t[p]&&""!==e?(c.push(e),e=""):e+=String.fromCharCode(t[p]);""===e&&0!==c.length||c.push(e)}return n.values=c,!0}function R(e){const t=e[0],n=d(t,"TILEWIDTH"),a=d(t,"TILELENGTH"),i=d(t,"IMAGEWIDTH"),s=d(t,"IMAGELENGTH"),r=d(t,"BITSPERSAMPLE"),l=d(t,"SAMPLESPERPIXEL"),o=d(t,"SAMPLEFORMAT")??1,f=h(o,r),u=D(t),g=T(t,"GDAL_NODATA");let w=null;g?.length&&(w=g.map((e=>parseFloat(e))),w.some((e=>isNaN(e)))&&(w=null));const S=d(t,"COMPRESSION")??1;let m;switch(S){case 1:m="NONE";break;case 2:case 3:case 4:case 32771:m="CCITT";break;case 5:m="LZW";break;case 6:case 7:m="JPEG";break;case 32773:m="PACKBITS";break;case 8:case 32946:m="DEFLATE";break;case 34712:m="JPEG2000";break;case 34887:m="LERC";break;default:m=String(S)}let y=!0,A="";c.has(S)||(y=!1,A+="unsupported tag compression "+S),o>3&&(y=!1,A+="unsupported tag sampleFormat "+o),1!==r&&2!==r&&4!==r&&r%8!=0&&(y=!1,A+="unsupported tag bitsPerSample "+r);const M=p(t,"GEOASCIIPARAMS");let P;if(M){const e=M.split("|").find((e=>e.includes("ESRI PE String = "))),t=e?e.replace("ESRI PE String = ",""):"";P=t.startsWith("COMPD_CS")||t.startsWith("PROJCS")||t.startsWith("GEOGCS")?{wkid:null,wkt:t}:null}const O=I(t,"GEOTIEPOINTS"),b=I(t,"GEOPIXELSCALE"),L=I(t,"GEOTRANSMATRIX"),R=t.has("GEOKEYDIRECTORY")?t.get("GEOKEYDIRECTORY").data:null;let k,G,F=!1,C=!1;if(R){F=2===d(R,"GTRasterTypeGeoKey");const e=d(R,"GTModelTypeGeoKey");if(2===e){const e=d(R,"GeographicTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e}),P||32767!==e||(C=!0,P={wkid:4326})}else if(1===e){const e=d(R,"ProjectedCSTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e})}}if(b&&O&&O.length>=6?(k=[b[0],0,O[3]-O[0]*b[0],0,-Math.abs(b[1]),O[4]-O[1]*b[1]],F&&(k[2]-=.5*k[0]+.5*k[1],k[5]-=.5*k[3]+.5*k[4])):L&&16===L.length&&(k=F?[L[0],L[1],L[3]-.5*L[0],L[4],L[5],L[7]-.5*L[5]]:[L[0],L[1],L[3],L[4],L[5],L[7]]),k){const e=[{x:0,y:s},{x:0,y:0},{x:i,y:s},{x:i,y:0}];let t,n=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let i=0;i<e.length;i++)t=E(e[i],k),n=t.x>n?n:t.x,r=t.x<r?r:t.x,a=t.y>a?a:t.y,l=t.y<l?l:t.y;G={xmin:n,xmax:r,ymin:a,ymax:l,spatialReference:P}}else G={xmin:-.5,ymin:.5-s,xmax:i-.5,ymax:.5,spatialReference:P};C&&(G.xmax-G.xmin>400||Math.max(Math.abs(G.xmin),Math.abs(G.xmax))>361)&&(P=null,G.spatialReference=null);const v=N(e);let B,W,H,Y,_;if(v.length>0){H=Math.round(Math.log(i/d(v[0],"IMAGEWIDTH"))/Math.LN2);const e=v[v.length-1];Y=Math.round(Math.log(i/d(e,"IMAGEWIDTH"))/Math.LN2),B=d(e,"TILEWIDTH"),W=d(e,"TILELENGTH")}B=null!=Y&&Y>0?B||n:null,W=null!=Y&&Y>0?W||a:null,n&&(_=[{maxCol:Math.ceil(i/n)-1,maxRow:Math.ceil(s/a)-1,minRow:0,minCol:0}],v.forEach((e=>{_.push({maxCol:Math.ceil(d(e,"IMAGEWIDTH")/d(e,"TILEWIDTH"))-1,maxRow:Math.ceil(d(e,"IMAGELENGTH")/d(e,"TILELENGTH"))-1,minRow:0,minCol:0})})));const K=p(e[0],"GDAL_METADATA"),X=x(K);A+=" "+V({width:i,height:s,tileWidth:n,tileHeight:a,planes:l,ifds:e});return{width:i,height:s,tileWidth:n,tileHeight:a,planes:l,isBSQ:u,pixelType:f,compression:m,noData:w,hasMaskBand:U(e).length===v.length+1,isSupported:y,message:A,extent:G,isPseudoGeographic:C,affine:b?null:k,firstPyramidLevel:H,maximumPyramidLevel:Y,pyramidBlockWidth:B,pyramidBlockHeight:W,tileBoundary:_,metadata:X}}function D(e,t){const n=T(e,"PLANARCONFIGURATION");return n?2===n[0]:!!t&&t.isBSQ}function N(e){return e.filter((e=>1===d(e,"NEWSUBFILETYPE")))}function U(e){return e.filter((e=>{const t=4==(4&(d(e,"NEWSUBFILETYPE")??0)),n=4===d(e,"PHOTOMETRICINTERPRETATION");return t&&n}))}function k(e){const{littleEndian:t,isBigTiff:n,firstIFDPos:a}=v(e);let i=a;const s=[];do{const a=B(e,t,i,0,r.TIFF_TAGS,n?8:4);if(!a.success)break;s.push(a.ifd),i=a.nextIFD}while(i>0);return{...R(s),littleEndian:t,isBigTiff:n,ifds:s,pyramidIFDs:N(s),maskIFDs:U(s)}}function G(e,t,n){const a=e.getUint32(t,n),i=e.getUint32(t+4,n);return n?i*u+a:a*u+i}function F(e,t,n){let a=n?e.getInt32(t,n):e.getUint32(t,n),i=n?e.getUint32(t+4,n):e.getInt32(t+4,n);const s=(n?a:i)>=0?1:-1;n?a*=s:i*=s;return s*(n?i*u+a:a*u+i)}function C(e,t,n,a){return a?G(e,t,n):e.getUint32(t,n)}function v(e){const t=new DataView(e,0,16),n=t.getUint16(0,!1);let a=null;if(18761===n)a=!0;else{if(19789!==n)throw new Error("unexpected endianess byte");a=!1}const i=t.getUint16(2,a);if(42!==i&&43!==i)throw new Error("unexpected tiff identifier");let s=4;const r=43===i;if(r){const e=t.getUint16(s,a);if(s+=2,8!==e)throw new Error("unsupported bigtiff version");if(0!==t.getUint16(s,a))throw new Error("unsupported bigtiff version");s+=2}return{littleEndian:a,isBigTiff:r,firstIFDPos:C(t,s,a,r)}}function B(t,n,a,i=0,s=r.TIFF_TAGS,l=4){const o=w(t,n,a,i,s,l);let f;const u=o.ifd;if(u){if(r.ifdTags.forEach(((e,a)=>{u.has(a)&&(f=u.get(a),f.data=w(t,n,f.valueOffset-i,i,e).ifd)})),u.has("GEOKEYDIRECTORY")){f=u.get("GEOKEYDIRECTORY");const e=f.values;if(e&&e.length>4){const a=e[0]+"."+e[1]+"."+e[2];f.data=w(t,n,f.valueOffset+6-i,i,r.GEO_KEYS,2).ifd,f.data&&f.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[a]})}}if(u.has("XMP")){f=u.get("XMP");const t=f.values;"number"==typeof t[0]&&7===f.type&&(f.values=[e(new Uint8Array(t))])}}return o}function V(e){const{width:t,height:n,tileHeight:a,tileWidth:i}=e,s=e.planes,r=i?i*a:t*n,l=d(e.ifds[0],"BITSPERSAMPLE");let o="";return r*s>2**30/(l>8?l/8:1)&&(o=i?"tiled tiff exceeding 1 gigabits per tile is not supported":"scanline tiff exceeding 1 gigabits is not supported"),o}async function W(e,t){const{headerInfo:n,ifd:a,offsets:i,sizes:r}=t,l=[];for(let s=0;s<i.length;s++){const t=await M(e,n.littleEndian,a,i[s],r[s]||e.byteLength);l.push(t)}const o=D(a,n),f=d(a,"BITSPERSAMPLE"),u=h(d(a,"SAMPLEFORMAT")??1,f),c=d(a,"SAMPLESPERPIXEL")||n.planes,E=g(u),T=d(a,"TILEWIDTH"),I=d(a,"TILELENGTH"),p=d(a,"COMPRESSION")??1,w=T*I;let S;const m=[];let y=l[0];const A=34887===p;for(let s=0;s<c;s++){if(S=new E(w),o&&A){if(y=l[s],y.length)for(let e=0;e<w;e++)S[e]=y[e+s]}else if(y.length)if(o||A&&!o)S=y.slice(w*s,w*(s+1));else for(let e=0;e<w;e++)S[e]=y[e*c+s];m.push(S)}const P=n.noData?n.noData[0]:t.noDataValue,O=n.metadata?n.metadata.statistics:null,x=O?O.map((e=>e.min)):null,L=O?O.map((e=>e.max)):null,R={pixelType:u,width:T,height:I,pixels:m,noDataValue:P};return null!=P?s(R,P):x&&L&&t.applyMinMaxConstraint&&(R.mask=b(m,x,L)),R}async function H(e,t={}){const n=t.pyramidLevel||0,a=t.headerInfo||k(e),{ifds:i,noData:r}=a;if(0===i.length)throw new Error("no valid image file directory");const l=V(a);if(l)throw l;let o=null;const f=-1===n?i[i.length-1]:i[n],u=r??t.noDataValue;return o=a.tileWidth?await P(e,a,f):await O(e,a,f),o?(null!=u&&s(o,u),o):o}export{H as decode,W as decodeTileOrStrip,R as getImageInfo,U as getMaskIFDs,N as getPyramidIFDs,D as isBSQConfig,L as parseFieldValues,k as parseHeader,B as parseIFD,v as parseSignature};
|
|
5
|
+
import{bytesToUTF8 as e}from"../rasterDatasets/byteStreamUtils.js";import{J as t}from"../../../chunks/Jpg.js";import{load as n,decode as a}from"./Lerc.js";import{decode as i}from"./Lzw.js";import{convertNoDataToMask as s}from"./pixelRangeUtils.js";import r from"./TiffTags.js";import{isPlatformLittleEndian as l}from"./utils.js";import{Z as o}from"../../../chunks/Zlib.js";const f=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],u=4294967296,c=new Set([1,5,6,7,8,34712,34887]);function h(e,t){let n="unknown";return 3===e?n=64===t?"f64":"f32":1===e?1===t?n="u1":2===t?n="u2":4===t?n="u4":t<=8?n="u8":t<=16?n="u16":t<=32&&(n="u32"):2===e&&(t<=8?n="s8":t<=16?n="s16":t<=32&&(n="s32")),n}function g(e){let t=null;switch(e?e.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":t=Uint8Array;break;case"u16":t=Uint16Array;break;case"u32":t=Uint32Array;break;case"s8":t=Int8Array;break;case"s16":t=Int16Array;break;case"s32":t=Int32Array;break;case"f64":t=Float64Array;break;default:t=Float32Array}return t}function E(e,t){return{x:t[0]*e.x+t[1]*e.y+t[2],y:t[3]*e.x+t[4]*e.y+t[5]}}function T(e,t){return e.get(t)?.values}function I(e,t){return e.get(t)?.values}function w(e,t){return e.get(t)?.values?.[0]}function p(e,t){return e.get(t)?.values?.[0]}function d(e,t,n,a=0,i=r.TIFF_TAGS,s=4){const l=8===s,o=l?k(new DataView(e,n,8),0,t):new DataView(e,n,2).getUint16(0,t),f=4+2*s,u=l?8:2,c=u+o*f;if(n+c>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:c};const h=n+c+4<=e.byteLength?C(new DataView(e,n+c,8===s?8:4),0,t,8===s):null,g=n+u,E=new Map;let T,I,w,p,d,S=0,y=0;for(let m=0;m<o;m++){I=new DataView(e,g+f*m,f),w=I.getUint16(0,t),d=I.getUint16(2,t),p=r.getTagName(w,i);const n=[];2===s?(S=I.getUint16(4,t),y=I.getUint16(6,t)):4===s?(S=I.getUint32(4,t),y=I.getUint32(8,t)):8===s&&(S=C(I,4,t,!0),y=C(I,12,t,!0),n.push(I.getUint32(12,t)),n.push(I.getUint32(16,t))),T={id:w,type:d,valueCount:S,valueOffset:y,valueOffsets:n,values:null},L(e,t,T,a,!1,s),E.set(p,T)}return{success:!0,ifd:E,nextIFD:h,requiredBufferSize:c}}const S=(e,t)=>a(e,{inputOffset:t}).pixels[0];function y(e,t){if(1!==t&&2!==t&&4!==t)return e;const n=new Uint8Array(e),a=8/t,i=new Uint8Array(e.byteLength*a);let s=0;const r=2**t-1;for(let l=0;l<n.length;l++){const e=n[l];for(let n=0;n<a;n++)i[s++]=e<<t*n>>>8-t&r}return i.buffer}function m(e,n,a){const i=new t;i.parse(e),i.colorTransform=6===a?-1:0;const s=i.getData(i.width,i.height,1!==n);return new Uint8Array(s.buffer)}function A(e){const t=new o(e).getBytes(),n=new ArrayBuffer(t.length),a=new Uint8Array(n);return a.set(t),a}async function M(e,t,a,s,r){const o=l===t,f=p(a,"BITSPERSAMPLE"),u=p(a,"SAMPLESPERPIXEL")??1,c=p(a,"PHOTOMETRICINTERPRETATION"),E=p(a,"SAMPLEFORMAT")??1,T=h(E,f),I=p(a,"COMPRESSION")??1,w=g(T);let d,M,P;if(34887===I)return await n(),S(e,s);if(1===I)d=e.slice(s,s+r),M=new Uint8Array(d);else if(8===I||32946===I)M=new Uint8Array(e,s,r),M=A(M),d=M.buffer;else if(6===I)M=new Uint8Array(e,s,r),M=m(M,u,c),d=M.buffer;else if(7===I){const t=a.get("JPEGTABLES").values,n=t.length-2;M=new Uint8Array(n+r-2);for(let e=0;e<n;e++)M[e]=t[e];const i=new Uint8Array(e,s+2,r-2);for(let e=0;e<i.length;e++)M[n+e]=i[e];M=m(M,u,c),d=M.buffer}else{if(5!==I)throw new Error("tiff-decode: unsupport compression "+I);M=i(e,s,r,t),d=M.buffer}if(d=y(d,f),"u8"===T||"s8"===T||o)P=new w(d);else{d=new ArrayBuffer(M.length);const e=new Uint8Array(d);switch(T){case"u16":case"s16":for(let t=0;t<M.length;t+=2)e[t]=M[t+1],e[t+1]=M[t];break;case"u32":case"s32":case"f32":for(let t=0;t<M.length;t+=4)e[t]=M[t+3],e[t+1]=M[t+2],e[t+2]=M[t+1],e[t+3]=M[t]}P=new w(d)}const O=p(a,"PREDICTOR")??1,b=p(a,"TILEWIDTH"),x=p(a,"TILELENGTH");if(O>1&&(5===I||8===I||32946===I)&&b&&x){const e=D(a),t=new w(P.length);t.set(P),P=W(t,x,b,3===E&&3===O,e?1:u)}return P}async function P(e,t,n){const a=I(n,"TILEOFFSETS");if(void 0===a)return null;const i=I(n,"TILEBYTECOUNTS"),{width:s,height:r,pixelType:l,tileWidth:o,tileHeight:f}=R([n]),u=D(n,t),c=p(n,"SAMPLESPERPIXEL")||t.planes,h=s*r,E=p(n,"BITSPERSAMPLE"),T=34887===(p(n,"COMPRESSION")??1),w=g(l),d=[];for(let g=0;g<c;g++)d.push(new w(h));let S,y,m,A,P,O,b,x,L,U,N,G,k;const F=Math.ceil(s/o);if(E%8==0)if(T&&u&&c>1){const l=Math.round(a.length/c);for(S=0;S<l;S++){O=Math.floor(S/F)*f,b=S%F*o,x=O*s+b;for(let l=0;l<c;l++){const u=S*c+l;if(0!==i[u])for(m=await M(e,t.littleEndian,n,a[u],i[u]),U=0,L=x,G=Math.min(o,s-b),N=Math.min(f,r-O),k=d[l],A=0;A<N;A++)for(L=x+A*s,U=A*o,P=0;P<G;P++,L++,U++)k[L]=m[U]}}}else for(S=0;S<a.length;S++)if(0!==i[S])for(O=Math.floor(S/F)*f,b=S%F*o,x=O*s+b,m=await M(e,t.littleEndian,n,a[S],i[S]),U=0,L=x,G=Math.min(o,s-b),N=Math.min(f,r-O),y=0;y<c;y++)if(k=d[y],u||T)for(A=0;A<N;A++)for(L=x+A*s,U=o*f*y+A*o,P=0;P<G;P++,L++,U++)k[L]=m[U];else for(A=0;A<N;A++)for(L=x+A*s,U=A*o*c+y,P=0;P<G;P++,L++,U+=c)k[L]=m[U];return{width:s,height:r,pixelType:l,pixels:d}}const O=(e,t,n)=>{const a=l===t.littleEndian,s=I(n,"STRIPOFFSETS");if(void 0===s)return null;const{width:r,height:o,pixelType:f}=R([n]),u=p(n,"SAMPLESPERPIXEL")||t.planes,c=p(n,"PHOTOMETRICINTERPRETATION"),h=r*o,E=p(n,"BITSPERSAMPLE"),T=g(f),w=new T(h*u),d=I(n,"STRIPBYTECOUNTS"),S=p(n,"ROWSPERSTRIP"),M=p(n,"COMPRESSION")??1;let P,O,b,x,L,D,U,N,G,k=S;if(E%8==0)for(P=0;P<s.length;P++){if(L=P*(S*r)*u,k=(P+1)*S>o?o-P*S:S,"u8"===f||"s8"===f||a)8===M||32946===M?(U=new Uint8Array(e,s[P],d[P]),U=A(U),D=U.buffer):6===M?(U=new Uint8Array(e,s[P],d[P]),U=m(U,u,c),D=U.buffer):5===M?(U=i(e,s[P],d[P],t.littleEndian),D=U.buffer):(d[P]!==k*r*u*E/8&&console.log("strip byte counts is different than expected"),D=e.slice(s[P],s[P]+d[P])),D=y(D,E),x=new T(D);else{switch(6===M||8===M||32946===M?(U=new Uint8Array(e,s[P],d[P]),N=A(U),D=N.buffer):(d[P]!==k*r*u*E/8&&console.log("strip byte counts is different than expected"),D=new ArrayBuffer(d[P]),U=new Uint8Array(e,s[P],d[P]),N=new Uint8Array(D)),f){case"u16":case"s16":for(b=0;b<U.length;b+=2)N[b]=U[b+1],N[b+1]=U[b];break;case"u32":case"s32":case"f32":for(b=0;b<U.length;b+=4)N[b]=U[b+3],N[b+1]=U[b+2],N[b+2]=U[b+1],N[b+3]=U[b]}D=y(D,E),x=new T(D)}w.set(x,L)}const F=[];if(1===u)F.push(w);else for(P=0;P<u;P++){for(G=new T(h),O=0;O<h;O++)G[O]=w[O*u+P];F.push(G)}return{width:r,height:o,pixelType:f,pixels:F}},b=(e,t,n)=>{if(!(e&&e.length>0&&t&&n))return null;let a,i,s;const r=e[0].length,l=e.length,o=new Uint8Array(r);for(let f=0;f<l;f++)if(a=e[f],i=t[f],s=n[f],0===f)for(let e=0;e<r;e++)o[e]=a[e]<i||a[e]>s?0:1;else for(let e=0;e<r;e++)o[e]&&(o[e]=a[e]<i||a[e]>s?0:1);return o},x=e=>{if(!e)return null;const t=e.match(/<Item(.*?)Item>/gi);if(!t||0===t.length)return null;const n=new Map;let a,i,s,r,l;for(let w=0;w<t.length;w++)a=t[w],i=a.slice(6,a.indexOf(">")),r=a.indexOf("sample="),r>-1&&(l=a.slice(r+8,a.indexOf('"',r+8))),r=a.indexOf("name="),r>-1&&(i=a.slice(r+6,a.indexOf('"',r+6))),i&&(s=a.slice(a.indexOf(">")+1,a.indexOf("</Item>")).trim(),null!=l?n.has(i)?n.get(i)[l]=s:n.set(i,[s]):n.set(i,s)),l=null;const o=n.get("STATISTICS_MINIMUM"),f=n.get("STATISTICS_MAXIMUM"),u=n.get("STATISTICS_MEAN"),c=n.get("STATISTICS_STDDEV");let h=null;if(o&&f){h=[];for(let e=0;e<o.length;e++)h.push({min:parseFloat(o[e]),max:parseFloat(f[e]),avg:u&&parseFloat(u[e]),stddev:c&&parseFloat(c[e])})}const g=n.get("BandName"),E=n.get("WavelengthMin"),T=n.get("WavelengthMax");let I=null;if(g){I=[];for(let e=0;e<g.length;e++)I.push({BandName:g[e],WavelengthMin:E&&parseFloat(E[e]),WavelengthMax:T&&parseFloat(T[e])})}return{statistics:h,bandProperties:I,dataType:n.get("DataType"),rawMetadata:n}};function L(e,t,n,a=0,i=!1,s=4){if(n.values)return!0;const r=n.type,l=n.valueCount;let o=n.valueOffset,c=[];const h=f[r],g=8*h,E=l*h,T=l*f[r]*8;let I,w;const p=8===s?64:32,d=n.valueOffsets;if(T>p){if(E>(i?e.byteLength:e?e.byteLength-o+a:0))return n.offlineOffsetSize=[o,E],n.values=null,!1}if(T<=p){if(!t)if(p<=32)o>>>=32-T;else{const e=d?.length?d[0]:o>>>0,t=d?.length?d[1]:Math.round((o-e)/u);T<=32?(o=e>>>32-T,d[0]=o):(o=e*2**(32-T)+(t>>>32-T),d[0]=e,d[1]=t>>>32-T)}if(1===l&&g===p)c=[o];else if(64===p){const e=d?.length?d[0]:o>>>0,t=d?.length?d[1]:Math.round((o-e)/u);let n=e,a=32;for(w=1;w<=l;w++){const e=32-g*w%32;if(a<g){const i=n<<e>>>32-a,s=t<<32-a>>>32-a;n=t,c.push(i+s*2**(g-a)),a-=32-(g-a)}else c.push(n<<e>>>32-g),a-=g;0===a&&(a=32,n=t)}}else for(w=1;w<=l;w++){const e=32-g*w;c.push(o<<e>>>32-g)}}else{o-=a,i&&(o=0);for(let n=o;n<o+E;n+=h){switch(r){case 1:case 2:case 7:I=new DataView(e,n,1).getUint8(0);break;case 3:I=new DataView(e,n,2).getUint16(0,t);break;case 4:case 13:I=new DataView(e,n,4).getUint32(0,t);break;case 5:I=new DataView(e,n,4).getUint32(0,t)/new DataView(e,n+4,4).getUint32(0,t);break;case 6:I=new DataView(e,n,1).getInt8(0);break;case 8:I=new DataView(e,n,2).getInt16(0,t);break;case 9:I=new DataView(e,n,4).getInt32(0,t);break;case 10:I=new DataView(e,n,4).getInt32(0,t)/new DataView(e,n+4,4).getInt32(0,t);break;case 11:I=new DataView(e,n,4).getFloat32(0,t);break;case 12:I=new DataView(e,n,8).getFloat64(0,t);break;case 16:case 18:I=k(new DataView(e,n,8),0,t);break;case 17:I=F(new DataView(e,n,8),0,t);break;default:I=null}c.push(I)}}if(2===r){let e="";const t=c;for(c=[],w=0;w<t.length;w++)0===t[w]&&""!==e?(c.push(e),e=""):e+=String.fromCharCode(t[w]);""===e&&0!==c.length||c.push(e)}return n.values=c,!0}function R(e){const t=e[0],n=p(t,"TILEWIDTH"),a=p(t,"TILELENGTH"),i=p(t,"IMAGEWIDTH"),s=p(t,"IMAGELENGTH"),r=p(t,"BITSPERSAMPLE"),l=p(t,"SAMPLESPERPIXEL"),o=p(t,"SAMPLEFORMAT")??1,f=h(o,r),u=D(t),g=T(t,"GDAL_NODATA");let d=null;g?.length&&(d=g.map((e=>parseFloat(e))),d.some((e=>isNaN(e)))&&(d=null));const S=p(t,"COMPRESSION")??1;let y;switch(S){case 1:y="NONE";break;case 2:case 3:case 4:case 32771:y="CCITT";break;case 5:y="LZW";break;case 6:case 7:y="JPEG";break;case 32773:y="PACKBITS";break;case 8:case 32946:y="DEFLATE";break;case 34712:y="JPEG2000";break;case 34887:y="LERC";break;default:y=String(S)}let m=!0,A="";c.has(S)||(m=!1,A+="unsupported tag compression "+S),o>3&&(m=!1,A+="unsupported tag sampleFormat "+o),1!==r&&2!==r&&4!==r&&r%8!=0&&(m=!1,A+="unsupported tag bitsPerSample "+r);const M=w(t,"GEOASCIIPARAMS");let P;if(M){const e=M.split("|").find((e=>e.includes("ESRI PE String = "))),t=e?e.replace("ESRI PE String = ",""):"";P=t.startsWith("COMPD_CS")||t.startsWith("PROJCS")||t.startsWith("GEOGCS")?{wkid:null,wkt:t}:null}const O=I(t,"GEOTIEPOINTS"),b=I(t,"GEOPIXELSCALE"),L=I(t,"GEOTRANSMATRIX"),R=t.has("GEOKEYDIRECTORY")?t.get("GEOKEYDIRECTORY").data:null;let G,k,F=!1,C=!1;if(R){F=2===p(R,"GTRasterTypeGeoKey");const e=p(R,"GTModelTypeGeoKey");if(2===e){const e=p(R,"GeographicTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e}),P||32767!==e||(C=!0,P={wkid:4326})}else if(1===e){const e=p(R,"ProjectedCSTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e})}}if(b&&O&&O.length>=6?(G=[b[0],0,O[3]-O[0]*b[0],0,-Math.abs(b[1]),O[4]-O[1]*b[1]],F&&(G[2]-=.5*G[0]+.5*G[1],G[5]-=.5*G[3]+.5*G[4])):L&&16===L.length&&(G=F?[L[0],L[1],L[3]-.5*L[0],L[4],L[5],L[7]-.5*L[5]]:[L[0],L[1],L[3],L[4],L[5],L[7]]),G){const e=[{x:0,y:s},{x:0,y:0},{x:i,y:s},{x:i,y:0}];let t,n=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let i=0;i<e.length;i++)t=E(e[i],G),n=t.x>n?n:t.x,r=t.x<r?r:t.x,a=t.y>a?a:t.y,l=t.y<l?l:t.y;k={xmin:n,xmax:r,ymin:a,ymax:l,spatialReference:P}}else k={xmin:-.5,ymin:.5-s,xmax:i-.5,ymax:.5,spatialReference:P};C&&(k.xmax-k.xmin>400||Math.max(Math.abs(k.xmin),Math.abs(k.xmax))>361)&&(P=null,k.spatialReference=null);const v=U(e);let B,W,H,Y,_;if(v.length>0){H=Math.round(Math.log(i/p(v[0],"IMAGEWIDTH"))/Math.LN2);const e=v[v.length-1];Y=Math.round(Math.log(i/p(e,"IMAGEWIDTH"))/Math.LN2),B=p(e,"TILEWIDTH"),W=p(e,"TILELENGTH")}B=null!=Y&&Y>0?B||n:null,W=null!=Y&&Y>0?W||a:null,n&&(_=[{maxCol:Math.ceil(i/n)-1,maxRow:Math.ceil(s/a)-1,minRow:0,minCol:0}],v.forEach((e=>{_.push({maxCol:Math.ceil(p(e,"IMAGEWIDTH")/p(e,"TILEWIDTH"))-1,maxRow:Math.ceil(p(e,"IMAGELENGTH")/p(e,"TILELENGTH"))-1,minRow:0,minCol:0})})));const K=w(e[0],"GDAL_METADATA"),X=x(K);A+=" "+V({width:i,height:s,tileWidth:n,tileHeight:a,planes:l,ifds:e});return{width:i,height:s,tileWidth:n,tileHeight:a,planes:l,isBSQ:u,pixelType:f,compression:y,noData:d,hasMaskBand:N(e).length===v.length+1,isSupported:m,message:A,extent:k,isPseudoGeographic:C,affine:b?null:G,firstPyramidLevel:H,maximumPyramidLevel:Y,pyramidBlockWidth:B,pyramidBlockHeight:W,tileBoundary:_,metadata:X}}function D(e,t){const n=T(e,"PLANARCONFIGURATION");return n?2===n[0]:!!t&&t.isBSQ}function U(e){return e.filter((e=>1===p(e,"NEWSUBFILETYPE")))}function N(e){return e.filter((e=>{const t=4==(4&(p(e,"NEWSUBFILETYPE")??0)),n=4===p(e,"PHOTOMETRICINTERPRETATION");return t&&n}))}function G(e){const{littleEndian:t,isBigTiff:n,firstIFDPos:a}=v(e);let i=a;const s=[];do{const a=B(e,t,i,0,r.TIFF_TAGS,n?8:4);if(!a.success)break;s.push(a.ifd),i=a.nextIFD}while(i>0);return{...R(s),littleEndian:t,isBigTiff:n,ifds:s,pyramidIFDs:U(s),maskIFDs:N(s)}}function k(e,t,n){const a=e.getUint32(t,n),i=e.getUint32(t+4,n);return n?i*u+a:a*u+i}function F(e,t,n){let a=n?e.getInt32(t,n):e.getUint32(t,n),i=n?e.getUint32(t+4,n):e.getInt32(t+4,n);const s=(n?a:i)>=0?1:-1;n?a*=s:i*=s;return s*(n?i*u+a:a*u+i)}function C(e,t,n,a){return a?k(e,t,n):e.getUint32(t,n)}function v(e){const t=new DataView(e,0,16),n=t.getUint16(0,!1);let a=null;if(18761===n)a=!0;else{if(19789!==n)throw new Error("unexpected endianess byte");a=!1}const i=t.getUint16(2,a);if(42!==i&&43!==i)throw new Error("unexpected tiff identifier");let s=4;const r=43===i;if(r){const e=t.getUint16(s,a);if(s+=2,8!==e)throw new Error("unsupported bigtiff version");if(0!==t.getUint16(s,a))throw new Error("unsupported bigtiff version");s+=2}return{littleEndian:a,isBigTiff:r,firstIFDPos:C(t,s,a,r)}}function B(t,n,a,i=0,s=r.TIFF_TAGS,l=4){const o=d(t,n,a,i,s,l);let f;const u=o.ifd;if(u){if(r.ifdTags.forEach(((e,a)=>{u.has(a)&&(f=u.get(a),f.data=d(t,n,f.valueOffset-i,i,e).ifd)})),u.has("GEOKEYDIRECTORY")){f=u.get("GEOKEYDIRECTORY");const e=f.values;if(e&&e.length>4){const a=e[0]+"."+e[1]+"."+e[2];f.data=d(t,n,f.valueOffset+6-i,i,r.GEO_KEYS,2).ifd,f.data&&f.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[a]})}}if(u.has("XMP")){f=u.get("XMP");const t=f.values;"number"==typeof t[0]&&7===f.type&&(f.values=[e(new Uint8Array(t))])}}return o}function V(e){const{width:t,height:n,tileHeight:a,tileWidth:i}=e,s=e.planes,r=i?i*a:t*n,l=p(e.ifds[0],"BITSPERSAMPLE");let o="";return r*s>2**30/(l>8?l/8:1)&&(o=i?"tiled tiff exceeding 1 gigabits per tile is not supported":"scanline tiff exceeding 1 gigabits is not supported"),o}function W(e,t,n,a,i){const s=a?4:1,r=n*s*i;a&&(e=new Uint8Array(e.buffer));for(let f=0;f<t;f++){const t=f*r;for(let n=i;n<r;n++)e[t+n]+=e[t+n-i]}if(!a)return e;const l=new Uint8Array(e.length),o=n*i;for(let f=0;f<t;f++){const t=f*r;for(let n=0;n<o;n++)for(let a=0;a<s;a++)l[t+n*s+a]=e[t+n+(s-a-1)*o]}return new Float32Array(l.buffer)}async function H(e,t){const{headerInfo:n,ifd:a,offsets:i,sizes:r}=t,l=[];for(let s=0;s<i.length;s++){const t=await M(e,n.littleEndian,a,i[s],r[s]||e.byteLength);l.push(t)}const o=D(a,n),f=p(a,"BITSPERSAMPLE"),u=h(p(a,"SAMPLEFORMAT")??1,f),c=p(a,"SAMPLESPERPIXEL")||n.planes,E=g(u),T=p(a,"TILEWIDTH"),I=p(a,"TILELENGTH"),w=p(a,"COMPRESSION")??1,d=T*I;let S;const y=[];let m=l[0];const A=34887===w;for(let s=0;s<c;s++){if(S=new E(d),l.length===c)m=l[s],m.length===d&&(S=m);else if(m.length)if(o||A)S=m.length===d?m:m.slice(d*s,d*(s+1));else for(let e=0;e<d;e++)S[e]=m[e*c+s];y.push(S)}const P=n.noData?n.noData[0]:t.noDataValue,O=n.metadata?n.metadata.statistics:null,x=O?O.map((e=>e.min)):null,L=O?O.map((e=>e.max)):null,R={pixelType:u,width:T,height:I,pixels:y,noDataValue:P};return null!=P?s(R,P):x&&L&&t.applyMinMaxConstraint&&(R.mask=b(y,x,L)),R}async function Y(e,t={}){const n=t.pyramidLevel||0,a=t.headerInfo||G(e),{ifds:i,noData:r}=a;if(0===i.length)throw new Error("no valid image file directory");const l=V(a);if(l)throw l;let o=null;const f=-1===n?i[i.length-1]:i[n],u=r??t.noDataValue;return o=a.tileWidth?await P(e,a,f):await O(e,a,f),o?(null!=u&&s(o,u),o):o}export{Y as decode,H as decodeTileOrStrip,R as getImageInfo,N as getMaskIFDs,U as getPyramidIFDs,D as isBSQConfig,L as parseFieldValues,G as parseHeader,B as parseIFD,v as parseSignature};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{toRGB as t}from"../../../core/colorUtils.js";import
|
|
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"./AspectFunction.js";import o from"./BandArithmeticFunction.js";import s from"./ColormapFunction.js";import a from"./CompositeBandFunction.js";import i from"./ConvolutionFunction.js";import c from"./CurvatureFunction.js";import u from"./ExtractBandFunction.js";import m from"./LocalFunction.js";import l from"./MaskFunction.js";import p from"./NDVIFunction.js";import f from"./RemapFunction.js";import d from"./SlopeFunction.js";import g from"./StatisticsHistogramFunction.js";import y from"./StretchFunction.js";const b=new Map;function F(t,e,r=["raster"],n=""){b.set(t,{desc:n,ctor:e,rasterArgumentNames:r})}function h(){const t=new Set;return b.forEach(((e,r)=>t.add(r))),t}function j(t,e){const{rasterFunctionArguments:r}=t;if(!r)return;(r.rasters||[r.raster]).forEach((t=>{t&&"number"!=typeof t&&("string"==typeof t?t.startsWith("http")&&(e.includes(t)||e.push(t)):"rasterFunctionArguments"in t&&j(t,e))}))}function A(t,n){if(n=n??{},"function"in(t=r(t))&&"arguments"in t&&t.arguments){const r=D(t,[],n);if(T(r),!r.renderingRule)throw new e("raster-function-helper","Unsupported raster function json.");t=r.renderingRule}if("rasterFunction"in t)return N(t=C(t),n);throw new e("raster-function-helper","unsupported raster function json.")}function _(t,e){return"rasters"===e[0]&&Array.isArray(t.rasters)?t.rasters:e.map((e=>t[e]))}function R(t){return!!(t&&"object"==typeof t&&t.rasterFunction&&t.rasterFunctionArguments)}function C(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=>R(t)?C(t):t));else switch(R(t)&&(t=C(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 N(t,r){const{rasterFunction:n,rasterFunctionArguments:o}=t,s=t.outputPixelType?.toLowerCase();if(null==n||!b.has(n))throw new e("raster-function-helper",`unsupported raster function: ${n}`);const a=b.get(n),i=("function"==typeof a.ctor?a.ctor:a.ctor.default).fromJSON({...t,outputPixelType:s}),{rasterArgumentNames:c}=i,u=[],m=_(o,c),l="rasters"===c[0],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=N(t,r),l||(i.functionArguments[c[e]]=n),u.push(n)),l&&p.push(n??t)}if(l&&(i.functionArguments.rasters=p),r){i.sourceRasters=u;const t=r.raster?.url;t&&(i.mainPrimaryRasterId=t)}return i}function S(t,e){if(t&&e)for(const r in t){const n=t[r];n&&"object"==typeof n&&"type"in n&&("RasterFunctionTemplate"===n.type?S(n.arguments,e):"RasterFunctionVariable"===n.type&&null!=e[n.name]&&(n.value=e[n.name]))}}function w(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?null:n.map((t=>"object"==typeof t&&"RasterFunctionVariable"===t.type?w(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;switch(n.type){case"RasterStatistics":case"RecordSet":default:return n;case"Scalar":return n.value;case"AlgorithmicColorRamp":return v(n);case"MultiPartColorRamp":return{type:"multipart",colorRamps:n.ArrayOfColorRamp.map(v)};case"ArgumentArray":{if(!n.elements?.length)return n.elements;if("RasterStatistics"===n.elements[0].type)return n.elements;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}=D(s,r);t.push(e),s._object_id&&e&&(r[s._object_id]=e)}else{if("RasterFunctionVariable"!==a)throw new e("raster-function-helper","unsupported raster function json.");{const e=w(s,r);t.push(e),s._object_id&&(r[s._object_id]=e)}}else t.push(s)}return t}}}function v(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 D(t,e=[],r){r&&S(t,r);const n={renderingRule:{},templates:e};return V(t,n),n}function V(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;a&&(n[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]=w(t,n):(r.rasterFunctionArguments[c]={},V(t,{renderingRule:r.rasterFunctionArguments[c],templates:n})),null==t._object_id||n[t._object_id]||(n[t._object_id]=(t.type,i[c])))}switch(i.DEM&&!i.Raster&&(i.Raster=i.DEM,delete i.DEM),r.rasterFunction){case"Stretch":x(i);break;case"Colormap":k(i);break;case"Convolution":$(i);break;case"Mask":E(i)}}function T(t){const{renderingRule:r,templates:n}=t;if("object"!=typeof r||!r?.rasterFunctionArguments||!n.length)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&&T({renderingRule:t,templates:n}),Array.isArray(t)&&t.forEach(((r,o)=>{if("object"==typeof r)if(null!=r._object_ref_id){const s=n[r._object_ref_id];if(null==s)throw new e("raster-function-helper",`unsupported raster function json. _object_ref_id: ${t} does not exist`);"object"==typeof s?Object.assign(r,s):t[o]=s}else T({renderingRule:r,templates:n})})));else{const t=n[r];if(!t)throw new e("raster-function-helper",`unsupported raster function json. _object_ref_id: ${r} does not exist`);if("object"!=typeof t)throw new e("raster-function-helper",`unsupported raster function json. _object_ref_id: ${r} does not exist`);Object.assign(o,t)}}}function x(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 k(t){"randomcolorramp"===t.ColorRamp?.type?.toLowerCase()&&(delete t.ColorRamp,t.ColormapName="Random"),0===t.ColorSchemeType&&delete t.ColorRamp}function $(t){null!=t.ConvolutionType&&(t.Type=t.ConvolutionType,delete t.ConvolutionType)}function E(t){t.NoDataValues?.length&&"string"==typeof t.NoDataValues[0]&&(t.NoDataValues=t.NoDataValues.filter((t=>""!==t)).map((t=>Number(t))))}b.set("Aspect",{desc:"Aspect Function",ctor:n,rasterArgumentNames:["raster"]}),b.set("BandArithmetic",{desc:"Band Arithmetic Function",ctor:o,rasterArgumentNames:["raster"]}),b.set("Colormap",{desc:"Colormap Function",ctor:s,rasterArgumentNames:["raster"]}),b.set("CompositeBand",{desc:"CompositeBand Function",ctor:a,rasterArgumentNames:["rasters"]}),b.set("Convolution",{desc:"Convolution Function",ctor:i,rasterArgumentNames:["raster"]}),b.set("ExtractBand",{desc:"ExtractBand Function",ctor:u,rasterArgumentNames:["raster"]}),b.set("Curvature",{desc:"Curvature Function",ctor:c,rasterArgumentNames:["raster"]}),b.set("Local",{desc:"Local Function",ctor:m,rasterArgumentNames:["rasters"]}),b.set("Mask",{desc:"Mask Function",ctor:l,rasterArgumentNames:["raster"]}),b.set("NDVI",{desc:"NDVI Function",ctor:p,rasterArgumentNames:["raster"]}),b.set("Remap",{desc:"Remap Function",ctor:f,rasterArgumentNames:["raster"]}),b.set("Slope",{desc:"Slope Function",ctor:d,rasterArgumentNames:["raster"]}),b.set("StatisticsHistogram",{desc:"Statistics Histogram Function",ctor:g,rasterArgumentNames:["raster"]}),b.set("Stretch",{desc:"Stretch Function",ctor:y,rasterArgumentNames:["raster"]});export{A as create,j as getPrimaryRasterUrls,_ as getRasterValues,h as getSupportedFunctions,F as register};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "4.27.0-next.
|
|
3
|
+
"version": "4.27.0-next.20230518",
|
|
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": [
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@esri/calcite-colors": "~6.1.0",
|
|
30
30
|
"@esri/calcite-components": "^1.3.1",
|
|
31
31
|
"@popperjs/core": "~2.11.7",
|
|
32
|
-
"focus-trap": "~7.4.
|
|
32
|
+
"focus-trap": "~7.4.2",
|
|
33
33
|
"luxon": "~3.3.0",
|
|
34
34
|
"sortablejs": "~1.15.0"
|
|
35
35
|
},
|
package/popup/FieldInfo.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../chunks/tslib.es6.js";import{JSONMap as o}from"../core/jsonMap.js";import{JSONSupport as e}from"../core/JSONSupport.js";import{clone as i}from"../core/lang.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{enumeration as s}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import l from"./support/FieldInfoFormat.js";var a;let n=a=class extends e{constructor(t){super(t),this.fieldName=null,this.format=null,this.isEditable=!
|
|
5
|
+
import{_ as t}from"../chunks/tslib.es6.js";import{JSONMap as o}from"../core/jsonMap.js";import{JSONSupport as e}from"../core/JSONSupport.js";import{clone as i}from"../core/lang.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{enumeration as s}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import l from"./support/FieldInfoFormat.js";var a;let n=a=class extends e{constructor(t){super(t),this.fieldName=null,this.format=null,this.isEditable=!0,this.label=null,this.stringFieldOption="text-box",this.statisticType=null,this.tooltip=null,this.visible=!0}clone(){return new a({fieldName:this.fieldName,format:this.format?i(this.format):null,isEditable:this.isEditable,label:this.label,stringFieldOption:this.stringFieldOption,statisticType:this.statisticType,tooltip:this.tooltip,visible:this.visible})}};t([r({type:String,json:{write:!0}})],n.prototype,"fieldName",void 0),t([r({type:l,json:{write:!0}})],n.prototype,"format",void 0),t([r({type:Boolean,json:{write:!0,default:!0}})],n.prototype,"isEditable",void 0),t([r({type:String,json:{write:!0}})],n.prototype,"label",void 0),t([s(new o({richtext:"rich-text",textarea:"text-area",textbox:"text-box"}),{default:"text-box"})],n.prototype,"stringFieldOption",void 0),t([r({type:["count","sum","min","max","avg","stddev","var"],json:{write:!0}})],n.prototype,"statisticType",void 0),t([r({type:String,json:{write:!0}})],n.prototype,"tooltip",void 0),t([r({type:Boolean,json:{write:!0}})],n.prototype,"visible",void 0),n=a=t([p("esri.popup.FieldInfo")],n);const c=n;export{c as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import{ClonableMixin as r}from"../../core/Clonable.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import{Integer as s}from"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{enumeration as i}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{formatDate as m,convertDateFormatToIntlOptions as p,utcTimeZone as n,formatDateOnly as u,formatTimeOnly as c,formatTimestamp as d,systemTimeZone as l,dateFormatJSONMap as f}from"../../intl/date.js";import{formatNumber as h,convertNumberFormatToIntlOptions as j}from"../../intl/number.js";let S=class extends(r(o)){constructor(t){super(t),this.dateFormat=null,this.digitSeparator=!1,this.places=null}formatNumber(t){return h(t,j(this))}formatDate(t,r=!1){return this.dateFormat?m(t,{...p(this.dateFormat),...r&&n}):this.formatNumber(t)}formatDateOnly(t){const r=(this.dateFormat&&p(this.dateFormat))??void 0;return u(t,r)}formatTimeOnly(t){const r=(this.dateFormat&&p(this.dateFormat))??void 0;return c(t,r)}formatTimestamp(t){return d(t,{...p(this.dateFormat??"short-date-short-time"),...l})}formatRasterPixelValue(t){return t.includes("-")?t:t.trim().includes(",")?this._formatDelimitedString(t,",",", "):t.trim().includes(";")?this._formatDelimitedString(t,";","; "):t.trim().includes(" ")?this._formatDelimitedString(t," "," "):this.formatNumber(Number(t))}_formatDelimitedString(t,r,o){return t&&r&&o?t.trim().split(r).map((t=>this.formatNumber(Number(t)))).join(o):t}};t([i(f)],S.prototype,"dateFormat",void 0),t([e({type:Boolean,json:{write:!0}})],S.prototype,"digitSeparator",void 0),t([e({type:s,json:{write:!0}})],S.prototype,"places",void 0),S=t([a("esri.popup.support.FieldInfoFormat")],S);const F=S;export{F as default};
|