@arcgis/core 4.25.0-next.20220718 → 4.25.0-next.20220721
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/Camera.js +1 -1
- package/analysis/DimensioningAnalysis.js +1 -1
- package/analysis/LineOfSightAnalysis.js +1 -1
- package/analysis/SliceAnalysis.js +1 -1
- package/arcade/featureset/support/RecentlyUsedCache.js +1 -1
- package/arcade/functions/featuresetgeom.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/1751de504354d98ac3fd.js +1 -0
- package/assets/esri/core/workers/chunks/1f4f1896880bfa6801c5.js +1 -0
- package/assets/esri/core/workers/chunks/290cd411d0d18b1d0efd.js +1 -0
- package/assets/esri/core/workers/chunks/{ab3bd5fecdb97f2d690e.js → 3b5be512567d9c1c6fe6.js} +1 -1
- package/assets/esri/core/workers/chunks/{c3236a7058e64ea3b939.js → 3c9da9b88777700879aa.js} +1 -1
- package/assets/esri/core/workers/chunks/{f96e8724ae3458f5e262.js → 4a7aa1b9de61eb013647.js} +1 -1
- package/assets/esri/core/workers/chunks/4cb64ccb5fba126f9a66.js +1 -0
- package/assets/esri/core/workers/chunks/{68f19e58aae01791944e.js → 579ba109718bc2554008.js} +1 -1
- package/assets/esri/core/workers/chunks/59845b02b07a8ed7ce81.js +1 -0
- package/assets/esri/core/workers/chunks/{c705f907ce60a646d9aa.js → 652d36523efbe5c9ebb2.js} +1 -1
- package/assets/esri/core/workers/chunks/888d8e4471c9a2cd5009.js +1 -0
- package/assets/esri/core/workers/chunks/9493a8e5d6001b6bf275.js +1 -0
- package/assets/esri/core/workers/chunks/9d824cdfbcdf3cb3246f.js +1 -0
- package/assets/esri/core/workers/chunks/bf348f6f52701fa6016e.js +987 -0
- package/assets/esri/core/workers/chunks/d02881954c0cc0d39dfb.js +1 -0
- package/assets/esri/core/workers/chunks/{1ecbf642debc2207b762.js → da54483123f377e9b3e1.js} +1 -1
- package/assets/esri/core/workers/chunks/{61b71b8e028eda10ccab.js → e4ad2cf5d6bded02e392.js} +1 -1
- package/assets/esri/core/workers/chunks/{3bfab05ae07ac18a75fe.js → f298a70f3b6f27675d53.js} +1 -1
- package/assets/esri/core/workers/chunks/{d499cce61c1c5c367380.js → f40290cfad3fe6fb4ef9.js} +1 -1
- package/assets/esri/layers/support/rasterFormats/lerc-wasm.wasm +0 -0
- package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -1
- 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/chunks/ComponentShader.glsl.js +39 -33
- package/chunks/Laserlines.glsl.js +4 -4
- package/chunks/Precipitation.glsl.js +2 -2
- package/chunks/RibbonLine.glsl.js +46 -44
- package/chunks/Stars.glsl.js +2 -2
- package/chunks/Terrain.glsl.js +25 -17
- package/chunks/boundedPlane.js +1 -1
- package/chunks/lerc-wasm.js +1 -1
- package/chunks/mat2d.js +1 -1
- package/chunks/quatf32.js +1 -1
- package/core/BidiEngine.js +1 -1
- package/core/accessorSupport/watch.js +1 -1
- package/core/libs/gl-matrix-2/factories/quatf32.js +1 -1
- package/core/libs/gl-matrix-2/math/mat2d.js +1 -1
- package/core/perspectiveUtils.js +1 -1
- package/core/promiseUtils.js +1 -1
- package/core/reactiveUtils.js +1 -1
- package/core/unitUtils.js +1 -1
- package/geometry/projection.js +1 -1
- package/geometry/projectionEllipsoid.js +1 -1
- package/geometry/support/MeshTexture.js +1 -1
- package/geometry/support/axisAngleDegrees.js +1 -1
- package/geometry/support/coordinateSystem.js +1 -1
- package/geometry/support/geodesicUtils.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/index.js +1 -1
- package/geometry/support/meshUtils/loadExternal.js +1 -1
- package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
- package/geometry/support/scaleUtils.js +1 -1
- package/geometry/support/spatialReferenceUtils.js +1 -1
- package/identity/IdentityManagerBase.js +1 -1
- package/identity/IdentityModal.js +1 -1
- package/interfaces.d.ts +3 -33
- package/layers/FeatureLayer.js +1 -1
- package/layers/effects/parser.js +1 -1
- package/layers/graphics/hydratedFeatures.js +1 -1
- package/layers/graphics/sources/support/sourceUtils.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/ogc/wfsUtils.js +1 -1
- package/layers/support/ContingentValue.js +1 -1
- package/layers/support/ElevationQuery.js +1 -1
- package/layers/support/PixelBlock.js +1 -1
- package/layers/support/kmlUtils.js +1 -1
- package/layers/support/rasterDatasets/CloudRaster.js +1 -1
- package/layers/support/rasterDatasets/EphemeralBlockCache.js +1 -1
- package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
- package/layers/support/rasterDatasets/multipartParser.js +1 -1
- package/layers/support/rasterFormats/ImageCanvasDecoder.js +1 -1
- package/layers/support/rasterFormats/JpgPlus.js +1 -1
- package/layers/support/rasterFormats/Lerc.js +1 -1
- package/layers/support/rasterFormats/RasterCodec.js +1 -1
- package/layers/support/rasterFormats/Raw.js +1 -1
- package/layers/support/rasterFormats/TiffTags.js +1 -1
- package/layers/support/rasterFunctions/vectorFieldUtils.js +1 -1
- package/layers/support/vectorTileLayerLoader.js +1 -1
- package/layers/support/wmtsUtils.js +1 -1
- package/package.json +1 -1
- package/renderers/RasterShadedReliefRenderer.js +1 -1
- package/renderers/RasterStretchRenderer.js +1 -1
- package/renderers/UniqueValueRenderer.js +1 -1
- package/renderers/support/AuthoringInfo.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/query/operations/queryTopFeatures.js +1 -1
- package/rest/support/DirectionsFeatureSet.js +1 -1
- package/rest/support/ImageHistogramParameters.js +1 -1
- package/rest/support/ImageSampleParameters.js +1 -1
- package/smartMapping/labels/clusters.js +1 -1
- package/smartMapping/renderers/relationship.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/support/basemapUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/LabelSymbol3D.js +1 -1
- package/symbols/PointSymbol3D.js +1 -1
- package/symbols/cim/CIMCursor.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/CIMSymbolRasterizer.js +1 -1
- package/symbols/support/previewSymbol3D.js +1 -1
- package/symbols/support/webStyleSymbolUtils.js +1 -1
- package/views/2d/ViewState.js +1 -1
- package/views/2d/engine/vectorTiles/Feature.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
- package/views/2d/engine/webgl/SDFConverter.js +1 -1
- package/views/2d/engine/webgl/TurboLine.js +1 -1
- package/views/2d/engine/webgl/brushes/BrushClip.js +1 -1
- package/views/2d/engine/webgl/brushes/BrushOverlay.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushLabel.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushLine.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushText.js +1 -1
- package/views/2d/engine/webgl/collisions/MetricReader.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/DisplayRecordReader.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/FreeList.js +1 -1
- package/views/2d/engine/webgl/mesh/heuristics.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicFillTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicLineTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicMarkerTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicTextTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLFillTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLLineTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLMarkerTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/input/MapViewInputManager.js +1 -1
- package/views/2d/layers/features/createSymbolSchema.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightVisualization.js +1 -1
- package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/camera/constraintUtils/distance.js +1 -1
- package/views/3d/environment/ChapmanAtmosphereTechniqueConfiguration.js +1 -1
- package/views/3d/environment/CloudsComposition.js +1 -1
- package/views/3d/environment/FogTechnique.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/lineUtils.js +1 -1
- package/views/3d/layers/i3s/I3SGeometryUtil.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/IDBCache.js +1 -1
- package/views/3d/layers/i3s/IDBMockCache.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/Overlay.js +1 -1
- package/views/3d/terrain/OverlayRenderTarget.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TilingSchemeLogic.js +1 -1
- package/views/3d/terrain/interfaces.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/collections/Component/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +9 -0
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +18 -17
- package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/ObjectAndLayerIdRenderHelper.js +5 -0
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/RenderInstanceData.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/LaserlinePathTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/MapView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/View.js +1 -1
- package/views/analysis/analysisViewUtils.js +1 -1
- package/views/animation/pointToPoint/apex/planning.js +1 -1
- package/views/draw/PolygonDrawAction.js +1 -1
- package/views/draw/PolylineDrawAction.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/draw/support/surfaceCoordinateSystems.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/input/handlers/LatestPointer.js +1 -1
- package/views/input/handlers/MultiTouch.js +5 -0
- package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileCache.js +1 -1
- package/views/interactive/tooltip/Tooltip.js +1 -1
- package/views/interactive/tooltip/support/measurements.js +1 -1
- package/views/layers/GroupLayerView.js +1 -1
- package/views/navigation/FilteredFiniteDifference.js +1 -1
- package/views/navigation/MomentumEstimator.js +1 -1
- package/views/navigation/PanPlanarMomentumEstimator.js +1 -1
- package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
- package/views/navigation/RotationMomentumEstimator.js +1 -1
- package/views/support/GroundViewElevationSampler.js +1 -1
- package/views/support/euclideanAreaMeasurementUtils.js +1 -1
- package/views/support/euclideanLengthMeasurementUtils.js +1 -1
- package/views/support/screenshotUtils.js +1 -1
- package/views/webgl/BufferObject.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/capabilities/Capabilities.js +1 -1
- package/views/webgl/capabilities.js +1 -1
- package/views/webgl/renderState.js +1 -1
- package/webscene/spec-certification/api.js +1 -1
- package/widgets/CoordinateConversion/support/formatUtils.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineInput.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/Legend/support/sizeRampUtils.js +1 -1
- package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
- package/widgets/Popup/PopupViewModel.js +1 -1
- package/widgets/Popup/actionUtils.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Slider/SliderViewModel.js +1 -1
- package/widgets/Widget.js +1 -1
- package/assets/esri/core/workers/chunks/04ea469cb081e181ca82.js +0 -1
- package/assets/esri/core/workers/chunks/16c2626ca47132700519.js +0 -1
- package/assets/esri/core/workers/chunks/1e4e5d147263e98536bc.js +0 -1
- package/assets/esri/core/workers/chunks/35083def3c658d1ae9ff.js +0 -1
- package/assets/esri/core/workers/chunks/40032d2bf404a46b8f80.js +0 -1
- package/assets/esri/core/workers/chunks/613e82a3e13442685ac4.js +0 -1
- package/assets/esri/core/workers/chunks/64b4f1dbf61439cde801.js +0 -1
- package/assets/esri/core/workers/chunks/abd68b7ba3be4696611c.js +0 -1
- package/assets/esri/core/workers/chunks/b8a062c0c9c626acf61e.js +0 -982
- package/assets/esri/core/workers/chunks/e08686088be0aaca1a99.js +0 -1
package/layers/ogc/wfsUtils.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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../geometry.js";import e from"../../request.js";import t from"../../core/Error.js";import{find as r,cache as n}from"../../core/iteratorUtils.js";import{isNone as a,isSome as o}from"../../core/maybe.js";import{eachAlways as s}from"../../core/promiseUtils.js";import{isHTTPSProtocol as i,hasSameOrigin as p,toHTTPS as u}from"../../core/urlUtils.js";import{initializeProjection as c,project as l}from"../../geometry/projection.js";import{WGS84 as m,equals as y}from"../../geometry/support/spatialReferenceUtils.js";import{featureGeometryTypeKebabDictionary as f}from"../../geometry/support/typeUtils.js";import{getGeometryType as d}from"../graphics/sources/geojson/geojson.js";import{parseDate as g}from"./dateUtils.js";import{iterateXML as w,visitXML as b}from"./xmlUtils.js";import h from"../support/Field.js";import T from"../../geometry/SpatialReference.js";import F from"../../geometry/Extent.js";const S="xlink:href",x="2.0.0",C="__esri_wfs_id__",E="wfs-layer:getWFSLayerTypeInfo-error",N="wfs-layer:empty-service",P="wfs-layer:feature-type-not-found",R="wfs-layer:geojson-not-supported",j="wfs-layer:kvp-encoding-not-supported",A="wfs-layer:malformed-json",G="wfs-layer:unknown-geometry-type",k="wfs-layer:unknown-field-type",v="wfs-layer:unsupported-spatial-reference",U="wfs-layer:unsupported-wfs-version";async function D(t,r){const n=I((await e(t,{responseType:"text",query:{SERVICE:"WFS",REQUEST:"GetCapabilities",VERSION:x,...r?.customParameters},signal:r?.signal})).data);return $(t,n),n}function I(e){const t=te(e);ne(t),ae(t);const r=t.firstElementChild,a=n(M(r));return{operations:L(r),get featureTypes(){return Array.from(a())},readFeatureTypes:a}}const O=new Set(["json","application/json","geojson","application/json; subtype=geojson"]);function L(e){let r=!1;const n={GetCapabilities:{url:""},DescribeFeatureType:{url:""},GetFeature:{url:"",outputFormat:null,supportsPagination:!1}};if(b(e,{OperationsMetadata:{Operation:e=>{switch(e.getAttribute("name")){case"GetCapabilities":return{DCP:{HTTP:{Get:e=>{n.GetCapabilities.url=e.getAttribute(S)}}}};case"DescribeFeatureType":return{DCP:{HTTP:{Get:e=>{n.DescribeFeatureType.url=e.getAttribute(S)}}}};case"GetFeature":return{DCP:{HTTP:{Get:e=>{n.GetFeature.url=e.getAttribute(S)}}},Parameter:e=>{if("outputFormat"===e.getAttribute("name"))return{AllowedValues:{Value:e=>{const t=e.textContent;O.has(t.toLowerCase())&&(n.GetFeature.outputFormat=t)}}}}}}},Constraint:e=>{switch(e.getAttribute("name")){case"KVPEncoding":return{DefaultValue:e=>{r="true"===e.textContent.toLowerCase()}};case"ImplementsResultPaging":return{DefaultValue:e=>{n.GetFeature.supportsPagination="true"===e.textContent.toLowerCase()}}}}}}),!r)throw new t(j,"WFS service doesn't support key/value pair (KVP) encoding");if(a(n.GetFeature.outputFormat))throw new t(R,"WFS service doesn't support GeoJSON output format");return n}function $(e,t){i(e)&&(p(e,t.operations.DescribeFeatureType.url,!0)&&(t.operations.DescribeFeatureType.url=u(t.operations.DescribeFeatureType.url)),p(e,t.operations.GetFeature.url,!0)&&(t.operations.GetFeature.url=u(t.operations.GetFeature.url)))}function M(e){return w(e,{FeatureTypeList:{FeatureType:e=>{const t={typeName:"undefined:undefined",name:"",title:"",description:"",extent:null,namespacePrefix:"",namespaceUri:"",supportedSpatialReferences:[]},r=new Set([4326]),n=e=>{const t=parseInt(e.textContent.match(/(?<wkid>\d+$)/i)?.groups?.wkid,10);Number.isNaN(t)||r.add(t)};return b(e,{Name:e=>{const{name:r,prefix:n}=re(e.textContent);t.typeName=`${n}:${r}`,t.name=r,t.namespacePrefix=n,t.namespaceUri=e.lookupNamespaceURI(n)},Abstract:e=>{t.description=e.textContent},Title:e=>{t.title=e.textContent},WGS84BoundingBox:e=>{t.extent=V(e)},DefaultSRS:n,DefaultCRS:n,OtherSRS:n,OtherCRS:n}),t.title||(t.title=t.name),t.supportedSpatialReferences.push(...r),t}}})}function V(e){let t,r,n,a;for(const o of e.children)switch(o.localName){case"LowerCorner":[t,r]=o.textContent.split(" ").map((e=>Number.parseFloat(e)));break;case"UpperCorner":[n,a]=o.textContent.split(" ").map((e=>Number.parseFloat(e)))}return{xmin:t,ymin:r,xmax:n,ymax:a,spatialReference:m}}function W(e,t,n){return r(e,(e=>n?e.name===t&&e.namespaceUri===n:e.typeName===t||e.name===t))}async function X(e,t,r,n={}){const{featureType:a,extent:o}=await Y(e,t,r,n),{fields:s,geometryType:i,swapXY:p,objectIdField:u,geometryField:c}=await q(e,a.typeName,n);return{url:e.operations.GetCapabilities.url,name:a.name,namespaceUri:a.namespaceUri,fields:s,geometryField:c,geometryType:i,objectIdField:u,spatialReference:n.spatialReference??T.WGS84,extent:o,swapXY:p,wfsCapabilities:e,customParameters:n.customParameters}}async function Y(e,r,n,o={}){const{spatialReference:s=T.WGS84}=o,i=e.readFeatureTypes(),p=r?W(i,r,n):i.next().value;if(a(p))throw r?new t(P,`The type '${r}' could not be found in the service`):new t(N,"The service is empty");let u=new F({...p.extent,spatialReference:s});if(!y(s,m))try{await c(m,s,void 0,o),u=l(u,m)}catch{throw new t(v,"Projection not supported")}return{extent:u,spatialReference:s,featureType:p}}async function q(e,r,n={}){const[o,i]=await s([J(e.operations.DescribeFeatureType.url,r,n),_(e,r,n)]);if(o.error||i.error)throw new t(E,`An error occurred while getting info about the feature type '${r}'`,{error:o.error||i.error});const{fields:p,errors:u}=o.value,c=o.value.geometryType||i.value.geometryType,l=i.value.swapXY;if(a(c))throw new t(G,`The geometry type could not be determined for type '${r}`,{typeName:r,geometryType:c,fields:p,errors:u});return{...z(p),geometryType:c,swapXY:l}}function z(e){const t=e.find((e=>"geometry"===e.type));let r=e.find((e=>"oid"===e.type));return e=e.filter((e=>"geometry"!==e.type)),r||(r=new h({name:C,type:"oid",alias:C}),e.unshift(r)),{geometryField:t?.name??null,objectIdField:r.name,fields:e}}async function _(t,r,n={}){let a,o=!1;const[s,i]=await Promise.all([K(t.operations.GetFeature.url,r,t.operations.GetFeature.outputFormat,{...n,count:1}),e(t.operations.GetFeature.url,{responseType:"text",query:Z(r,void 0,{...n,count:1}),signal:n?.signal})]),p="FeatureCollection"===s.type&&s.features[0]?.geometry;if(p){let e;switch(a=f.fromJSON(d(p.type)),p.type){case"Point":e=p.coordinates;break;case"LineString":case"MultiPoint":e=p.coordinates[0];break;case"MultiLineString":case"Polygon":e=p.coordinates[0][0];break;case"MultiPolygon":e=p.coordinates[0][0][0]}const t=/<[^>]*pos[^>]*> *(-?\d+(?:\.\d+)?) (-?\d+(?:\.\d+)?)/.exec(i.data);if(t){const r=e[0].toFixed(3),n=e[1].toFixed(3),a=parseFloat(t[1]).toFixed(3);r===parseFloat(t[2]).toFixed(3)&&n===a&&(o=!0)}}return{geometryType:a,swapXY:o}}async function J(t,r,n){return Q(r,(await e(t,{responseType:"text",query:{SERVICE:"WFS",REQUEST:"DescribeFeatureType",VERSION:x,TYPENAME:r,...n?.customParameters},signal:n?.signal})).data)}function Q(e,n){const{name:a}=re(e),s=te(n);ae(s);const i=r(w(s.firstElementChild,{element:e=>({name:e.getAttribute("name"),typeName:re(e.getAttribute("type")).name})}),(({name:e})=>e===a));if(o(i)){const e=r(w(s.firstElementChild,{complexType:e=>e}),(e=>e.getAttribute("name")===i.typeName));if(o(e))return B(e)}throw new t(P,`Type '${e}' not found in document`,{document:(new XMLSerializer).serializeToString(s)})}const H=new Set(["objectid","fid"]);function B(e){const r=[],n=[];let a;const o=w(e,{complexContent:{extension:{sequence:{element:e=>e}}}});for(const s of o){const o=s.getAttribute("name");if(!o)continue;let i,p;if(s.hasAttribute("type")?i=re(s.getAttribute("type")).name:b(s,{simpleType:{restriction:e=>(i=re(e.getAttribute("base")).name,{maxLength:e=>{p=+e.getAttribute("value")}})}}),!i)continue;const u="true"===s.getAttribute("nillable");let c=!1;switch(i.toLowerCase()){case"integer":case"nonpositiveinteger":case"negativeinteger":case"long":case"int":case"short":case"byte":case"nonnegativeinteger":case"unsignedlong":case"unsignedint":case"unsignedshort":case"unsignedbyte":case"positiveinteger":n.push(new h({name:o,alias:o,type:"integer",nullable:u}));break;case"float":case"double":case"decimal":n.push(new h({name:o,alias:o,type:"double",nullable:u}));break;case"boolean":case"string":case"gyearmonth":case"gyear":case"gmonthday":case"gday":case"gmonth":case"anyuri":case"qname":case"notation":case"normalizedstring":case"token":case"language":case"idrefs":case"entities":case"nmtoken":case"nmtokens":case"name":case"ncname":case"id":case"idref":case"entity":case"duration":case"time":n.push(new h({name:o,alias:o,type:"string",nullable:u,length:p??255}));break;case"datetime":case"date":n.push(new h({name:o,alias:o,type:"date",nullable:u,length:p??36}));break;case"pointpropertytype":a="point",c=!0;break;case"multipointpropertytype":a="multipoint",c=!0;break;case"curvepropertytype":case"multicurvepropertytype":case"multilinestringpropertytype":a="polyline",c=!0;break;case"surfacepropertytype":case"multisurfacepropertytype":case"multipolygonpropertytype":a="polygon",c=!0;break;case"geometrypropertytype":case"multigeometrypropertytype":c=!0,r.push(new t(G,`geometry type '${i}' is not supported`,{type:(new XMLSerializer).serializeToString(e)}));break;default:r.push(new t(k,`Unknown field type '${i}'`,{type:(new XMLSerializer).serializeToString(e)}))}c&&n.push(new h({name:o,alias:o,type:"geometry",nullable:u}))}for(const t of n)if("integer"===t.type&&!t.nullable&&H.has(t.name.toLowerCase())){t.type="oid";break}return{geometryType:a,fields:n,errors:r}}async function K(r,n,a,o){let{data:s}=await e(r,{responseType:"text",query:Z(n,a,o),signal:o?.signal});s=s.replace(/": +(-?\d+),(\d+)(,)?/g,'": $1.$2$3');try{if(o?.dateFields?.length){const e=new Set(o.dateFields);return JSON.parse(s,((t,r)=>e.has(t)?g(r):r))}return JSON.parse(s)}catch(i){throw new t(A,"Error while parsing the response",{response:s,error:i})}}function Z(e,t,r){return{SERVICE:"WFS",REQUEST:"GetFeature",VERSION:x,TYPENAMES:e,OUTPUTFORMAT:t,SRSNAME:"EPSG:4326",STARTINDEX:r?.startIndex,COUNT:r?.count,...r?.customParameters}}async function ee(t,r,n){const a=te((await e(t,{responseType:"text",query:{SERVICE:"WFS",REQUEST:"GetFeature",VERSION:x,TYPENAMES:r,RESULTTYPE:"hits",...n?.customParameters},signal:n?.signal})).data);ae(a);const o=Number.parseFloat(a.firstElementChild.getAttribute("numberMatched"));return Number.isNaN(o)?0:o}function te(e){return(new DOMParser).parseFromString(e.trim(),"text/xml")}function re(e){const[t,r]=e.split(":");return{prefix:r?t:"",name:r??t}}function ne(e){const r=e.firstElementChild.getAttribute("version");if(r&&r!==x)throw new t(U,`Unsupported WFS version ${r}. Supported version: ${x}`)}function ae(e){let r,n;if(b(e.firstElementChild,{Exception:e=>(r=e.getAttribute("exceptionCode"),{ExceptionText:e=>{n=e.textContent}})}),r)throw new t(`wfs-layer:${r}`,n)}export{C as WFS_OID_FIELD_NAME,J as describeFeatureType,W as findFeatureType,D as getCapabilities,K as getFeature,ee as getFeatureCount,Y as getFeatureTypeInfo,X as getWFSLayerInfo,Q as parseDescribeFeatureTypeResponse,I as parseGetCapabilitiesResponse,z as prepareWFSLayerFields};
|
|
5
|
+
import"../../geometry.js";import e from"../../request.js";import t from"../../core/Error.js";import{cache as r,find as n}from"../../core/iteratorUtils.js";import{isNone as a,isSome as o}from"../../core/maybe.js";import{eachAlways as s}from"../../core/promiseUtils.js";import{isHTTPSProtocol as i,hasSameOrigin as p,toHTTPS as u}from"../../core/urlUtils.js";import{initializeProjection as c,project as l}from"../../geometry/projection.js";import{WGS84 as m,equals as y}from"../../geometry/support/spatialReferenceUtils.js";import{featureGeometryTypeKebabDictionary as f}from"../../geometry/support/typeUtils.js";import{getGeometryType as d}from"../graphics/sources/geojson/geojson.js";import{parseDate as g}from"./dateUtils.js";import{visitXML as w,iterateXML as b}from"./xmlUtils.js";import h from"../support/Field.js";import T from"../../geometry/SpatialReference.js";import F from"../../geometry/Extent.js";const S="xlink:href",x="2.0.0",C="__esri_wfs_id__",E="wfs-layer:getWFSLayerTypeInfo-error",N="wfs-layer:empty-service",P="wfs-layer:feature-type-not-found",R="wfs-layer:geojson-not-supported",j="wfs-layer:kvp-encoding-not-supported",A="wfs-layer:malformed-json",G="wfs-layer:unknown-geometry-type",k="wfs-layer:unknown-field-type",v="wfs-layer:unsupported-spatial-reference",U="wfs-layer:unsupported-wfs-version";async function D(t,r){const n=I((await e(t,{responseType:"text",query:{SERVICE:"WFS",REQUEST:"GetCapabilities",VERSION:x,...r?.customParameters},signal:r?.signal})).data);return $(t,n),n}function I(e){const t=te(e);ne(t),ae(t);const n=t.firstElementChild,a=r(M(n));return{operations:L(n),get featureTypes(){return Array.from(a())},readFeatureTypes:a}}const O=new Set(["json","application/json","geojson","application/json; subtype=geojson"]);function L(e){let r=!1;const n={GetCapabilities:{url:""},DescribeFeatureType:{url:""},GetFeature:{url:"",outputFormat:null,supportsPagination:!1}};if(w(e,{OperationsMetadata:{Operation:e=>{switch(e.getAttribute("name")){case"GetCapabilities":return{DCP:{HTTP:{Get:e=>{n.GetCapabilities.url=e.getAttribute(S)}}}};case"DescribeFeatureType":return{DCP:{HTTP:{Get:e=>{n.DescribeFeatureType.url=e.getAttribute(S)}}}};case"GetFeature":return{DCP:{HTTP:{Get:e=>{n.GetFeature.url=e.getAttribute(S)}}},Parameter:e=>{if("outputFormat"===e.getAttribute("name"))return{AllowedValues:{Value:e=>{const t=e.textContent;O.has(t.toLowerCase())&&(n.GetFeature.outputFormat=t)}}}}}}},Constraint:e=>{switch(e.getAttribute("name")){case"KVPEncoding":return{DefaultValue:e=>{r="true"===e.textContent.toLowerCase()}};case"ImplementsResultPaging":return{DefaultValue:e=>{n.GetFeature.supportsPagination="true"===e.textContent.toLowerCase()}}}}}}),!r)throw new t(j,"WFS service doesn't support key/value pair (KVP) encoding");if(a(n.GetFeature.outputFormat))throw new t(R,"WFS service doesn't support GeoJSON output format");return n}function $(e,t){i(e)&&(p(e,t.operations.DescribeFeatureType.url,!0)&&(t.operations.DescribeFeatureType.url=u(t.operations.DescribeFeatureType.url)),p(e,t.operations.GetFeature.url,!0)&&(t.operations.GetFeature.url=u(t.operations.GetFeature.url)))}function M(e){return b(e,{FeatureTypeList:{FeatureType:e=>{const t={typeName:"undefined:undefined",name:"",title:"",description:"",extent:null,namespacePrefix:"",namespaceUri:"",supportedSpatialReferences:[]},r=new Set([4326]),n=e=>{const t=parseInt(e.textContent.match(/(?<wkid>\d+$)/i)?.groups?.wkid,10);Number.isNaN(t)||r.add(t)};return w(e,{Name:e=>{const{name:r,prefix:n}=re(e.textContent);t.typeName=`${n}:${r}`,t.name=r,t.namespacePrefix=n,t.namespaceUri=e.lookupNamespaceURI(n)},Abstract:e=>{t.description=e.textContent},Title:e=>{t.title=e.textContent},WGS84BoundingBox:e=>{t.extent=V(e)},DefaultSRS:n,DefaultCRS:n,OtherSRS:n,OtherCRS:n}),t.title||(t.title=t.name),t.supportedSpatialReferences.push(...r),t}}})}function V(e){let t,r,n,a;for(const o of e.children)switch(o.localName){case"LowerCorner":[t,r]=o.textContent.split(" ").map((e=>Number.parseFloat(e)));break;case"UpperCorner":[n,a]=o.textContent.split(" ").map((e=>Number.parseFloat(e)))}return{xmin:t,ymin:r,xmax:n,ymax:a,spatialReference:m}}function W(e,t,r){return n(e,(e=>r?e.name===t&&e.namespaceUri===r:e.typeName===t||e.name===t))}async function X(e,t,r,n={}){const{featureType:a,extent:o}=await Y(e,t,r,n),{fields:s,geometryType:i,swapXY:p,objectIdField:u,geometryField:c}=await q(e,a.typeName,n);return{url:e.operations.GetCapabilities.url,name:a.name,namespaceUri:a.namespaceUri,fields:s,geometryField:c,geometryType:i,objectIdField:u,spatialReference:n.spatialReference??T.WGS84,extent:o,swapXY:p,wfsCapabilities:e,customParameters:n.customParameters}}async function Y(e,r,n,o={}){const{spatialReference:s=T.WGS84}=o,i=e.readFeatureTypes(),p=r?W(i,r,n):i.next().value;if(a(p))throw r?new t(P,`The type '${r}' could not be found in the service`):new t(N,"The service is empty");let u=new F({...p.extent,spatialReference:s});if(!y(s,m))try{await c(m,s,void 0,o),u=l(u,m)}catch{throw new t(v,"Projection not supported")}return{extent:u,spatialReference:s,featureType:p}}async function q(e,r,n={}){const[o,i]=await s([J(e.operations.DescribeFeatureType.url,r,n),_(e,r,n)]);if(o.error||i.error)throw new t(E,`An error occurred while getting info about the feature type '${r}'`,{error:o.error||i.error});const{fields:p,errors:u}=o.value,c=o.value.geometryType||i.value.geometryType,l=i.value.swapXY;if(a(c))throw new t(G,`The geometry type could not be determined for type '${r}`,{typeName:r,geometryType:c,fields:p,errors:u});return{...z(p),geometryType:c,swapXY:l}}function z(e){const t=e.find((e=>"geometry"===e.type));let r=e.find((e=>"oid"===e.type));return e=e.filter((e=>"geometry"!==e.type)),r||(r=new h({name:C,type:"oid",alias:C}),e.unshift(r)),{geometryField:t?.name??null,objectIdField:r.name,fields:e}}async function _(t,r,n={}){let a,o=!1;const[s,i]=await Promise.all([K(t.operations.GetFeature.url,r,t.operations.GetFeature.outputFormat,{...n,count:1}),e(t.operations.GetFeature.url,{responseType:"text",query:Z(r,void 0,{...n,count:1}),signal:n?.signal})]),p="FeatureCollection"===s.type&&s.features[0]?.geometry;if(p){let e;switch(a=f.fromJSON(d(p.type)),p.type){case"Point":e=p.coordinates;break;case"LineString":case"MultiPoint":e=p.coordinates[0];break;case"MultiLineString":case"Polygon":e=p.coordinates[0][0];break;case"MultiPolygon":e=p.coordinates[0][0][0]}const t=/<[^>]*pos[^>]*> *(-?\d+(?:\.\d+)?) (-?\d+(?:\.\d+)?)/.exec(i.data);if(t){const r=e[0].toFixed(3),n=e[1].toFixed(3),a=parseFloat(t[1]).toFixed(3);r===parseFloat(t[2]).toFixed(3)&&n===a&&(o=!0)}}return{geometryType:a,swapXY:o}}async function J(t,r,n){return Q(r,(await e(t,{responseType:"text",query:{SERVICE:"WFS",REQUEST:"DescribeFeatureType",VERSION:x,TYPENAME:r,...n?.customParameters},signal:n?.signal})).data)}function Q(e,r){const{name:a}=re(e),s=te(r);ae(s);const i=n(b(s.firstElementChild,{element:e=>({name:e.getAttribute("name"),typeName:re(e.getAttribute("type")).name})}),(({name:e})=>e===a));if(o(i)){const e=n(b(s.firstElementChild,{complexType:e=>e}),(e=>e.getAttribute("name")===i.typeName));if(o(e))return B(e)}throw new t(P,`Type '${e}' not found in document`,{document:(new XMLSerializer).serializeToString(s)})}const H=new Set(["objectid","fid"]);function B(e){const r=[],n=[];let a;const o=b(e,{complexContent:{extension:{sequence:{element:e=>e}}}});for(const s of o){const o=s.getAttribute("name");if(!o)continue;let i,p;if(s.hasAttribute("type")?i=re(s.getAttribute("type")).name:w(s,{simpleType:{restriction:e=>(i=re(e.getAttribute("base")).name,{maxLength:e=>{p=+e.getAttribute("value")}})}}),!i)continue;const u="true"===s.getAttribute("nillable");let c=!1;switch(i.toLowerCase()){case"integer":case"nonpositiveinteger":case"negativeinteger":case"long":case"int":case"short":case"byte":case"nonnegativeinteger":case"unsignedlong":case"unsignedint":case"unsignedshort":case"unsignedbyte":case"positiveinteger":n.push(new h({name:o,alias:o,type:"integer",nullable:u}));break;case"float":case"double":case"decimal":n.push(new h({name:o,alias:o,type:"double",nullable:u}));break;case"boolean":case"string":case"gyearmonth":case"gyear":case"gmonthday":case"gday":case"gmonth":case"anyuri":case"qname":case"notation":case"normalizedstring":case"token":case"language":case"idrefs":case"entities":case"nmtoken":case"nmtokens":case"name":case"ncname":case"id":case"idref":case"entity":case"duration":case"time":n.push(new h({name:o,alias:o,type:"string",nullable:u,length:p??255}));break;case"datetime":case"date":n.push(new h({name:o,alias:o,type:"date",nullable:u,length:p??36}));break;case"pointpropertytype":a="point",c=!0;break;case"multipointpropertytype":a="multipoint",c=!0;break;case"curvepropertytype":case"multicurvepropertytype":case"multilinestringpropertytype":a="polyline",c=!0;break;case"surfacepropertytype":case"multisurfacepropertytype":case"multipolygonpropertytype":a="polygon",c=!0;break;case"geometrypropertytype":case"multigeometrypropertytype":c=!0,r.push(new t(G,`geometry type '${i}' is not supported`,{type:(new XMLSerializer).serializeToString(e)}));break;default:r.push(new t(k,`Unknown field type '${i}'`,{type:(new XMLSerializer).serializeToString(e)}))}c&&n.push(new h({name:o,alias:o,type:"geometry",nullable:u}))}for(const t of n)if("integer"===t.type&&!t.nullable&&H.has(t.name.toLowerCase())){t.type="oid";break}return{geometryType:a,fields:n,errors:r}}async function K(r,n,a,o){let{data:s}=await e(r,{responseType:"text",query:Z(n,a,o),signal:o?.signal});s=s.replace(/": +(-?\d+),(\d+)(,)?/g,'": $1.$2$3');try{if(o?.dateFields?.length){const e=new Set(o.dateFields);return JSON.parse(s,((t,r)=>e.has(t)?g(r):r))}return JSON.parse(s)}catch(i){throw new t(A,"Error while parsing the response",{response:s,error:i})}}function Z(e,t,r){return{SERVICE:"WFS",REQUEST:"GetFeature",VERSION:x,TYPENAMES:e,OUTPUTFORMAT:t,SRSNAME:"EPSG:4326",STARTINDEX:r?.startIndex,COUNT:r?.count,...r?.customParameters}}async function ee(t,r,n){const a=te((await e(t,{responseType:"text",query:{SERVICE:"WFS",REQUEST:"GetFeature",VERSION:x,TYPENAMES:r,RESULTTYPE:"hits",...n?.customParameters},signal:n?.signal})).data);ae(a);const o=Number.parseFloat(a.firstElementChild.getAttribute("numberMatched"));return Number.isNaN(o)?0:o}function te(e){return(new DOMParser).parseFromString(e.trim(),"text/xml")}function re(e){const[t,r]=e.split(":");return{prefix:r?t:"",name:r??t}}function ne(e){const r=e.firstElementChild.getAttribute("version");if(r&&r!==x)throw new t(U,`Unsupported WFS version ${r}. Supported version: ${x}`)}function ae(e){let r,n;if(w(e.firstElementChild,{Exception:e=>(r=e.getAttribute("exceptionCode"),{ExceptionText:e=>{n=e.textContent}})}),r)throw new t(`wfs-layer:${r}`,n)}export{C as WFS_OID_FIELD_NAME,J as describeFeatureType,W as findFeatureType,D as getCapabilities,K as getFeature,ee as getFeatureCount,Y as getFeatureTypeInfo,X as getWFSLayerInfo,Q as parseDescribeFeatureTypeResponse,I as parseGetCapabilitiesResponse,z as prepareWFSLayerFields};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Accessor.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";let t=class extends r{constructor(o){super(o),this.maxValue=null,this.minValue=null}};o([e()],t.prototype,"objectType",void 0),o([e()],t.prototype,"maxValue",void 0),o([e()],t.prototype,"minValue",void 0),o([e()],t.prototype,"codedValue",void 0),t=o([s("esri.layers.support.ContingentValue")],t);const p=t;export{p as default};
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Accessor.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";let t=class extends r{constructor(o){super(o),this.maxValue=null,this.minValue=null,this.codedValue=null}};o([e()],t.prototype,"objectType",void 0),o([e()],t.prototype,"maxValue",void 0),o([e()],t.prototype,"minValue",void 0),o([e()],t.prototype,"codedValue",void 0),t=o([s("esri.layers.support.ContingentValue")],t);const p=t;export{p 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{result as e}from"../../core/asyncUtils.js";import t from"../../core/Error.js";import{isNone as i,isSome as o}from"../../core/maybe.js";import{whenOrAbort as s,throwIfAbortError as n,eachAlways as l}from"../../core/promiseUtils.js";import{getMetersPerUnitForSR as a}from"../../core/unitUtils.js";import r from"../../geometry/Multipoint.js";import c from"../../geometry/Point.js";import u from"../../geometry/Polyline.js";import{initializeProjection as h,project as p}from"../../geometry/projection.js";import{fromExtent as m,create as f,contains as d}from"../../geometry/support/aaBoundingRect.js";import{MultiTileElevationSampler as y}from"./ElevationSampler.js";import{ElevationTile as T}from"./ElevationTile.js";import{TileKey as v}from"./TileKey.js";class x{async queryAll(e,i,o){if(!(e=o&&o.ignoreInvisibleLayers?e.filter((e=>e.visible)):e.slice()).length)throw new t("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");const s=g.fromGeometry(i);let n=!1;o&&o.returnSampleInfo||(n=!0);const l={...q,...o,returnSampleInfo:!0},a=await this.query(e[e.length-1],s,l),r=await this._queryAllContinue(e,a,l);return r.geometry=r.geometry.export(),n&&delete r.sampleInfo,r}async query(e,i,o){if(!e)throw new t("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||!(i instanceof g)&&"point"!==i.type&&"multipoint"!==i.type&&"polyline"!==i.type)throw new t("elevation-query:invalid-geometry","Only point, polyline and multipoint geometries can be used to query elevation");const s={...q,...o},n=new w(e,i.spatialReference,s),l=s.signal;return await e.load({signal:l}),await this._createGeometryDescriptor(n,i,l),await this._selectTiles(n,l),await this._populateElevationTiles(n,l),this._sampleGeometryWithElevation(n),this._createQueryResult(n,l)}async createSampler(e,i,o){if(!e)throw new t("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const s={...q,...o};return this._createSampler(e,i,s)}async createSamplerAll(e,i,o){if(!(e=o&&o.ignoreInvisibleLayers?e.filter((e=>e.visible)):e.slice()).length)throw new t("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const s={...q,...o,returnSampleInfo:!0},n=await this._createSampler(e[e.length-1],i,s);return this._createSamplerAllContinue(e,i,n,s)}async _createSampler(e,t,i,o){const s=i.signal;await e.load({signal:s});const n=t.spatialReference,l=e.tileInfo.spatialReference;n.equals(l)||(await h([{source:n,dest:l}],{signal:s}),t=p(t,l));const a=new E(e,t,i,o);return await this._selectTiles(a,s),await this._populateElevationTiles(a,s),new y(a.elevationTiles,a.layer.tileInfo,a.options.noDataValue)}async _createSamplerAllContinue(e,t,i,o){if(e.pop(),!e.length)return i;const s=i.samplers.map((e=>m(e.extent))),n=await this._createSampler(e[e.length-1],t,o,s);if(0===n.samplers.length)return i;const l=i.samplers.concat(n.samplers),a=new y(l,o.noDataValue);return this._createSamplerAllContinue(e,t,a,o)}async _queryAllContinue(e,t,i){const o=e.pop(),s=t.geometry.coordinates,n=[],l=[];for(let c=0;c<s.length;c++){const i=t.sampleInfo[c];i.demResolution>=0?i.source||(i.source=o):e.length&&(n.push(s[c]),l.push(c))}if(!e.length||0===n.length)return t;const a=t.geometry.clone(n),r=await this.query(e[e.length-1],a,i);return l.forEach(((e,i)=>{s[e].z=r.geometry.coordinates[i].z,t.sampleInfo[e].demResolution=r.sampleInfo[i].demResolution})),this._queryAllContinue(e,t,i)}async _createQueryResult(e,t){const i={geometry:(await e.geometry.project(e.outSpatialReference,t)).export(),noDataValue:e.options.noDataValue};return e.options.returnSampleInfo&&(i.sampleInfo=this._extractSampleInfo(e)),e.geometry.coordinates.forEach((e=>{e.tile=null,e.elevationTile=null})),i}async _createGeometryDescriptor(e,i,o){let s;const n=e.layer.tileInfo.spatialReference;if(i instanceof g?s=await i.project(n,o):(await h([{source:i.spatialReference,dest:n}],{signal:o}),s=p(i,n)),!s)throw new t("elevation-query:spatial-reference-mismatch",`Cannot query elevation in '${i.spatialReference.wkid}' on an elevation service in '${n.wkid}'`);e.geometry=g.fromGeometry(s)}async _selectTiles(e,i){const o=e.options.demResolution;if("geometry"===e.type&&this._preselectOutsideLayerExtent(e),"number"==typeof o)this._selectTilesClosestResolution(e);else if("finest-contiguous"===o)await this._selectTilesFinestContiguous(e,i);else{if("auto"!==o)throw new t("elevation-query:invalid-dem-resolution",`Invalid dem resolution value '${o}', expected a number, "finest-contiguous" or "auto"`);await this._selectTilesAuto(e,i)}}_preselectOutsideLayerExtent(e){if(i(e.layer.fullExtent))return;const t=new T(null);t.sample=()=>e.options.noDataValue,e.outsideExtentTile=t;const o=e.layer.fullExtent;e.geometry.coordinates.forEach((e=>{const i=e.x,s=e.y;(i<o.xmin||i>o.xmax||s<o.ymin||s>o.ymax)&&(e.elevationTile=t)}))}_selectTilesClosestResolution(e){const t=e.layer.tileInfo,i=this._findNearestDemResolutionLODIndex(t,e.options.demResolution);e.selectTilesAtLOD(i)}_findNearestDemResolutionLODIndex(e,t){const i=t/a(e.spatialReference);let o=e.lods[0],s=0;for(let n=1;n<e.lods.length;n++){const t=e.lods[n];Math.abs(t.resolution-i)<Math.abs(o.resolution-i)&&(o=t,s=n)}return s}async _selectTilesFinestContiguous(e,t){const i=R(e.layer.tileInfo,e.options.minDemResolution);await this._selectTilesFinestContiguousAt(e,i,t)}async _selectTilesFinestContiguousAt(e,i,o){const l=e.layer;if(e.selectTilesAtLOD(i),i<0)return;const a=l.tilemapCache,r=e.getTilesToFetch();try{if(a)await s(Promise.all(r.map((e=>a.fetchAvailability(e.level,e.row,e.col,{signal:o})))),o);else if(await this._populateElevationTiles(e,o),!e.allElevationTilesFetched())throw e.clearElevationTiles(),new t("elevation-query:has-unavailable-tiles")}catch(c){n(c),await this._selectTilesFinestContiguousAt(e,i-1,o)}}async _populateElevationTiles(e,t){const i=e.getTilesToFetch(),n={},a=e.options.cache,r=e.options.noDataValue,c=i.map((async i=>{const s=`${e.layer.uid}:${i.id}:${r}`,l=o(a)?a.get(s):null,c=o(l)?l:await e.layer.fetchTile(i.level,i.row,i.col,{noDataValue:r,signal:t});o(a)&&a.put(s,c),n[i.id]=new T(i,c)}));await s(l(c),t),e.populateElevationTiles(n)}async _selectTilesAuto(t,i){this._selectTilesAutoFinest(t),this._reduceTilesForMaximumRequests(t);const o=t.layer.tilemapCache;if(!o)return this._selectTilesAutoPrefetchUpsample(t,i);const l=t.getTilesToFetch(),a={},r=l.map((async t=>{const s=new v(null,0,0,0,f()),l=await e(o.fetchAvailabilityUpsample(t.level,t.row,t.col,s,{signal:i}));!1===l.ok?n(l.error):a[t.id]=s}));await s(Promise.all(r),i),t.remapTiles(a)}_reduceTilesForMaximumRequests(e){const t=e.layer.tileInfo;let i=0;const o={},s=e=>{e.id in o?o[e.id]++:(o[e.id]=1,i++)},n=e=>{const t=o[e.id];1===t?(delete o[e.id],i--):o[e.id]=t-1};e.forEachTileToFetch(s,n);let l=!0;for(;l&&(l=!1,e.forEachTileToFetch((o=>{i<=e.options.maximumAutoTileRequests||(n(o),t.upsampleTile(o)&&(l=!0),s(o))}),n),l););}_selectTilesAutoFinest(e){const t=R(e.layer.tileInfo,e.options.minDemResolution);e.selectTilesAtLOD(t,e.options.maximumAutoTileRequests)}async _selectTilesAutoPrefetchUpsample(e,t){const i=e.layer.tileInfo;await this._populateElevationTiles(e,t);let o=!1;e.forEachTileToFetch(((e,t)=>{i.upsampleTile(e)?o=!0:t()})),o&&await this._selectTilesAutoPrefetchUpsample(e,t)}_sampleGeometryWithElevation(e){e.geometry.coordinates.forEach((t=>{const i=t.elevationTile;let s=e.options.noDataValue;if(i){const e=i.sample(t.x,t.y);o(e)?s=e:t.elevationTile=null}t.z=s}))}_extractSampleInfo(e){const t=e.layer.tileInfo,i=a(t.spatialReference);return e.geometry.coordinates.map((o=>{let s=-1;if(o.elevationTile&&o.elevationTile!==e.outsideExtentTile){s=t.lodAt(o.elevationTile.tile.level).resolution*i}return{demResolution:s}}))}}class g{export(){return this._exporter(this.coordinates,this.spatialReference)}clone(e){const t=new g;return t.geometry=this.geometry,t.spatialReference=this.spatialReference,t.coordinates=e||this.coordinates.map((e=>this._cloneCoordinate(e))),t._exporter=this._exporter,t}async project(e,t){if(this.spatialReference.equals(e))return this.clone();await h([{source:this.spatialReference,dest:e}],{signal:t});const i=new r({spatialReference:this.spatialReference,points:this.coordinates.map((e=>[e.x,e.y]))}),o=p(i,e);if(!o)return null;const s=this.coordinates.map(((e,t)=>{const i=this._cloneCoordinate(e),s=o.points[t];return i.x=s[0],i.y=s[1],i})),n=this.clone(s);return n.spatialReference=e,n}_cloneCoordinate(e){return{x:e.x,y:e.y,z:e.z,m:e.m,tile:null,elevationTile:null}}static fromGeometry(e){const t=new g;if(t.geometry=e,t.spatialReference=e.spatialReference,e instanceof g)t.coordinates=e.coordinates.map((e=>t._cloneCoordinate(e))),t._exporter=(t,i)=>{const o=e.clone(t);return o.spatialReference=i,o};else switch(e.type){case"point":{const i=e,{hasZ:o,hasM:s}=i;t.coordinates=o&&s?[{x:i.x,y:i.y,z:i.z,m:i.m}]:o?[{x:i.x,y:i.y,z:i.z}]:s?[{x:i.x,y:i.y,m:i.m}]:[{x:i.x,y:i.y}],t._exporter=(t,i)=>e.hasM?new c(t[0].x,t[0].y,t[0].z,t[0].m,i):new c(t[0].x,t[0].y,t[0].z,i);break}case"multipoint":{const i=e,{hasZ:o,hasM:s}=i;t.coordinates=o&&s?i.points.map((e=>({x:e[0],y:e[1],z:e[2],m:e[3]}))):o?i.points.map((e=>({x:e[0],y:e[1],z:e[2]}))):s?i.points.map((e=>({x:e[0],y:e[1],m:e[2]}))):i.points.map((e=>({x:e[0],y:e[1]}))),t._exporter=(t,i)=>e.hasM?new r({points:t.map((e=>[e.x,e.y,e.z,e.m])),hasZ:!0,hasM:!0,spatiaReference:i}):new r(t.map((e=>[e.x,e.y,e.z])),i);break}case"polyline":{const i=e,o=[],s=[],{hasZ:n,hasM:l}=e;let a=0;for(const e of i.paths)if(s.push([a,a+e.length]),a+=e.length,n&&l)for(const t of e)o.push({x:t[0],y:t[1],z:t[2],m:t[3]});else if(n)for(const t of e)o.push({x:t[0],y:t[1],z:t[2]});else if(l)for(const t of e)o.push({x:t[0],y:t[1],m:t[2]});else for(const t of e)o.push({x:t[0],y:t[1]});t.coordinates=o,t._exporter=(t,i)=>{const o=e.hasM?t.map((e=>[e.x,e.y,e.z,e.m])):t.map((e=>[e.x,e.y,e.z])),n=s.map((e=>o.slice(e[0],e[1])));return new u({paths:n,hasM:e.hasM,hasZ:!0,spatialReference:i})};break}}return t}}class _{constructor(e,t){this.layer=e,this.options=t}}class w extends _{constructor(e,t,i){super(e,i),this.outSpatialReference=t,this.type="geometry"}selectTilesAtLOD(e){if(e<0)this.geometry.coordinates.forEach((e=>e.tile=null));else{const t=this.layer.tileInfo,i=t.lods[e].level;this.geometry.coordinates.forEach((e=>{e.tile=t.tileAt(i,e.x,e.y)}))}}allElevationTilesFetched(){return!this.geometry.coordinates.some((e=>!e.elevationTile))}clearElevationTiles(){for(const e of this.geometry.coordinates)e.elevationTile!==this.outsideExtentTile&&(e.elevationTile=null)}populateElevationTiles(e){for(const t of this.geometry.coordinates)!t.elevationTile&&t.tile&&(t.elevationTile=e[t.tile.id])}remapTiles(e){for(const t of this.geometry.coordinates)t.tile=e[t.tile.id]}getTilesToFetch(){const e={},t=[];for(const i of this.geometry.coordinates){const o=i.tile;i.elevationTile||!i.tile||e[o.id]||(e[o.id]=o,t.push(o))}return t}forEachTileToFetch(e){for(const t of this.geometry.coordinates)t.tile&&!t.elevationTile&&e(t.tile,(()=>t.tile=null))}}class E extends _{constructor(e,t,i,o){super(e,i),this.type="extent",this.elevationTiles=[],this._candidateTiles=[],this._fetchedCandidates=new Set,this.extent=t.intersection(e.fullExtent),this.maskExtents=o}selectTilesAtLOD(e,t){const i=this._maximumLodForRequests(t),o=Math.min(i,e);o<0?this._candidateTiles.length=0:this._selectCandidateTilesCoveringExtentAt(o)}_maximumLodForRequests(e){const t=this.layer.tileInfo;if(!e)return t.lods.length-1;const o=this.extent;if(i(o))return-1;for(let i=t.lods.length-1;i>=0;i--){const s=t.lods[i],n=s.resolution*t.size[0],l=s.resolution*t.size[1];if(Math.ceil(o.width/n)*Math.ceil(o.height/l)<=e)return i}return-1}allElevationTilesFetched(){return this._candidateTiles.length===this.elevationTiles.length}clearElevationTiles(){this.elevationTiles.length=0,this._fetchedCandidates.clear()}populateElevationTiles(e){for(const t of this._candidateTiles){const i=e[t.id];i&&(this._fetchedCandidates.add(t),this.elevationTiles.push(i))}}remapTiles(e){this._candidateTiles=this._uniqueNonOverlappingTiles(this._candidateTiles.map((t=>e[t.id])))}getTilesToFetch(){return this._candidateTiles}forEachTileToFetch(e,t){const i=this._candidateTiles;this._candidateTiles=[],i.forEach((i=>{if(this._fetchedCandidates.has(i))return void(t&&t(i));let o=!1;e(i,(()=>o=!0)),o?t&&t(i):this._candidateTiles.push(i)})),this._candidateTiles=this._uniqueNonOverlappingTiles(this._candidateTiles,t)}_uniqueNonOverlappingTiles(e,t){const i={},o=[];for(const n of e)i[n.id]?t&&t(n):(i[n.id]=n,o.push(n));const s=o.sort(((e,t)=>e.level-t.level));return s.filter(((e,i)=>{for(let o=0;o<i;o++)if(d(s[o].extent,e.extent))return t&&t(e),!1;return!0}))}_selectCandidateTilesCoveringExtentAt(e){this._candidateTiles.length=0;const t=this.extent;if(i(t))return;const o=this.layer.tileInfo,s=o.lods[e],n=o.tileAt(s.level,t.xmin,t.ymin),l=s.resolution*o.size[0],a=s.resolution*o.size[1],r=Math.ceil((t.xmax-n.extent[0])/l),c=Math.ceil((t.ymax-n.extent[1])/a);for(let i=0;i<c;i++)for(let e=0;e<r;e++){const t=new v(null,n.level,n.row-i,n.col+e);o.updateTileInfo(t),this._tileIsMasked(t)||this._candidateTiles.push(t)}}_tileIsMasked(e){return!!this.maskExtents&&this.maskExtents.some((t=>d(t,e.extent)))}}function R(e,t){let i=e.lods.length-1;if(t>0){const o=t/a(e.spatialReference),s=e.lods.findIndex((e=>e.resolution<o));0===s?i=0:s>0&&(i=s-1)}return i}const q={maximumAutoTileRequests:20,noDataValue:0,returnSampleInfo:!1,demResolution:"auto",minDemResolution:0};export{x as ElevationQuery,g as GeometryDescriptor,R as getFinestLodIndex};
|
|
5
|
+
import{result as e}from"../../core/asyncUtils.js";import t from"../../core/Error.js";import{isNone as i,isSome as s}from"../../core/maybe.js";import{whenOrAbort as o,throwIfAbortError as n,eachAlways as l}from"../../core/promiseUtils.js";import{getMetersPerUnitForSR as a}from"../../core/unitUtils.js";import r from"../../geometry/Multipoint.js";import c from"../../geometry/Point.js";import u from"../../geometry/Polyline.js";import{initializeProjection as h,project as p}from"../../geometry/projection.js";import{fromExtent as m,create as f,contains as d}from"../../geometry/support/aaBoundingRect.js";import{MultiTileElevationSampler as y}from"./ElevationSampler.js";import{ElevationTile as T}from"./ElevationTile.js";import{TileKey as v}from"./TileKey.js";class g{async queryAll(e,i,s){if(!(e=s&&s.ignoreInvisibleLayers?e.filter((e=>e.visible)):e.slice()).length)throw new t("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");const o=w.fromGeometry(i);let n=!1;s&&s.returnSampleInfo||(n=!0);const l={...I,...s,returnSampleInfo:!0},a=await this.query(e[e.length-1],o,l),r=await this._queryAllContinue(e,a,l);return r.geometry=r.geometry.export(),n&&delete r.sampleInfo,r}async query(e,i,s){if(!e)throw new t("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||!(i instanceof w)&&"point"!==i.type&&"multipoint"!==i.type&&"polyline"!==i.type)throw new t("elevation-query:invalid-geometry","Only point, polyline and multipoint geometries can be used to query elevation");const o={...I,...s},n=new E(e,i.spatialReference,o),l=o.signal;return await e.load({signal:l}),await this._createGeometryDescriptor(n,i,l),await this._selectTiles(n,l),await this._populateElevationTiles(n,l),this._sampleGeometryWithElevation(n),this._createQueryResult(n,l)}async createSampler(e,i,s){if(!e)throw new t("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const o={...I,...s};return this._createSampler(e,i,o)}async createSamplerAll(e,i,s){if(!(e=s&&s.ignoreInvisibleLayers?e.filter((e=>e.visible)):e.slice()).length)throw new t("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const o={...I,...s,returnSampleInfo:!0},n=await this._createSampler(e[e.length-1],i,o);return this._createSamplerAllContinue(e,i,n,o)}async _createSampler(e,t,i,s){const o=i.signal;await e.load({signal:o});const n=t.spatialReference,l=e.tileInfo.spatialReference;n.equals(l)||(await h([{source:n,dest:l}],{signal:o}),t=p(t,l));const a=new R(e,t,i,s);return await this._selectTiles(a,o),await this._populateElevationTiles(a,o),new y(a.elevationTiles,a.layer.tileInfo,a.options.noDataValue)}async _createSamplerAllContinue(e,t,i,s){if(e.pop(),!e.length)return i;const o=i.samplers.map((e=>m(e.extent))),n=await this._createSampler(e[e.length-1],t,s,o);if(0===n.samplers.length)return i;const l=i.samplers.concat(n.samplers),a=new y(l,s.noDataValue);return this._createSamplerAllContinue(e,t,a,s)}async _queryAllContinue(e,t,i){const s=e.pop(),o=t.geometry.coordinates,n=[],l=[];for(let c=0;c<o.length;c++){const i=t.sampleInfo[c];i.demResolution>=0?i.source||(i.source=s):e.length&&(n.push(o[c]),l.push(c))}if(!e.length||0===n.length)return t;const a=t.geometry.clone(n),r=await this.query(e[e.length-1],a,i);return l.forEach(((e,i)=>{o[e].z=r.geometry.coordinates[i].z,t.sampleInfo[e].demResolution=r.sampleInfo[i].demResolution})),this._queryAllContinue(e,t,i)}async _createQueryResult(e,t){const i={geometry:(await e.geometry.project(e.outSpatialReference,t)).export(),noDataValue:e.options.noDataValue};return e.options.returnSampleInfo&&(i.sampleInfo=this._extractSampleInfo(e)),e.geometry.coordinates.forEach((e=>{e.tile=null,e.elevationTile=null})),i}async _createGeometryDescriptor(e,i,s){let o;const n=e.layer.tileInfo.spatialReference;if(i instanceof w?o=await i.project(n,s):(await h([{source:i.spatialReference,dest:n}],{signal:s}),o=p(i,n)),!o)throw new t("elevation-query:spatial-reference-mismatch",`Cannot query elevation in '${i.spatialReference.wkid}' on an elevation service in '${n.wkid}'`);e.geometry=w.fromGeometry(o)}async _selectTiles(e,i){const s=e.options.demResolution;if("geometry"===e.type&&this._preselectOutsideLayerExtent(e),"number"==typeof s)this._selectTilesClosestResolution(e);else if("finest-contiguous"===s)await this._selectTilesFinestContiguous(e,i);else{if("auto"!==s)throw new t("elevation-query:invalid-dem-resolution",`Invalid dem resolution value '${s}', expected a number, "finest-contiguous" or "auto"`);await this._selectTilesAuto(e,i)}}_preselectOutsideLayerExtent(e){if(i(e.layer.fullExtent))return;const t=new T(null);t.sample=()=>e.options.noDataValue,e.outsideExtentTile=t;const s=e.layer.fullExtent;e.geometry.coordinates.forEach((e=>{const i=e.x,o=e.y;(i<s.xmin||i>s.xmax||o<s.ymin||o>s.ymax)&&(e.elevationTile=t)}))}_selectTilesClosestResolution(e){const t=e.layer.tileInfo,i=this._findNearestDemResolutionLODIndex(t,e.options.demResolution);e.selectTilesAtLOD(i)}_findNearestDemResolutionLODIndex(e,t){const i=t/a(e.spatialReference);let s=e.lods[0],o=0;for(let n=1;n<e.lods.length;n++){const t=e.lods[n];Math.abs(t.resolution-i)<Math.abs(s.resolution-i)&&(s=t,o=n)}return o}async _selectTilesFinestContiguous(e,t){const i=q(e.layer.tileInfo,e.options.minDemResolution);await this._selectTilesFinestContiguousAt(e,i,t)}async _selectTilesFinestContiguousAt(e,i,s){const l=e.layer;if(e.selectTilesAtLOD(i),i<0)return;const a=l.tilemapCache,r=e.getTilesToFetch();try{if(a)await o(Promise.all(r.map((e=>a.fetchAvailability(e.level,e.row,e.col,{signal:s})))),s);else if(await this._populateElevationTiles(e,s),!e.allElevationTilesFetched())throw e.clearElevationTiles(),new t("elevation-query:has-unavailable-tiles")}catch(c){n(c),await this._selectTilesFinestContiguousAt(e,i-1,s)}}async _populateElevationTiles(e,t){const i=e.getTilesToFetch(),n={},a=e.options.cache,r=e.options.noDataValue,c=i.map((async i=>{const o=`${e.layer.uid}:${i.id}:${r}`,l=s(a)?a.get(o):null,c=s(l)?l:await e.layer.fetchTile(i.level,i.row,i.col,{noDataValue:r,signal:t});s(a)&&a.put(o,c),n[i.id]=new T(i,c)}));await o(l(c),t),e.populateElevationTiles(n)}async _selectTilesAuto(t,i){this._selectTilesAutoFinest(t),this._reduceTilesForMaximumRequests(t);const s=t.layer.tilemapCache;if(!s)return this._selectTilesAutoPrefetchUpsample(t,i);const l=t.getTilesToFetch(),a={},r=l.map((async t=>{const o=new v(null,0,0,0,f()),l=await e(s.fetchAvailabilityUpsample(t.level,t.row,t.col,o,{signal:i}));!1===l.ok?n(l.error):a[t.id]=o}));await o(Promise.all(r),i),t.remapTiles(a)}_reduceTilesForMaximumRequests(e){const t=e.layer.tileInfo;let i=0;const s={},o=e=>{e.id in s?s[e.id]++:(s[e.id]=1,i++)},n=e=>{const t=s[e.id];1===t?(delete s[e.id],i--):s[e.id]=t-1};e.forEachTileToFetch(o,n);let l=!0;for(;l&&(l=!1,e.forEachTileToFetch((s=>{i<=e.options.maximumAutoTileRequests||(n(s),t.upsampleTile(s)&&(l=!0),o(s))}),n),l););}_selectTilesAutoFinest(e){const t=q(e.layer.tileInfo,e.options.minDemResolution);e.selectTilesAtLOD(t,e.options.maximumAutoTileRequests)}async _selectTilesAutoPrefetchUpsample(e,t){const i=e.layer.tileInfo;await this._populateElevationTiles(e,t);let s=!1;e.forEachTileToFetch(((e,t)=>{i.upsampleTile(e)?s=!0:t()})),s&&await this._selectTilesAutoPrefetchUpsample(e,t)}_sampleGeometryWithElevation(e){e.geometry.coordinates.forEach((t=>{const i=t.elevationTile;let o=e.options.noDataValue;if(i){const e=i.sample(t.x,t.y);s(e)?o=e:t.elevationTile=null}t.z=o}))}_extractSampleInfo(e){const t=e.layer.tileInfo,i=a(t.spatialReference);return e.geometry.coordinates.map((s=>{let o=-1;if(s.elevationTile&&s.elevationTile!==e.outsideExtentTile){o=t.lodAt(s.elevationTile.tile.level).resolution*i}return{demResolution:o}}))}}class w{export(){return this._exporter(this.coordinates,this.spatialReference)}clone(e){const t=new w;return t.geometry=this.geometry,t.spatialReference=this.spatialReference,t.coordinates=e||this.coordinates.map((e=>e.clone())),t._exporter=this._exporter,t}async project(e,t){if(this.spatialReference.equals(e))return this.clone();await h([{source:this.spatialReference,dest:e}],{signal:t});const i=new r({spatialReference:this.spatialReference,points:this.coordinates.map((e=>[e.x,e.y]))}),s=p(i,e);if(!s)return null;const o=this.coordinates.map(((e,t)=>{const i=e.clone(),o=s.points[t];return i.x=o[0],i.y=o[1],i})),n=this.clone(o);return n.spatialReference=e,n}static fromGeometry(e){const t=new w;if(t.geometry=e,t.spatialReference=e.spatialReference,e instanceof w)t.coordinates=e.coordinates.map((e=>e.clone())),t._exporter=(t,i)=>{const s=e.clone(t);return s.spatialReference=i,s};else switch(e.type){case"point":{const i=e,{hasZ:s,hasM:o}=i;t.coordinates=s&&o?[new x(i.x,i.y,i.z,i.m)]:s?[new x(i.x,i.y,i.z)]:o?[new x(i.x,i.y,null,i.m)]:[new x(i.x,i.y)],t._exporter=(t,i)=>e.hasM?new c(t[0].x,t[0].y,t[0].z,t[0].m,i):new c(t[0].x,t[0].y,t[0].z,i);break}case"multipoint":{const i=e,{hasZ:s,hasM:o}=i;t.coordinates=s&&o?i.points.map((e=>new x(e[0],e[1],e[2],e[3]))):s?i.points.map((e=>new x(e[0],e[1],e[2]))):o?i.points.map((e=>new x(e[0],e[1],null,e[2]))):i.points.map((e=>new x(e[0],e[1]))),t._exporter=(t,i)=>e.hasM?new r({points:t.map((e=>[e.x,e.y,e.z,e.m])),hasZ:!0,hasM:!0,spatiaReference:i}):new r(t.map((e=>[e.x,e.y,e.z])),i);break}case"polyline":{const i=e,s=[],o=[],{hasZ:n,hasM:l}=e;let a=0;for(const e of i.paths)if(o.push([a,a+e.length]),a+=e.length,n&&l)for(const t of e)s.push(new x(t[0],t[1],t[2],t[3]));else if(n)for(const t of e)s.push(new x(t[0],t[1],t[2]));else if(l)for(const t of e)s.push(new x(t[0],t[1],null,t[2]));else for(const t of e)s.push(new x(t[0],t[1]));t.coordinates=s,t._exporter=(t,i)=>{const s=e.hasM?t.map((e=>[e.x,e.y,e.z,e.m])):t.map((e=>[e.x,e.y,e.z])),n=o.map((e=>s.slice(e[0],e[1])));return new u({paths:n,hasM:e.hasM,hasZ:!0,spatialReference:i})};break}}return t}}class x{constructor(e,t,i=null,s=null,o=null,n=null){this.x=e,this.y=t,this.z=i,this.m=s,this.tile=o,this.elevationTile=n}clone(){return new x(this.x,this.y,this.z,this.m)}}class _{constructor(e,t){this.layer=e,this.options=t}}class E extends _{constructor(e,t,i){super(e,i),this.outSpatialReference=t,this.type="geometry"}selectTilesAtLOD(e){if(e<0)this.geometry.coordinates.forEach((e=>{e.tile=null}));else{const t=this.layer.tileInfo,i=t.lods[e].level;this.geometry.coordinates.forEach((e=>{e.tile=t.tileAt(i,e.x,e.y)}))}}allElevationTilesFetched(){return!this.geometry.coordinates.some((e=>!e.elevationTile))}clearElevationTiles(){for(const e of this.geometry.coordinates)e.elevationTile!==this.outsideExtentTile&&(e.elevationTile=null)}populateElevationTiles(e){for(const t of this.geometry.coordinates)!t.elevationTile&&t.tile&&(t.elevationTile=e[t.tile.id])}remapTiles(e){for(const t of this.geometry.coordinates){const i=t.tile?.id;t.tile=i?e[i]:null}}getTilesToFetch(){const e={},t=[];for(const i of this.geometry.coordinates){const s=i.tile;i.elevationTile||!i.tile||e[s.id]||(e[s.id]=s,t.push(s))}return t}forEachTileToFetch(e){for(const t of this.geometry.coordinates)t.tile&&!t.elevationTile&&e(t.tile,(()=>{t.tile=null}))}}class R extends _{constructor(e,t,i,s){super(e,i),this.type="extent",this.elevationTiles=[],this._candidateTiles=[],this._fetchedCandidates=new Set,this.extent=t.intersection(e.fullExtent),this.maskExtents=s}selectTilesAtLOD(e,t){const i=this._maximumLodForRequests(t),s=Math.min(i,e);s<0?this._candidateTiles.length=0:this._selectCandidateTilesCoveringExtentAt(s)}_maximumLodForRequests(e){const t=this.layer.tileInfo;if(!e)return t.lods.length-1;const s=this.extent;if(i(s))return-1;for(let i=t.lods.length-1;i>=0;i--){const o=t.lods[i],n=o.resolution*t.size[0],l=o.resolution*t.size[1];if(Math.ceil(s.width/n)*Math.ceil(s.height/l)<=e)return i}return-1}allElevationTilesFetched(){return this._candidateTiles.length===this.elevationTiles.length}clearElevationTiles(){this.elevationTiles.length=0,this._fetchedCandidates.clear()}populateElevationTiles(e){for(const t of this._candidateTiles){const i=e[t.id];i&&(this._fetchedCandidates.add(t),this.elevationTiles.push(i))}}remapTiles(e){this._candidateTiles=this._uniqueNonOverlappingTiles(this._candidateTiles.map((t=>e[t.id])))}getTilesToFetch(){return this._candidateTiles}forEachTileToFetch(e,t){const i=this._candidateTiles;this._candidateTiles=[],i.forEach((i=>{if(this._fetchedCandidates.has(i))return void(t&&t(i));let s=!1;e(i,(()=>s=!0)),s?t&&t(i):this._candidateTiles.push(i)})),this._candidateTiles=this._uniqueNonOverlappingTiles(this._candidateTiles,t)}_uniqueNonOverlappingTiles(e,t){const i={},s=[];for(const n of e)i[n.id]?t&&t(n):(i[n.id]=n,s.push(n));const o=s.sort(((e,t)=>e.level-t.level));return o.filter(((e,i)=>{for(let s=0;s<i;s++)if(d(o[s].extent,e.extent))return t&&t(e),!1;return!0}))}_selectCandidateTilesCoveringExtentAt(e){this._candidateTiles.length=0;const t=this.extent;if(i(t))return;const s=this.layer.tileInfo,o=s.lods[e],n=s.tileAt(o.level,t.xmin,t.ymin),l=o.resolution*s.size[0],a=o.resolution*s.size[1],r=Math.ceil((t.xmax-n.extent[0])/l),c=Math.ceil((t.ymax-n.extent[1])/a);for(let i=0;i<c;i++)for(let e=0;e<r;e++){const t=new v(null,n.level,n.row-i,n.col+e);s.updateTileInfo(t),this._tileIsMasked(t)||this._candidateTiles.push(t)}}_tileIsMasked(e){return!!this.maskExtents&&this.maskExtents.some((t=>d(t,e.extent)))}}function q(e,t){let i=e.lods.length-1;if(t>0){const s=t/a(e.spatialReference),o=e.lods.findIndex((e=>e.resolution<s));0===o?i=0:o>0&&(i=o-1)}return i}const I={maximumAutoTileRequests:20,noDataValue:0,returnSampleInfo:!1,demResolution:"auto",minDemResolution:0};export{g as ElevationQuery,w as GeometryDescriptor,q as getFinestLodIndex};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Error.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{clone as i}from"../../core/lang.js";import r from"../../core/Logger.js";import{isSome as l,isNone as a}from"../../core/maybe.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{cast as h}from"../../core/accessorSupport/decorators/cast.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{SimpleBandStatistics as c}from"./SimpleBandStatistics.js";var p;let u=p=class extends s{constructor(t){super(t),this.width=null,this.height=null,this.pixelType="f32",this.validPixelCount=null,this.mask=null,this.maskIsAlpha=!1,this.
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Error.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{clone as i}from"../../core/lang.js";import r from"../../core/Logger.js";import{isSome as l,isNone as a}from"../../core/maybe.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{cast as h}from"../../core/accessorSupport/decorators/cast.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{SimpleBandStatistics as c}from"./SimpleBandStatistics.js";var p;let u=p=class extends s{constructor(t){super(t),this.width=null,this.height=null,this.pixelType="f32",this.validPixelCount=null,this.mask=null,this.maskIsAlpha=!1,this.statistics=null}static createEmptyBand(t,e){return new(p.getPixelArrayConstructor(t))(e)}static getPixelArrayConstructor(t){let e;switch(t){case"u1":case"u2":case"u4":case"u8":e=Uint8Array;break;case"u16":e=Uint16Array;break;case"u32":e=Uint32Array;break;case"s8":e=Int8Array;break;case"s16":e=Int16Array;break;case"s32":e=Int32Array;break;case"f32":case"c64":case"c128":case"unknown":e=Float32Array;break;case"f64":e=Float64Array}return e}castPixelType(t){if(!t)return"f32";let e=t.toLowerCase();return["u1","u2","u4"].includes(e)?e="u8":["unknown","u8","s8","u16","s16","u32","s32","f32","f64"].includes(e)||(e="f32"),e}getPlaneCount(){return this.pixels?.length}addData(t){if(!t.pixels||t.pixels.length!==this.width*this.height)throw new e("pixelblock:invalid-or-missing-pixels","add data requires valid pixels array that has same length defined by pixel block width * height");this.pixels||(this.pixels=[]),this.statistics||(this.statistics=[]),this.pixels.push(t.pixels),this.statistics.push(t.statistics??new c)}getAsRGBA(){const t=new ArrayBuffer(this.width*this.height*4);switch(this.pixelType){case"s8":case"s16":case"u16":case"s32":case"u32":case"f32":case"f64":this._fillFromNon8Bit(t);break;default:this._fillFrom8Bit(t)}return new Uint8ClampedArray(t)}getAsRGBAFloat(){const t=new Float32Array(this.width*this.height*4);return this._fillFrom32Bit(t),t}updateStatistics(){if(!this.pixels)return;this.statistics=this.pixels.map((t=>this._calculateBandStatistics(t,this.mask)));const t=this.mask;let e=0;if(l(t))for(let s=0;s<t.length;s++)t[s]&&e++;else e=this.width*this.height;this.validPixelCount=e}clamp(t){if(!t||"f64"===t||"f32"===t||!this.pixels)return;let e;switch(t){case"u8":e=[0,255];break;case"u16":e=[0,65535];break;case"u32":e=[0,4294967295];break;case"s8":e=[-128,127];break;case"s16":e=[-32768,32767];break;case"s32":e=[-2147483648,2147483647];break;default:e=[-34e38,34e38]}const[s,i]=e,r=this.pixels,l=this.width*this.height,a=r.length;let o,h,n;const c=[];for(let u=0;u<a;u++){n=p.createEmptyBand(t,l),o=r[u];for(let t=0;t<l;t++)h=o[t],n[t]=h>i?i:h<s?s:h;c.push(n)}this.pixels=c,this.pixelType=t}extractBands(t){const{pixels:e,statistics:s}=this;if(a(t)||0===t.length||!e||0===e.length)return this;const i=e.length,r=t.some((t=>t>=e.length)),l=i===t.length&&!t.some(((t,e)=>t!==e));return r||l?this:new p({pixelType:this.pixelType,width:this.width,height:this.height,mask:this.mask,validPixelCount:this.validPixelCount,maskIsAlpha:this.maskIsAlpha,pixels:t.map((t=>e[t])),statistics:s&&t.map((t=>s[t]))})}clone(){const t=new p({width:this.width,height:this.height,pixelType:this.pixelType,maskIsAlpha:this.maskIsAlpha,validPixelCount:this.validPixelCount});let e;l(this.mask)&&(this.mask instanceof Uint8Array?t.mask=new Uint8Array(this.mask):t.mask=this.mask.slice(0));const s=p.getPixelArrayConstructor(this.pixelType);if(this.pixels&&this.pixels.length>0){t.pixels=[];const i=!!this.pixels[0].slice;for(e=0;e<this.pixels.length;e++)t.pixels[e]=i?this.pixels[e].slice(0,this.pixels[e].length):new s(this.pixels[e])}if(this.statistics)for(t.statistics=[],e=0;e<this.statistics.length;e++)t.statistics[e]=i(this.statistics[e]);return t}_fillFrom8Bit(t){const{mask:e,maskIsAlpha:s,pixels:i}=this;if(!t||!i||!i.length)return void r.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The input pixel block is empty.");let a,o,h,n;a=o=h=i[0],i.length>=3?(o=i[1],h=i[2]):2===i.length&&(o=i[1]);const c=new Uint32Array(t),p=this.width*this.height;if(a.length===p)if(l(e)&&e.length===p)if(s)for(n=0;n<p;n++)e[n]&&(c[n]=e[n]<<24|h[n]<<16|o[n]<<8|a[n]);else for(n=0;n<p;n++)e[n]&&(c[n]=255<<24|h[n]<<16|o[n]<<8|a[n]);else for(n=0;n<p;n++)c[n]=255<<24|h[n]<<16|o[n]<<8|a[n];else r.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The pixelblock is invalid.")}_fillFromNon8Bit(t){const{pixels:e,mask:s,statistics:i}=this;if(!t||!e||!e.length)return void r.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The input pixel block is empty.");const a=this.pixelType;let o=1,h=0,n=1;if(i&&i.length>0){for(const t of i)if(null!=t.minValue&&(h=Math.min(h,t.minValue)),null!=t.maxValue&&null!=t.minValue){const e=t.maxValue-t.minValue;n=Math.max(n,e)}o=255/n}else{let t=255;"s8"===a?(h=-128,t=127):"u16"===a?t=65535:"s16"===a?(h=-32768,t=32767):"u32"===a?t=4294967295:"s32"===a?(h=-2147483648,t=2147483647):"f32"===a?(h=-34e38,t=34e38):"f64"===a&&(h=-Number.MAX_VALUE,t=Number.MAX_VALUE),o=255/(t-h)}const c=new Uint32Array(t),p=this.width*this.height;let u,g,f,m,d;if(u=g=f=e[0],u.length!==p)return r.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The pixelblock is invalid.");if(e.length>=2)if(g=e[1],e.length>=3&&(f=e[2]),l(s)&&s.length===p)for(m=0;m<p;m++)s[m]&&(c[m]=255<<24|(f[m]-h)*o<<16|(g[m]-h)*o<<8|(u[m]-h)*o);else for(m=0;m<p;m++)c[m]=255<<24|(f[m]-h)*o<<16|(g[m]-h)*o<<8|(u[m]-h)*o;else if(l(s)&&s.length===p)for(m=0;m<p;m++)d=(u[m]-h)*o,s[m]&&(c[m]=255<<24|d<<16|d<<8|d);else for(m=0;m<p;m++)d=(u[m]-h)*o,c[m]=255<<24|d<<16|d<<8|d}_fillFrom32Bit(t){const{pixels:e,mask:s}=this;if(!t||!e||!e.length)return r.getLogger(this.declaredClass).error("getAsRGBAFloat()","Unable to convert to RGBA. The input pixel block is empty.");let i,a,o,h;i=a=o=e[0],e.length>=3?(a=e[1],o=e[2]):2===e.length&&(a=e[1]);const n=this.width*this.height;if(i.length!==n)return r.getLogger(this.declaredClass).error("getAsRGBAFloat()","Unable to convert to RGBA. The pixelblock is invalid.");let c=0;if(l(s)&&s.length===n)for(h=0;h<n;h++)t[c++]=i[h],t[c++]=a[h],t[c++]=o[h],t[c++]=1&s[h];else for(h=0;h<n;h++)t[c++]=i[h],t[c++]=a[h],t[c++]=o[h],t[c++]=1}_calculateBandStatistics(t,e){let s=1/0,i=-1/0;const r=t.length;let a,o=0;if(l(e))for(a=0;a<r;a++)e[a]&&(o=t[a],s=o<s?o:s,i=o>i?o:i);else for(a=0;a<r;a++)o=t[a],s=o<s?o:s,i=o>i?o:i;return new c(s,i)}};t([o({json:{write:!0}})],u.prototype,"width",void 0),t([o({json:{write:!0}})],u.prototype,"height",void 0),t([o({json:{write:!0}})],u.prototype,"pixelType",void 0),t([h("pixelType")],u.prototype,"castPixelType",null),t([o({json:{write:!0}})],u.prototype,"validPixelCount",void 0),t([o({json:{write:!0}})],u.prototype,"mask",void 0),t([o({json:{write:!0}})],u.prototype,"maskIsAlpha",void 0),t([o({json:{write:!0}})],u.prototype,"pixels",void 0),t([o({json:{write:!0}})],u.prototype,"statistics",void 0),u=p=t([n("esri.layers.support.PixelBlock")],u);const g=u;export{g as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../config.js";import{id as o}from"../../kernel.js";import t from"../../PopupTemplate.js";import r from"../../request.js";import{clone as s}from"../../core/lang.js";import{addQueryParameters as n}from"../../core/urlUtils.js";import i from"../../geometry/SpatialReference.js";import{
|
|
5
|
+
import e from"../../config.js";import{id as o}from"../../kernel.js";import t from"../../PopupTemplate.js";import r from"../../request.js";import{clone as s}from"../../core/lang.js";import{addQueryParameters as n}from"../../core/urlUtils.js";import i from"../../geometry/SpatialReference.js";import{create as f,NEGATIVE_INFINITY as a,expandWithAABB as l,equals as u}from"../../geometry/support/aaBoundingBox.js";import{getBoundsXYZ as p}from"../../geometry/support/boundsUtils.js";import{fromJSON as m}from"../../renderers/support/jsonUtils.js";import y from"../../rest/support/FeatureSet.js";const c={esriGeometryPoint:"points",esriGeometryPolyline:"polylines",esriGeometryPolygon:"polygons"};function d(e){const o=e.folders||[],t=o.slice(),r=new Map,n=new Map,i=new Map,f=new Map,a=new Map,l={esriGeometryPoint:n,esriGeometryPolyline:i,esriGeometryPolygon:f};(e.featureCollection&&e.featureCollection.layers||[]).forEach((e=>{const o=s(e);o.featureSet.features=[];const t=e.featureSet.geometryType;r.set(t,o);const a=e.layerDefinition.objectIdField;"esriGeometryPoint"===t?G(n,a,e.featureSet.features):"esriGeometryPolyline"===t?G(i,a,e.featureSet.features):"esriGeometryPolygon"===t&&G(f,a,e.featureSet.features)})),e.groundOverlays&&e.groundOverlays.forEach((e=>{a.set(e.id,e)})),o.forEach((o=>{o.networkLinkIds.forEach((r=>{const s=P(r,o.id,e.networkLinks);s&&t.push(s)}))})),t.forEach((e=>{if(e.featureInfos){e.points=s(r.get("esriGeometryPoint")),e.polylines=s(r.get("esriGeometryPolyline")),e.polygons=s(r.get("esriGeometryPolygon")),e.mapImages=[];for(const o of e.featureInfos)switch(o.type){case"esriGeometryPoint":case"esriGeometryPolyline":case"esriGeometryPolygon":{const t=l[o.type].get(o.id);t&&e[c[o.type]].featureSet.features.push(t);break}case"GroundOverlay":{const t=a.get(o.id);t&&e.mapImages.push(t);break}}e.fullExtent=j([e])}}));const u=j(t);return{folders:o,sublayers:t,extent:u}}function g(t,s,i,f){const a=o&&o.findCredential(t);t=n(t,{token:a&&a.token});const l=e.kmlServiceUrl;return r(l,{query:{url:t,model:"simple",folders:"",refresh:0!==i||void 0,outSR:JSON.stringify(s)},responseType:"json",signal:f})}function S(e,o,t=null,r=[]){const s=[],n={},i=o.sublayers,f=o.folders.map((e=>e.id));return i.forEach((o=>{const i=new e;if(t?i.read(o,t):i.read(o),r.length&&f.includes(i.id)&&(i.visible=r.includes(i.id)),n[o.id]=i,null!=o.parentFolderId&&-1!==o.parentFolderId){const e=n[o.parentFolderId];e.sublayers||(e.sublayers=[]),e.sublayers.unshift(i)}else s.unshift(i)})),s}function G(e,o,t){t.forEach((t=>{e.set(t.attributes[o],t)}))}function h(e,o){let t;return o.some((o=>o.id===e&&(t=o,!0))),t}function P(e,o,t){const r=h(e,t);return r&&(r.parentFolderId=o,r.networkLink=r),r}async function b(e){const o=y.fromJSON(e.featureSet).features,r=e.layerDefinition,s=m(r.drawingInfo.renderer),n=t.fromJSON(e.popupInfo),i=[];for(const t of o){const e=await s.getSymbolAsync(t);t.symbol=e,t.popupTemplate=n,t.visible=!0,i.push(t)}return i}function j(e){const o=f(a),t=f(a);for(const r of e){if(r.polygons&&r.polygons.featureSet&&r.polygons.featureSet.features)for(const e of r.polygons.featureSet.features)p(o,e.geometry),l(t,o);if(r.polylines&&r.polylines.featureSet&&r.polylines.featureSet.features)for(const e of r.polylines.featureSet.features)p(o,e.geometry),l(t,o);if(r.points&&r.points.featureSet&&r.points.featureSet.features)for(const e of r.points.featureSet.features)p(o,e.geometry),l(t,o);if(r.mapImages)for(const e of r.mapImages)p(o,e.extent),l(t,o)}return u(t,a)?null:{xmin:t[0],ymin:t[1],zmin:t[2],xmax:t[3],ymax:t[4],zmax:t[5],spatialReference:i.WGS84}}export{j as computeExtent,g as fetchService,b as getGraphics,d as parseKML,S as sublayersFromJSON};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Error.js";import{isNone as r,isSome as i}from"../../../core/maybe.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../RasterInfo.js";import n from"../RasterStorageInfo.js";import l from"../TileInfo.js";import f from"./BaseRaster.js";import m from"./DBFParser.js";import{isTransformSupported as c,readTransform as p}from"../rasterTransforms/utils.js";import d from"../../../rest/support/FeatureSet.js";import u from"../../../geometry/SpatialReference.js";import h from"../../../geometry/Extent.js";import g from"../../../geometry/Point.js";const y=new Map;y.set("int16","esriFieldTypeSmallInteger"),y.set("int32","esriFieldTypeInteger"),y.set("int64","esriFieldTypeInteger"),y.set("float32","esriFieldTypeSingle"),y.set("float64","esriFieldTypeDouble"),y.set("text","esriFieldTypeString");const x=8;let S=class extends f{constructor(){super(...arguments),this.storageInfo=null,this.datasetFormat="CRF"}async open(e){await this.init();const{data:r}=await this.request(this.url+"/conf.json",{signal:e?.signal});if(!this._validateHeader(r))throw new t("cloudraster:open","Invalid or unsupported conf.json.");this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{storageInfo:i,rasterInfo:o}=this._parseHeader(r);if("thematic"===o.dataType){const e=await this._fetchAuxiliaryInformation();o.attributeTable=e}this._set("storageInfo",i),this._set("rasterInfo",o),this.ioConfig.retryCount=this.ioConfig.retryCount||0}async fetchRawTile(e,t,r,i={}){const{transposeInfo:o}=this.rasterInfo.storageInfo,{transposedVariableName:s}=i,a=!(!o||!s),n=a?0:this.rasterInfo.storageInfo.maximumPyramidLevel-e;if(n<0)return null;const l=this._buildCacheFilePath(n,t,r,i.multidimensionalDefinition,s),f=this._getIndexRecordFromBundle(t,r,a),m=await this.request(l,{range:{from:0,to:this.storageInfo.headerSize-1},responseType:"array-buffer",signal:i.signal});if(!m)return null;const c=new Uint8Array(m.data),p=this._getTileEndAndContentType(c,f);if(0===p.recordSize)return null;const d=await this.request(l,{range:{from:p.position,to:p.position+p.recordSize},responseType:"array-buffer",signal:i.signal});if(!d)return null;const[u,h]=this._getTileSize(a);return this.decodePixelBlock(d.data,{width:u,height:h,planes:null,pixelType:null,
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Error.js";import{isNone as r,isSome as i}from"../../../core/maybe.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../RasterInfo.js";import n from"../RasterStorageInfo.js";import l from"../TileInfo.js";import f from"./BaseRaster.js";import m from"./DBFParser.js";import{isTransformSupported as c,readTransform as p}from"../rasterTransforms/utils.js";import d from"../../../rest/support/FeatureSet.js";import u from"../../../geometry/SpatialReference.js";import h from"../../../geometry/Extent.js";import g from"../../../geometry/Point.js";const y=new Map;y.set("int16","esriFieldTypeSmallInteger"),y.set("int32","esriFieldTypeInteger"),y.set("int64","esriFieldTypeInteger"),y.set("float32","esriFieldTypeSingle"),y.set("float64","esriFieldTypeDouble"),y.set("text","esriFieldTypeString");const x=8;let S=class extends f{constructor(){super(...arguments),this.storageInfo=null,this.datasetFormat="CRF"}async open(e){await this.init();const{data:r}=await this.request(this.url+"/conf.json",{signal:e?.signal});if(!this._validateHeader(r))throw new t("cloudraster:open","Invalid or unsupported conf.json.");this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{storageInfo:i,rasterInfo:o}=this._parseHeader(r);if("thematic"===o.dataType){const e=await this._fetchAuxiliaryInformation();o.attributeTable=e}this._set("storageInfo",i),this._set("rasterInfo",o),this.ioConfig.retryCount=this.ioConfig.retryCount||0}async fetchRawTile(e,t,r,i={}){const{transposeInfo:o}=this.rasterInfo.storageInfo,{transposedVariableName:s}=i,a=!(!o||!s),n=a?0:this.rasterInfo.storageInfo.maximumPyramidLevel-e;if(n<0)return null;const l=this._buildCacheFilePath(n,t,r,i.multidimensionalDefinition,s),f=this._getIndexRecordFromBundle(t,r,a),m=await this.request(l,{range:{from:0,to:this.storageInfo.headerSize-1},responseType:"array-buffer",signal:i.signal});if(!m)return null;const c=new Uint8Array(m.data),p=this._getTileEndAndContentType(c,f);if(0===p.recordSize)return null;const d=await this.request(l,{range:{from:p.position,to:p.position+p.recordSize},responseType:"array-buffer",signal:i.signal});if(!d)return null;const[u,h]=this._getTileSize(a);return this.decodePixelBlock(d.data,{width:u,height:h,planes:null,pixelType:null,returnInterleaved:a})}_validateHeader(e){const t=["origin","extent","geodataXform","LODInfos","blockWidth","blockHeight","bandCount","pixelType","pixelSizeX","pixelSizeY","format","packetSize"];return e&&"RasterInfo"===e.type&&!t.some((t=>!e[t]))}_parseHeader(e){const t=["u1","u2","u4","u8","s8","u16","s16","u32","s32","f32","f64"][e.pixelType],{bandCount:r,histograms:i,colormap:o,blockWidth:s,blockHeight:f,firstPyramidLevel:m,maximumPyramidLevel:c}=e,p=e.statistics&&e.statistics.map((e=>({min:e.min,max:e.max,avg:e.mean,stddev:e.standardDeviation,median:e.median,mode:e.mode}))),d=e.extent.spatialReference,y=e.geodataXform?.spatialReference,S=new u(d?.wkid||d?.wkt?d:y);let I=new h({xmin:e.extent.xmin,ymin:e.extent.ymin,xmax:e.extent.xmax,ymax:e.extent.ymax,spatialReference:S});const w=new g({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:S}),_=Math.round((I.xmax-I.xmin)/w.x),v=Math.round((I.ymax-I.ymin)/w.y),b=this._parseTransform(e.geodataXform),z=b?I:null;b&&(I=b.forwardTransform(I),w.x=(I.xmax-I.xmin)/_,w.y=(I.ymax-I.ymin)/v);const T=e.properties??{},k=e.format.toLowerCase().replace("cache/",""),j=new g(e.origin.x,e.origin.y,S);let C,R,F,P;if(o&&o.colors)for(C=[],R=0;R<o.colors.length;R++)F=o.colors[R],P=o.values?o.values[R]:R,C.push([P,255&F,F<<16>>>24,F<<8>>>24,F>>>24]);const H=e.LODInfos,D=[];for(R=0;R<H.levels.length;R++)D.push({level:H.levels[R],resolution:H.resolutions[R],scale:96/.0254*H.resolutions[R]});const L=new l({dpi:96,lods:D,format:k,origin:j,size:[s,f],spatialReference:S}),M={recordSize:x,packetSize:e.packetSize,headerSize:e.packetSize*e.packetSize*x+64},B=[{maxCol:Math.ceil(_/s)-1,maxRow:Math.ceil(v/f)-1,minCol:0,minRow:0}];let O=2;if(c>0)for(R=0;R<c;R++)B.push({maxCol:Math.ceil(_/O/s)-1,maxRow:Math.ceil(v/O/f)-1,minCol:0,minRow:0}),O*=2;const $=e.mdInfo;let N=null;if($&&T._yxs){const e=T._yxs;N={packetSize:e.PacketSize,tileSize:[e.TileXSize,e.TileYSize]}}return{storageInfo:M,rasterInfo:new a({width:_,height:v,pixelType:t,bandCount:r,extent:I,nativeExtent:z,transform:b,spatialReference:S,pixelSize:w,keyProperties:T,statistics:p,histograms:i,multidimensionalInfo:$,colormap:C,storageInfo:new n({blockWidth:s,blockHeight:f,pyramidBlockWidth:s,pyramidBlockHeight:f,origin:j,tileInfo:L,transposeInfo:N,firstPyramidLevel:m,maximumPyramidLevel:c,blockBoundary:B})})}}_parseTransform(e){if(!c(e))throw new t("cloudraster:open","the data contains unsupported geodata transform types");const r=p(e);if("identity"===r.type)return null;if("polynomial"!==r.type||!r.forwardCoefficients?.length||!r.inverseCoefficients?.length)throw new t("cloudraster:open","the data contains unsupported geodata transforms - both forward and inverse coefficients are required currently");return r}async _fetchAuxiliaryInformation(e){const t=this.request(this.url+"/conf.vat.json",{signal:e}).then((e=>e.data)).catch((()=>null)),r=this.request(this.url+"/conf.vat.dbf",{responseType:"array-buffer",signal:e}).then((e=>e.data)).catch((()=>null)),i=await Promise.all([t,r]);let o;if(i[0]){let e=i[0].fields;const t=i[0].values;if(e&&t){e=e.map((e=>({type:"OID"===e.name?"esriFieldTypeOID":y.get(e.type),name:e.name,alias:e.alias||e.name})));const r=t.map((e=>({attributes:e})));e&&t&&(o={fields:e,features:r})}}if(!o&&i[1]){o=m.parse(i[1]).recordSet}return d.fromJSON(o)}_buildCacheFilePath(e,t,i,o,s){const a=this._getPackageSize(!!s),n=Math.floor(t/a)*a,l=Math.floor(i/a)*a,f="R"+this._toHexString4(n)+"C"+this._toHexString4(l);let m="L";m+=e>=10?e.toString():"0"+e.toString();const{multidimensionalInfo:c}=this.rasterInfo,p=o?.[0];if(r(c)||!p)return`${this.url}/_alllayers/${m}/${f}.bundle`;let d="_yxs";if(!s){d=c.variables.find((e=>e.name===p.variableName)).dimensions[0].values.indexOf(p.values[0]).toString(16);const e=4-d.length;for(let t=0;t<e;t++)d="0"+d;d="S"+d}const u=this._getVariableFolderName(s||p.variableName);return`${this.url}/_alllayers/${u}/${d}/${m}/${f}.bundle`}_getPackageSize(e=!1){const{transposeInfo:t}=this.rasterInfo.storageInfo;return e&&i(t)?t.packetSize:this.storageInfo.packetSize}_getTileSize(e=!1){const{storageInfo:t}=this.rasterInfo,{transposeInfo:r}=t;return e&&i(r)?r.tileSize:t.tileInfo.size}_getVariableFolderName(e){return""===(e=e.trim())?"_v":e.replace(/[\{|\}\-]/g,"_").replace("\\*","_v")}_getIndexRecordFromBundle(e,t,r=!1){const i=this._getPackageSize(r),o=i*(e%i)+t%i;if(o<0)throw"Invalid level / row / col";return 20+o*this.storageInfo.recordSize+44}_getTileEndAndContentType(e,t){const r=e.subarray(t,t+8);let i,o=0;for(i=0;i<5;i++)o|=(255&r[i])<<8*i;const s=0xffffffffff&o;for(o=0,i=5;i<8;i++)o|=(255&r[i])<<8*(i-5);return{position:s,recordSize:0xffffffffff&o}}_toHexString4(e){let t=e.toString(16);if(4!==t.length){let e=4-t.length;for(;e-- >0;)t="0"+t}return t}};e([o({readOnly:!0})],S.prototype,"storageInfo",void 0),e([o({type:String,json:{write:!0}})],S.prototype,"datasetFormat",void 0),S=e([s("esri.layers.support.rasterDatasets.CloudRaster")],S);const I=S;export{I 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class t{constructor(t=15e3,e=5e3){this._timer=null,this._cachedBlocks=new Map,this._size=-1,this._duration=t,this._interval=Math.min(t,e)}decreaseRefCount(t,e){const s=t+"/"+e,r=this._cachedBlocks;if(r.has(s)){const t=r.get(s);return t.refCount--,t.refCount<=0&&(r.delete(s),t.controller&&t.controller.abort()),t.refCount}return 0}getBlock(t,e){const s=t+"/"+e,r=this._cachedBlocks;if(r.has(s)){const t=r.get(s);return t.ts=Date.now(),t.refCount++,r.delete(s),r.set(s,t),t.block}return null}putBlock(t,e,s,r
|
|
5
|
+
class t{constructor(t=15e3,e=5e3){this._timer=null,this._cachedBlocks=new Map,this._size=-1,this._duration=t,this._interval=Math.min(t,e)}decreaseRefCount(t,e){const s=t+"/"+e,r=this._cachedBlocks;if(r.has(s)){const t=r.get(s);return t.refCount--,t.refCount<=0&&(r.delete(s),t.controller&&t.controller.abort()),t.refCount}return 0}getBlock(t,e){const s=t+"/"+e,r=this._cachedBlocks;if(r.has(s)){const t=r.get(s);return t.ts=Date.now(),t.refCount++,r.delete(s),r.set(s,t),t.block}return null}putBlock(t,e,s,r){const i=this._cachedBlocks,c=t+"/"+e;if(i.has(c)){const t=i.get(c);t.ts=Date.now(),t.refCount++}else i.set(c,{block:s,ts:Date.now(),refCount:1,controller:r});this._trim(),this._updateTimer()}deleteBlock(t,e){const s=this._cachedBlocks,r=t+"/"+e;s.has(r)&&s.delete(r)}updateMaxSize(t){this._size=t,this._trim()}empty(){this._cachedBlocks.clear(),this._clearTimer()}getCurrentSize(){return this._cachedBlocks.size}_updateTimer(){if(null!=this._timer)return;const t=this._cachedBlocks;this._timer=setInterval((()=>{const e=Array.from(t),s=Date.now();for(let r=0;r<e.length&&e[r][1].ts<=s-this._duration;r++)t.delete(e[r][0]);0===t.size&&this._clearTimer()}),this._interval)}_trim(){const t=this._cachedBlocks;if(-1===this._size||this._size>=t.size)return;const e=Array.from(t);for(let s=0;s<e.length-this._size;s++)t.delete(e[s][0])}_clearTimer(){null!=this._timer&&(clearInterval(this._timer),this._timer=null)}}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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Error.js";import{isNone as i,isSome as s,unwrap as r}from"../../../core/maybe.js";import{urlToObject as a}from"../../../core/urlUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import n from"../RasterInfo.js";import c from"../RasterStorageInfo.js";import{readServiceTileInfo as m}from"../serviceTileInfoProperty.js";import h from"../TileInfo.js";import{TilemapCache as f}from"../TilemapCache.js";import p from"./BaseRaster.js";import{setValidBoundary as u}from"../rasterFunctions/pixelUtils.js";import y from"../rasterTransforms/GCSShiftTransform.js";import{fetchServiceRasterInfo as d}from"../../../rest/imageService/fetchRasterInfo.js";import x from"../../../geometry/SpatialReference.js";import g from"../../../geometry/Point.js";import v from"../../../geometry/Extent.js";let S=class extends p{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer"}async open(e){await this.init();const s=e&&e.signal,r=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:s});r.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const l=r.data;if(this.sourceJSON=l,!l)throw new t("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!l.tileInfo)throw new t("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();const o=["jpg","jpeg","png","png8","png24","png32","mixed"];this.tileType=l.cacheType,null==this.tileType&&(o.includes(l.tileInfo.format.toLowerCase())?this.tileType="Map":"lerc"===l.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=l.name?.slice(l.name.indexOf("/")+1)??"";const n=await this._fetchRasterInfo({signal:s});if(i(n))throw new t("image-server-raster:open","cannot initialize image service");const p="Map"===this.tileType?m(l.tileInfo,l):h.fromJSON(l.tileInfo),[u,y]=this._computeMinMaxLOD(n,p),{extent:d,pixelSize:x}=n,g=.5/n.width*x.x,v=Math.max(x.x,x.y),{lods:S}=p;("Map"!==this.tileType&&0!==l.maxScale||Math.abs(x.x-x.y)>g||!S.some((e=>Math.abs(e.resolution-v)<g)))&&(x.x=x.y=u.resolution,n.width=Math.ceil((d.xmax-d.xmin)/x.x-.1),n.height=Math.ceil((d.ymax-d.ymin)/x.y-.1));const I=u.level-y.level,[w,j]=p.size,b=[];S.forEach((e=>{e.level>=y.level&&e.level<=u.level&&b.push({x:e.resolution,y:e.resolution})})),b.sort(((e,t)=>e.x-t.x));const T=this.computeBlockBoundary(d,w,j,p.origin,b,I),_=b.length>1?b.slice(1):null;let M;if(l.transposeInfo&&(M={tileSize:[l.transposeInfo.rows,l.transposeInfo.cols],packetSize:n.keyProperties?._yxs.PacketSize??0}),n.storageInfo=new c({blockWidth:p.size[0],blockHeight:p.size[1],pyramidBlockWidth:p.size[0],pyramidBlockHeight:p.size[1],pyramidResolutions:_,compression:p.format,origin:p.origin,firstPyramidLevel:1,maximumPyramidLevel:I,tileInfo:p,transposeInfo:M,blockBoundary:T}),this._fixGCSShift(n),this._set("rasterInfo",n),l.capabilities.toLowerCase().includes("tilemap")){const e={tileInfo:n.storageInfo.tileInfo,parsedUrl:a(this.url),url:this.url,tileServers:[],type:"tile"};this._tilemapCache=new f({layer:e})}}async fetchRawTile(e,t,i,r={}){const{storageInfo:a,extent:l}=this.rasterInfo,{transposeInfo:o}=a,n=s(o)&&!!r.transposedVariableName;if(this._slices&&!n&&null==r.sliceId)return null;const c=n?0:a.maximumPyramidLevel-e+this._levelOffset,m=`${this.url}/tile/${c}/${t}/${i}`,h=this._slices?n?{variable:r.transposedVariableName}:{sliceId:r.sliceId||0}:null,{data:f}=await this.request(m,{query:h,responseType:"array-buffer",signal:r.signal});if(!f)return null;const p=n?o.tileSize:a.tileInfo.size,y=await this.decodePixelBlock(f,{width:p[0],height:p[1],planes:null,pixelType:null,isPoint:"Elevation"===this.tileType,
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Error.js";import{isNone as i,isSome as s,unwrap as r}from"../../../core/maybe.js";import{urlToObject as a}from"../../../core/urlUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import n from"../RasterInfo.js";import c from"../RasterStorageInfo.js";import{readServiceTileInfo as m}from"../serviceTileInfoProperty.js";import h from"../TileInfo.js";import{TilemapCache as f}from"../TilemapCache.js";import p from"./BaseRaster.js";import{setValidBoundary as u}from"../rasterFunctions/pixelUtils.js";import y from"../rasterTransforms/GCSShiftTransform.js";import{fetchServiceRasterInfo as d}from"../../../rest/imageService/fetchRasterInfo.js";import x from"../../../geometry/SpatialReference.js";import g from"../../../geometry/Point.js";import v from"../../../geometry/Extent.js";let S=class extends p{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer"}async open(e){await this.init();const s=e&&e.signal,r=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:s});r.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const l=r.data;if(this.sourceJSON=l,!l)throw new t("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!l.tileInfo)throw new t("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();const o=["jpg","jpeg","png","png8","png24","png32","mixed"];this.tileType=l.cacheType,null==this.tileType&&(o.includes(l.tileInfo.format.toLowerCase())?this.tileType="Map":"lerc"===l.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=l.name?.slice(l.name.indexOf("/")+1)??"";const n=await this._fetchRasterInfo({signal:s});if(i(n))throw new t("image-server-raster:open","cannot initialize image service");const p="Map"===this.tileType?m(l.tileInfo,l):h.fromJSON(l.tileInfo),[u,y]=this._computeMinMaxLOD(n,p),{extent:d,pixelSize:x}=n,g=.5/n.width*x.x,v=Math.max(x.x,x.y),{lods:S}=p;("Map"!==this.tileType&&0!==l.maxScale||Math.abs(x.x-x.y)>g||!S.some((e=>Math.abs(e.resolution-v)<g)))&&(x.x=x.y=u.resolution,n.width=Math.ceil((d.xmax-d.xmin)/x.x-.1),n.height=Math.ceil((d.ymax-d.ymin)/x.y-.1));const I=u.level-y.level,[w,j]=p.size,b=[];S.forEach((e=>{e.level>=y.level&&e.level<=u.level&&b.push({x:e.resolution,y:e.resolution})})),b.sort(((e,t)=>e.x-t.x));const T=this.computeBlockBoundary(d,w,j,p.origin,b,I),_=b.length>1?b.slice(1):null;let M;if(l.transposeInfo&&(M={tileSize:[l.transposeInfo.rows,l.transposeInfo.cols],packetSize:n.keyProperties?._yxs.PacketSize??0}),n.storageInfo=new c({blockWidth:p.size[0],blockHeight:p.size[1],pyramidBlockWidth:p.size[0],pyramidBlockHeight:p.size[1],pyramidResolutions:_,compression:p.format,origin:p.origin,firstPyramidLevel:1,maximumPyramidLevel:I,tileInfo:p,transposeInfo:M,blockBoundary:T}),this._fixGCSShift(n),this._set("rasterInfo",n),l.capabilities.toLowerCase().includes("tilemap")){const e={tileInfo:n.storageInfo.tileInfo,parsedUrl:a(this.url),url:this.url,tileServers:[],type:"tile"};this._tilemapCache=new f({layer:e})}}async fetchRawTile(e,t,i,r={}){const{storageInfo:a,extent:l}=this.rasterInfo,{transposeInfo:o}=a,n=s(o)&&!!r.transposedVariableName;if(this._slices&&!n&&null==r.sliceId)return null;const c=n?0:a.maximumPyramidLevel-e+this._levelOffset,m=`${this.url}/tile/${c}/${t}/${i}`,h=this._slices?n?{variable:r.transposedVariableName}:{sliceId:r.sliceId||0}:null,{data:f}=await this.request(m,{query:h,responseType:"array-buffer",signal:r.signal});if(!f)return null;const p=n?o.tileSize:a.tileInfo.size,y=await this.decodePixelBlock(f,{width:p[0],height:p[1],planes:null,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:n}),d=a.blockBoundary[e];if("jpg"!==a.compression||i>d.minCol&&i<d.maxCol&&t>d.minRow&&t<d.maxRow)return y;const{origin:x,blockWidth:g,blockHeight:v}=a,{x:S,y:I}=this.getPyramidPixelSize(e),w=Math.round((l.xmin-x.x)/S)%g,j=Math.round((l.xmax-x.x)/S)%g||g,b=Math.round((x.y-l.ymax)/I)%v,T=Math.round((x.y-l.ymin)/I)%v||v,_=i===d.minCol?w:0,M=t===d.minRow?b:0,R=i===d.maxCol?j:g,z=t===d.maxRow?T:v;return u(y,{x:_,y:M},{width:R-_,height:z-M}),y}getSliceIndex(e){if(!this._slices||i(e)||0===e.length)return null;const t=e;for(let i=0;i<this._slices.length;i++){const e=this._slices[i].multidimensionalDefinition;if(e.length===t.length&&!e.some((e=>{const i=t.find((t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName));if(!i)return!0;return(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])})))return i}return null}async fetchVariableStatisticsHistograms(e,t){const i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.statistics)),s=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.histograms)),r=await Promise.all([i,s]);return r[0]&&r[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:r[0]||null,histograms:r[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,r(t.datumTransformation));if(null===i)return null;let s=0;const{maximumPyramidLevel:a}=this.rasterInfo.storageInfo;let l=a-s+this._levelOffset;const o=i.srcLocation;for(;l>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(l,i.row,i.col,t))break}catch{}if(l--,s++,i=this.identifyPixelLocation(o,s,r(t.datumTransformation)),null===i)return null}return-1===l||null==i?null:s}async _fetchRasterInfo(e){const t=this.sourceJSON;if("Map"===this.tileType){const e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),s=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),r=x.fromJSON(t.spatialReference||e.spatialReference),a=new g({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:r});return new n({width:i,height:s,bandCount:3,extent:v.fromJSON(e),spatialReference:r,pixelSize:a,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:i}=e,s=d(this.url,this.sourceJSON,{signal:i,query:this.ioConfig.customFetchParameters}),r=t.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:i}).then((e=>e.data&&e.data.slices)).catch((()=>null)):null,a=await Promise.all([s,r]);return this._slices=a[1],a[0]}_fixScaleInServiceInfo(){const{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_fixGCSShift(e){const{extent:t,spatialReference:i}=e;0===t.xmin&&360===t.xmax&&i.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new y,e.extent=e.transform.forwardTransform(t))}_computeMinMaxLOD(e,t){const{pixelSize:i}=e,s=.5/e.width*i.x,{lods:r}=t,a=t.lodAt(Math.max.apply(null,r.map((e=>e.level)))),l=t.lodAt(Math.min.apply(null,r.map((e=>e.level)))),{tileType:o}=this;if("Map"===o)return this._levelOffset=r[0].level,[a,l];if("Raster"===o){return[r.find((e=>e.resolution===i.x))??a,l]}const{minScale:n,maxScale:c}=this.sourceJSON;let m=a;c>0&&(m=r.find((e=>Math.abs(e.scale-c)<s)),m||(m=r.filter((e=>e.scale>c)).sort(((e,t)=>e.scale>t.scale?1:-1))[0]??a));let h=l;return n>0&&(h=r.find((e=>Math.abs(e.scale-n)<s))??l,this._levelOffset=h.level-l.level),[m,h]}};e([l({type:String,json:{write:!0}})],S.prototype,"datasetFormat",void 0),e([l()],S.prototype,"tileType",void 0),S=e([o("esri.layers.support.rasterDatasets.ImageServerRaster")],S);const I=S;export{I 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const t=5e4;function n(t){const n=o(t);if(!n)return{isMultipart:!1,data:null};return{isMultipart:!0,data:n.boundary?r(t.data,n,0):null}}function e(t){const n=new Uint8Array(t,0,2e3),e=String.fromCharCode.apply(null,n),r=e.indexOf('boundary="'),o=-1!==r?e.slice(r+10,e.indexOf('"',r+10)):"";return{boundary:o,offset:-1!==r?r+12+o.length:0}}function r(n,e,r=0){const o="--"+e.boundary,a=[];for(let t=0;t<o.length;t++)a.push(o.charCodeAt(t));const s=[],l="\n--"+e.boundary+"--";for(let t=0;t<l.length;t++)s.push(l.charCodeAt(t));const c=[10],f=[13,10],u=[],h=a.length,g=new Uint8Array(n,r),d=Math.min(t,g.length-h);let p=0,y=0;for(let t=0;t<d;t++){for(y=0;y<h&&g[t+y]===a[y];y++);y===h&&(p&&u.push(i(g.subarray(p,t),e)),t+=h-1,g[t+1]===c[0]?t+=1:g[t+1]===f[0]&&g[t+2]===f[1]&&(t+=2),p=t+1)}const b=s.length;for(let t=g.length-b-10;t<g.length-b;t++){for(y=0;y<b&&g[t+y]===s[y];y++);if(y===b){u.push(i(g.subarray(p,t),e));break}}return u}function o(t){const n=t.getHeader("Content-Type")?.split(";");if(!(n?.[0].trim()??"").startsWith("multipart/"))return null;const e={boundary:"",start:"",type:""};for(let r=1;r<n.length;r++){const t=n[r].indexOf("=");if(t>0){const o=n[r].slice(0,t).trim(),i=n[r].slice(t+1).trim();e[o]=i.startsWith('"')?i.slice(1,i.length-1):i}}return e}function i(t,n){const e=String.fromCharCode.apply(null,t.subarray(0,Math.min(300,t.length))).split("\n"),r=Math.min(e.length,7),o={contentDisposition:"inline"};let i=0;for(let a=0;a<r;a++)if(e[a].length<4)i=i+e[a].length+1;else if("content"===e[a].slice(0,7).toLowerCase()){if(i=i+e[a].length+1,!e[a].includes(":"))continue;const t=e[a].substring(0,e[a].indexOf(":")).trim(),n=e[a].substring(e[a].indexOf(":")+1).trim();switch(t.toLowerCase()){case"content-type":o.contentType=n;break;case"content-description":o.contentDescription=n;break;case"content-transfer-encoding":o.contentTransferEncoding=n;break;case"content-id":o.contentID=n;break;case"content-disposition":o.contentDisposition=n;break;case"content-location":o.contentLocation=n}}else{if(o.contentDisposition.toLowerCase().includes("inline")&&e[a].length>=4&&o.contentType?.toLowerCase().indexOf("image")>-1){let n=!0,e=t.subarray(i,t.length);if(o.contentType.toLowerCase().indexOf("tif")>0){if("base64"===o.contentTransferEncoding){let t="";const n=e;for(let e=0;e<n.length;e+=65535){const r=n.subarray(e,e+65535>n.length-1?n.length-1:e+65535);t+=String.fromCharCode.apply(null,r)}const r=atob(t);e=new Uint8Array(r.length);for(let o=0;o<e.length;o++)e[o]=r.charCodeAt(o)}n=73===e[0]&&73===e[1]||77===e[0]&&77===e[1]}if(n){let n=e.buffer;"base64"!==o.contentTransferEncoding&&(n=new ArrayBuffer(t.length-i),e=new Uint8Array(n),e.set(t.subarray(i,t.length))),o.contentData=n}break}if((""===n.start||o.contentID===n.start)&&o.contentType){if(o.contentType.includes("text")||o.contentType.includes("xml")){o.contentData=String.fromCharCode.apply(null,t.subarray(i,t.length));break}o.contentData=t.subarray(i,t.length)}}return o}export{e as getBoundary,n as parse};
|
|
5
|
+
const t=5e4;function n(t){const n=o(t);if(!n)return{isMultipart:!1,data:null};return{isMultipart:!0,data:n.boundary?r(t.data,n,0):null}}function e(t){const n=new Uint8Array(t,0,2e3),e=String.fromCharCode.apply(null,n),r=e.indexOf('boundary="'),o=-1!==r?e.slice(r+10,e.indexOf('"',r+10)):"";return{boundary:o,offset:-1!==r?r+12+o.length:0}}function r(n,e,r=0){const o="--"+e.boundary,a=[];for(let t=0;t<o.length;t++)a.push(o.charCodeAt(t));const s=[],l="\n--"+e.boundary+"--";for(let t=0;t<l.length;t++)s.push(l.charCodeAt(t));const c=[10],f=[13,10],u=[],h=a.length,g=new Uint8Array(n,r),d=Math.min(t,g.length-h);let p=0,y=0;for(let t=0;t<d;t++){for(y=0;y<h&&g[t+y]===a[y];y++);y===h&&(p&&u.push(i(g.subarray(p,t),e)),t+=h-1,g[t+1]===c[0]?t+=1:g[t+1]===f[0]&&g[t+2]===f[1]&&(t+=2),p=t+1)}const b=s.length;for(let t=g.length-b-10;t<g.length-b;t++){for(y=0;y<b&&g[t+y]===s[y];y++);if(y===b){u.push(i(g.subarray(p,t),e));break}}return u}function o(t){const n=t.getHeader?.("Content-Type")?.split(";");if(!(n?.[0].trim()??"").startsWith("multipart/"))return null;const e={boundary:"",start:"",type:""};for(let r=1;r<n.length;r++){const t=n[r].indexOf("=");if(t>0){const o=n[r].slice(0,t).trim(),i=n[r].slice(t+1).trim();e[o]=i.startsWith('"')?i.slice(1,i.length-1):i}}return e}function i(t,n){const e=String.fromCharCode.apply(null,t.subarray(0,Math.min(300,t.length))).split("\n"),r=Math.min(e.length,7),o={contentDisposition:"inline"};let i=0;for(let a=0;a<r;a++)if(e[a].length<4)i=i+e[a].length+1;else if("content"===e[a].slice(0,7).toLowerCase()){if(i=i+e[a].length+1,!e[a].includes(":"))continue;const t=e[a].substring(0,e[a].indexOf(":")).trim(),n=e[a].substring(e[a].indexOf(":")+1).trim();switch(t.toLowerCase()){case"content-type":o.contentType=n;break;case"content-description":o.contentDescription=n;break;case"content-transfer-encoding":o.contentTransferEncoding=n;break;case"content-id":o.contentID=n;break;case"content-disposition":o.contentDisposition=n;break;case"content-location":o.contentLocation=n}}else{if(o.contentDisposition.toLowerCase().includes("inline")&&e[a].length>=4&&o.contentType?.toLowerCase().indexOf("image")>-1){let n=!0,e=t.subarray(i,t.length);if(o.contentType.toLowerCase().indexOf("tif")>0){if("base64"===o.contentTransferEncoding){let t="";const n=e;for(let e=0;e<n.length;e+=65535){const r=n.subarray(e,e+65535>n.length-1?n.length-1:e+65535);t+=String.fromCharCode.apply(null,r)}const r=atob(t);e=new Uint8Array(r.length);for(let o=0;o<e.length;o++)e[o]=r.charCodeAt(o)}n=73===e[0]&&73===e[1]||77===e[0]&&77===e[1]}if(n){let n=e.buffer;"base64"!==o.contentTransferEncoding&&(n=new ArrayBuffer(t.length-i),e=new Uint8Array(n),e.set(t.subarray(i,t.length))),o.contentData=n}break}if((""===n.start||o.contentID===n.start)&&o.contentType){if(o.contentType.includes("text")||o.contentType.includes("xml")){o.contentData=String.fromCharCode.apply(null,t.subarray(i,t.length));break}o.contentData=t.subarray(i,t.length)}}return o}export{e as getBoundary,n as parse};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../core/Error.js";import{isAborted as e,createAbortError as a}from"../../../core/promiseUtils.js";import{Z as n}from"../../../chunks/Zlib.js";class i{constructor(t){t&&(this._canvas=t.canvas,this._ctx=t.ctx||t.canvas&&t.canvas.getContext("2d"))}decode(n,r
|
|
5
|
+
import t from"../../../core/Error.js";import{isAborted as e,createAbortError as a}from"../../../core/promiseUtils.js";import{Z as n}from"../../../chunks/Zlib.js";class i{constructor(t){this._canvas=null,this._ctx=null,t&&(this._canvas=t.canvas,this._ctx=t.ctx||t.canvas&&t.canvas.getContext("2d"))}decode(n,s,r){if(!n||n.byteLength<10)throw new t("imagecanvasdecoder: decode","required a valid encoded data as input.");let{width:c=0,height:h=0,format:o}=s;const{applyJpegMask:l}=s;if(l&&(!c||!h))throw new t("imagecanvasdecoder: decode","image width and height are needed to apply jpeg mask directly to canvas");return new Promise(((t,d)=>{let g=null;"jpg"===o&&l&&(g=i._getMask(n,{width:c,height:h}));const w=new Blob([new Uint8Array(n)],{type:"image/"+o=="jpg"?"jpeg":o}),v=URL.createObjectURL(w),m=new Image;let _;m.src=v,m.onload=()=>{if(URL.revokeObjectURL(v),e(r))return void d(a());c=m.width,h=m.height,this._canvas&&this._ctx?(this._canvas.width===c&&this._canvas.height===h||(this._canvas.width=c,this._canvas.height=h),this._ctx.clearRect(0,0,c,h)):(this._canvas=document.createElement("canvas"),this._canvas.width=c,this._canvas.height=h,this._ctx=this._canvas.getContext("2d")),this._ctx.drawImage(m,0,0);const n=this._ctx.getImageData(0,0,c,h);let i;if(_=n.data,s.renderOnCanvas){if(g)for(i=0;i<g.length;i++)g[i]?_[4*i+3]=255:_[4*i+3]=0;return this._ctx.putImageData(n,0,0),void t(null)}const o=c*h,l=new Uint8Array(o),w=new Uint8Array(o),p=new Uint8Array(o);if(g)for(i=0;i<o;i++)l[i]=_[4*i],w[i]=_[4*i+1],p[i]=_[4*i+2];else for(g=new Uint8Array(o),i=0;i<o;i++)l[i]=_[4*i],w[i]=_[4*i+1],p[i]=_[4*i+2],g[i]=_[4*i+3];t({width:c,height:h,pixels:[l,w,p],mask:g,pixelType:"u8"})},m.onerror=()=>{URL.revokeObjectURL(v),d("cannot load image")}}))}static _getMask(t,e){let a=null;try{const i=new Uint8Array(t),s=Math.ceil(i.length/2);let r=0;const c=i.length-2;for(r=s;r<c&&(255!==i[r]||217!==i[r+1]);r++);if(r+=2,r<i.length-1){const t=new n(i.subarray(r)).getBytes();a=new Uint8Array(e.width*e.height);let s=0;for(let e=0;e<t.length;e++)for(let n=7;n>=0;n--)a[s++]=t[e]>>n&1}}catch(i){}return a}}export{i 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{J as t}from"../../../chunks/Jpg.js";import{Z as e}from"../../../chunks/Zlib.js";class
|
|
5
|
+
import{J as t}from"../../../chunks/Jpg.js";import{Z as e}from"../../../chunks/Zlib.js";class r{static decode(r,n=!1){const s=new Uint8Array(r),o=new t;o.parse(s);const{width:a,height:i,numComponents:h,eof:l}=o,f=o.getData(a,i,!0),c=a*i;let g,p=null,u=0,m=0,w=0;if(!n&&l<s.length-1)try{const t=new e(s.subarray(l)).getBytes();p=new Uint8Array(c);let r=0;for(u=0;u<t.length;u++)for(w=7;w>=0;w--)p[r++]=t[u]>>w&1}catch{}if(1===h&&f.length===a*i)g=[f,f,f];else{for(g=[],u=0;u<3;u++)g.push(new Uint8Array(c));for(w=0,m=0;m<c;m++)for(u=0;u<3;u++)g[u][m]=f[w++]}return{width:a,height:i,pixels:g,mask:p}}}export{r 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getAssetUrl as e}from"../../../assets.js";const t=[{pixelType:"S8",size:1,ctor:Int8Array,range:[-128,128]},{pixelType:"U8",size:1,ctor:Uint8Array,range:[0,255]},{pixelType:"S16",size:2,ctor:Int16Array,range:[-32768,32767]},{pixelType:"U16",size:2,ctor:Uint16Array,range:[0,65536]},{pixelType:"S32",size:4,ctor:Int32Array,range:[-2147483648,2147483647]},{pixelType:"U32",size:4,ctor:Uint32Array,range:[0,4294967296]},{pixelType:"F32",size:4,ctor:Float32Array,range:[-34027999387901484e22,34027999387901484e22]},{pixelType:"F64",size:8,ctor:Float64Array,range:[-17976931348623157e292,17976931348623157e292]}];let n=null,r=!1;function a(){return n||(n=import("../../../chunks/lerc-wasm.js").then((e=>e.l)).then((({default:t})=>t({locateFile:t=>e(`esri/layers/support/rasterFormats/${t}`)}))).then((e=>{u(e),r=!0})),n)}function
|
|
5
|
+
import{getAssetUrl as e}from"../../../assets.js";const t=[{pixelType:"S8",size:1,ctor:Int8Array,range:[-128,128]},{pixelType:"U8",size:1,ctor:Uint8Array,range:[0,255]},{pixelType:"S16",size:2,ctor:Int16Array,range:[-32768,32767]},{pixelType:"U16",size:2,ctor:Uint16Array,range:[0,65536]},{pixelType:"S32",size:4,ctor:Int32Array,range:[-2147483648,2147483647]},{pixelType:"U32",size:4,ctor:Uint32Array,range:[0,4294967296]},{pixelType:"F32",size:4,ctor:Float32Array,range:[-34027999387901484e22,34027999387901484e22]},{pixelType:"F64",size:8,ctor:Float64Array,range:[-17976931348623157e292,17976931348623157e292]}];let n=null,r=!1;function a(){return n||(n=import("../../../chunks/lerc-wasm.js").then((e=>e.l)).then((({default:t})=>t({locateFile:t=>e(`esri/layers/support/rasterFormats/${t}`)}))).then((e=>{u(e),r=!0})),n)}function o(){return r}const l={getBlobInfo:null,decode:null};function s(e){return 16+(e>>3<<3)}function i(e,t,n){n.set(e.slice(t,t+n.length))}function u(e){const{_malloc:n,_free:r,_lerc_getBlobInfo:a,_lerc_getDataRanges:o,_lerc_decode_4D:u,asm:f}=e;let c;const h=Object.values(f).find((t=>t&&"buffer"in t&&t.buffer===e.HEAPU8.buffer)),y=e=>{const t=e.map((e=>s(e))),r=t.reduce(((e,t)=>e+t)),a=n(r);c=new Uint8Array(h.buffer);let o=t[0];t[0]=a;for(let n=1;n<t.length;n++){const e=t[n];t[n]=t[n-1]+o,o=e}return t};l.getBlobInfo=e=>{const t=12,n=3,l=new Uint8Array(4*t),s=new Uint8Array(8*n),[u,f,p]=y([e.length,l.length,s.length]);c.set(e,u),c.set(l,f),c.set(s,p);let g=a(u,e.length,f,p,t,n);if(g)throw r(u),`lerc-getBlobInfo: error code is ${g}`;c=new Uint8Array(h.buffer),i(c,f,l),i(c,p,s);const d=new Uint32Array(l.buffer),b=new Float64Array(s.buffer),[A,w,,m,U,x,C,T,V,z,F]=d,I={version:A,depthCount:z,width:m,height:U,validPixelCount:C,bandCount:x,blobSize:T,maskCount:V,dataType:w,minValue:b[0],maxValue:b[1],maxZerror:b[2],statistics:[],bandCountWithNoData:F};if(F)return I;if(1===z&&1===x)return r(u),I.statistics.push({minValue:b[0],maxValue:b[1]}),I;const D=z*x*8,_=new Uint8Array(D),k=new Uint8Array(D);let B=u,S=0,v=0,O=!1;if(c.byteLength<u+2*D?(r(u),O=!0,[B,S,v]=y([e.length,D,D]),c.set(e,B)):[S,v]=y([D,D]),c.set(_,S),c.set(k,v),g=o(B,e.length,z,x,S,v),g)throw r(B),O||r(S),`lerc-getDataRanges: error code is ${g}`;c=new Uint8Array(h.buffer),i(c,S,_),i(c,v,k);const $=new Float64Array(_.buffer),j=new Float64Array(k.buffer),M=I.statistics;for(let r=0;r<x;r++)if(z>1){const e=$.slice(r*z,(r+1)*z),t=j.slice(r*z,(r+1)*z),n=Math.min.apply(null,e),a=Math.max.apply(null,t);M.push({minValue:n,maxValue:a,depthStats:{minValues:e,maxValues:t}})}else M.push({minValue:$[r],maxValue:j[r]});return r(B),O||r(S),I},l.decode=(e,n)=>{const{maskCount:a,depthCount:o,bandCount:l,width:s,height:f,dataType:p,bandCountWithNoData:g}=n,d=t[p],b=s*f,A=new Uint8Array(b*l),w=b*o*l*d.size,m=new Uint8Array(w),U=new Uint8Array(l),x=new Uint8Array(8*l),[C,T,V,z,F]=y([e.length,A.length,m.length,U.length,x.length]);c.set(e,C),c.set(A,T),c.set(m,V),c.set(U,z),c.set(x,F);const I=u(C,e.length,a,T,o,s,f,l,p,V,z,F);if(I)throw r(C),`lerc-decode: error code is ${I}`;c=new Uint8Array(h.buffer),i(c,V,m),i(c,T,A);let D=null;if(g){i(c,z,U),i(c,F,x),D=[];const e=new Float64Array(x.buffer);for(let t=0;t<U.length;t++)D.push(U[t]?e[t]:null)}return r(C),{data:m,maskData:A,noDataValues:D}}}function f(e,t,n,r,a){if(n<2)return e;const o=new r(t*n);if(a)for(let l=0,s=0;l<t;l++)for(let r=0,a=l;r<n;r++,a+=t)o[a]=e[s++];else for(let l=0,s=0;l<t;l++)for(let r=0,a=l;r<n;r++,a+=t)o[s++]=e[a];return o}function c(e,n={}){const r=n.inputOffset??0,a=e instanceof Uint8Array?e.subarray(r):new Uint8Array(e,r),o=l.getBlobInfo(a),{data:s,maskData:i}=l.decode(a,o),{width:u,height:c,bandCount:h,depthCount:y,dataType:p,maskCount:g,statistics:d}=o,b=t[p],A=new b.ctor(s.buffer),w=[],m=[],U=u*c,x=U*y;for(let t=0;t<h;t++){const e=A.subarray(t*x,(t+1)*x);if(n.returnInterleaved)w.push(e);else{const t=f(e,U,y,b.ctor,!0);w.push(t)}m.push(i.subarray(t*x,(t+1)*x))}const C=0===g?null:1===g?m[0]:new Uint8Array(U);if(g>1){C.set(m[0]);for(let e=1;e<m.length;e++){const t=m[e];for(let e=0;e<U;e++)C[e]=C[e]&t[e]}}const{noDataValue:T}=n,V=null!=T&&b.range[0]<=T&&b.range[1]>=T;if(g>0&&V)for(let t=0;t<h;t++){const e=w[t],n=m[t]||C;for(let t=0;t<U;t++)0===n[t]&&(e[t]=T)}const z=g===h&&h>1?m:null,{pixelType:F}=b;return{width:u,height:c,bandCount:h,pixelType:F,depthCount:y,statistics:d,pixels:w,mask:C,bandMasks:z}}function h(e,t={}){const n=e instanceof Uint8Array?e.subarray(t.inputOffset??0):new Uint8Array(e,t.inputOffset??0);return l.getBlobInfo(n)}export{c as decode,h as getBlobInfo,o as isLoaded,a as load};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../core/Error.js";import{isSome as e}from"../../../core/maybe.js";import i from"../PixelBlock.js";import a from"./ImageCanvasDecoder.js";import s from"./JpgPlus.js";import{load as r,decode as n}from"./Lerc.js";import{decode as o}from"./Lzw.js";import{Z as h}from"../../../chunks/Zlib.js";import c from"./Raw.js";import{decodeTileOrStrip as p,decode as l}from"./TiffDecoder.js";import{isPlatformLittleEndian as d}from"./utils.js";var u=function(t){var e,i,a,s,r,n;function o(t){var e,i,a,s,r,n,o,h,c,p,l,d,u;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},r=null;;){switch(e=this.readUInt32(),h=function(){var t,e;for(e=[],t=0;t<4;++t)e.push(String.fromCharCode(this.data[this.pos++]));return e}.call(this).join(""),h){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(e);break;case"fcTL":r&&this.animation.frames.push(r),this.pos+=4,r={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},s=this.readUInt16(),a=this.readUInt16()||100,r.delay=1e3*s/a,r.disposeOp=this.data[this.pos++],r.blendOp=this.data[this.pos++],r.data=[];break;case"IDAT":case"fdAT":for("fdAT"===h&&(this.pos+=4,e-=4),t=(null!=r?r.data:void 0)||this.imgData,l=0;0<=e?l<e:l>e;0<=e?++l:--l)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(e),(c=255-this.transparency.indexed.length)>0)for(d=0;0<=c?d<c:d>c;0<=c?++d:--d)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":n=(p=this.read(e)).indexOf(0),o=String.fromCharCode.apply(String,p.slice(0,n)),this.text[o]=String.fromCharCode.apply(String,p.slice(n+1));break;case"IEND":return r&&this.animation.frames.push(r),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(u=this.colorType)||6===u,i=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*i,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return o.load=function(t,e,i){var a;return"function"==typeof e&&(i=e),(a=new XMLHttpRequest).open("GET",t,!0),a.responseType="arraybuffer",a.onload=function(){var t;return t=new o(new Uint8Array(a.response||a.mozResponseArrayBuffer)),"function"==typeof(null!=e?e.getContext:void 0)&&t.render(e),"function"==typeof i?i(t):void 0},a.send(null)},i=1,a=2,e=0,o.prototype.read=function(t){var e,i;for(i=[],e=0;0<=t?e<t:e>t;0<=t?++e:--e)i.push(this.data[this.pos++]);return i},o.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.decodePixels=function(t){var e,i,a,s,r,n,o,c,p,l,d,u,f,m,g,w,y,x,b,k,T,U,I;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=(t=new h(t)).getBytes(),w=(u=this.pixelBitlength/8)*this.width,f=new Uint8Array(w*this.height),n=t.length,g=0,m=0,i=0;m<n;){switch(t[m++]){case 0:for(s=b=0;b<w;s=b+=1)f[i++]=t[m++];break;case 1:for(s=k=0;k<w;s=k+=1)e=t[m++],r=s<u?0:f[i-u],f[i++]=(e+r)%256;break;case 2:for(s=T=0;T<w;s=T+=1)e=t[m++],a=(s-s%u)/u,y=g&&f[(g-1)*w+a*u+s%u],f[i++]=(y+e)%256;break;case 3:for(s=U=0;U<w;s=U+=1)e=t[m++],a=(s-s%u)/u,r=s<u?0:f[i-u],y=g&&f[(g-1)*w+a*u+s%u],f[i++]=(e+Math.floor((r+y)/2))%256;break;case 4:for(s=I=0;I<w;s=I+=1)e=t[m++],a=(s-s%u)/u,r=s<u?0:f[i-u],0===g?y=x=0:(y=f[(g-1)*w+a*u+s%u],x=a&&f[(g-1)*w+(a-1)*u+s%u]),o=r+y-x,c=Math.abs(o-r),l=Math.abs(o-y),d=Math.abs(o-x),p=c<=l&&c<=d?r:l<=d?y:x,f[i++]=(e+p)%256;break;default:throw new Error("Invalid filter algorithm: "+t[m-1])}g++}return f},o.prototype.decodePalette=function(){var t,e,i,a,s,r,n,o,h;for(i=this.palette,r=this.transparency.indexed||[],s=new Uint8Array((r.length||0)+i.length),a=0,i.length,t=0,e=n=0,o=i.length;n<o;e=n+=3)s[a++]=i[e],s[a++]=i[e+1],s[a++]=i[e+2],s[a++]=null!=(h=r[t++])?h:255;return s},o.prototype.copyToImageData=function(t,e){var i,a,s,r,n,o,h,c,p,l,d;if(a=this.colors,p=null,i=this.hasAlphaChannel,this.palette.length&&(p=null!=(d=this._decodedPalette)?d:this._decodedPalette=this.decodePalette(),a=4,i=!0),c=(s=t.data||t).length,n=p||e,r=o=0,1===a)for(;r<c;)h=p?4*e[r/4]:o,l=n[h++],s[r++]=l,s[r++]=l,s[r++]=l,s[r++]=i?n[h++]:this.transparency.grayscale&&this.transparency.grayscale===l?0:255,o=h;else for(;r<c;)h=p?4*e[r/4]:o,s[r++]=n[h++],s[r++]=n[h++],s[r++]=n[h++],s[r++]=i?n[h++]:this.transparency.rgb&&this.transparency.rgb[1]===n[h-3]&&this.transparency.rgb[3]===n[h-2]&&this.transparency.rgb[5]===n[h-1]?0:255,o=h},o.prototype.decode=function(){var t;return t=new Uint8Array(this.width*this.height*4),this.copyToImageData(t,this.decodePixels()),t},r=t.document&&t.document.createElement("canvas"),n=r&&r.getContext("2d"),s=function(t){var e;return n.width=t.width,n.height=t.height,n.clearRect(0,0,t.width,t.height),n.putImageData(t,0,0),(e=new Image).src=r.toDataURL(),e},o.prototype.decodeFrames=function(t){var e,i,a,r,n,o,h,c;if(this.animation){for(c=[],i=n=0,o=(h=this.animation.frames).length;n<o;i=++n)e=h[i],a=t.createImageData(e.width,e.height),r=this.decodePixels(new Uint8Array(e.data)),this.copyToImageData(a,r),e.imageData=a,c.push(e.image=s(a));return c}},o.prototype.renderFrame=function(t,s){var r,n,o;return r=(n=this.animation.frames)[s],o=n[s-1],0===s&&t.clearRect(0,0,this.width,this.height),(null!=o?o.disposeOp:void 0)===i?t.clearRect(o.xOffset,o.yOffset,o.width,o.height):(null!=o?o.disposeOp:void 0)===a&&t.putImageData(o.imageData,o.xOffset,o.yOffset),r.blendOp===e&&t.clearRect(r.xOffset,r.yOffset,r.width,r.height),t.drawImage(r.image,r.xOffset,r.yOffset)},o.prototype.animate=function(t){var e,i,a,s,r,n,o=this;return i=0,n=this.animation,s=n.numFrames,a=n.frames,r=n.numPlays,(e=function(){var n,h;if(n=i++%s,h=a[n],o.renderFrame(t,n),s>1&&i/s<r)return o.animation._timeout=setTimeout(e,h.delay)})()},o.prototype.stopAnimation=function(){var t;return clearTimeout(null!=(t=this.animation)?t._timeout:void 0)},o.prototype.render=function(t){var e,i;return t._png&&t._png.stopAnimation(),t._png=this,t.width=this.width,t.height=this.height,e=t.getContext("2d"),this.animation?(this.decodeFrames(e),this.animate(e)):(i=e.createImageData(this.width,this.height),this.copyToImageData(i,this.decodePixels()),e.putImageData(i,0,0))},o}(self);const f=new Set(["jpg","png","bmp","gif"]),m=new Set(["S8","U8","S16","U16","S32","U32","F32","F64"]);async function g(e,a){if(!d)throw new t("rasterCoded:decode","lerc decoder is not supported on big endian platform");await r();const{offset:s,noDataValue:o}=a;let h=a.pixelType?.toUpperCase();h&&!m.has(h)&&(h=null);const{width:c,height:p,pixelType:l,statistics:u,pixels:f,mask:g}=n(e,{inputOffset:s,noDataValue:o,pixelType:h,returnPixelInterleavedDims:a.returnPixelInterleavedDims});return new i({width:c,height:p,pixelType:l.toLowerCase(),pixels:f,mask:g,statistics:u})}async function w(t,e){const a=await l(t,e),s=new i({width:a.width,height:a.height,pixels:a.pixels,pixelType:a.pixelType.toLowerCase(),mask:a.mask,statistics:null});return s.updateStatistics(),s}async function y(t,e){const a=await p(t,e.customOptions),s=new i({width:a.width,height:a.height,pixels:a.pixels,pixelType:a.pixelType.toLowerCase(),mask:a.mask,statistics:null});return s.updateStatistics(),s}function x(t,e){const a=e.pixelType||"u8",s=i.getPixelArrayConstructor(a),r="u8"===a?t:new s(t.buffer),n=[],o=e.planes||1;if(1===o)n.push(r);else for(let i=0;i<o;i++){const a=(e.width||1)*(e.height||t.length),h=new s(a);for(let t=0;t<a;t++)h[t]=r[t*o+i];n.push(h)}const h=new i({width:e.width||1,height:e.height||t.length,pixels:n,pixelType:a,statistics:null});return h.updateStatistics(),h}function b(t,e){return x(new h(new Uint8Array(t)).getBytes(),e)}function k(t,e){return x(o(t,e.offset,e.eof,!e.isInputBigEndian),e)}function T(t,e,a){const{pixelTypeCtor:s}=D(e.pixelType),r=(0,c.decode)(t,{width:e.width,height:e.height,pixelType:s,format:a}),n=new i({width:e.width,height:e.height,pixels:r.pixels,pixelType:e.pixelType,mask:r.mask,statistics:null});return n.updateStatistics(),n}function U(t,e){const a=s.decode(t,e.hasNoZlibMask),r=new i({width:a.width,height:a.height,pixels:a.pixels,pixelType:"U8",mask:a.mask,statistics:null});return r.updateStatistics(),r}function I(t,e){const a=new Uint8Array(t),s=new u(a),{width:r,height:n}=e,o=r*n,h=s.decode();let c,p=0,l=0;const d=new Uint8Array(o);for(p=0;p<o;p++)d[p]=h[4*p+3];const f=new i({width:r,height:n,pixels:[],pixelType:"U8",mask:d,statistics:[]});for(p=0;p<3;p++){for(c=new Uint8Array(o),l=0;l<o;l++)c[l]=h[4*l+p];f.addData({pixels:c})}return f.updateStatistics(),f}async function v(t,e,s,r){const n=new a,o={applyJpegMask:!1,format:e,...s},h=await n.decode(t,o,r),c=new i(h);return c.updateStatistics(),c}function C(e){if(null==e)throw new t("rasterCodec:decode","parameter encodeddata is required.");const i=new Uint8Array(e,0,10);let a="";return 255===i[0]&&216===i[1]?a="jpg":137===i[0]&&80===i[1]&&78===i[2]&&71===i[3]?a="png":67===i[0]&&110===i[1]&&116===i[2]&&90===i[3]&&73===i[4]&&109===i[5]&&97===i[6]&&103===i[7]&&101===i[8]&&32===i[9]?a="lerc":76===i[0]&&101===i[1]&&114===i[2]&&99===i[3]&&50===i[4]&&32===i[5]?a="lerc2":73===i[0]&&73===i[1]&&42===i[2]&&0===i[3]||77===i[0]&&77===i[1]&&0===i[2]&&42===i[3]||73===i[0]&&73===i[1]&&43===i[2]&&0===i[3]||77===i[0]&&77===i[1]&&0===i[2]&&43===i[3]?a="tiff":71===i[0]&&73===i[1]&&70===i[2]?a="gif":66===i[0]&&77===i[1]?a="bmp":String.fromCharCode.apply(null,i).toLowerCase().includes("error")&&(a="error"),a}function A(e){let i=null;switch(e){case"lerc":case"lerc2":i=g;break;case"jpg":i=U;break;case"png":i=I;break;case"bsq":case"bip":i=(t,i)=>T(t,i,e);break;case"tiff":i=w;break;case"deflate":i=b;break;case"lzw":i=k;break;case"error":i=()=>{throw new t("rasterCodec:decode","input data contains error")};break;default:i=()=>{throw new t("rasterCodec:decode","unsupported raster format")}}return i}function D(t){let e=null,i=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":i=255,e=Uint8Array;break;case"u16":i=i||65535,e=Uint16Array;break;case"u32":i=i||2**32-1,e=Uint32Array;break;case"s8":i=i||-128,e=Int8Array;break;case"s16":i=i||-32768,e=Int16Array;break;case"s32":i=i||0-2**31,e=Int32Array;break;default:e=Float32Array}return{pixelTypeCtor:e,noDataValue:i}}function P(t,a=1){if(!t)return;const{pixels:s,width:r,height:n,mask:o}=t;if(!s||0===s.length)return;const h=s.length,c=r-1,p=n-1,l=[];let d,u,f,m,g,w,y;const x=i.getPixelArrayConstructor(t.pixelType);if(0===a){for(d=0;d<h;d++){for(g=s[d],w=new x(c*p),u=0;u<p;u++)for(m=u*r,f=0;f<c;f++)w[u*c+f]=g[m+f];l.push(w)}if(e(o))for(y=new Uint8Array(c*p),u=0;u<p;u++)for(m=u*r,f=0;f<c;f++)y[u*c+f]=o[m+f]}else{for(d=0;d<h;d++){for(g=s[d],w=new x(c*p),u=0;u<p;u++)for(m=u*r,f=0;f<c;f++)w[u*c+f]=(g[m+f]+g[m+f+1]+g[m+r+f]+g[m+r+f+1])/4;l.push(w)}if(o)for(y=new Uint8Array(c*p),u=0;u<p;u++)for(m=u*r,f=0;f<c;f++)y[u*c+f]=Math.min.apply(null,[o[m+f],o[m+f+1],o[m+r+f],o[m+r+f+1]])}t.width=c,t.height=p,t.mask=y,t.pixels=l}function S(t){let e=C(t);return"lerc2"===e?e="lerc":"error"===e&&(e=""),e}async function O(e,i={},a){if(null==e)throw new t("rasterCodec:decode","missing encodeddata parameter.");let s,r,n=i.format&&i.format.toLowerCase();if(!("bsq"!==n&&"bip"!==n||null!=i.width&&null!=i.height))throw new t("rasterCodec:decode","requires width and height in options parameter.");return"tiff"===n&&i.customOptions?y(e,i):((!n||"bsq"!==n&&"bip"!==n&&"deflate"!==n&&"lzw"!==n)&&(n=C(e)),i.useCanvas&&f.has(n)?r=await v(e,n,i,a):(s=A(n),i.isPoint&&((i={...i}).width++,i.height++),r=await s(e,i),i.isPoint&&P(r)),r)}export{O as decode,S as getFormat};
|
|
5
|
+
import t from"../../../core/Error.js";import{isSome as e}from"../../../core/maybe.js";import i from"../PixelBlock.js";import a from"./ImageCanvasDecoder.js";import s from"./JpgPlus.js";import{load as r,decode as n}from"./Lerc.js";import{decode as o}from"./Lzw.js";import{Z as h}from"../../../chunks/Zlib.js";import c from"./Raw.js";import{decodeTileOrStrip as p,decode as l}from"./TiffDecoder.js";import{isPlatformLittleEndian as d}from"./utils.js";var u=function(t){var e,i,a,s,r,n;function o(t){var e,i,a,s,r,n,o,h,c,p,l,d,u;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},r=null;;){switch(e=this.readUInt32(),h=function(){var t,e;for(e=[],t=0;t<4;++t)e.push(String.fromCharCode(this.data[this.pos++]));return e}.call(this).join(""),h){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(e);break;case"fcTL":r&&this.animation.frames.push(r),this.pos+=4,r={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},s=this.readUInt16(),a=this.readUInt16()||100,r.delay=1e3*s/a,r.disposeOp=this.data[this.pos++],r.blendOp=this.data[this.pos++],r.data=[];break;case"IDAT":case"fdAT":for("fdAT"===h&&(this.pos+=4,e-=4),t=(null!=r?r.data:void 0)||this.imgData,l=0;0<=e?l<e:l>e;0<=e?++l:--l)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(e),(c=255-this.transparency.indexed.length)>0)for(d=0;0<=c?d<c:d>c;0<=c?++d:--d)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":n=(p=this.read(e)).indexOf(0),o=String.fromCharCode.apply(String,p.slice(0,n)),this.text[o]=String.fromCharCode.apply(String,p.slice(n+1));break;case"IEND":return r&&this.animation.frames.push(r),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(u=this.colorType)||6===u,i=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*i,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return o.load=function(t,e,i){var a;return"function"==typeof e&&(i=e),(a=new XMLHttpRequest).open("GET",t,!0),a.responseType="arraybuffer",a.onload=function(){var t;return t=new o(new Uint8Array(a.response||a.mozResponseArrayBuffer)),"function"==typeof(null!=e?e.getContext:void 0)&&t.render(e),"function"==typeof i?i(t):void 0},a.send(null)},i=1,a=2,e=0,o.prototype.read=function(t){var e,i;for(i=[],e=0;0<=t?e<t:e>t;0<=t?++e:--e)i.push(this.data[this.pos++]);return i},o.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.decodePixels=function(t){var e,i,a,s,r,n,o,c,p,l,d,u,f,m,g,w,y,x,b,k,T,U,I;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=(t=new h(t)).getBytes(),w=(u=this.pixelBitlength/8)*this.width,f=new Uint8Array(w*this.height),n=t.length,g=0,m=0,i=0;m<n;){switch(t[m++]){case 0:for(s=b=0;b<w;s=b+=1)f[i++]=t[m++];break;case 1:for(s=k=0;k<w;s=k+=1)e=t[m++],r=s<u?0:f[i-u],f[i++]=(e+r)%256;break;case 2:for(s=T=0;T<w;s=T+=1)e=t[m++],a=(s-s%u)/u,y=g&&f[(g-1)*w+a*u+s%u],f[i++]=(y+e)%256;break;case 3:for(s=U=0;U<w;s=U+=1)e=t[m++],a=(s-s%u)/u,r=s<u?0:f[i-u],y=g&&f[(g-1)*w+a*u+s%u],f[i++]=(e+Math.floor((r+y)/2))%256;break;case 4:for(s=I=0;I<w;s=I+=1)e=t[m++],a=(s-s%u)/u,r=s<u?0:f[i-u],0===g?y=x=0:(y=f[(g-1)*w+a*u+s%u],x=a&&f[(g-1)*w+(a-1)*u+s%u]),o=r+y-x,c=Math.abs(o-r),l=Math.abs(o-y),d=Math.abs(o-x),p=c<=l&&c<=d?r:l<=d?y:x,f[i++]=(e+p)%256;break;default:throw new Error("Invalid filter algorithm: "+t[m-1])}g++}return f},o.prototype.decodePalette=function(){var t,e,i,a,s,r,n,o,h;for(i=this.palette,r=this.transparency.indexed||[],s=new Uint8Array((r.length||0)+i.length),a=0,i.length,t=0,e=n=0,o=i.length;n<o;e=n+=3)s[a++]=i[e],s[a++]=i[e+1],s[a++]=i[e+2],s[a++]=null!=(h=r[t++])?h:255;return s},o.prototype.copyToImageData=function(t,e){var i,a,s,r,n,o,h,c,p,l,d;if(a=this.colors,p=null,i=this.hasAlphaChannel,this.palette.length&&(p=null!=(d=this._decodedPalette)?d:this._decodedPalette=this.decodePalette(),a=4,i=!0),c=(s=t.data||t).length,n=p||e,r=o=0,1===a)for(;r<c;)h=p?4*e[r/4]:o,l=n[h++],s[r++]=l,s[r++]=l,s[r++]=l,s[r++]=i?n[h++]:this.transparency.grayscale&&this.transparency.grayscale===l?0:255,o=h;else for(;r<c;)h=p?4*e[r/4]:o,s[r++]=n[h++],s[r++]=n[h++],s[r++]=n[h++],s[r++]=i?n[h++]:this.transparency.rgb&&this.transparency.rgb[1]===n[h-3]&&this.transparency.rgb[3]===n[h-2]&&this.transparency.rgb[5]===n[h-1]?0:255,o=h},o.prototype.decode=function(){var t;return t=new Uint8Array(this.width*this.height*4),this.copyToImageData(t,this.decodePixels()),t},r=t.document&&t.document.createElement("canvas"),n=r&&r.getContext("2d"),s=function(t){var e;return n.width=t.width,n.height=t.height,n.clearRect(0,0,t.width,t.height),n.putImageData(t,0,0),(e=new Image).src=r.toDataURL(),e},o.prototype.decodeFrames=function(t){var e,i,a,r,n,o,h,c;if(this.animation){for(c=[],i=n=0,o=(h=this.animation.frames).length;n<o;i=++n)e=h[i],a=t.createImageData(e.width,e.height),r=this.decodePixels(new Uint8Array(e.data)),this.copyToImageData(a,r),e.imageData=a,c.push(e.image=s(a));return c}},o.prototype.renderFrame=function(t,s){var r,n,o;return r=(n=this.animation.frames)[s],o=n[s-1],0===s&&t.clearRect(0,0,this.width,this.height),(null!=o?o.disposeOp:void 0)===i?t.clearRect(o.xOffset,o.yOffset,o.width,o.height):(null!=o?o.disposeOp:void 0)===a&&t.putImageData(o.imageData,o.xOffset,o.yOffset),r.blendOp===e&&t.clearRect(r.xOffset,r.yOffset,r.width,r.height),t.drawImage(r.image,r.xOffset,r.yOffset)},o.prototype.animate=function(t){var e,i,a,s,r,n,o=this;return i=0,n=this.animation,s=n.numFrames,a=n.frames,r=n.numPlays,(e=function(){var n,h;if(n=i++%s,h=a[n],o.renderFrame(t,n),s>1&&i/s<r)return o.animation._timeout=setTimeout(e,h.delay)})()},o.prototype.stopAnimation=function(){var t;return clearTimeout(null!=(t=this.animation)?t._timeout:void 0)},o.prototype.render=function(t){var e,i;return t._png&&t._png.stopAnimation(),t._png=this,t.width=this.width,t.height=this.height,e=t.getContext("2d"),this.animation?(this.decodeFrames(e),this.animate(e)):(i=e.createImageData(this.width,this.height),this.copyToImageData(i,this.decodePixels()),e.putImageData(i,0,0))},o}(self);const f=new Set(["jpg","png","bmp","gif"]),m=new Set(["S8","U8","S16","U16","S32","U32","F32","F64"]);async function g(e,a){if(!d)throw new t("rasterCoded:decode","lerc decoder is not supported on big endian platform");await r();const{offset:s,noDataValue:o}=a;let h=a.pixelType?.toUpperCase();h&&!m.has(h)&&(h=null);const{width:c,height:p,pixelType:l,statistics:u,pixels:f,mask:g}=n(e,{inputOffset:s,noDataValue:o,returnInterleaved:a.returnInterleaved});return new i({width:c,height:p,pixelType:l.toLowerCase(),pixels:f,mask:g,statistics:u})}async function w(t,e){const a=await l(t,e),s=new i({width:a.width,height:a.height,pixels:a.pixels,pixelType:a.pixelType.toLowerCase(),mask:a.mask,statistics:null});return s.updateStatistics(),s}async function y(t,e){const a=await p(t,e.customOptions),s=new i({width:a.width,height:a.height,pixels:a.pixels,pixelType:a.pixelType.toLowerCase(),mask:a.mask,statistics:null});return s.updateStatistics(),s}function x(t,e){const a=e.pixelType||"u8",s=i.getPixelArrayConstructor(a),r="u8"===a?t:new s(t.buffer),n=[],o=e.planes||1;if(1===o)n.push(r);else for(let i=0;i<o;i++){const a=(e.width||1)*(e.height||t.length),h=new s(a);for(let t=0;t<a;t++)h[t]=r[t*o+i];n.push(h)}const h=new i({width:e.width||1,height:e.height||t.length,pixels:n,pixelType:a,statistics:null});return h.updateStatistics(),h}function b(t,e){return x(new h(new Uint8Array(t)).getBytes(),e)}function k(t,e){return x(o(t,e.offset,e.eof,!e.isInputBigEndian),e)}function T(t,e,a){const{pixelTypeCtor:s}=D(e.pixelType),r=(0,c.decode)(t,{width:e.width,height:e.height,pixelType:s,format:a}),n=new i({width:e.width,height:e.height,pixels:r.pixels,pixelType:e.pixelType,mask:r.mask,statistics:null});return n.updateStatistics(),n}function U(t,e){const a=s.decode(t,e.hasNoZlibMask),r=new i({width:a.width,height:a.height,pixels:a.pixels,pixelType:"U8",mask:a.mask,statistics:null});return r.updateStatistics(),r}function I(t,e){const a=new Uint8Array(t),s=new u(a),{width:r,height:n}=e,o=r*n,h=s.decode();let c,p=0,l=0;const d=new Uint8Array(o);for(p=0;p<o;p++)d[p]=h[4*p+3];const f=new i({width:r,height:n,pixels:[],pixelType:"U8",mask:d,statistics:[]});for(p=0;p<3;p++){for(c=new Uint8Array(o),l=0;l<o;l++)c[l]=h[4*l+p];f.addData({pixels:c})}return f.updateStatistics(),f}async function v(t,e,s,r){const n=new a,o={applyJpegMask:!1,format:e,...s},h=await n.decode(t,o,r),c=new i(h);return c.updateStatistics(),c}function C(e){if(null==e)throw new t("rasterCodec:decode","parameter encodeddata is required.");const i=new Uint8Array(e,0,10);let a="";return 255===i[0]&&216===i[1]?a="jpg":137===i[0]&&80===i[1]&&78===i[2]&&71===i[3]?a="png":67===i[0]&&110===i[1]&&116===i[2]&&90===i[3]&&73===i[4]&&109===i[5]&&97===i[6]&&103===i[7]&&101===i[8]&&32===i[9]?a="lerc":76===i[0]&&101===i[1]&&114===i[2]&&99===i[3]&&50===i[4]&&32===i[5]?a="lerc2":73===i[0]&&73===i[1]&&42===i[2]&&0===i[3]||77===i[0]&&77===i[1]&&0===i[2]&&42===i[3]||73===i[0]&&73===i[1]&&43===i[2]&&0===i[3]||77===i[0]&&77===i[1]&&0===i[2]&&43===i[3]?a="tiff":71===i[0]&&73===i[1]&&70===i[2]?a="gif":66===i[0]&&77===i[1]?a="bmp":String.fromCharCode.apply(null,i).toLowerCase().includes("error")&&(a="error"),a}function A(e){let i=null;switch(e){case"lerc":case"lerc2":i=g;break;case"jpg":i=U;break;case"png":i=I;break;case"bsq":case"bip":i=(t,i)=>T(t,i,e);break;case"tiff":i=w;break;case"deflate":i=b;break;case"lzw":i=k;break;case"error":i=()=>{throw new t("rasterCodec:decode","input data contains error")};break;default:i=()=>{throw new t("rasterCodec:decode","unsupported raster format")}}return i}function D(t){let e=null,i=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":i=255,e=Uint8Array;break;case"u16":i=i||65535,e=Uint16Array;break;case"u32":i=i||2**32-1,e=Uint32Array;break;case"s8":i=i||-128,e=Int8Array;break;case"s16":i=i||-32768,e=Int16Array;break;case"s32":i=i||0-2**31,e=Int32Array;break;default:e=Float32Array}return{pixelTypeCtor:e,noDataValue:i}}function S(t,a=1){if(!t)return;const{pixels:s,width:r,height:n,mask:o}=t;if(!s||0===s.length)return;const h=s.length,c=r-1,p=n-1,l=[];let d,u,f,m,g,w,y;const x=i.getPixelArrayConstructor(t.pixelType);if(0===a){for(d=0;d<h;d++){for(g=s[d],w=new x(c*p),u=0;u<p;u++)for(m=u*r,f=0;f<c;f++)w[u*c+f]=g[m+f];l.push(w)}if(e(o))for(y=new Uint8Array(c*p),u=0;u<p;u++)for(m=u*r,f=0;f<c;f++)y[u*c+f]=o[m+f]}else{for(d=0;d<h;d++){for(g=s[d],w=new x(c*p),u=0;u<p;u++)for(m=u*r,f=0;f<c;f++)w[u*c+f]=(g[m+f]+g[m+f+1]+g[m+r+f]+g[m+r+f+1])/4;l.push(w)}if(o)for(y=new Uint8Array(c*p),u=0;u<p;u++)for(m=u*r,f=0;f<c;f++)y[u*c+f]=Math.min.apply(null,[o[m+f],o[m+f+1],o[m+r+f],o[m+r+f+1]])}t.width=c,t.height=p,t.mask=y,t.pixels=l}function O(t){let e=C(t);return"lerc2"===e?e="lerc":"error"===e&&(e=""),e}async function P(e,i={},a){if(null==e)throw new t("rasterCodec:decode","missing encodeddata parameter.");let s,r,n=i.format&&i.format.toLowerCase();if(!("bsq"!==n&&"bip"!==n||null!=i.width&&null!=i.height))throw new t("rasterCodec:decode","requires width and height in options parameter.");return"tiff"===n&&i.customOptions?y(e,i):((!n||"bsq"!==n&&"bip"!==n&&"deflate"!==n&&"lzw"!==n)&&(n=C(e)),i.useCanvas&&f.has(n)?r=await v(e,n,i,a):(s=A(n),i.isPoint&&((i={...i}).width++,i.height++),r=await s(e,i),i.isPoint&&S(r)),r)}export{P as decode,O as getFormat};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const e=(e,r)=>{const a=r.width*r.height,n=r.pixelType;return Math.floor(e.byteLength/(a*t(n)))},t=e=>{let t=1;switch(e){case Uint8Array:case Int8Array:t=1;break;case Uint16Array:case Int16Array:t=2;break;case Uint32Array:case Int32Array:case Float32Array:t=4;break;case Float64Array:t=8}return t},r=(e,t)=>{if(8*e.byteLength<t)return null;const r=new Uint8Array(e,0,Math.ceil(t/8)),a=new Uint8Array(t);let n=0,s=0,
|
|
5
|
+
const e=(e,r)=>{const a=r.width*r.height,n=r.pixelType;return Math.floor(e.byteLength/(a*t(n)))},t=e=>{let t=1;switch(e){case Uint8Array:case Int8Array:t=1;break;case Uint16Array:case Int16Array:t=2;break;case Uint32Array:case Int32Array:case Float32Array:t=4;break;case Float64Array:t=8}return t},r=(e,t)=>{if(8*e.byteLength<t)return null;const r=new Uint8Array(e,0,Math.ceil(t/8)),a=new Uint8Array(t);let n=0,s=0,l=0,i=0;for(l=0;l<r.length-1;l++)for(s=r[l],i=7;i>=0;i--)a[n++]=s>>i&1;for(i=7;n<t-1;)s=r[r.length-1],a[n++]=s>>i&1,i--;return a};class a{static decode(a,n){const s=n.pixelType,l=[],i=n.width*n.height,h=e(a,n),{bandIds:c,format:y}=n,o=c&&c.length||e(a,n),b=a.byteLength-a.byteLength%(i*t(s)),f=new s(a,0,i*h);let u,g,A,p,d=null;if("bip"===y)for(u=0;u<o;u++){for(A=new s(i),p=c?c[u]:u,g=0;g<i;g++)A[g]=f[g*h+p];l.push(A)}else if("bsq"===y)for(u=0;u<o;u++)p=c?c[u]:u,l.push(f.subarray(p*i,(p+1)*i));return b<a.byteLength-1&&(d=r(a.slice(b),i)),{pixels:l,mask:d}}}export{a as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const e=(()=>{const e=[];return e[254]="NEWSUBFILETYPE",e[255]="SUBFILETYPE",e[256]="IMAGEWIDTH",e[257]="IMAGELENGTH",e[258]="BITSPERSAMPLE",e[259]="COMPRESSION",e[262]="PHOTOMETRICINTERPRETATION",e[263]="THRESHHOLDING",e[264]="CELLWIDTH",e[265]="CELLLENGTH",e[266]="FILLORDER",e[269]="DOCUMENTNAME",e[270]="IMAGEDESCRIPTION",e[271]="MAKE",e[272]="MODEL",e[273]="STRIPOFFSETS",e[274]="ORIENTATION",e[277]="SAMPLESPERPIXEL",e[278]="ROWSPERSTRIP",e[279]="STRIPBYTECOUNTS",e[280]="MINSAMPLEVALUE",e[281]="MAXSAMPLEVALUE",e[282]="XRESOLUTION",e[283]="YRESOLUTION",e[284]="PLANARCONFIGURATION",e[285]="PAGENAME",e[286]="XPOSITION",e[287]="YPOSITION",e[288]="FREEOFFSETS",e[289]="FREEBYTECOUNTS",e[290]="GRAYRESPONSEUNIT",e[291]="GRAYRESPONSECURVE",e[292]="T4OPTIONS",e[293]="T6OPTIONS",e[296]="RESOLUTIONUNIT",e[297]="PAGENUMBER",e[300]="COLORRESPONSEUNIT",e[301]="TRANSFERFUNCTION",e[305]="SOFTWARE",e[306]="DATETIME",e[315]="ARTIST",e[316]="HOSTCOMPUTER",e[317]="PREDICTOR",e[318]="WHITEPOINT",e[319]="PRIMARYCHROMATICITIES",e[320]="COLORMAP",e[321]="HALFTONEHINTS",e[322]="TILEWIDTH",e[323]="TILELENGTH",e[324]="TILEOFFSETS",e[325]="TILEBYTECOUNTS",e[326]="BADFAXLINES",e[327]="CLEANFAXDATA",e[328]="CONSECUTIVEBADFAXLINES",e[330]="SUBIFD",e[332]="INKSET",e[333]="INKNAMES",e[334]="NUMBEROFINKS",e[336]="DOTRANGE",e[337]="TARGETPRINTER",e[338]="EXTRASAMPLES",e[339]="SAMPLEFORMAT",e[340]="SMINSAMPLEVALUE",e[341]="SMAXSAMPLEVALUE",e[342]="TRANSFERRANGE",e[347]="JPEGTABLES",e[512]="JPEGPROC",e[513]="JPEGIFOFFSET",e[514]="JPEGIFBYTECOUNT",e[515]="JPEGRESTARTINTERVAL",e[517]="JPEGLOSSLESSPREDICTORS",e[518]="JPEGPOINTTRANSFORM",e[519]="JPEGQTABLES",e[520]="JPEGDCTABLES",e[521]="JPEGACTABLES",e[529]="YCBCRCOEFFICIENTS",e[530]="YCBCRSUBSAMPLING",e[531]="YCBCRPOSITIONING",e[532]="REFERENCEBLACKWHITE",e[700]="XMP",e[33550]="GEOPIXELSCALE",e[33922]="GEOTIEPOINTS",e[33432]="COPYRIGHT",e[42112]="GDAL_METADATA",e[42113]="GDAL_NODATA",e[50844]="RPCCOEFFICIENT",e[34264]="GEOTRANSMATRIX",e[34735]="GEOKEYDIRECTORY",e[34736]="GEODOUBLEPARAMS",e[34737]="GEOASCIIPARAMS",e[34665]="EXIFIFD",e[34853]="GPSIFD",e[40965]="INTEROPERABILITYIFD",e})(),i=(()=>{const i=
|
|
5
|
+
const e=(()=>{const e=[];return e[254]="NEWSUBFILETYPE",e[255]="SUBFILETYPE",e[256]="IMAGEWIDTH",e[257]="IMAGELENGTH",e[258]="BITSPERSAMPLE",e[259]="COMPRESSION",e[262]="PHOTOMETRICINTERPRETATION",e[263]="THRESHHOLDING",e[264]="CELLWIDTH",e[265]="CELLLENGTH",e[266]="FILLORDER",e[269]="DOCUMENTNAME",e[270]="IMAGEDESCRIPTION",e[271]="MAKE",e[272]="MODEL",e[273]="STRIPOFFSETS",e[274]="ORIENTATION",e[277]="SAMPLESPERPIXEL",e[278]="ROWSPERSTRIP",e[279]="STRIPBYTECOUNTS",e[280]="MINSAMPLEVALUE",e[281]="MAXSAMPLEVALUE",e[282]="XRESOLUTION",e[283]="YRESOLUTION",e[284]="PLANARCONFIGURATION",e[285]="PAGENAME",e[286]="XPOSITION",e[287]="YPOSITION",e[288]="FREEOFFSETS",e[289]="FREEBYTECOUNTS",e[290]="GRAYRESPONSEUNIT",e[291]="GRAYRESPONSECURVE",e[292]="T4OPTIONS",e[293]="T6OPTIONS",e[296]="RESOLUTIONUNIT",e[297]="PAGENUMBER",e[300]="COLORRESPONSEUNIT",e[301]="TRANSFERFUNCTION",e[305]="SOFTWARE",e[306]="DATETIME",e[315]="ARTIST",e[316]="HOSTCOMPUTER",e[317]="PREDICTOR",e[318]="WHITEPOINT",e[319]="PRIMARYCHROMATICITIES",e[320]="COLORMAP",e[321]="HALFTONEHINTS",e[322]="TILEWIDTH",e[323]="TILELENGTH",e[324]="TILEOFFSETS",e[325]="TILEBYTECOUNTS",e[326]="BADFAXLINES",e[327]="CLEANFAXDATA",e[328]="CONSECUTIVEBADFAXLINES",e[330]="SUBIFD",e[332]="INKSET",e[333]="INKNAMES",e[334]="NUMBEROFINKS",e[336]="DOTRANGE",e[337]="TARGETPRINTER",e[338]="EXTRASAMPLES",e[339]="SAMPLEFORMAT",e[340]="SMINSAMPLEVALUE",e[341]="SMAXSAMPLEVALUE",e[342]="TRANSFERRANGE",e[347]="JPEGTABLES",e[512]="JPEGPROC",e[513]="JPEGIFOFFSET",e[514]="JPEGIFBYTECOUNT",e[515]="JPEGRESTARTINTERVAL",e[517]="JPEGLOSSLESSPREDICTORS",e[518]="JPEGPOINTTRANSFORM",e[519]="JPEGQTABLES",e[520]="JPEGDCTABLES",e[521]="JPEGACTABLES",e[529]="YCBCRCOEFFICIENTS",e[530]="YCBCRSUBSAMPLING",e[531]="YCBCRPOSITIONING",e[532]="REFERENCEBLACKWHITE",e[700]="XMP",e[33550]="GEOPIXELSCALE",e[33922]="GEOTIEPOINTS",e[33432]="COPYRIGHT",e[42112]="GDAL_METADATA",e[42113]="GDAL_NODATA",e[50844]="RPCCOEFFICIENT",e[34264]="GEOTRANSMATRIX",e[34735]="GEOKEYDIRECTORY",e[34736]="GEODOUBLEPARAMS",e[34737]="GEOASCIIPARAMS",e[34665]="EXIFIFD",e[34853]="GPSIFD",e[40965]="INTEROPERABILITYIFD",e})(),i=(()=>{const i=e.slice();return i[36864]="ExifVersion",i[40960]="FlashpixVersion",i[40961]="ColorSpace",i[42240]="Gamma",i[37121]="ComponentsConfiguration",i[37122]="CompressedBitsPerPixel",i[40962]="PixelXDimension",i[40963]="PixelYDimension",i[37500]="MakerNote",i[37510]="UserComment",i[40964]="RelatedSoundFile",i[36867]="DateTimeOriginal",i[36868]="DateTimeDigitized",i[36880]="OffsetTime",i[36881]="OffsetTimeOriginal",i[36882]="OffsetTimeDigitized",i[37520]="SubSecTime",i[37521]="SubSecTimeOriginal",i[37522]="SubSecTimeDigitized",i[37888]="Temperature",i[37889]="Humidity",i[37890]="Pressure",i[37891]="WaterDepth",i[37892]="Acceleration",i[37893]="CameraElevationAngle",i[42016]="ImageUniqueID",i[42032]="CameraOwnerName",i[42033]="BodySerialNumber",i[42034]="LensSpecification",i[42035]="LensMake",i[42036]="LensModel",i[42037]="LensSerialNumber",i[33434]="ExposureTime",i[33437]="FNumber",i[34850]="ExposureProgram",i[34852]="SpectralSensitivity",i[34855]="PhotographicSensitivity",i[34856]="OECF",i[34864]="SensitivityType",i[34865]="StandardOutputSensitivity",i[34866]="RecommendedExposureIndex",i[34867]="ISOSpeed",i[34868]="ISOSpeedLatitudeyyy",i[34869]="ISOSpeedLatitudezzz",i[37377]="ShutterSpeedValue",i[37378]="ApertureValue",i[37379]="BrightnessValue",i[37380]="ExposureBiasValue",i[37381]="MaxApertureValue",i[37382]="SubjectDistance",i[37383]="MeteringMode",i[37384]="LightSource",i[37385]="Flash",i[37386]="FocalLength",i[37396]="SubjectArea",i[41483]="FlashEnergy",i[41484]="SpatialFrequencyResponse",i[41486]="FocalPlaneXResolution",i[41487]="FocalPlaneYResolution",i[41488]="FocalPlaneResolutionUnit",i[41492]="SubjectLocation",i[41493]="ExposureIndex",i[41495]="SensingMethod",i[41728]="FileSource",i[41729]="SceneType",i[41730]="CFAPattern",i[41985]="CustomRendered",i[41986]="ExposureMode",i[41987]="WhiteBalance",i[41988]="DigitalZoomRatio",i[41989]="FocalLengthIn35mmFilm",i[41990]="SceneCaptureType",i[41991]="GainControl",i[41992]="Contrast",i[41993]="Saturation",i[41994]="Sharpness",i[41995]="DeviceSettingDescription",i[41996]="SubjectDistanceRange",i})(),t=["GPSVersionID","GPSLatitudeRef","GPSLatitude","GPSLongitudeRef","GPSLongitude","GPSAltitudeRef","GPSAltitude","GPSTimeStamp","GPSSatellites","GPSStatus","GPSMeasureMode","GPSDOP","GPSSpeedRef","GPSSpeed","GPSTrackRef","GPSTrack","GPSImgDirectionRef","GPSImgDirection","GPSMapDatum","GPSDestLatitudeRef","GPSDestLatitude","GPSDestLongitudeRef","GPSDestLongitude","GPSDestBearingRef","GPSDestBearing","GPSDestDistanceRef","GPSDestDistance","GPSProcessingMethod","GPSAreaInformation","GPSDateStamp","GPSDifferential","GPSHPositioningError"],o=(()=>{const e=[];return e[1024]="GTModelTypeGeoKey",e[1025]="GTRasterTypeGeoKey",e[1026]="GTCitationGeoKey",e[2048]="GeographicTypeGeoKey",e[2049]="GeogCitationGeoKey",e[2050]="GeogGeodeticDatumGeoKey",e[2051]="GeogPrimeMeridianGeoKey",e[2052]="GeogLinearUnitsGeoKey",e[2053]="GeogLinearUnitSizeGeoKey",e[2054]="GeogAngularUnitsGeoKey",e[2055]="GeogAngularUnitSizeGeoKey",e[2056]="GeogEllipsoidGeoKey",e[2057]="GeogSemiMajorAxisGeoKey",e[2058]="GeogSemiMinorAxisGeoKey",e[2059]="GeogInvFlatteningGeoKey",e[2061]="GeogPrimeMeridianLongGeoKey",e[2060]="GeogAzimuthUnitsGeoKey",e[3072]="ProjectedCSTypeGeoKey",e[3073]="PCSCitationGeoKey",e[3074]="ProjectionGeoKey",e[3075]="ProjCoordTransGeoKey",e[3076]="ProjLinearUnitsGeoKey",e[3077]="ProjLinearUnitSizeGeoKey",e[3078]="ProjStdParallel1GeoKey",e[3079]="ProjStdParallel2GeoKey",e[3080]="ProjNatOriginLongGeoKey",e[3081]="ProjNatOriginLatGeoKey",e[3082]="ProjFalseEastingGeoKey",e[3083]="ProjFalseNorthingGeoKey",e[3084]="ProjFalseOriginLongGeoKey",e[3085]="ProjFalseOriginLatGeoKey",e[3086]="ProjFalseOriginEastingGeoKey",e[3087]="ProjFalseOriginNorthingGeoKey",e[3088]="ProjCenterLongGeoKey",e[3090]="ProjCenterEastingGeoKey",e[3091]="ProjCenterNorthingGeoKey",e[3092]="ProjScaleAtNatOriginGeoKey",e[3093]="ProjScaleAtCenterGeoKey",e[3094]="ProjAzimuthAngleGeoKey",e[3095]="ProjStraightVertPoleLongGeoKey",e[4096]="VerticalCSTypeGeoKey",e[4097]="VerticalCitationGeoKey",e[4098]="VerticalDatumGeoKey",e[4099]="VerticalUnitsGeoKey",e})(),S=(i,t)=>{let o=(t||e)[i];return void 0===o&&(o="unknown"+String(i)),o},E=new Map;E.set("EXIFIFD",i),E.set("GPSIFD",t);const n={TIFF_TAGS:e,ifdTags:E,GEO_KEYS:o,getTagName:S};export{n as default};
|