@arcgis/core 4.32.0-next.20250101 → 4.32.0-next.20250103
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/Color.js +1 -1
- package/PopupTemplate.js +1 -1
- package/arcade/functions/date.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetstats.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/geometry.js +1 -1
- package/arcade/functions/geomsync.js +1 -1
- package/arcade/functions/knowledgegraph.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/arcade/geometry/extendedUnitData.js +5 -0
- package/arcade/geometry/functions.js +5 -0
- package/arcade/geometry/operators.js +5 -0
- package/arcade/geometry/unitConversion.js +5 -0
- package/arcade/geometry/wkt.js +5 -0
- package/arcade/languageUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{e371f4f0eb3c22f222df.js → 005727711cca0614c2ab.js} +2 -2
- package/assets/esri/core/workers/chunks/{e371f4f0eb3c22f222df.js.LICENSE.txt → 005727711cca0614c2ab.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{2d908c115ea18e813b95.js → 00c0fbe19c12691cf2c3.js} +1 -1
- package/assets/esri/core/workers/chunks/08e28328385066c519c2.js +1 -0
- package/assets/esri/core/workers/chunks/{0e735d01296d340b393e.js → 0b95ec12218f3c04df18.js} +1 -1
- package/assets/esri/core/workers/chunks/{59bf879b4802a5ba431e.js → 0ee669947c23f469e357.js} +1 -1
- package/assets/esri/core/workers/chunks/116103ecec27cce47a2f.js +1 -0
- package/assets/esri/core/workers/chunks/11f00218905f0db447ff.js +1 -0
- package/assets/esri/core/workers/chunks/14b87f3dd9942e6b19d0.js +1 -0
- package/assets/esri/core/workers/chunks/16d7c07e1c11b88dae84.js +1 -0
- package/assets/esri/core/workers/chunks/1d04fe800cb98e4d6bc4.js +1 -0
- package/assets/esri/core/workers/chunks/{71f6e5742cf0c482066b.js → 1dc6b5b177022b80c473.js} +1 -1
- package/assets/esri/core/workers/chunks/{59455e2dd44b4c01cc76.js → 2586741c359057b3f626.js} +1 -1
- package/assets/esri/core/workers/chunks/{250a810dd4e1ff293564.js → 318a39b56851e707edad.js} +1 -1
- package/assets/esri/core/workers/chunks/{b1e4813f0c73fc2a483c.js → 370b230fd2d7703d0698.js} +2 -2
- package/assets/esri/core/workers/chunks/{b1e4813f0c73fc2a483c.js.LICENSE.txt → 370b230fd2d7703d0698.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/38d03fe352057fb375b5.js +1 -0
- package/assets/esri/core/workers/chunks/{ebf9caf2dc8af89afec2.js → 42aa697b4718b75b8cb2.js} +2 -2
- package/assets/esri/core/workers/chunks/{ebf9caf2dc8af89afec2.js.LICENSE.txt → 42aa697b4718b75b8cb2.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{801dbea20966806db1c9.js → 53cd990b2c988518de6d.js} +1 -1
- package/assets/esri/core/workers/chunks/5a1eb0d1e25ff5574c43.js +1 -0
- package/assets/esri/core/workers/chunks/6157c49e7431f5868c77.js +1 -0
- package/assets/esri/core/workers/chunks/{eef2d94a73064f9bc085.js → 61d64f163840563017d5.js} +1 -1
- package/assets/esri/core/workers/chunks/6d218fb5e0f0a04d72c5.js +2 -0
- package/assets/esri/core/workers/chunks/{d82b3e2905cab511ff3a.js.LICENSE.txt → 6d218fb5e0f0a04d72c5.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/6ed57d01be6bc054c7cd.js +1 -0
- package/assets/esri/core/workers/chunks/7254956381e823219db0.js +1 -0
- package/assets/esri/core/workers/chunks/740e6bdb3b76f2ea6d61.js +1 -0
- package/assets/esri/core/workers/chunks/756c2f7c8659deab6c96.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{56fc353421252f2d0a99.js → 75e8ba7e02647b7216ae.js} +1 -1
- package/assets/esri/core/workers/chunks/89d7eec47e5b29935d92.js +1 -0
- package/assets/esri/core/workers/chunks/8cd2c9ec1e541836b81c.js +1 -0
- package/assets/esri/core/workers/chunks/{0b3e1e903120da297641.js → 932375de79e3d33bc4d7.js} +1 -1
- package/assets/esri/core/workers/chunks/{263adfd1c2641ef5c0f5.js → 95f23bd17ce9e07fc8ef.js} +1 -1
- package/assets/esri/core/workers/chunks/{7de9c01849c4aa1940e7.js → 986889cea53c4a470347.js} +1 -1
- package/assets/esri/core/workers/chunks/{cc6160e8ab3cea4040c2.js → 9e9b2fd958e816b1b5f6.js} +1 -1
- package/assets/esri/core/workers/chunks/a57cead317eb2fc9afd8.js +1 -0
- package/assets/esri/core/workers/chunks/acec58a7f23b2cc938ee.js +1 -0
- package/assets/esri/core/workers/chunks/b0f4254d8a32dd713009.js +1 -0
- package/assets/esri/core/workers/chunks/b277b8c2f556918e4f9a.js +1 -0
- package/assets/esri/core/workers/chunks/{deffd56e39ce725ce377.js → b30046a40bcfbec8abe4.js} +1 -1
- package/assets/esri/core/workers/chunks/{5c11e2e65b97565e5003.js → b7db64b07edb0b37ece1.js} +1 -1
- package/assets/esri/core/workers/chunks/bd1fb82e8bac439d05ea.js +1 -0
- package/assets/esri/core/workers/chunks/bf0a0ca7fdac98f06a89.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/c44ce0302dc82fb66ada.js +1 -0
- package/assets/esri/core/workers/chunks/c52872a50a5989121388.js +1 -0
- package/assets/esri/core/workers/chunks/c8cd6ba5600d8ff8db0b.js +2 -0
- package/assets/esri/core/workers/chunks/{a100fb789d72410f8d4f.js.LICENSE.txt → c8cd6ba5600d8ff8db0b.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{57c1370b310768c0790a.js → ca1e186f136abb23ae4b.js} +1 -1
- package/assets/esri/core/workers/chunks/{d14e4fc82ad772899336.js → ca4a37bdc0f7fb705146.js} +1 -1
- package/assets/esri/core/workers/chunks/cb94fc9b0f613ad50b3f.js +1 -0
- package/assets/esri/core/workers/chunks/d20764cc99fcabcb7cbf.js +1 -0
- package/assets/esri/core/workers/chunks/df18a72e3625cbe31935.js +1 -0
- package/assets/esri/core/workers/chunks/eff8fcb6393cd1193cbc.js +1 -0
- package/assets/esri/core/workers/chunks/f19d3c855f6e93544918.js +1 -0
- package/assets/esri/core/workers/chunks/{60b40b2319d1651dd150.js → f7e50a8284d12da21355.js} +1 -1
- package/assets/esri/core/workers/chunks/f9c0d571f62e611ffe2b.js +1 -0
- package/assets/esri/core/workers/chunks/fdfe8e0d942b78f08191.js +1 -0
- package/assets/esri/core/workers/chunks/ff21207f46a354786eed.js +1 -0
- package/chunks/Bufferer-BiY2mtjI.js +1 -1
- package/chunks/Centroid-DZi-eb9F.js +1 -1
- package/chunks/Clipper-a9xfvRaw.js +1 -1
- package/chunks/CrackAndCluster-CfzXpEle.js +1 -1
- package/chunks/Distance2DCalculator-eS0piaux.js +1 -1
- package/chunks/GeodeticDistanceCalculator-bNilDneE.js +1 -1
- package/chunks/Geometry.js +1 -1
- package/chunks/GeometryCleaner-DVgW95-D.js +1 -1
- package/chunks/Intersector-K1VmdfQW.js +1 -1
- package/chunks/LineSeries.js +1 -1
- package/chunks/OperatorClip.js +1 -1
- package/chunks/OperatorCrosses.js +1 -1
- package/chunks/OperatorCut.js +1 -1
- package/chunks/OperatorDensify.js +1 -1
- package/chunks/OperatorDifference.js +1 -1
- package/chunks/OperatorGeneralize.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
- package/chunks/OperatorGeodeticDistance.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorIntersection.js +1 -1
- package/chunks/OperatorIntersects.js +1 -1
- package/chunks/OperatorMultiPartToSinglePart.js +1 -1
- package/chunks/OperatorOverlaps.js +1 -1
- package/chunks/OperatorProject.js +1 -1
- package/chunks/OperatorProximity.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingDensify.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorSimplify.js +1 -1
- package/chunks/OperatorTouches.js +1 -1
- package/chunks/OperatorUnion.js +1 -1
- package/chunks/OperatorWithin.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/SideCalculator2D-Bf4QCxCR.js +1 -1
- package/chunks/Theme.js +1 -1
- package/chunks/Tick.js +1 -1
- package/chunks/Transformation2D.js +1 -1
- package/chunks/arcade.js +1 -1
- package/chunks/areaOperator.js +5 -0
- package/chunks/array.js +1 -1
- package/chunks/bufferOperator.js +5 -0
- package/chunks/centroidOperator.js +5 -0
- package/chunks/chartUtilsAm5.js +1 -1
- package/chunks/clipOperator.js +5 -0
- package/chunks/containsOperator.js +5 -0
- package/chunks/convexHullOperator.js +5 -0
- package/chunks/crossesOperator.js +5 -0
- package/chunks/cutOperator.js +5 -0
- package/chunks/densifyOperator.js +5 -0
- package/chunks/differenceOperator.js +5 -0
- package/chunks/disjointOperator.js +5 -0
- package/chunks/distanceOperator.js +5 -0
- package/chunks/equalsOperator.js +5 -0
- package/chunks/generalizeOperator.js +5 -0
- package/chunks/geodesicBufferOperator.js +5 -0
- package/chunks/geodeticAreaOperator.js +5 -0
- package/chunks/geodeticDensifyOperator.js +5 -0
- package/chunks/geodeticLengthOperator.js +5 -0
- package/chunks/i3s.js +1 -1
- package/chunks/intersectionOperator.js +5 -0
- package/chunks/intersectsOperator.js +5 -0
- package/chunks/languageUtils.js +1 -1
- package/chunks/lclayout.js +1 -1
- package/chunks/lengthOperator.js +5 -0
- package/chunks/lyr3DMain.js +1 -1
- package/chunks/lyr3DWorker.js +1 -1
- package/chunks/offsetOperator.js +5 -0
- package/chunks/overlapsOperator.js +5 -0
- package/chunks/pe-wasm.js +1 -1
- package/chunks/proximityOperator.js +5 -0
- package/chunks/relateOperator.js +5 -0
- package/chunks/simplifyOperator.js +5 -0
- package/chunks/symmetricDifferenceOperator.js +5 -0
- package/chunks/touchesOperator.js +5 -0
- package/chunks/unionOperator.js +5 -0
- package/chunks/vxlLayer.js +1 -1
- package/chunks/withinOperator.js +5 -0
- package/copyright.txt +2 -2
- package/core/Evented.js +1 -1
- package/geometry/operators/areaOperator.js +1 -1
- package/geometry/operators/bufferOperator.js +1 -1
- package/geometry/operators/centroidOperator.js +1 -1
- package/geometry/operators/clipOperator.js +1 -1
- package/geometry/operators/containsOperator.js +1 -1
- package/geometry/operators/convexHullOperator.js +1 -1
- package/geometry/operators/crossesOperator.js +1 -1
- package/geometry/operators/cutOperator.js +1 -1
- package/geometry/operators/densifyOperator.js +1 -1
- package/geometry/operators/differenceOperator.js +1 -1
- package/geometry/operators/disjointOperator.js +1 -1
- package/geometry/operators/distanceOperator.js +1 -1
- package/geometry/operators/equalsOperator.js +1 -1
- package/geometry/operators/extendOperator.js +1 -1
- package/geometry/operators/generalizeOperator.js +1 -1
- package/geometry/operators/geodesicBufferOperator.js +1 -1
- package/geometry/operators/geodeticAreaOperator.js +1 -1
- package/geometry/operators/geodeticDensifyOperator.js +1 -1
- package/geometry/operators/geodeticLengthOperator.js +1 -1
- package/geometry/operators/gx/operatorAffineTransform.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorAutoComplete.js +1 -1
- package/geometry/operators/gx/operatorBoundary.js +1 -1
- package/geometry/operators/gx/operatorBuffer.js +1 -1
- package/geometry/operators/gx/operatorConvexHull.js +1 -1
- package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
- package/geometry/operators/gx/operatorIntegrate.js +1 -1
- package/geometry/operators/gx/operatorLabelPoint.js +1 -1
- package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
- package/geometry/operators/gx/operatorLocateBetween.js +1 -1
- package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/gx/operatorSinglePartToMultiPart.js +1 -1
- package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
- package/geometry/operators/intersectionOperator.js +1 -1
- package/geometry/operators/intersectsOperator.js +1 -1
- package/geometry/operators/isNearOperator.js +1 -1
- package/geometry/operators/json/disjointOperator.js +1 -1
- package/geometry/operators/lengthOperator.js +1 -1
- package/geometry/operators/offsetOperator.js +1 -1
- package/geometry/operators/overlapsOperator.js +1 -1
- package/geometry/operators/proximityOperator.js +1 -1
- package/geometry/operators/relateOperator.js +1 -1
- package/geometry/operators/reshapeOperator.js +1 -1
- package/geometry/operators/simplifyOperator.js +1 -1
- package/geometry/operators/support/apiConverter.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/operators/symmetricDifferenceOperator.js +1 -1
- package/geometry/operators/touchesOperator.js +1 -1
- package/geometry/operators/unionOperator.js +1 -1
- package/geometry/operators/withinOperator.js +1 -1
- package/geometry/support/contains.js +1 -1
- package/kernel.js +1 -1
- package/layers/KMLLayer.js +1 -1
- package/layers/WCSLayer.js +1 -1
- package/layers/support/rasterDatasets/WCSRaster.js +1 -1
- package/layers/support/rasterFormats/RasterCodec.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/layers/support/wmtsUtils.js +1 -1
- package/package.json +3 -3
- package/smartMapping/renderers/support/utils.js +1 -1
- package/smartMapping/symbology/support/Theme.js +1 -1
- package/support/revision.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
- package/views/3d/support/DisplayQualityProfile.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/interfaces.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/SelectionManager.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/Legend/support/heatmapRampUtils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/assets/esri/core/workers/chunks/015285436ca965f94e17.js +0 -1
- package/assets/esri/core/workers/chunks/048d296efa26ccd79056.js +0 -1
- package/assets/esri/core/workers/chunks/0e0b978459d70b15acb5.js +0 -1
- package/assets/esri/core/workers/chunks/10fa211987b16fd71a1a.js +0 -1
- package/assets/esri/core/workers/chunks/200a5f1864c2c2f7536c.js +0 -1
- package/assets/esri/core/workers/chunks/23a697d48f6e45cc033e.js +0 -1
- package/assets/esri/core/workers/chunks/29b610ff44708e044cbd.js +0 -1
- package/assets/esri/core/workers/chunks/3600125c58d5d04c515a.js +0 -1
- package/assets/esri/core/workers/chunks/457d4abc938d14f28e31.js +0 -1
- package/assets/esri/core/workers/chunks/4b5dbdcad438cb2dd4bf.js +0 -1
- package/assets/esri/core/workers/chunks/69efc716991a407c3d23.js +0 -1
- package/assets/esri/core/workers/chunks/6e254e846e284223ef63.js +0 -1
- package/assets/esri/core/workers/chunks/785610aa615198fd3815.js +0 -1
- package/assets/esri/core/workers/chunks/7bf7aace72f81f5de4e4.js +0 -1
- package/assets/esri/core/workers/chunks/7ea3d652536e1d79dfc6.js +0 -1
- package/assets/esri/core/workers/chunks/816c9c81352cd0ca8ce8.js +0 -1
- package/assets/esri/core/workers/chunks/9291508232b23f030178.js +0 -1
- package/assets/esri/core/workers/chunks/9fc49968dea8e2b64f3e.js +0 -1
- package/assets/esri/core/workers/chunks/a0b3d70a1b0360084593.js +0 -1
- package/assets/esri/core/workers/chunks/a100fb789d72410f8d4f.js +0 -2
- package/assets/esri/core/workers/chunks/b4d76d46661aba356ea3.js +0 -1
- package/assets/esri/core/workers/chunks/cb3af81e1fe6405c4885.js +0 -1
- package/assets/esri/core/workers/chunks/cbf57abb537e86c1dd7f.js +0 -1
- package/assets/esri/core/workers/chunks/cebdf2f88c4d2ad8baab.js +0 -1
- package/assets/esri/core/workers/chunks/d56d77125798beb7e493.js +0 -1
- package/assets/esri/core/workers/chunks/d82b3e2905cab511ff3a.js +0 -2
- package/assets/esri/core/workers/chunks/e2f91098793b8742fae6.js +0 -1
- package/assets/esri/core/workers/chunks/f25c04cf1a4bc1d2636a.js +0 -1
package/kernel.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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as e
|
|
5
|
+
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as e}from"./support/revision.js";export{commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.32";let s,i=r;i=`${"4.32.0"}-next.${e}`;function t(o){s=o}function n(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{n as addTokenParameter,e as buildDate,i as fullVersion,s as id,t as setId,r as version};
|
package/layers/KMLLayer.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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import r from"../core/Collection.js";import t from"../core/CollectionFlattener.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as s}from"../core/promiseUtils.js";import{watch as i,sync as l}from"../core/reactiveUtils.js";import{getFilename as a}from"../core/urlUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{reader as p}from"../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{writer as y}from"../core/accessorSupport/decorators/writer.js";import m from"../geometry/SpatialReference.js";import c from"./Layer.js";import{BlendLayer as d}from"./mixins/BlendLayer.js";import{OperationalLayer as h}from"./mixins/OperationalLayer.js";import{PortalLayer as f}from"./mixins/PortalLayer.js";import{RefreshableLayer as b}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as j}from"./mixins/ScaleRangeLayer.js";import{url as v}from"./support/commonProperties.js";import g from"./support/KMLSublayer.js";import{sublayersFromJSON as S,fetchService as x,parseKML as L}from"./support/kmlUtils.js";import E from"../geometry/Extent.js";const w=["kml","xml"];let F=class extends(d(b(j(h(f(o(c))))))){constructor(...e){super(...e),this._visibleFolders=[],this.allSublayers=new t({getCollections:()=>[this.sublayers],getChildrenFunction:e=>e.sublayers}),this.outSpatialReference=m.WGS84,this.path=null,this.legendEnabled=!1,this.operationalLayerType="KML",this.sublayers=null,this.type="kml",this.url=null}initialize(){this.addHandles([i((()=>this.sublayers),((e,r)=>{r&&r.forEach((e=>{e.parent=null,e.layer=null})),e&&e.forEach((e=>{e.parent=this,e.layer=this}))}),l),this.on("sublayer-update",(()=>this.notifyChange("fullExtent")))])}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}readSublayersFromItemOrWebMap(e,r){this._visibleFolders=r.visibleFolders}readSublayers(e,r,t){return S(g,r,t,this._visibleFolders)}writeSublayers(e,r){const t=[],o=e.toArray();for(;o.length;){const e=o[0];e.networkLink||(e.visible&&t.push(e.id),e.sublayers&&o.push(...e.sublayers.toArray())),o.shift()}r.visibleFolders=t}get title(){const e=this._get("title");return e&&"defaults"!==this.originOf("title")?e:this.url?a(this.url,w)||"KML":e}set title(e){this._set("title",e)}get visibleSublayers(){const e=this.sublayers,r=[],t=e=>{e.visible&&(r.push(e),e.sublayers&&e.sublayers.forEach(t))};return e&&e.forEach(t),r}get fullExtent(){return this._recomputeFullExtent()}load(e){const r=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["KML"],supportsData:!1},e).catch(s).then((()=>this._fetchService(r)))),Promise.resolve(this)}destroy(){super.destroy(),this.allSublayers.destroy()}async _fetchService(e){const r=await Promise.resolve().then((()=>this.resourceInfo?{ssl:!1,data:this.resourceInfo}:x(this.url??"",this.outSpatialReference,this.refreshInterval,e))),t=L(r.data);
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import r from"../core/Collection.js";import t from"../core/CollectionFlattener.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as s}from"../core/promiseUtils.js";import{watch as i,sync as l}from"../core/reactiveUtils.js";import{getFilename as a}from"../core/urlUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{reader as p}from"../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{writer as y}from"../core/accessorSupport/decorators/writer.js";import m from"../geometry/SpatialReference.js";import c from"./Layer.js";import{BlendLayer as d}from"./mixins/BlendLayer.js";import{OperationalLayer as h}from"./mixins/OperationalLayer.js";import{PortalLayer as f}from"./mixins/PortalLayer.js";import{RefreshableLayer as b}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as j}from"./mixins/ScaleRangeLayer.js";import{url as v}from"./support/commonProperties.js";import g from"./support/KMLSublayer.js";import{sublayersFromJSON as S,fetchService as x,parseKML as L}from"./support/kmlUtils.js";import E from"../geometry/Extent.js";const w=["kml","xml"];let F=class extends(d(b(j(h(f(o(c))))))){constructor(...e){super(...e),this._visibleFolders=[],this.allSublayers=new t({getCollections:()=>[this.sublayers],getChildrenFunction:e=>e.sublayers}),this.outSpatialReference=m.WGS84,this.path=null,this.legendEnabled=!1,this.operationalLayerType="KML",this.sublayers=null,this.type="kml",this.url=null}initialize(){this.addHandles([i((()=>this.sublayers),((e,r)=>{r&&r.forEach((e=>{e.parent=null,e.layer=null})),e&&e.forEach((e=>{e.parent=this,e.layer=this}))}),l),this.on("sublayer-update",(()=>this.notifyChange("fullExtent")))])}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}readSublayersFromItemOrWebMap(e,r){this._visibleFolders=r.visibleFolders}readSublayers(e,r,t){return S(g,r,t,this._visibleFolders)}writeSublayers(e,r){const t=[],o=e.toArray();for(;o.length;){const e=o[0];e.networkLink||(e.visible&&t.push(e.id),e.sublayers&&o.push(...e.sublayers.toArray())),o.shift()}r.visibleFolders=t}get title(){const e=this._get("title");return e&&"defaults"!==this.originOf("title")?e:this.url?a(this.url,w)||"KML":e}set title(e){this._set("title",e)}get visibleSublayers(){const e=this.sublayers,r=[],t=e=>{e.visible&&(r.push(e),e.sublayers&&e.sublayers.forEach(t))};return e&&e.forEach(t),r}get fullExtent(){return this._recomputeFullExtent()}load(e){const r=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["KML"],supportsData:!1},e).catch(s).then((()=>this._fetchService(r)))),Promise.resolve(this)}destroy(){super.destroy(),this.allSublayers.destroy()}async _fetchService(e){const r=await Promise.resolve().then((()=>this.resourceInfo?{ssl:!1,data:this.resourceInfo}:x(this.url??"",this.outSpatialReference,this.refreshInterval,e))),t=L(r.data);this.read(t,{origin:"service"})}_recomputeFullExtent(){let e=null;null!=this.extent&&(e=this.extent.clone());const r=t=>{if(t.sublayers)for(const o of t.sublayers.items)r(o),o.visible&&o.fullExtent&&(null!=e?e.union(o.fullExtent):e=o.fullExtent.clone())};return r(this),e}};e([n({readOnly:!0})],F.prototype,"allSublayers",void 0),e([n({type:m})],F.prototype,"outSpatialReference",void 0),e([n({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],F.prototype,"path",void 0),e([n({readOnly:!0,json:{read:!1,write:!1}})],F.prototype,"legendEnabled",void 0),e([n({type:["show","hide","hide-children"]})],F.prototype,"listMode",void 0),e([n({type:["KML"]})],F.prototype,"operationalLayerType",void 0),e([n({})],F.prototype,"resourceInfo",void 0),e([n({type:r.ofType(g),json:{write:{ignoreOrigin:!0}}})],F.prototype,"sublayers",void 0),e([p(["web-map","portal-item"],"sublayers",["visibleFolders"])],F.prototype,"readSublayersFromItemOrWebMap",null),e([p("service","sublayers",["sublayers"])],F.prototype,"readSublayers",null),e([y("sublayers")],F.prototype,"writeSublayers",null),e([n({readOnly:!0,json:{read:!1}})],F.prototype,"type",void 0),e([n({json:{origins:{"web-map":{read:{source:"title"}}},write:{ignoreOrigin:!0}}})],F.prototype,"title",null),e([n(v)],F.prototype,"url",void 0),e([n({readOnly:!0})],F.prototype,"visibleSublayers",null),e([n({type:E})],F.prototype,"extent",void 0),e([n()],F.prototype,"fullExtent",null),F=e([u("esri.layers.KMLLayer")],F);const O=F;export{O as default};
|
package/layers/WCSLayer.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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import r from"../core/Clonable.js";import o from"../core/Error.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{debounce as i,throwIfAbortError as a}from"../core/promiseUtils.js";import{watch as n}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import m from"./Layer.js";import{BlendLayer as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import r from"../core/Clonable.js";import o from"../core/Error.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{debounce as i,throwIfAbortError as a}from"../core/promiseUtils.js";import{watch as n}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import m from"./Layer.js";import{BlendLayer as d}from"./mixins/BlendLayer.js";import{CustomParametersMixin as c}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as u}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as f}from"./mixins/OperationalLayer.js";import{PortalLayer as y}from"./mixins/PortalLayer.js";import{RefreshableLayer as h}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as v}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as g}from"./mixins/TemporalLayer.js";import{legendEnabled as j,popupEnabled as I}from"./support/commonProperties.js";import S from"./support/Field.js";import{getServicePixelValueField as w}from"./support/rasterFieldUtils.js";import b from"./support/rasterDatasets/WCSRaster.js";import{createPopupTemplate as x}from"../support/popupUtils.js";import{SaveOperationType as A}from"../webdoc/interfaces.js";const P=new Set(["milliseconds","seconds","minutes","hours","days","weeks","months","years","decades","centuries"]);let C=class extends(d(v(f(y(c(u(g(h(s(r.ClonableMixin(m))))))))))){constructor(...e){super(...e),this.coverageId=null,this.version=null,this.isReference=null,this.legendEnabled=!0,this.noData=0,this.operationalLayerType="WCS",this.type="wcs",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null,this._debouncedSaveOperations=i((async(e,t,r)=>{const{save:o,saveAs:s}=await import("./save/imageryUtils.js");switch(e){case A.SAVE:return o(this,t);case A.SAVE_AS:return s(this,r,t)}}))}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WCS"]},e).catch(a).then((()=>this._openRaster(t)))),Promise.resolve(this)}get coverageInfo(){return this.raster.coverageInfo}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){return[w("Pixel Value")]}createPopupTemplate(e){return x({fields:this.rasterFields,title:this.title},e)}async save(e){return this._debouncedSaveOperations(A.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(A.SAVE_AS,t,e)}async _openRaster(e){const t=new b({url:this.url,version:this.version,coverageId:this.coverageId,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters}});if(await t.open({signal:e}),!t.rasterInfo)throw t.destroy(),new o("wcs-layer:load","cannot load resources on "+this.url);const{rasterInfo:r}=t;null==r.noDataValue&&(r.noDataValue=this.noData),this._set("serviceRasterInfo",r),this._set("spatialReference",r.spatialReference),null==this.title&&this.setAtOrigin("title",t.datasetName,"service"),null==this.coverageId&&this.setAtOrigin("coverageId",t.coverageInfo.id,"service"),null==this.version&&t.version&&this.setAtOrigin("version",t.version,"service"),this.setAtOrigin("tileInfo",t.rasterInfo.storageInfo.tileInfo,"service");const{multidimensionalInfo:s}=r;if(null!=s){const e=s.variables[0].dimensions.find((({name:e})=>"StdTime"===e));if(e){let t=e.extent?.[0]??e.values[0];Array.isArray(t)&&(t=t[0]);let r=e.extent?.[1]??e.values[e.values.length-1];Array.isArray(r)&&(r=r[1]);const o=P.has(e.intervalUnit?.toLowerCase())?e.intervalUnit?.toLowerCase():null;this.set("timeInfo",{startField:"StdTime",fullTimeExtent:{start:t,end:r},timeZone:null,interval:o?{value:e.interval,unit:o}:null})}}this.raster=t,this._configDefaultSettings(),this.addHandles(n((()=>this.customParameters),(e=>this.raster.ioConfig.customFetchParameters=e)))}};e([l({type:String,nonNullable:!0,json:{name:"wcsInfo.coverageId",write:{isRequired:!0}}})],C.prototype,"coverageId",void 0),e([l()],C.prototype,"coverageInfo",null),e([l({type:["1.0.0","1.1.0","1.1.1","1.1.2","2.0.1"],nonNullable:!0,json:{name:"wcsInfo.version",write:{isRequired:!0}}})],C.prototype,"version",void 0),e([l({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],C.prototype,"isReference",void 0),e([l({json:{read:!0,write:!0}})],C.prototype,"blendMode",void 0),e([l(j)],C.prototype,"legendEnabled",void 0),e([l({type:["show","hide"]})],C.prototype,"listMode",void 0),e([l()],C.prototype,"noData",void 0),e([l({type:["WCS"]})],C.prototype,"operationalLayerType",void 0),e([l()],C.prototype,"raster",void 0),e([l({readOnly:!0})],C.prototype,"type",void 0),e([l(I)],C.prototype,"popupEnabled",void 0),e([l({type:t,json:{name:"popupInfo",write:!0}})],C.prototype,"popupTemplate",void 0),e([l({readOnly:!0})],C.prototype,"defaultPopupTemplate",null),e([l({readOnly:!0,type:[S]})],C.prototype,"fields",void 0),e([l({readOnly:!0,type:[S]})],C.prototype,"rasterFields",null),C=e([p("esri.layers.WCSLayer")],C);const T=C;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.32/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 i from"../../../core/Logger.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{isAxesOrderReversedForWkid as o}from"../../ogc/crsUtils.js";import{getCapabilities as r,describeCoverage as a}from"../../ogc/wcsUtils.js";import l from"../DimensionalDefinition.js";import c from"./BaseRaster.js";import{parse as d}from"./multipartParser.js";import{standardizeInterpolations as p}from"./wcsCoverageParser.js";import{getFormat as f}from"../rasterFormats/RasterCodec.js";import{clip as u}from"../rasterFunctions/pixelUtils.js";import h from"../../../geometry/Extent.js";const g=["nearest neighbor","bilinear","bicubic"],m=["nearest","linear","cubic"],w="response is not a supported multipart/related mediaType with inline tiff, switching to compatibility mode",v="response is not a supported multipart mediaType with inline tiff",y="response is base64 encoded which may impact layer display performance",x="server returns an exception",I=new Set(["1.0.0","1.1.0","1.1.1","1.1.2","2.0.1"]);let C=class extends c{constructor(){super(...arguments),this.datasetFormat="WCSServer",this.tileType="Raster"}async fetchRawTile(e,i,n,s={}){if(this.isBlockOutside(e,i,n))return null;const{nativePixelSize:o,spatialReference:r}=this.rasterInfo,a=2**e,l=o.x*a,c=o.y*a,{blockWidth:d,blockHeight:p}=this.getBlockWidthHeight(e),{origin:f}=this.rasterInfo.storageInfo.tileInfo,h=this.getTileExtent({x:l,y:c},i,n,f,r,[d,p]),g=this.rasterInfo.extent,m=h.xmax>g.xmax,w=h.ymin<g.ymin,v=m||w;let y=h,x=d,I=p;if(v&&(y=h.clone().intersection(g),null!=y&&(m&&(x=Math.floor((y.xmax-y.xmin)/l),y.xmax=y.xmin+l*x),w&&(I=Math.floor((y.ymax-y.ymin)/c),y.ymin=y.ymax-c*I))),null==y||x<=1||I<=1)return null;const C=await this._getCoverage(y,x,I,a,s);if(!C)return null;const{coverageDescription:b}=this.coverageInfo;let{noDataValue:$,multidimensionalInfo:S}=this.rasterInfo;const{multidimensionalDefinition:j}=s;if(null!=S&&null!=j&&j.length){const e=j[0].variableName;if("2.0"===b.version){const t=b.rangeType[0].find((t=>t.name===e));$=t?.nilValue}else if("1.1"===b.version){const t=b.range.find((t=>t.identifier===e));$=t?.nullValues}}const T=await this.decodePixelBlock(C,{width:x,height:I,planes:null,pixelType:null,noDataValue:Array.isArray($)?$[0]:$});if(null==T)return null;if(T&&(T.width!==x||T.height!==I))throw new t("wcsraster-fetch",`the response has unexpected dimension width: ${T.width}, height: {pixelBlock.height}`);return v?u(T,{x:0,y:0},{width:p,height:p}):T}async _open(e){const{customFetchParameters:i}=this.ioConfig,n=e?.signal,s=await r(this.url,{version:this.version,customParameters:i,signal:n});if(this.capabilities=s,!this.version){let e=s.version.slice(0,3);"2.0"===e||"1.1"===e||"1.0"===e?this.version=s.version:(e=s.supportedVersions.find((e=>"2.0.1"===e))||s.supportedVersions.find((e=>"2.0"===e.slice(0,3)))||s.supportedVersions.find((e=>"1.1"===e.slice(0,3)))||s.supportedVersions.find((e=>"1.0"===e.slice(0,3)))||"1.0.0",this.version=e)}if(!I.has(this.version))throw new t("wcsraster-open",`unsupported WCS version ${this.version}`);const{gridCoverages:o}=s;if(!o.length)throw new t("wcsraster-open","cannot find rectified grid coverages");null==this.coverageId&&(this.coverageId=o[0].id);const l=o.find((e=>e.id===this.coverageId));if(null==l)throw new t("wcsraster-open",`the coverageId ${this.coverageId} does not exist in capabilities`);const c=await a(this.url,{coverageIds:[this.coverageId],version:this.version,customParameters:i,signal:n});this.coverageInfo=c[0],"2.0"===this.version.slice(0,3)&&(this.coverageInfo.lonLatEnvelope=l.lonLatEnvelope,this.coverageInfo.supportedInterpolations=p(s.supportedInterpolations)),this.datasetName=this.coverageInfo.title;const{rasterInfo:d}=this.coverageInfo;if(this.createRemoteDatasetStorageInfo(d,512,512),this._set("rasterInfo",d),null==d.spatialReference)throw new t("wcsraster-open",`coverage without spatial reference is not supported: ${this.coverageId}`);const{pixelType:f,bandCount:u}=await this._getPixelTypeAndBandCount(n);d.pixelType=f,1===d.bandCount&&u>1&&(d.bandCount=u),this.updateTileInfo()}async _getPixelTypeAndBandCount(e){const{pixelSize:n,extent:s,multidimensionalInfo:o}=this.rasterInfo,r=s.center,a=new h({xmin:r.x-n.x,xmax:r.x+n.x,ymin:r.y-n.y,ymax:r.y+n.y,spatialReference:s.spatialReference});let c=[];if(null!=o){const e=o.variables[0];c=[],e.dimensions.forEach((t=>{c.push(new l({variableName:e.name,dimensionName:t.name,values:t.hasRegularIntervals?t.extent?.[0]:t.values?.[0],isSlice:!0}))}))}const{coverageDescription:d}=this.coverageInfo,p={interpolation:"nearest",multidimensionalDefinition:c,signal:e},{version:f}=d,{ioConfig:u}=this,g="2.0"===f&&null==u.allowAnyMediaType||"1.1"===f&&null==u.use2GridOffsets;let m;try{m=await this._getCoverage(a,2,2,1,p,!0)}catch(y){if(!g)throw y;if("1.1"===f){if(!y.details?.isResolutionMismatch)throw y;u.use2GridOffsets=!0}}if(!m&&g&&("2.0"===f&&(u.allowAnyMediaType=!0),m=await this._getCoverage(a,2,2,1,p),m&&i.getLogger(this).warn("wcsraster:getcoverage",w)),!m)throw new t("wcsraster-open","unable to determine pixel type");const v=await this.decodePixelBlock(m,{width:2,height:2,planes:null,pixelType:null});if(null==v)throw new t("wcsraster-open","unable to determine pixel type");return{pixelType:v.pixelType,bandCount:v.getPlaneCount()??0}}async _getCoverage(e,n,s,o,r,a=!1){const{coverageDescription:l}=this.coverageInfo,{version:c}=l,p="2.0"===c?this._getCoverage201Parameters(e,n,s,o,r,l):"1.1"===c?this._getCoverage110Parameters(e,n,s,r,l):this._getCoverage100Parameters(e,n,s,r),u="2.0"===c?await this.request(this._constructWCS201Url(p),{signal:r.signal,responseType:"array-buffer"}):await this.request(this.url,{query:p,signal:r.signal,responseType:"array-buffer"});if("1.0"===c)return u.data;if("2.0"===c&&!1!==this.ioConfig.allowAnyMediaType){if("tiff"===f(u.data))return a&&(this.ioConfig.allowAnyMediaType=!0,i.getLogger(this).warn("wcsraster:getcoverage",w)),u.data}const h=d(u);if(h.isMultipart&&h.data){const e=h.data.find((e=>e.contentType?.toLowerCase().includes("image")&&null!=e.contentData));return a&&"base64"===e?.contentTransferEncoding&&i.getLogger(this).warn("wcsraster:getcoverage",y),e?.contentData}const g=new Uint8Array(u.data,0,Math.min(u.data.byteLength,2e3)),m=String.fromCharCode.apply(null,g).toLowerCase().includes("exception"),I=m&&String.fromCharCode.apply(null,g).includes("A non-zero RESX/RESY or WIDTH/HEIGHT is required but neither was provided");if(m)throw new t("wcsraster:getcoverage",x,{isResolutionMismatch:I});throw new t("wcsraster:getcoverage",v)}_getInterpolationIndex(e){return e&&this.coverageInfo.supportedInterpolations?.includes(e)?"nearest"===e?0:"bilinear"===e?1:"cubic"===e?2:0:0}_getCoverage100Parameters(e,t,i,n){const s=`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`,o=e.spatialReference.wkid,r=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().includes("tiff")))||"GEOTIFF",{bandIds:a,interpolation:l}=n,c=this._getInterpolationIndex(l),d=a?a.map((e=>this.coverageInfo.bandNames[e])):null,p=g[c],{multidimensionalDefinition:f}=n;let u;if(null!=f&&null!=this.rasterInfo.multidimensionalInfo){const e=f.find((e=>"StdTime"===e.dimensionName));let t=e?.values;t&&t.length>0&&(Array.isArray(t[0])&&(t=t[0]),u=t.map((e=>b(e))).join(","))}return{service:"WCS",request:"GetCoverage",version:this.version,coverage:this.coverageId,format:r,crs:`EPSG:${o}`,bbox:s,width:t,height:i,time:u,interpolation:p,band:d?.join(",")}}_getCoverage110Parameters(e,t,i,n,s){const{multidimensionalDefinition:r,bandIds:a,interpolation:l}=n,c=e.spatialReference.wkid,d=`urn:ogc:def:crs:EPSG::${c}`,p=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().includes("tiff")))||"image/tiff",f=this._getInterpolationIndex(l),u=m[f],h=null==l||0===this.coverageInfo.supportedInterpolations?.indexOf(l),g=s.domain.spatialDomain,w=g.origin.x<=g.envelope.xmin&&g.origin.y<=g.envelope.ymin,v=e.width/t,y=e.height/i*(w?1:-1),x=w?[e.xmin,e.ymin]:[e.xmin,e.ymax],I=g.useEPSGAxis&&o(c),C=I?`${x[1]},${x[0]}`:`${x[0]},${x[1]}`,$=this.ioConfig.use2GridOffsets,S=I?$?`${y},${v}`:`${y},0,0,${v}`:$?`${v},${y}`:`${v},0,0,${y}`,j=v/2,T=e.xmin+j,L=e.xmax-j,P=Math.abs(y)/2,R=e.ymin+P,E=e.ymax-P,_=I?`${R},${T},${E},${L},${d}`:`${T},${R},${L},${E},${d}`,A=s.range.find((e=>e.axis.some((e=>e.identifier.toLowerCase().includes("band")))));let D,G=A&&u&&a?h?`${A.identifier}[${A.axis[0].identifier}[${a.join(",")}]]`:`${A.identifier}:${u}[${A.axis[0].identifier}[${a.join(",")}]]`:null;if(null!=r&&r.length)for(let o=0;o<r.length;o++){let e=r[o].values;const t=r[o].dimensionName?.toLowerCase(),i=r[o].variableName?.toLowerCase();if(e.length>0)if(Array.isArray(e[0])&&(e=e[0]),"stdtime"===t)D=e.map((e=>b(e))).join(",");else{const n=s.range.find((e=>e.identifier.toLowerCase()===i));if(n){const i=n.axis.find((e=>e.identifier.toLowerCase()===t));i&&(G=h?n.identifier+"["+i.identifier+"["+e.join(",")+"]]":n.identifier+":"+u+"["+i.identifier+"["+e.join(",")+"]]")}}}return{service:"WCS",request:"GetCoverage",version:this.version,identifier:this.coverageId,format:p,crs:`EPSG:${c}`,boundingbox:_,gridCS:"urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS",gridType:"urn:ogc:def:method:WCS:1.1:2dGridIn2dCrs",gridOrigin:C,gridOffsets:S,gridBaseCRS:d,timeSequence:D,rangeSubset:G}}_getCoverage201Parameters(e,t,i,n,s,o){const{multidimensionalDefinition:r,interpolation:a}=s,l=this._getInterpolationIndex(a);let c=null;const{supportedInterpolations:d}=this.capabilities;if(d?.length)switch(l){case 0:c=d.find((e=>e.toLowerCase().includes("nearest")));break;case 1:c=d.find((e=>e.toLowerCase().includes("linear")));break;case 2:c=d.find((e=>e.toLowerCase().includes("cubic")||e.toLowerCase().includes("quadratic")))}const p=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().includes("tiff")))||"image/tiff",{bandNames:f}=this.coverageInfo,{boundedBy:u,domainSet:h,rangeType:g}=o,m=u.isEastFirst?0:1,w=1-m,{axisLabels:v}=u,y=v[m],x=v[w],I=`http://www.opengis.net/def/crs/EPSG/0/${e.spatialReference.wkid}`,C=I,$=[];$.push(`${y}(${e.xmin},${e.xmax})`),$.push(`${x}(${e.ymin},${e.ymax})`);const S=[];if(v.length>2)for(let E=2;E<v.length;E++){const e=h.origin[E];if(v[E].toLowerCase().includes("time")){let t=e.toString();u.uomLabels?.[E].toLowerCase().includes("ole")&&(S.push(v[E]),t=b(e,!0)),$.push(v[E]+",http://www.opengis.net("+t+")")}else $.push(v[E]+",http://www.opengis.net("+e+")")}let j=null;if(null!=r&&r.length){const e=[];g.forEach((t=>t.forEach((t=>e.push(t.name)))));const t=[];for(let i=0;i<r.length;i++){const n=v.find((e=>e===r[i].dimensionName)),s=e.find((e=>e===r[i].variableName));if(t.includes(s)||t.push(s),n){let e=r[i].values;if(e.length>0){Array.isArray(e[0])&&(e=e[0]);let t="";t=n.toLowerCase().includes("time")?e.map((e=>b(e))).join(","):e.join(",");const i=$.findIndex((e=>0===e.indexOf(n+",http://www.opengis.net")));-1===i&&$.push(n+",http://www.opengis.net("+t+")"),-1===i||$[i].includes("("+t+")")||$.splice(i,1,n+",http://www.opengis.net("+t+")")}}}t.length&&(j=t.join(","))}else if(f?.length>=2){j=(s.bandIds?s.bandIds.map((e=>f[e])):f).join(",")}const T=$.join("&subset="),L=!o.domainSet.hasSameAxisLabelsAsBoundedBy&&!1!==this.ioConfig.allowScaleFactor,P=L?null:`${y}(${t}),${x}(${i})`,R=L?1/n:null;return{service:"WCS",request:"GetCoverage",version:this.version,coverageId:this.coverageId,rangesubset:j,interpolation:c,scaleSize:P,scaleFactor:R,subset:T,format:p,mediaType:this.ioConfig.allowAnyMediaType?null:"multipart/related",outputcrs:I,subsettingcrs:C}}_constructWCS201Url(e){const t={...this.ioConfig.customFetchParameters,...e},i=[];Object.keys(t).forEach((e=>{const n=t[e];null!=n&&("subset"===e?"string"==typeof n&&n.split("&subset=").forEach((e=>{e&&i.push(`subset=${encodeURIComponent(e)}`)})):i.push(`${e}=${encodeURIComponent(n)}`))}));return`${encodeURI(this.url)}?${i.join("&")}`}};function b(e,t=!1){return(t?new Date(24*(e-25569)*60*60*1e3):new Date(e)).toISOString()}e([n({type:String,json:{write:!0}})],C.prototype,"datasetFormat",void 0),e([n({readOnly:!0})],C.prototype,"tileType",void 0),e([n({type:String,json:{write:!0}})],C.prototype,"version",void 0),e([n({type:String,json:{write:!0}})],C.prototype,"coverageId",void 0),C=e([s("esri.layers.support.rasterDatasets.WCSRaster")],C);const $=C;export{$ as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Error.js";import i from"../../../core/Logger.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{isAxesOrderReversedForWkid as o}from"../../ogc/crsUtils.js";import{getCapabilities as r,describeCoverage as a}from"../../ogc/wcsUtils.js";import l from"../DimensionalDefinition.js";import c from"./BaseRaster.js";import{parse as d}from"./multipartParser.js";import{standardizeInterpolations as p}from"./wcsCoverageParser.js";import{getFormat as f}from"../rasterFormats/RasterCodec.js";import{clip as u}from"../rasterFunctions/pixelUtils.js";import h from"../../../geometry/Extent.js";const g=["nearest neighbor","bilinear","bicubic"],m=["nearest","linear","cubic"],w="response is not a supported multipart/related mediaType with inline tiff, switching to compatibility mode",v="response is not a supported multipart mediaType with inline tiff",y="response is base64 encoded which may impact layer display performance",x="server returns an exception",I=new Set(["1.0.0","1.1.0","1.1.1","1.1.2","2.0.1"]);let C=class extends c{constructor(){super(...arguments),this.datasetFormat="WCSServer",this.tileType="Raster"}async fetchRawTile(e,i,n,s={}){if(this.isBlockOutside(e,i,n))return null;const{nativePixelSize:o,spatialReference:r}=this.rasterInfo,a=2**e,l=o.x*a,c=o.y*a,{blockWidth:d,blockHeight:p}=this.getBlockWidthHeight(e),{origin:f}=this.rasterInfo.storageInfo.tileInfo,h=this.getTileExtent({x:l,y:c},i,n,f,r,[d,p]),g=this.rasterInfo.extent,m=h.xmax>g.xmax,w=h.ymin<g.ymin,v=m||w;let y=h,x=d,I=p;if(v&&(y=h.clone().intersection(g),null!=y&&(m&&(x=Math.floor((y.xmax-y.xmin)/l),y.xmax=y.xmin+l*x),w&&(I=Math.floor((y.ymax-y.ymin)/c),y.ymin=y.ymax-c*I))),null==y||x<=1||I<=1)return null;const C=await this._getCoverage(y,x,I,a,s);if(!C)return null;const{coverageDescription:b}=this.coverageInfo,{noDataValue:$,multidimensionalInfo:S}=this.rasterInfo,{multidimensionalDefinition:j}=s;let T;if(null!=S&&null!=j&&j.length){const e=j[0].variableName;if("2.0"===b.version){const t=b.rangeType[0].find((t=>t.name===e));T=t?.nilValue}else if("1.1"===b.version){const t=b.range.find((t=>t.identifier===e));T=t?.nullValues}}const L=T??$,P=await this.decodePixelBlock(C,{width:x,height:I,planes:null,pixelType:null,tiffNoDataValue:Array.isArray(L)?L[0]:L});if(null==P)return null;if(P&&(P.width!==x||P.height!==I))throw new t("wcsraster-fetch",`the response has unexpected dimension width: ${P.width}, height: {pixelBlock.height}`);return v?u(P,{x:0,y:0},{width:p,height:p}):P}async _open(e){const{customFetchParameters:i}=this.ioConfig,n=e?.signal,s=await r(this.url,{version:this.version,customParameters:i,signal:n});if(this.capabilities=s,!this.version){let e=s.version.slice(0,3);"2.0"===e||"1.1"===e||"1.0"===e?this.version=s.version:(e=s.supportedVersions.find((e=>"2.0.1"===e))||s.supportedVersions.find((e=>"2.0"===e.slice(0,3)))||s.supportedVersions.find((e=>"1.1"===e.slice(0,3)))||s.supportedVersions.find((e=>"1.0"===e.slice(0,3)))||"1.0.0",this.version=e)}if(!I.has(this.version))throw new t("wcsraster-open",`unsupported WCS version ${this.version}`);const{gridCoverages:o}=s;if(!o.length)throw new t("wcsraster-open","cannot find rectified grid coverages");null==this.coverageId&&(this.coverageId=o[0].id);const l=o.find((e=>e.id===this.coverageId));if(null==l)throw new t("wcsraster-open",`the coverageId ${this.coverageId} does not exist in capabilities`);const c=await a(this.url,{coverageIds:[this.coverageId],version:this.version,customParameters:i,signal:n});this.coverageInfo=c[0],"2.0"===this.version.slice(0,3)&&(this.coverageInfo.lonLatEnvelope=l.lonLatEnvelope,this.coverageInfo.supportedInterpolations=p(s.supportedInterpolations)),this.datasetName=this.coverageInfo.title;const{rasterInfo:d}=this.coverageInfo;if(this.createRemoteDatasetStorageInfo(d,512,512),this._set("rasterInfo",d),null==d.spatialReference)throw new t("wcsraster-open",`coverage without spatial reference is not supported: ${this.coverageId}`);const{pixelType:f,bandCount:u}=await this._getPixelTypeAndBandCount(n);d.pixelType=f,1===d.bandCount&&u>1&&(d.bandCount=u),this.updateTileInfo()}async _getPixelTypeAndBandCount(e){const{pixelSize:n,extent:s,multidimensionalInfo:o}=this.rasterInfo,r=s.center,a=new h({xmin:r.x-n.x,xmax:r.x+n.x,ymin:r.y-n.y,ymax:r.y+n.y,spatialReference:s.spatialReference});let c=[];if(null!=o){const e=o.variables[0];c=[],e.dimensions.forEach((t=>{c.push(new l({variableName:e.name,dimensionName:t.name,values:t.hasRegularIntervals?t.extent?.[0]:t.values?.[0],isSlice:!0}))}))}const{coverageDescription:d}=this.coverageInfo,p={interpolation:"nearest",multidimensionalDefinition:c,signal:e},{version:f}=d,{ioConfig:u}=this,g="2.0"===f&&null==u.allowAnyMediaType||"1.1"===f&&null==u.use2GridOffsets;let m;try{m=await this._getCoverage(a,2,2,1,p,!0)}catch(y){if(!g)throw y;if("1.1"===f){if(!y.details?.isResolutionMismatch)throw y;u.use2GridOffsets=!0}}if(!m&&g&&("2.0"===f&&(u.allowAnyMediaType=!0),m=await this._getCoverage(a,2,2,1,p),m&&i.getLogger(this).warn("wcsraster:getcoverage",w)),!m)throw new t("wcsraster-open","unable to determine pixel type");const v=await this.decodePixelBlock(m,{width:2,height:2,planes:null,pixelType:null});if(null==v)throw new t("wcsraster-open","unable to determine pixel type");return{pixelType:v.pixelType,bandCount:v.getPlaneCount()??0}}async _getCoverage(e,n,s,o,r,a=!1){const{coverageDescription:l}=this.coverageInfo,{version:c}=l,p="2.0"===c?this._getCoverage201Parameters(e,n,s,o,r,l):"1.1"===c?this._getCoverage110Parameters(e,n,s,r,l):this._getCoverage100Parameters(e,n,s,r),u="2.0"===c?await this.request(this._constructWCS201Url(p),{signal:r.signal,responseType:"array-buffer"}):await this.request(this.url,{query:p,signal:r.signal,responseType:"array-buffer"});if("1.0"===c)return u.data;if("2.0"===c&&!1!==this.ioConfig.allowAnyMediaType){if("tiff"===f(u.data))return a&&(this.ioConfig.allowAnyMediaType=!0,i.getLogger(this).warn("wcsraster:getcoverage",w)),u.data}const h=d(u);if(h.isMultipart&&h.data){const e=h.data.find((e=>e.contentType?.toLowerCase().includes("image")&&null!=e.contentData));return a&&"base64"===e?.contentTransferEncoding&&i.getLogger(this).warn("wcsraster:getcoverage",y),e?.contentData}const g=new Uint8Array(u.data,0,Math.min(u.data.byteLength,2e3)),m=String.fromCharCode.apply(null,g).toLowerCase().includes("exception"),I=m&&String.fromCharCode.apply(null,g).includes("A non-zero RESX/RESY or WIDTH/HEIGHT is required but neither was provided");if(m)throw new t("wcsraster:getcoverage",x,{isResolutionMismatch:I});throw new t("wcsraster:getcoverage",v)}_getInterpolationIndex(e){return e&&this.coverageInfo.supportedInterpolations?.includes(e)?"nearest"===e?0:"bilinear"===e?1:"cubic"===e?2:0:0}_getCoverage100Parameters(e,t,i,n){const s=`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`,o=e.spatialReference.wkid,r=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().includes("tiff")))||"GEOTIFF",{bandIds:a,interpolation:l}=n,c=this._getInterpolationIndex(l),d=a?a.map((e=>this.coverageInfo.bandNames[e])):null,p=g[c],{multidimensionalDefinition:f}=n;let u;if(null!=f&&null!=this.rasterInfo.multidimensionalInfo){const e=f.find((e=>"StdTime"===e.dimensionName));let t=e?.values;t&&t.length>0&&(Array.isArray(t[0])&&(t=t[0]),u=t.map((e=>b(e))).join(","))}return{service:"WCS",request:"GetCoverage",version:this.version,coverage:this.coverageId,format:r,crs:`EPSG:${o}`,bbox:s,width:t,height:i,time:u,interpolation:p,band:d?.join(",")}}_getCoverage110Parameters(e,t,i,n,s){const{multidimensionalDefinition:r,bandIds:a,interpolation:l}=n,c=e.spatialReference.wkid,d=`urn:ogc:def:crs:EPSG::${c}`,p=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().includes("tiff")))||"image/tiff",f=this._getInterpolationIndex(l),u=m[f],h=null==l||0===this.coverageInfo.supportedInterpolations?.indexOf(l),g=s.domain.spatialDomain,w=g.origin.x<=g.envelope.xmin&&g.origin.y<=g.envelope.ymin,v=e.width/t,y=e.height/i*(w?1:-1),x=w?[e.xmin,e.ymin]:[e.xmin,e.ymax],I=g.useEPSGAxis&&o(c),C=I?`${x[1]},${x[0]}`:`${x[0]},${x[1]}`,$=this.ioConfig.use2GridOffsets,S=I?$?`${y},${v}`:`${y},0,0,${v}`:$?`${v},${y}`:`${v},0,0,${y}`,j=v/2,T=e.xmin+j,L=e.xmax-j,P=Math.abs(y)/2,R=e.ymin+P,E=e.ymax-P,_=I?`${R},${T},${E},${L},${d}`:`${T},${R},${L},${E},${d}`,A=s.range.find((e=>e.axis.some((e=>e.identifier.toLowerCase().includes("band")))));let D,G=A&&u&&a?h?`${A.identifier}[${A.axis[0].identifier}[${a.join(",")}]]`:`${A.identifier}:${u}[${A.axis[0].identifier}[${a.join(",")}]]`:null;if(null!=r&&r.length)for(let o=0;o<r.length;o++){let e=r[o].values;const t=r[o].dimensionName?.toLowerCase(),i=r[o].variableName?.toLowerCase();if(e.length>0)if(Array.isArray(e[0])&&(e=e[0]),"stdtime"===t)D=e.map((e=>b(e))).join(",");else{const n=s.range.find((e=>e.identifier.toLowerCase()===i));if(n){const i=n.axis.find((e=>e.identifier.toLowerCase()===t));i&&(G=h?n.identifier+"["+i.identifier+"["+e.join(",")+"]]":n.identifier+":"+u+"["+i.identifier+"["+e.join(",")+"]]")}}}return{service:"WCS",request:"GetCoverage",version:this.version,identifier:this.coverageId,format:p,crs:`EPSG:${c}`,boundingbox:_,gridCS:"urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS",gridType:"urn:ogc:def:method:WCS:1.1:2dGridIn2dCrs",gridOrigin:C,gridOffsets:S,gridBaseCRS:d,timeSequence:D,rangeSubset:G}}_getCoverage201Parameters(e,t,i,n,s,o){const{multidimensionalDefinition:r,interpolation:a}=s,l=this._getInterpolationIndex(a);let c=null;const{supportedInterpolations:d}=this.capabilities;if(d?.length)switch(l){case 0:c=d.find((e=>e.toLowerCase().includes("nearest")));break;case 1:c=d.find((e=>e.toLowerCase().includes("linear")));break;case 2:c=d.find((e=>e.toLowerCase().includes("cubic")||e.toLowerCase().includes("quadratic")))}const p=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().includes("tiff")))||"image/tiff",{bandNames:f}=this.coverageInfo,{boundedBy:u,domainSet:h,rangeType:g}=o,m=u.isEastFirst?0:1,w=1-m,{axisLabels:v}=u,y=v[m],x=v[w],I=`http://www.opengis.net/def/crs/EPSG/0/${e.spatialReference.wkid}`,C=I,$=[];$.push(`${y}(${e.xmin},${e.xmax})`),$.push(`${x}(${e.ymin},${e.ymax})`);const S=[];if(v.length>2)for(let E=2;E<v.length;E++){const e=h.origin[E];if(v[E].toLowerCase().includes("time")){let t=e.toString();u.uomLabels?.[E].toLowerCase().includes("ole")&&(S.push(v[E]),t=b(e,!0)),$.push(v[E]+",http://www.opengis.net("+t+")")}else $.push(v[E]+",http://www.opengis.net("+e+")")}let j=null;if(null!=r&&r.length){const e=[];g.forEach((t=>t.forEach((t=>e.push(t.name)))));const t=[];for(let i=0;i<r.length;i++){const n=v.find((e=>e===r[i].dimensionName)),s=e.find((e=>e===r[i].variableName));if(t.includes(s)||t.push(s),n){let e=r[i].values;if(e.length>0){Array.isArray(e[0])&&(e=e[0]);let t="";t=n.toLowerCase().includes("time")?e.map((e=>b(e))).join(","):e.join(",");const i=$.findIndex((e=>0===e.indexOf(n+",http://www.opengis.net")));-1===i&&$.push(n+",http://www.opengis.net("+t+")"),-1===i||$[i].includes("("+t+")")||$.splice(i,1,n+",http://www.opengis.net("+t+")")}}}t.length&&(j=t.join(","))}else if(f?.length>=2){j=(s.bandIds?s.bandIds.map((e=>f[e])):f).join(",")}const T=$.join("&subset="),L=!o.domainSet.hasSameAxisLabelsAsBoundedBy&&!1!==this.ioConfig.allowScaleFactor,P=L?null:`${y}(${t}),${x}(${i})`,R=L?1/n:null;return{service:"WCS",request:"GetCoverage",version:this.version,coverageId:this.coverageId,rangesubset:j,interpolation:c,scaleSize:P,scaleFactor:R,subset:T,format:p,mediaType:this.ioConfig.allowAnyMediaType?null:"multipart/related",outputcrs:I,subsettingcrs:C}}_constructWCS201Url(e){const t={...this.ioConfig.customFetchParameters,...e},i=[];Object.keys(t).forEach((e=>{const n=t[e];null!=n&&("subset"===e?"string"==typeof n&&n.split("&subset=").forEach((e=>{e&&i.push(`subset=${encodeURIComponent(e)}`)})):i.push(`${e}=${encodeURIComponent(n)}`))}));return`${encodeURI(this.url)}?${i.join("&")}`}};function b(e,t=!1){return(t?new Date(24*(e-25569)*60*60*1e3):new Date(e)).toISOString()}e([n({type:String,json:{write:!0}})],C.prototype,"datasetFormat",void 0),e([n({readOnly:!0})],C.prototype,"tileType",void 0),e([n({type:String,json:{write:!0}})],C.prototype,"version",void 0),e([n({type:String,json:{write:!0}})],C.prototype,"coverageId",void 0),C=e([s("esri.layers.support.rasterDatasets.WCSRaster")],C);const $=C;export{$ 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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../core/Error.js";import{assertIsSome as e}from"../../../core/maybe.js";import a from"../PixelBlock.js";import{SimpleBandStatistics as i}from"../SimpleBandStatistics.js";import s from"./ImageCanvasDecoder.js";import r from"./JpgPlus.js";import{load as n,decode as o}from"./Lerc.js";import{decode as h}from"./Lzw.js";import{convertNoDataToMask as c}from"./pixelRangeUtils.js";import{Z as l}from"../../../chunks/Zlib.js";import p from"./Raw.js";import{decodeTileOrStrip as d,decode as u}from"./TiffDecoder.js";import{isPlatformLittleEndian as f}from"./utils.js";var m=function(t){var e,a,i,s,r,n;function o(t){var e,a,i,s,r,n,o,h,c,l,p,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(),i=this.readUInt16()||100,r.delay=1e3*s/i,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,p=0;0<=e?p<e:p>e;0<=e?++p:--p)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=(l=this.read(e)).indexOf(0),o=String.fromCharCode.apply(String,l.slice(0,n)),this.text[o]=String.fromCharCode.apply(String,l.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,a=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*a,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,a){var i;return"function"==typeof e&&(a=e),(i=new XMLHttpRequest).open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(){var t;return t=new o(new Uint8Array(i.response||i.mozResponseArrayBuffer)),"function"==typeof(null!=e?e.getContext:void 0)&&t.render(e),"function"==typeof a?a(t):void 0},i.send(null)},a=1,i=2,e=0,o.prototype.read=function(t){var e,a;for(a=[],e=0;0<=t?e<t:e>t;0<=t?++e:--e)a.push(this.data[this.pos++]);return a},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,a,i,s,r,n,o,h,c,p,d,u,f,m,g,w,y,x,b,k,T,I,C;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=(t=new l(t)).getBytes(),w=(u=this.pixelBitlength/8)*this.width,f=new Uint8Array(w*this.height),n=t.length,g=0,m=0,a=0;m<n;){switch(t[m++]){case 0:for(s=b=0;b<w;s=b+=1)f[a++]=t[m++];break;case 1:for(s=k=0;k<w;s=k+=1)e=t[m++],r=s<u?0:f[a-u],f[a++]=(e+r)%256;break;case 2:for(s=T=0;T<w;s=T+=1)e=t[m++],i=(s-s%u)/u,y=g&&f[(g-1)*w+i*u+s%u],f[a++]=(y+e)%256;break;case 3:for(s=I=0;I<w;s=I+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],y=g&&f[(g-1)*w+i*u+s%u],f[a++]=(e+Math.floor((r+y)/2))%256;break;case 4:for(s=C=0;C<w;s=C+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],0===g?y=x=0:(y=f[(g-1)*w+i*u+s%u],x=i&&f[(g-1)*w+(i-1)*u+s%u]),o=r+y-x,h=Math.abs(o-r),p=Math.abs(o-y),d=Math.abs(o-x),c=h<=p&&h<=d?r:p<=d?y:x,f[a++]=(e+c)%256;break;default:throw new Error("Invalid filter algorithm: "+t[m-1])}g++}return f},o.prototype.decodePalette=function(){var t,e,a,i,s,r,n,o,h;for(a=this.palette,r=this.transparency.indexed||[],s=new Uint8Array((r.length||0)+a.length),i=0,a.length,t=0,e=n=0,o=a.length;n<o;e=n+=3)s[i++]=a[e],s[i++]=a[e+1],s[i++]=a[e+2],s[i++]=null!=(h=r[t++])?h:255;return s},o.prototype.copyToImageData=function(t,e){var a,i,s,r,n,o,h,c,l,p,d;if(i=this.colors,l=null,a=this.hasAlphaChannel,this.palette.length&&(l=null!=(d=this._decodedPalette)?d:this._decodedPalette=this.decodePalette(),i=4,a=!0),c=(s=t.data||t).length,n=l||e,r=o=0,1===i)for(;r<c;)h=l?4*e[r/4]:o,p=n[h++],s[r++]=p,s[r++]=p,s[r++]=p,s[r++]=a?n[h++]:this.transparency.grayscale&&this.transparency.grayscale===p?0:255,o=h;else for(;r<c;)h=l?4*e[r/4]:o,s[r++]=n[h++],s[r++]=n[h++],s[r++]=n[h++],s[r++]=a?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,a,i,r,n,o,h,c;if(this.animation){for(c=[],a=n=0,o=(h=this.animation.frames).length;n<o;a=++n)e=h[a],i=t.createImageData(e.width,e.height),r=this.decodePixels(new Uint8Array(e.data)),this.copyToImageData(i,r),e.imageData=i,c.push(e.image=s(i));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)===a?t.clearRect(o.xOffset,o.yOffset,o.width,o.height):(null!=o?o.disposeOp:void 0)===i&&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,a,i,s,r,n,o=this;return a=0,n=this.animation,s=n.numFrames,i=n.frames,r=n.numPlays,(e=function(){var n,h;if(n=a++%s,h=i[n],o.renderFrame(t,n),s>1&&a/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,a;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)):(a=e.createImageData(this.width,this.height),this.copyToImageData(a,this.decodePixels()),e.putImageData(a,0,0))},o}(self);const g=new Set(["jpg","png","bmp","gif"]);async function w(e,s){if(!f)throw new t("rasterCoded:decode","lerc decoder is not supported on big endian platform");await n();const{offset:r}=s,{width:h,height:c,pixelType:l,statistics:p,depthCount:d,noDataValues:u,bandMasks:m,pixels:g,mask:w}=o(e,{inputOffset:r,returnInterleaved:s.returnInterleaved}),y=new a({width:h,height:c,pixelType:l.toLowerCase(),pixels:g,mask:w,statistics:p.map((({minValue:t,maxValue:e})=>new i(t,e))),bandMasks:m,depthCount:d,noDataValues:u});return p?.length||y.updateStatistics(),y}async function y(t,i){const s=await u(t,{...i,noDataValue:null});e(s);const r=new a({width:s.width,height:s.height,pixels:s.pixels,pixelType:s.pixelType.toLowerCase(),mask:s.mask,bandMasks:s.bandMasks,statistics:null});return r.updateStatistics(),r}async function x(t,e){const i=await d(t,e.customOptions),s=new a({width:i.width,height:i.height,pixels:i.pixels,pixelType:i.pixelType.toLowerCase(),mask:i.mask,statistics:null});return s.updateStatistics(),s}function b(t,e){const i=e.pixelType||"u8",s=a.getPixelArrayConstructor(i),r="u8"===i?t:new s(t.buffer),n=[],o=e.planes||1;if(1===o)n.push(r);else for(let a=0;a<o;a++){const i=(e.width||1)*(e.height||t.length),h=new s(i);for(let t=0;t<i;t++)h[t]=r[t*o+a];n.push(h)}const h=new a({width:e.width||1,height:e.height||t.length,pixels:n,pixelType:i,statistics:null});return h.updateStatistics(),h}function k(t,e){return b(new l(new Uint8Array(t)).getBytes(),e)}function T(t,e){return b(h(t,e.offset,e.eof,!e.isInputBigEndian),e)}function I(t,e,i){const{pixelTypeCtor:s}=S(e.pixelType),r=(0,p.decode)(t,{width:e.width,height:e.height,pixelType:s,format:i}),n=new a({width:e.width,height:e.height,pixels:r.pixels,pixelType:e.pixelType,mask:r.mask,statistics:null});return n.updateStatistics(),n}function C(t,e){const i=r.decode(t,e.hasNoZlibMask??void 0),s=new a({width:i.width,height:i.height,pixels:i.pixels,pixelType:"u8",mask:i.mask,statistics:null});return s.updateStatistics(),s}function v(t,e){const i=new Uint8Array(t),s=new m(i),{width:r,height:n}=e,o=r*n,h=s.decode();let c,l=0,p=0;const d=new Uint8Array(o);for(l=0;l<o;l++)d[l]=h[4*l+3];const u=new a({width:r,height:n,pixels:[],pixelType:"u8",mask:d,statistics:[]});for(l=0;l<3;l++){for(c=new Uint8Array(o),p=0;p<o;p++)c[p]=h[4*p+l];u.addData({pixels:c})}return u.updateStatistics(),u}async function A(t,e,i,r){const n=new s,o={applyJpegMask:!1,format:e,...i},h=await n.decode(t,o,r),c=new a(h);return c.updateStatistics(),c}function U(e){if(null==e)throw new t("rasterCodec:decode","parameter encodeddata is required.");const a=new Uint8Array(e,0,10);let i="";return 255===a[0]&&216===a[1]?i="jpg":137===a[0]&&80===a[1]&&78===a[2]&&71===a[3]?i="png":67===a[0]&&110===a[1]&&116===a[2]&&90===a[3]&&73===a[4]&&109===a[5]&&97===a[6]&&103===a[7]&&101===a[8]&&32===a[9]?i="lerc":76===a[0]&&101===a[1]&&114===a[2]&&99===a[3]&&50===a[4]&&32===a[5]?i="lerc2":73===a[0]&&73===a[1]&&42===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&42===a[3]||73===a[0]&&73===a[1]&&43===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&43===a[3]?i="tiff":71===a[0]&&73===a[1]&&70===a[2]?i="gif":66===a[0]&&77===a[1]?i="bmp":String.fromCharCode.apply(null,a).toLowerCase().includes("error")&&(i="error"),i}function D(e){let a=null;switch(e){case"lerc":case"lerc2":a=w;break;case"jpg":a=C;break;case"png":a=v;break;case"bsq":case"bip":a=(t,a)=>I(t,a,e);break;case"tiff":a=y;break;case"deflate":a=k;break;case"lzw":a=T;break;case"error":a=()=>{throw new t("rasterCodec:decode","input data contains error")};break;default:a=()=>{throw new t("rasterCodec:decode","unsupported raster format")}}return a}function S(t){let e=null,a=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":a=255,e=Uint8Array;break;case"u16":a=a||65535,e=Uint16Array;break;case"u32":a=a||2**32-1,e=Uint32Array;break;case"s8":a=a||-128,e=Int8Array;break;case"s16":a=a||-32768,e=Int16Array;break;case"s32":a=a||0-2**31,e=Int32Array;break;default:e=Float32Array}return{pixelTypeCtor:e,noDataValue:a}}function O(t,e=1){if(!t)return;const{pixels:i,width:s,height:r,mask:n}=t;if(!i||0===i.length)return;const o=i.length,h=s-1,c=r-1,l=[];let p,d,u,f,m,g,w=null;const y=a.getPixelArrayConstructor(t.pixelType);if(0===e){for(p=0;p<o;p++){for(m=i[p],g=new y(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)g[d*h+u]=m[f+u];l.push(g)}if(null!=n)for(w=new Uint8Array(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)w[d*h+u]=n[f+u]}else{for(p=0;p<o;p++){for(m=i[p],g=new y(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)g[d*h+u]=(m[f+u]+m[f+u+1]+m[f+s+u]+m[f+s+u+1])/4;l.push(g)}if(n)for(w=new Uint8Array(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)w[d*h+u]=Math.min.apply(null,[n[f+u],n[f+u+1],n[f+s+u],n[f+s+u+1]])}t.width=h,t.height=c,t.mask=w,t.pixels=l}function P(t){let e=U(t);return"lerc2"===e?e="lerc":"error"===e&&(e=""),e}async function j(e,i={},s){if(null==e)throw new t("rasterCodec:decode","missing encodeddata parameter.");let r=i.format?.toLowerCase();if(!("bsq"!==r&&"bip"!==r||null!=i.width&&null!=i.height))throw new t("rasterCodec:decode","requires width and height in options parameter.");if("tiff"===r&&i.customOptions)return x(e,i);if((!r||"bsq"!==r&&"bip"!==r&&"deflate"!==r&&"lzw"!==r)&&(r=U(e)),i.useCanvas&&g.has(r))return A(e,r,i,s);const n=D(r);let o;i.isPoint&&(null!=(i={...i}).width&&i.width++,null!=i.height&&i.height++);const{offsets:h}=i;if(h&&h.length>1){const t=h.map(((t,a)=>n(e.slice(t,h[a+1]),i))),s=await Promise.all(t);o=s[0],o.pixels=s.map((t=>t.pixels[0]));const r=s.map((t=>t.mask));s.some((t=>null!=t))&&(r.forEach(((t,e)=>{null==t&&(r[e]=new Uint8Array(o.width*o.height).fill(255))})),o.bandMasks=r,o.mask=a.combineBandMasks(r)),o.updateStatistics()}else o=await n(e,{...i,offset:h?.[0]??i.offset});return"jpg"!==r&&null!=i.noDataValue&&1===o.depthCount&&c(o,i.noDataValue,{customFloatTolerance:i.tolerance}),i.isPoint&&O(o),o}export{j as decode,P as getFormat};
|
|
5
|
+
import t from"../../../core/Error.js";import{assertIsSome as e}from"../../../core/maybe.js";import a from"../PixelBlock.js";import{SimpleBandStatistics as i}from"../SimpleBandStatistics.js";import s from"./ImageCanvasDecoder.js";import r from"./JpgPlus.js";import{load as n,decode as o}from"./Lerc.js";import{decode as h}from"./Lzw.js";import{convertNoDataToMask as c}from"./pixelRangeUtils.js";import{Z as l}from"../../../chunks/Zlib.js";import p from"./Raw.js";import{decodeTileOrStrip as d,decode as u}from"./TiffDecoder.js";import{isPlatformLittleEndian as f}from"./utils.js";var m=function(t){var e,a,i,s,r,n;function o(t){var e,a,i,s,r,n,o,h,c,l,p,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(),i=this.readUInt16()||100,r.delay=1e3*s/i,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,p=0;0<=e?p<e:p>e;0<=e?++p:--p)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=(l=this.read(e)).indexOf(0),o=String.fromCharCode.apply(String,l.slice(0,n)),this.text[o]=String.fromCharCode.apply(String,l.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,a=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*a,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,a){var i;return"function"==typeof e&&(a=e),(i=new XMLHttpRequest).open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(){var t;return t=new o(new Uint8Array(i.response||i.mozResponseArrayBuffer)),"function"==typeof(null!=e?e.getContext:void 0)&&t.render(e),"function"==typeof a?a(t):void 0},i.send(null)},a=1,i=2,e=0,o.prototype.read=function(t){var e,a;for(a=[],e=0;0<=t?e<t:e>t;0<=t?++e:--e)a.push(this.data[this.pos++]);return a},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,a,i,s,r,n,o,h,c,p,d,u,f,m,g,w,y,x,b,k,T,I,C;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=(t=new l(t)).getBytes(),w=(u=this.pixelBitlength/8)*this.width,f=new Uint8Array(w*this.height),n=t.length,g=0,m=0,a=0;m<n;){switch(t[m++]){case 0:for(s=b=0;b<w;s=b+=1)f[a++]=t[m++];break;case 1:for(s=k=0;k<w;s=k+=1)e=t[m++],r=s<u?0:f[a-u],f[a++]=(e+r)%256;break;case 2:for(s=T=0;T<w;s=T+=1)e=t[m++],i=(s-s%u)/u,y=g&&f[(g-1)*w+i*u+s%u],f[a++]=(y+e)%256;break;case 3:for(s=I=0;I<w;s=I+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],y=g&&f[(g-1)*w+i*u+s%u],f[a++]=(e+Math.floor((r+y)/2))%256;break;case 4:for(s=C=0;C<w;s=C+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],0===g?y=x=0:(y=f[(g-1)*w+i*u+s%u],x=i&&f[(g-1)*w+(i-1)*u+s%u]),o=r+y-x,h=Math.abs(o-r),p=Math.abs(o-y),d=Math.abs(o-x),c=h<=p&&h<=d?r:p<=d?y:x,f[a++]=(e+c)%256;break;default:throw new Error("Invalid filter algorithm: "+t[m-1])}g++}return f},o.prototype.decodePalette=function(){var t,e,a,i,s,r,n,o,h;for(a=this.palette,r=this.transparency.indexed||[],s=new Uint8Array((r.length||0)+a.length),i=0,a.length,t=0,e=n=0,o=a.length;n<o;e=n+=3)s[i++]=a[e],s[i++]=a[e+1],s[i++]=a[e+2],s[i++]=null!=(h=r[t++])?h:255;return s},o.prototype.copyToImageData=function(t,e){var a,i,s,r,n,o,h,c,l,p,d;if(i=this.colors,l=null,a=this.hasAlphaChannel,this.palette.length&&(l=null!=(d=this._decodedPalette)?d:this._decodedPalette=this.decodePalette(),i=4,a=!0),c=(s=t.data||t).length,n=l||e,r=o=0,1===i)for(;r<c;)h=l?4*e[r/4]:o,p=n[h++],s[r++]=p,s[r++]=p,s[r++]=p,s[r++]=a?n[h++]:this.transparency.grayscale&&this.transparency.grayscale===p?0:255,o=h;else for(;r<c;)h=l?4*e[r/4]:o,s[r++]=n[h++],s[r++]=n[h++],s[r++]=n[h++],s[r++]=a?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,a,i,r,n,o,h,c;if(this.animation){for(c=[],a=n=0,o=(h=this.animation.frames).length;n<o;a=++n)e=h[a],i=t.createImageData(e.width,e.height),r=this.decodePixels(new Uint8Array(e.data)),this.copyToImageData(i,r),e.imageData=i,c.push(e.image=s(i));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)===a?t.clearRect(o.xOffset,o.yOffset,o.width,o.height):(null!=o?o.disposeOp:void 0)===i&&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,a,i,s,r,n,o=this;return a=0,n=this.animation,s=n.numFrames,i=n.frames,r=n.numPlays,(e=function(){var n,h;if(n=a++%s,h=i[n],o.renderFrame(t,n),s>1&&a/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,a;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)):(a=e.createImageData(this.width,this.height),this.copyToImageData(a,this.decodePixels()),e.putImageData(a,0,0))},o}(self);const g=new Set(["jpg","png","bmp","gif"]);async function w(e,s){if(!f)throw new t("rasterCoded:decode","lerc decoder is not supported on big endian platform");await n();const{offset:r}=s,{width:h,height:c,pixelType:l,statistics:p,depthCount:d,noDataValues:u,bandMasks:m,pixels:g,mask:w}=o(e,{inputOffset:r,returnInterleaved:s.returnInterleaved}),y=new a({width:h,height:c,pixelType:l.toLowerCase(),pixels:g,mask:w,statistics:p.map((({minValue:t,maxValue:e})=>new i(t,e))),bandMasks:m,depthCount:d,noDataValues:u});return p?.length||y.updateStatistics(),y}async function y(t,i){const s=await u(t,{...i,noDataValue:i.tiffNoDataValue});e(s);const r=new a({width:s.width,height:s.height,pixels:s.pixels,pixelType:s.pixelType.toLowerCase(),mask:s.mask,bandMasks:s.bandMasks,statistics:null});return r.updateStatistics(),r}async function x(t,e){const i=await d(t,e.customOptions),s=new a({width:i.width,height:i.height,pixels:i.pixels,pixelType:i.pixelType.toLowerCase(),mask:i.mask,statistics:null});return s.updateStatistics(),s}function b(t,e){const i=e.pixelType||"u8",s=a.getPixelArrayConstructor(i),r="u8"===i?t:new s(t.buffer),n=[],o=e.planes||1;if(1===o)n.push(r);else for(let a=0;a<o;a++){const i=(e.width||1)*(e.height||t.length),h=new s(i);for(let t=0;t<i;t++)h[t]=r[t*o+a];n.push(h)}const h=new a({width:e.width||1,height:e.height||t.length,pixels:n,pixelType:i,statistics:null});return h.updateStatistics(),h}function k(t,e){return b(new l(new Uint8Array(t)).getBytes(),e)}function T(t,e){return b(h(t,e.offset,e.eof,!e.isInputBigEndian),e)}function I(t,e,i){const{pixelTypeCtor:s}=S(e.pixelType),r=(0,p.decode)(t,{width:e.width,height:e.height,pixelType:s,format:i}),n=new a({width:e.width,height:e.height,pixels:r.pixels,pixelType:e.pixelType,mask:r.mask,statistics:null});return n.updateStatistics(),n}function C(t,e){const i=r.decode(t,e.hasNoZlibMask??void 0),s=new a({width:i.width,height:i.height,pixels:i.pixels,pixelType:"u8",mask:i.mask,statistics:null});return s.updateStatistics(),s}function v(t,e){const i=new Uint8Array(t),s=new m(i),{width:r,height:n}=e,o=r*n,h=s.decode();let c,l=0,p=0;const d=new Uint8Array(o);for(l=0;l<o;l++)d[l]=h[4*l+3];const u=new a({width:r,height:n,pixels:[],pixelType:"u8",mask:d,statistics:[]});for(l=0;l<3;l++){for(c=new Uint8Array(o),p=0;p<o;p++)c[p]=h[4*p+l];u.addData({pixels:c})}return u.updateStatistics(),u}async function A(t,e,i,r){const n=new s,o={applyJpegMask:!1,format:e,...i},h=await n.decode(t,o,r),c=new a(h);return c.updateStatistics(),c}function U(e){if(null==e)throw new t("rasterCodec:decode","parameter encodeddata is required.");const a=new Uint8Array(e,0,10);let i="";return 255===a[0]&&216===a[1]?i="jpg":137===a[0]&&80===a[1]&&78===a[2]&&71===a[3]?i="png":67===a[0]&&110===a[1]&&116===a[2]&&90===a[3]&&73===a[4]&&109===a[5]&&97===a[6]&&103===a[7]&&101===a[8]&&32===a[9]?i="lerc":76===a[0]&&101===a[1]&&114===a[2]&&99===a[3]&&50===a[4]&&32===a[5]?i="lerc2":73===a[0]&&73===a[1]&&42===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&42===a[3]||73===a[0]&&73===a[1]&&43===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&43===a[3]?i="tiff":71===a[0]&&73===a[1]&&70===a[2]?i="gif":66===a[0]&&77===a[1]?i="bmp":String.fromCharCode.apply(null,a).toLowerCase().includes("error")&&(i="error"),i}function D(e){let a=null;switch(e){case"lerc":case"lerc2":a=w;break;case"jpg":a=C;break;case"png":a=v;break;case"bsq":case"bip":a=(t,a)=>I(t,a,e);break;case"tiff":a=y;break;case"deflate":a=k;break;case"lzw":a=T;break;case"error":a=()=>{throw new t("rasterCodec:decode","input data contains error")};break;default:a=()=>{throw new t("rasterCodec:decode","unsupported raster format")}}return a}function S(t){let e=null,a=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":a=255,e=Uint8Array;break;case"u16":a=a||65535,e=Uint16Array;break;case"u32":a=a||2**32-1,e=Uint32Array;break;case"s8":a=a||-128,e=Int8Array;break;case"s16":a=a||-32768,e=Int16Array;break;case"s32":a=a||0-2**31,e=Int32Array;break;default:e=Float32Array}return{pixelTypeCtor:e,noDataValue:a}}function O(t,e=1){if(!t)return;const{pixels:i,width:s,height:r,mask:n}=t;if(!i||0===i.length)return;const o=i.length,h=s-1,c=r-1,l=[];let p,d,u,f,m,g,w=null;const y=a.getPixelArrayConstructor(t.pixelType);if(0===e){for(p=0;p<o;p++){for(m=i[p],g=new y(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)g[d*h+u]=m[f+u];l.push(g)}if(null!=n)for(w=new Uint8Array(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)w[d*h+u]=n[f+u]}else{for(p=0;p<o;p++){for(m=i[p],g=new y(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)g[d*h+u]=(m[f+u]+m[f+u+1]+m[f+s+u]+m[f+s+u+1])/4;l.push(g)}if(n)for(w=new Uint8Array(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)w[d*h+u]=Math.min.apply(null,[n[f+u],n[f+u+1],n[f+s+u],n[f+s+u+1]])}t.width=h,t.height=c,t.mask=w,t.pixels=l}function P(t){let e=U(t);return"lerc2"===e?e="lerc":"error"===e&&(e=""),e}async function j(e,i={},s){if(null==e)throw new t("rasterCodec:decode","missing encodeddata parameter.");let r=i.format?.toLowerCase();if(!("bsq"!==r&&"bip"!==r||null!=i.width&&null!=i.height))throw new t("rasterCodec:decode","requires width and height in options parameter.");if("tiff"===r&&i.customOptions)return x(e,i);if((!r||"bsq"!==r&&"bip"!==r&&"deflate"!==r&&"lzw"!==r)&&(r=U(e)),i.useCanvas&&g.has(r))return A(e,r,i,s);const n=D(r);let o;i.isPoint&&(null!=(i={...i}).width&&i.width++,null!=i.height&&i.height++);const{offsets:h}=i;if(h&&h.length>1){const t=h.map(((t,a)=>n(e.slice(t,h[a+1]),i))),s=await Promise.all(t);o=s[0],o.pixels=s.map((t=>t.pixels[0]));const r=s.map((t=>t.mask));s.some((t=>null!=t))&&(r.forEach(((t,e)=>{null==t&&(r[e]=new Uint8Array(o.width*o.height).fill(255))})),o.bandMasks=r,o.mask=a.combineBandMasks(r)),o.updateStatistics()}else o=await n(e,{...i,offset:h?.[0]??i.offset});return"jpg"!==r&&null!=i.noDataValue&&1===o.depthCount&&c(o,i.noDataValue,{customFloatTolerance:i.tolerance}),i.isPoint&&O(o),o}export{j as decode,P 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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../core/has.js";import{bytesToUTF8 as e}from"../rasterDatasets/byteStreamUtils.js";import{J as t}from"../../../chunks/Jpg.js";import{load as n,decode as a}from"./Lerc.js";import{decode as i}from"./Lzw.js";import{convertNoDataToMask as s}from"./pixelRangeUtils.js";import r from"./TiffTags.js";import{isPlatformLittleEndian as l}from"./utils.js";import{Z as o}from"../../../chunks/Zlib.js";const f=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],u=4294967296,c=new Set([1,5,6,7,8,34712,34887]);function h(e,t){let n="unknown";return 3===e?n=64===t?"f64":"f32":1===e?1===t?n="u1":2===t?n="u2":4===t?n="u4":t<=8?n="u8":t<=16?n="u16":t<=32&&(n="u32"):2===e&&(t<=8?n="s8":t<=16?n="s16":t<=32&&(n="s32")),n}function g(e){let t=null;switch(e?e.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":t=Uint8Array;break;case"u16":t=Uint16Array;break;case"u32":t=Uint32Array;break;case"s8":t=Int8Array;break;case"s16":t=Int16Array;break;case"s32":t=Int32Array;break;case"f64":t=Float64Array;break;default:t=Float32Array}return t}function E(e,t){return{x:t[0]*e.x+t[1]*e.y+t[2],y:t[3]*e.x+t[4]*e.y+t[5]}}function T(e,t){return e.get(t)?.values}function I(e,t){return e.get(t)?.values}function w(e,t){return e.get(t)?.values?.[0]}function p(e,t){return e.get(t)?.values?.[0]}function d(e,t,n,a=0,i=r.tiffTags,s=4){const l=8===s,o=l?C(new DataView(e,n,8),0,t):new DataView(e,n,2).getUint16(0,t),f=4+2*s,u=l?8:2,c=u+o*f;if(n+c>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:c};const h=n+c+4<=e.byteLength?v(new DataView(e,n+c,8===s?8:4),0,t,8===s):null,g=n+u,E=new Map;let T,I,w,p,d,m=0,y=0;for(let S=0;S<o;S++){I=new DataView(e,g+f*S,f),w=I.getUint16(0,t),d=I.getUint16(2,t),p=r.getTagName(w,i);const n=[];2===s?(m=I.getUint16(4,t),y=I.getUint16(6,t)):4===s?(m=I.getUint32(4,t),y=I.getUint32(8,t)):8===s&&(m=v(I,4,t,!0),y=v(I,12,t,!0),n.push(I.getUint32(12,t)),n.push(I.getUint32(16,t))),T={id:w,type:d,valueCount:m,valueOffset:y,valueOffsets:n,values:null},L(e,t,T,a,!1,s),E.set(p,T)}return{success:!0,ifd:E,nextIFD:h,requiredBufferSize:c}}const m=(e,t)=>a(e,{inputOffset:t}).pixels[0];function y(e,t){if(1!==t&&2!==t&&4!==t)return e;const n=new Uint8Array(e),a=8/t,i=new Uint8Array(e.byteLength*a);let s=0;const r=2**t-1;for(let l=0;l<n.length;l++){const e=n[l];for(let n=0;n<a;n++)i[s++]=e<<t*n>>>8-t&r}return i.buffer}function S(e,n,a){const i=new t;i.parse(e),i.colorTransform=6===a?-1:0;const s=i.getData(i.width,i.height,1!==n&&4!==n);return new Uint8Array(s.buffer)}function A(e){const t=new o(e).getBytes(),n=new ArrayBuffer(t.length),a=new Uint8Array(n);return a.set(t),a}async function M(e,t,a,s,r){const o=l===t,f=p(a,"BITSPERSAMPLE"),u=p(a,"SAMPLESPERPIXEL")??1,c=p(a,"PHOTOMETRICINTERPRETATION"),E=p(a,"SAMPLEFORMAT")??1,T=h(E,f),I=p(a,"COMPRESSION")??1,w=g(T);let d,M,P;if(34887===I)return await n(),m(e,s);if(1===I)d=e.slice(s,s+r),M=new Uint8Array(d);else if(8===I||32946===I)M=new Uint8Array(e,s,r),M=A(M),d=M.buffer;else if(6===I)M=new Uint8Array(e,s,r),M=S(M,u,c),d=M.buffer;else if(7===I){const t=a.get("JPEGTABLES").values,n=t.length-2;M=new Uint8Array(n+r-2);for(let e=0;e<n;e++)M[e]=t[e];const i=new Uint8Array(e,s+2,r-2);for(let e=0;e<i.length;e++)M[n+e]=i[e];M=S(M,u,c),d=M.buffer}else{if(5!==I)throw new Error("tiff-decode: unsupport compression "+I);M=i(e,s,r,t),d=M.buffer}if(d=y(d,f),"u8"===T||"s8"===T||o)P=new w(d);else{d=new ArrayBuffer(M.length);const e=new Uint8Array(d);switch(T){case"u16":case"s16":for(let t=0;t<M.length;t+=2)e[t]=M[t+1],e[t+1]=M[t];break;case"u32":case"s32":case"f32":for(let t=0;t<M.length;t+=4)e[t]=M[t+3],e[t+1]=M[t+2],e[t+2]=M[t+1],e[t+3]=M[t]}P=new w(d)}const O=p(a,"PREDICTOR")??1,b=p(a,"TILEWIDTH"),x=p(a,"TILELENGTH");if(O>1&&(5===I||8===I||32946===I)&&b&&x){const e=D(a),t=new w(P.length);t.set(P),P=W(t,x,b,3===E&&3===O,e?1:u)}return P}async function P(e,t,n){const a=I(n,"TILEOFFSETS");if(void 0===a)return null;const i=I(n,"TILEBYTECOUNTS"),{width:s,height:r,pixelType:l,tileWidth:o,tileHeight:f}=R([n]),u=D(n,t),c=p(n,"SAMPLESPERPIXEL")||t.planes,h=s*r,E=p(n,"BITSPERSAMPLE"),T=34887===(p(n,"COMPRESSION")??1),w=g(l),d=[];for(let g=0;g<c;g++)d.push(new w(h));let m,y,S,A,P,O,b,x,L,U,N,k,C;const G=Math.ceil(s/o),v=new Uint8Array(h).fill(255);let F=!1;if(E%8==0)if(T&&u&&c>1){const l=Math.round(a.length/c);for(m=0;m<l;m++){O=Math.floor(m/G)*f,b=m%G*o,x=O*s+b;for(let l=0;l<c;l++){const u=m*c+l;for(0===i[u]?(S=null,F=!0):S=await M(e,t.littleEndian,n,a[u],i[u]),U=0,L=x,k=Math.min(o,s-b),N=Math.min(f,r-O),C=d[l],A=0;A<N;A++)for(L=x+A*s,U=A*o,P=0;P<k;P++,L++,U++)S?C[L]=S[U]:v[L]=0}}}else for(m=0;m<a.length;m++)for(O=Math.floor(m/G)*f,b=m%G*o,x=O*s+b,0===i[m]?(S=null,F=!0):S=await M(e,t.littleEndian,n,a[m],i[m]),U=0,L=x,k=Math.min(o,s-b),N=Math.min(f,r-O),y=0;y<c;y++)if(C=d[y],u||T)for(A=0;A<N;A++)for(L=x+A*s,U=o*f*y+A*o,P=0;P<k;P++,L++,U++)S?C[L]=S[U]:v[L]=0;else for(A=0;A<N;A++)for(L=x+A*s,U=A*o*c+y,P=0;P<k;P++,L++,U+=c)S?C[L]=S[U]:v[L]=0;return{width:s,height:r,pixelType:l,pixels:d,mask:F?v:void 0}}const O=(e,t,n)=>{const a=l===t.littleEndian,s=I(n,"STRIPOFFSETS");if(void 0===s)return null;const{width:r,height:o,pixelType:f}=R([n]),u=p(n,"SAMPLESPERPIXEL")||t.planes,c=p(n,"PHOTOMETRICINTERPRETATION"),h=r*o,E=p(n,"BITSPERSAMPLE"),T=g(f),w=new T(h*u),d=I(n,"STRIPBYTECOUNTS"),m=p(n,"ROWSPERSTRIP"),M=p(n,"COMPRESSION")??1;let P,O,b,x,L,D,U,N,k;if(E%8==0)for(P=0;P<s.length;P++){if(L=P*(m*r)*u,"u8"===f||"s8"===f||a)8===M||32946===M?(U=new Uint8Array(e,s[P],d[P]),U=A(U),D=U.buffer):6===M?(U=new Uint8Array(e,s[P],d[P]),U=S(U,u,c),D=U.buffer):5===M?(U=i(e,s[P],d[P],t.littleEndian),D=U.buffer):D=e.slice(s[P],s[P]+d[P]),D=y(D,E),x=new T(D);else{switch(6===M||8===M||32946===M?(U=new Uint8Array(e,s[P],d[P]),N=A(U),D=N.buffer):(D=new ArrayBuffer(d[P]),U=new Uint8Array(e,s[P],d[P]),N=new Uint8Array(D)),f){case"u16":case"s16":for(b=0;b<U.length;b+=2)N[b]=U[b+1],N[b+1]=U[b];break;case"u32":case"s32":case"f32":for(b=0;b<U.length;b+=4)N[b]=U[b+3],N[b+1]=U[b+2],N[b+2]=U[b+1],N[b+3]=U[b]}D=y(D,E),x=new T(D)}w.set(x,L)}const C=[];if(1===u)C.push(w);else for(P=0;P<u;P++){for(k=new T(h),O=0;O<h;O++)k[O]=w[O*u+P];C.push(k)}return{width:r,height:o,pixelType:f,pixels:C}},b=(e,t,n)=>{if(!(e&&e.length>0&&t&&n))return null;let a,i,s;const r=e[0].length,l=e.length,o=new Uint8Array(r);for(let f=0;f<l;f++)if(a=e[f],i=t[f],s=n[f],0===f)for(let e=0;e<r;e++)o[e]=a[e]<i||a[e]>s?0:1;else for(let e=0;e<r;e++)o[e]&&(o[e]=a[e]<i||a[e]>s?0:1);return o},x=e=>{if(!e)return null;const t=e.match(/<Item(.*?)Item>/gi);if(!t||0===t.length)return null;const n=new Map;let a,i,s,r,l;for(let w=0;w<t.length;w++)a=t[w],i=a.slice(6,a.indexOf(">")),r=a.indexOf("sample="),r>-1&&(l=a.slice(r+8,a.indexOf('"',r+8))),r=a.indexOf("name="),r>-1&&(i=a.slice(r+6,a.indexOf('"',r+6))),i&&(s=a.slice(a.indexOf(">")+1,a.indexOf("</Item>")).trim(),null!=l?n.has(i)?n.get(i)[l]=s:n.set(i,[s]):n.set(i,s)),l=null;const o=n.get("STATISTICS_MINIMUM"),f=n.get("STATISTICS_MAXIMUM"),u=n.get("STATISTICS_MEAN"),c=n.get("STATISTICS_STDDEV");let h=null;if(o&&f){h=[];for(let e=0;e<o.length;e++)h.push({min:parseFloat(o[e]),max:parseFloat(f[e]),avg:u&&parseFloat(u[e]),stddev:c&&parseFloat(c[e])})}const g=n.get("BandName"),E=n.get("WavelengthMin"),T=n.get("WavelengthMax");let I=null;if(g){I=[];for(let e=0;e<g.length;e++)I.push({BandName:g[e],WavelengthMin:E&&parseFloat(E[e]),WavelengthMax:T&&parseFloat(T[e])})}return{statistics:h,bandProperties:I,dataType:n.get("DataType"),rawMetadata:n}};function L(e,t,n,a=0,i=!1,s=4){if(n.values)return!0;const r=n.type,l=n.valueCount;let o=n.valueOffset,c=[];const h=f[r],g=8*h,E=l*h,T=l*f[r]*8;let I,w;const p=8===s?64:32,d=n.valueOffsets;if(T>p){if(E>(i?e.byteLength:e?e.byteLength-o+a:0))return n.offlineOffsetSize=[o,E],n.values=null,!1}if(T<=p){if(!t)if(p<=32)o>>>=32-T;else{const e=d?.length?d[0]:o>>>0,t=d?.length?d[1]:Math.round((o-e)/u);T<=32?(o=e>>>32-T,d[0]=o):(o=e*2**(32-T)+(t>>>32-T),d[0]=e,d[1]=t>>>32-T)}if(1===l&&g===p)c=[o];else if(64===p){const e=d?.length?d[0]:o>>>0,t=d?.length?d[1]:Math.round((o-e)/u);let n=e,a=32;for(w=1;w<=l;w++){const e=32-g*w%32;if(a<g){const i=n<<e>>>32-a,s=t<<32-a>>>32-a;n=t,c.push(i+s*2**(g-a)),a-=32-(g-a)}else c.push(n<<e>>>32-g),a-=g;0===a&&(a=32,n=t)}}else for(w=1;w<=l;w++){const e=32-g*w;c.push(o<<e>>>32-g)}}else{o-=a,i&&(o=0);for(let n=o;n<o+E;n+=h){switch(r){case 1:case 2:case 7:I=new DataView(e,n,1).getUint8(0);break;case 3:I=new DataView(e,n,2).getUint16(0,t);break;case 4:case 13:I=new DataView(e,n,4).getUint32(0,t);break;case 5:I=new DataView(e,n,4).getUint32(0,t)/new DataView(e,n+4,4).getUint32(0,t);break;case 6:I=new DataView(e,n,1).getInt8(0);break;case 8:I=new DataView(e,n,2).getInt16(0,t);break;case 9:I=new DataView(e,n,4).getInt32(0,t);break;case 10:I=new DataView(e,n,4).getInt32(0,t)/new DataView(e,n+4,4).getInt32(0,t);break;case 11:I=new DataView(e,n,4).getFloat32(0,t);break;case 12:I=new DataView(e,n,8).getFloat64(0,t);break;case 16:case 18:I=C(new DataView(e,n,8),0,t);break;case 17:I=G(new DataView(e,n,8),0,t);break;default:I=null}c.push(I)}}if(2===r){let e="";const t=c;for(c=[],w=0;w<t.length;w++)0===t[w]&&""!==e?(c.push(e),e=""):e+=String.fromCharCode(t[w]);""===e&&0!==c.length||c.push(e)}return n.values=c,!0}function R(e){const t=e[0],n=p(t,"TILEWIDTH"),a=p(t,"TILELENGTH"),i=p(t,"IMAGEWIDTH"),s=p(t,"IMAGELENGTH"),r=p(t,"BITSPERSAMPLE"),l=p(t,"SAMPLESPERPIXEL"),o=p(t,"SAMPLEFORMAT")??1,f=h(o,r),u=D(t),g=T(t,"GDAL_NODATA");let d=null;g?.length&&(d=g.map((e=>parseFloat(e))),d.some((e=>isNaN(e)))&&(d=null));const m=p(t,"COMPRESSION")??1;let y;switch(m){case 1:y="NONE";break;case 2:case 3:case 4:case 32771:y="CCITT";break;case 5:y="LZW";break;case 6:case 7:y="JPEG";break;case 32773:y="PACKBITS";break;case 8:case 32946:y="DEFLATE";break;case 34712:y="JPEG2000";break;case 34887:y="LERC";break;default:y=String(m)}let S=!0,A="";c.has(m)||(S=!1,A+="unsupported tag compression "+m),o>3&&(S=!1,A+="unsupported tag sampleFormat "+o),1!==r&&2!==r&&4!==r&&r%8!=0&&(S=!1,A+="unsupported tag bitsPerSample "+r);const M=w(t,"GEOASCIIPARAMS");let P;if(M){const e=M.split("|").find((e=>e.includes("ESRI PE String = "))),t=e?e.replace("ESRI PE String = ",""):"";P=t.startsWith("COMPD_CS")||t.startsWith("PROJCS")||t.startsWith("GEOGCS")?{wkid:null,wkt:t}:null}const O=I(t,"GEOTIEPOINTS"),b=I(t,"GEOPIXELSCALE"),L=I(t,"GEOTRANSMATRIX"),R=t.has("GEOKEYDIRECTORY")?t.get("GEOKEYDIRECTORY").data:null;let k,C,G=!1,v=!1;if(R){G=2===p(R,"GTRasterTypeGeoKey");const e=p(R,"GTModelTypeGeoKey");if(2===e){const e=p(R,"GeographicTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e}),P||32767!==e||(v=!0,P={wkid:4326})}else if(1===e){const e=p(R,"ProjectedCSTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e})}}if(b&&O&&O.length>=6?(k=[b[0],0,O[3]-O[0]*b[0],0,-Math.abs(b[1]),O[4]-O[1]*b[1]],G&&(k[2]-=.5*k[0]+.5*k[1],k[5]-=.5*k[3]+.5*k[4])):L&&16===L.length&&(k=G?[L[0],L[1],L[3]-.5*L[0],L[4],L[5],L[7]-.5*L[5]]:[L[0],L[1],L[3],L[4],L[5],L[7]]),k){const e=[{x:0,y:s},{x:0,y:0},{x:i,y:s},{x:i,y:0}];let t,n=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let i=0;i<e.length;i++)t=E(e[i],k),n=t.x>n?n:t.x,r=t.x<r?r:t.x,a=t.y>a?a:t.y,l=t.y<l?l:t.y;C={xmin:n,xmax:r,ymin:a,ymax:l,spatialReference:P}}else C={xmin:-.5,ymin:.5-s,xmax:i-.5,ymax:.5,spatialReference:P};v&&(C.xmax-C.xmin>400||Math.max(Math.abs(C.xmin),Math.abs(C.xmax))>361)&&(P=null,C.spatialReference=null);const F=U(e);let B,W,H,Y,_;if(F.length>0){H=Math.round(Math.log(i/p(F[0],"IMAGEWIDTH"))/Math.LN2);const e=F[F.length-1];Y=F.length,B=p(e,"TILEWIDTH"),W=p(e,"TILELENGTH")}B=null!=Y&&Y>0?B||n:null,W=null!=Y&&Y>0?W||a:null,n&&(_=[{maxCol:Math.ceil(i/n)-1,maxRow:Math.ceil(s/a)-1,minRow:0,minCol:0}],F.forEach((e=>{_.push({maxCol:Math.ceil(p(e,"IMAGEWIDTH")/p(e,"TILEWIDTH"))-1,maxRow:Math.ceil(p(e,"IMAGELENGTH")/p(e,"TILELENGTH"))-1,minRow:0,minCol:0})})));const j=w(e[0],"GDAL_METADATA"),K=x(j);A+=" "+V({width:i,height:s,tileWidth:n,tileHeight:a,planes:l,ifds:e});const X=N(e).length===F.length+1,J=F?.length?F.map((e=>({x:i/p(e,"IMAGEWIDTH"),y:s/p(e,"IMAGELENGTH")}))):void 0;return{width:i,height:s,tileWidth:n,tileHeight:a,planes:l,isBSQ:u,pixelType:f,compression:y,noData:d,hasMaskBand:X,isSupported:S,pyramidResolutions:J,message:A,extent:C,isPseudoGeographic:v,affine:b?null:k,firstPyramidLevel:H,maximumPyramidLevel:Y,pyramidBlockWidth:B,pyramidBlockHeight:W,tileBoundary:_,metadata:K}}function D(e,t){const n=T(e,"PLANARCONFIGURATION");return n?2===n[0]:!!t&&t.isBSQ}function U(e){return e.filter((e=>1===p(e,"NEWSUBFILETYPE")))}function N(e){return e.filter((e=>{const t=!(4&~(p(e,"NEWSUBFILETYPE")??0)),n=4===p(e,"PHOTOMETRICINTERPRETATION");return t&&n}))}function k(e){const{littleEndian:t,isBigTiff:n,firstIFDPos:a}=F(e);let i=a;const s=[];do{const a=B(e,t,i,0,r.tiffTags,n?8:4);if(!a.success)break;s.push(a.ifd),i=a.nextIFD}while(i>0);return{...R(s),littleEndian:t,isBigTiff:n,ifds:s,pyramidIFDs:U(s),maskIFDs:N(s)}}function C(e,t,n){const a=e.getUint32(t,n),i=e.getUint32(t+4,n);return n?i*u+a:a*u+i}function G(e,t,n){let a=n?e.getInt32(t,n):e.getUint32(t,n),i=n?e.getUint32(t+4,n):e.getInt32(t+4,n);const s=(n?a:i)>=0?1:-1;n?a*=s:i*=s;return s*(n?i*u+a:a*u+i)}function v(e,t,n,a){return a?C(e,t,n):e.getUint32(t,n)}function F(e){const t=new DataView(e,0,16),n=t.getUint16(0,!1);let a=null;if(18761===n)a=!0;else{if(19789!==n)throw new Error("unexpected endianess byte");a=!1}const i=t.getUint16(2,a);if(42!==i&&43!==i)throw new Error("unexpected tiff identifier");let s=4;const r=43===i;if(r){const e=t.getUint16(s,a);if(s+=2,8!==e)throw new Error("unsupported bigtiff version");if(0!==t.getUint16(s,a))throw new Error("unsupported bigtiff version");s+=2}return{littleEndian:a,isBigTiff:r,firstIFDPos:v(t,s,a,r)}}function B(t,n,a,i=0,s=r.tiffTags,l=4){const o=d(t,n,a,i,s,l);let f;const u=o.ifd;if(u){if(r.ifdTags.forEach(((e,a)=>{u.has(a)&&(f=u.get(a),f.data=d(t,n,f.valueOffset-i,i,e).ifd)})),u.has("GEOKEYDIRECTORY")){f=u.get("GEOKEYDIRECTORY");const e=f.values;if(e&&e.length>4){const a=e[0]+"."+e[1]+"."+e[2];f.data=d(t,n,f.valueOffset+6-i,i,r.geoKeys,2).ifd,f.data&&f.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[a]})}}if(u.has("XMP")){f=u.get("XMP");const t=f.values;"number"==typeof t[0]&&7===f.type&&(f.values=[e(new Uint8Array(t))])}}return o}function V(e){const{width:t,height:n,tileHeight:a,tileWidth:i}=e,s=e.planes,r=i?i*a:t*n,l=p(e.ifds[0],"BITSPERSAMPLE");let o="";return r*s>2**30/(l>8?l/8:1)&&(o=i?"tiled tiff exceeding 1 gigabits per tile is not supported":"scanline tiff exceeding 1 gigabits is not supported"),o}function W(e,t,n,a,i){const s=a?4:1,r=n*s*i;a&&(e=new Uint8Array(e.buffer));for(let f=0;f<t;f++){const t=f*r;for(let n=i;n<r;n++)e[t+n]+=e[t+n-i]}if(!a)return e;const l=new Uint8Array(e.length),o=n*i;for(let f=0;f<t;f++){const t=f*r;for(let n=0;n<o;n++)for(let a=0;a<s;a++)l[t+n*s+a]=e[t+n+(s-a-1)*o]}return new Float32Array(l.buffer)}async function H(e,t){const{headerInfo:n,ifd:a,offsets:i,sizes:r}=t,l=[];for(let s=0;s<i.length;s++){r[s];const t=await M(e,n.littleEndian,a,i[s],r[s]||e.byteLength);l.push(t)}const o=D(a,n),f=p(a,"BITSPERSAMPLE"),u=h(p(a,"SAMPLEFORMAT")??1,f),c=p(a,"SAMPLESPERPIXEL")||n.planes,E=g(u),T=p(a,"TILEWIDTH"),I=p(a,"TILELENGTH"),w=p(a,"COMPRESSION")??1,d=T*I;let m;const y=[];let S=l[0];const A=34887===w;for(let s=0;s<c;s++){if(m=new E(d),l.length===c)S=l[s],S.length===d&&(m=S);else if(S.length)if(o||A)m=S.length===d?S:S.slice(d*s,d*(s+1));else for(let e=0;e<d;e++)m[e]=S[e*c+s];y.push(m)}const P=n.noData?n.noData[0]:t.noDataValue,O=n.metadata?n.metadata.statistics:null,x=O?O.map((e=>e.min)):null,L=O?O.map((e=>e.max)):null,R={pixelType:u,width:T,height:I,pixels:y,noDataValue:P};return null!=P?s(R,P):x&&L&&t.applyMinMaxConstraint&&(R.mask=b(y,x,L)),R}async function Y(e,t={}){const n=t.pyramidLevel||0,a=t.headerInfo||k(e),{ifds:i,noData:r}=a;if(0===i.length)throw new Error("no valid image file directory");const l=V(a);if(l)throw l;let o=null;const f=-1===n?i[i.length-1]:i[n],u=r??t.noDataValue;return o=a.tileWidth?await P(e,a,f):O(e,a,f),o?(null!=u&&s(o,u),o):o}export{Y as decode,H as decodeTileOrStrip,R as getImageInfo,N as getMaskIFDs,U as getPyramidIFDs,D as isBSQConfig,L as parseFieldValues,k as parseHeader,B as parseIFD,F as parseSignature};
|
|
5
|
+
import"../../../core/has.js";import{bytesToUTF8 as e}from"../rasterDatasets/byteStreamUtils.js";import{J as t}from"../../../chunks/Jpg.js";import{load as n,decode as a}from"./Lerc.js";import{decode as i}from"./Lzw.js";import{convertNoDataToMask as s}from"./pixelRangeUtils.js";import r from"./TiffTags.js";import{isPlatformLittleEndian as l}from"./utils.js";import{Z as o}from"../../../chunks/Zlib.js";const f=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],u=4294967296,c=new Set([1,5,6,7,8,34712,34887]);function h(e,t){let n="unknown";return 3===e?n=64===t?"f64":"f32":1===e?1===t?n="u1":2===t?n="u2":4===t?n="u4":t<=8?n="u8":t<=16?n="u16":t<=32&&(n="u32"):2===e&&(t<=8?n="s8":t<=16?n="s16":t<=32&&(n="s32")),n}function g(e){let t=null;switch(e?e.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":t=Uint8Array;break;case"u16":t=Uint16Array;break;case"u32":t=Uint32Array;break;case"s8":t=Int8Array;break;case"s16":t=Int16Array;break;case"s32":t=Int32Array;break;case"f64":t=Float64Array;break;default:t=Float32Array}return t}function E(e,t){return{x:t[0]*e.x+t[1]*e.y+t[2],y:t[3]*e.x+t[4]*e.y+t[5]}}function T(e,t){return e.get(t)?.values}function I(e,t){return e.get(t)?.values}function w(e,t){return e.get(t)?.values?.[0]}function p(e,t){return e.get(t)?.values?.[0]}function d(e,t,n,a=0,i=r.tiffTags,s=4){const l=8===s,o=l?C(new DataView(e,n,8),0,t):new DataView(e,n,2).getUint16(0,t),f=4+2*s,u=l?8:2,c=u+o*f;if(n+c>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:c};const h=n+c+4<=e.byteLength?v(new DataView(e,n+c,8===s?8:4),0,t,8===s):null,g=n+u,E=new Map;let T,I,w,p,d,m=0,y=0;for(let S=0;S<o;S++){I=new DataView(e,g+f*S,f),w=I.getUint16(0,t),d=I.getUint16(2,t),p=r.getTagName(w,i);const n=[];2===s?(m=I.getUint16(4,t),y=I.getUint16(6,t)):4===s?(m=I.getUint32(4,t),y=I.getUint32(8,t)):8===s&&(m=v(I,4,t,!0),y=v(I,12,t,!0),n.push(I.getUint32(12,t)),n.push(I.getUint32(16,t))),T={id:w,type:d,valueCount:m,valueOffset:y,valueOffsets:n,values:null},L(e,t,T,a,!1,s),E.set(p,T)}return{success:!0,ifd:E,nextIFD:h,requiredBufferSize:c}}const m=(e,t)=>a(e,{inputOffset:t}).pixels[0];function y(e,t){if(1!==t&&2!==t&&4!==t)return e;const n=new Uint8Array(e),a=8/t,i=new Uint8Array(e.byteLength*a);let s=0;const r=2**t-1;for(let l=0;l<n.length;l++){const e=n[l];for(let n=0;n<a;n++)i[s++]=e<<t*n>>>8-t&r}return i.buffer}function S(e,n,a){const i=new t;i.parse(e),i.colorTransform=6===a?-1:0;const s=i.getData(i.width,i.height,1!==n&&4!==n);return new Uint8Array(s.buffer)}function A(e){const t=new o(e).getBytes(),n=new ArrayBuffer(t.length),a=new Uint8Array(n);return a.set(t),a}async function M(e,t,a,s,r){const o=l===t,f=p(a,"BITSPERSAMPLE"),u=p(a,"SAMPLESPERPIXEL")??1,c=p(a,"PHOTOMETRICINTERPRETATION"),E=p(a,"SAMPLEFORMAT")??1,T=h(E,f),I=p(a,"COMPRESSION")??1,w=g(T);let d,M,P;if(34887===I)return await n(),m(e,s);if(1===I)d=e.slice(s,s+r),M=new Uint8Array(d);else if(8===I||32946===I)M=new Uint8Array(e,s,r),M=A(M),d=M.buffer;else if(6===I)M=new Uint8Array(e,s,r),M=S(M,u,c),d=M.buffer;else if(7===I){const t=a.get("JPEGTABLES").values,n=t.length-2;M=new Uint8Array(n+r-2);for(let e=0;e<n;e++)M[e]=t[e];const i=new Uint8Array(e,s+2,r-2);for(let e=0;e<i.length;e++)M[n+e]=i[e];M=S(M,u,c),d=M.buffer}else{if(5!==I)throw new Error("tiff-decode: unsupport compression "+I);M=i(e,s,r,t),d=M.buffer}if(d=y(d,f),"u8"===T||"s8"===T||o)P=new w(d);else{d=new ArrayBuffer(M.length);const e=new Uint8Array(d);switch(T){case"u16":case"s16":for(let t=0;t<M.length;t+=2)e[t]=M[t+1],e[t+1]=M[t];break;case"u32":case"s32":case"f32":for(let t=0;t<M.length;t+=4)e[t]=M[t+3],e[t+1]=M[t+2],e[t+2]=M[t+1],e[t+3]=M[t]}P=new w(d)}const O=p(a,"PREDICTOR")??1,b=p(a,"TILEWIDTH"),x=p(a,"TILELENGTH");if(O>1&&(5===I||8===I||32946===I)&&b&&x){const e=D(a),t=new w(P.length);t.set(P),P=W(t,x,b,3===E&&3===O,e?1:u)}return P}async function P(e,t,n){const a=I(n,"TILEOFFSETS");if(void 0===a)return null;const i=I(n,"TILEBYTECOUNTS"),{width:s,height:r,pixelType:l,tileWidth:o,tileHeight:f}=R([n]),u=D(n,t),c=p(n,"SAMPLESPERPIXEL")||t.planes,h=s*r,E=p(n,"BITSPERSAMPLE"),T=34887===(p(n,"COMPRESSION")??1),w=g(l),d=[];for(let g=0;g<c;g++)d.push(new w(h));let m,y,S,A,P,O,b,x,L,U,N,k,C;const G=Math.ceil(s/o),v=new Uint8Array(h).fill(255);let F=!1;if(E%8==0)if(T&&u&&c>1){const l=Math.round(a.length/c);for(m=0;m<l;m++){O=Math.floor(m/G)*f,b=m%G*o,x=O*s+b;for(let l=0;l<c;l++){const u=m*c+l;for(0===i[u]?(S=null,F=!0):S=await M(e,t.littleEndian,n,a[u],i[u]),U=0,L=x,k=Math.min(o,s-b),N=Math.min(f,r-O),C=d[l],A=0;A<N;A++)for(L=x+A*s,U=A*o,P=0;P<k;P++,L++,U++)S?C[L]=S[U]:v[L]=0}}}else for(m=0;m<a.length;m++)for(O=Math.floor(m/G)*f,b=m%G*o,x=O*s+b,0===i[m]?(S=null,F=!0):S=await M(e,t.littleEndian,n,a[m],i[m]),U=0,L=x,k=Math.min(o,s-b),N=Math.min(f,r-O),y=0;y<c;y++)if(C=d[y],u||T)for(A=0;A<N;A++)for(L=x+A*s,U=o*f*y+A*o,P=0;P<k;P++,L++,U++)S?C[L]=S[U]:v[L]=0;else for(A=0;A<N;A++)for(L=x+A*s,U=A*o*c+y,P=0;P<k;P++,L++,U+=c)S?C[L]=S[U]:v[L]=0;return{width:s,height:r,pixelType:l,pixels:d,mask:F?v:void 0}}const O=(e,t,n)=>{const a=l===t.littleEndian,s=I(n,"STRIPOFFSETS");if(void 0===s)return null;const{width:r,height:o,pixelType:f}=R([n]),u=p(n,"SAMPLESPERPIXEL")||t.planes,c=p(n,"PHOTOMETRICINTERPRETATION"),h=r*o,E=p(n,"BITSPERSAMPLE"),T=g(f),w=new T(h*u),d=I(n,"STRIPBYTECOUNTS"),m=p(n,"ROWSPERSTRIP"),M=p(n,"COMPRESSION")??1;let P,O,b,x,L,D,U,N,k;if(E%8==0)for(P=0;P<s.length;P++){if(L=P*(m*r)*u,"u8"===f||"s8"===f||a)8===M||32946===M?(U=new Uint8Array(e,s[P],d[P]),U=A(U),D=U.buffer):6===M?(U=new Uint8Array(e,s[P],d[P]),U=S(U,u,c),D=U.buffer):5===M?(U=i(e,s[P],d[P],t.littleEndian),D=U.buffer):D=e.slice(s[P],s[P]+d[P]),D=y(D,E),x=new T(D);else{switch(6===M||8===M||32946===M?(U=new Uint8Array(e,s[P],d[P]),N=A(U),D=N.buffer):(D=new ArrayBuffer(d[P]),U=new Uint8Array(e,s[P],d[P]),N=new Uint8Array(D)),f){case"u16":case"s16":for(b=0;b<U.length;b+=2)N[b]=U[b+1],N[b+1]=U[b];break;case"u32":case"s32":case"f32":for(b=0;b<U.length;b+=4)N[b]=U[b+3],N[b+1]=U[b+2],N[b+2]=U[b+1],N[b+3]=U[b]}D=y(D,E),x=new T(D)}w.set(x,L)}const C=[];if(1===u)C.push(w);else for(P=0;P<u;P++){for(k=new T(h),O=0;O<h;O++)k[O]=w[O*u+P];C.push(k)}return{width:r,height:o,pixelType:f,pixels:C}},b=(e,t,n)=>{if(!(e.length>0&&t&&n))return null;let a,i,s;const r=e[0].length,l=e.length,o=new Uint8Array(r);for(let f=0;f<l;f++)if(a=e[f],i=t[f],s=n[f],0===f)for(let e=0;e<r;e++)o[e]=a[e]<i||a[e]>s?0:1;else for(let e=0;e<r;e++)o[e]&&(o[e]=a[e]<i||a[e]>s?0:1);return o},x=e=>{if(!e)return null;const t=e.match(/<Item(.*?)Item>/gi);if(!t||0===t.length)return null;const n=new Map;let a,i,s,r,l;for(let w=0;w<t.length;w++)a=t[w],i=a.slice(6,a.indexOf(">")),r=a.indexOf("sample="),r>-1&&(l=a.slice(r+8,a.indexOf('"',r+8))),r=a.indexOf("name="),r>-1&&(i=a.slice(r+6,a.indexOf('"',r+6))),i&&(s=a.slice(a.indexOf(">")+1,a.indexOf("</Item>")).trim(),null!=l?n.has(i)?n.get(i)[l]=s:n.set(i,[s]):n.set(i,s)),l=null;const o=n.get("STATISTICS_MINIMUM"),f=n.get("STATISTICS_MAXIMUM"),u=n.get("STATISTICS_MEAN"),c=n.get("STATISTICS_STDDEV");let h=null;if(o&&f){h=[];for(let e=0;e<o.length;e++)h.push({min:parseFloat(o[e]),max:parseFloat(f[e]),avg:u&&parseFloat(u[e]),stddev:c&&parseFloat(c[e])})}const g=n.get("BandName"),E=n.get("WavelengthMin"),T=n.get("WavelengthMax");let I=null;if(g){I=[];for(let e=0;e<g.length;e++)I.push({BandName:g[e],WavelengthMin:E&&parseFloat(E[e]),WavelengthMax:T&&parseFloat(T[e])})}return{statistics:h,bandProperties:I,dataType:n.get("DataType"),rawMetadata:n}};function L(e,t,n,a=0,i=!1,s=4){if(n.values)return!0;const r=n.type,l=n.valueCount;let o=n.valueOffset,c=[];const h=f[r],g=8*h,E=l*h,T=l*f[r]*8;let I,w;const p=8===s?64:32,d=n.valueOffsets;if(T>p){if(E>(i?e.byteLength:e?e.byteLength-o+a:0))return n.offlineOffsetSize=[o,E],n.values=null,!1}if(T<=p){if(!t)if(p<=32)o>>>=32-T;else{const e=d?.length?d[0]:o>>>0,t=d?.length?d[1]:Math.round((o-e)/u);T<=32?(o=e>>>32-T,d[0]=o):(o=e*2**(32-T)+(t>>>32-T),d[0]=e,d[1]=t>>>32-T)}if(1===l&&g===p)c=[o];else if(64===p){const e=d?.length?d[0]:o>>>0,t=d?.length?d[1]:Math.round((o-e)/u);let n=e,a=32;for(w=1;w<=l;w++){const e=32-g*w%32;if(a<g){const i=n<<e>>>32-a,s=t<<32-a>>>32-a;n=t,c.push(i+s*2**(g-a)),a-=32-(g-a)}else c.push(n<<e>>>32-g),a-=g;0===a&&(a=32,n=t)}}else for(w=1;w<=l;w++){const e=32-g*w;c.push(o<<e>>>32-g)}}else{o-=a,i&&(o=0);for(let n=o;n<o+E;n+=h){switch(r){case 1:case 2:case 7:I=new DataView(e,n,1).getUint8(0);break;case 3:I=new DataView(e,n,2).getUint16(0,t);break;case 4:case 13:I=new DataView(e,n,4).getUint32(0,t);break;case 5:I=new DataView(e,n,4).getUint32(0,t)/new DataView(e,n+4,4).getUint32(0,t);break;case 6:I=new DataView(e,n,1).getInt8(0);break;case 8:I=new DataView(e,n,2).getInt16(0,t);break;case 9:I=new DataView(e,n,4).getInt32(0,t);break;case 10:I=new DataView(e,n,4).getInt32(0,t)/new DataView(e,n+4,4).getInt32(0,t);break;case 11:I=new DataView(e,n,4).getFloat32(0,t);break;case 12:I=new DataView(e,n,8).getFloat64(0,t);break;case 16:case 18:I=C(new DataView(e,n,8),0,t);break;case 17:I=G(new DataView(e,n,8),0,t);break;default:I=null}c.push(I)}}if(2===r){let e="";const t=c;for(c=[],w=0;w<t.length;w++)0===t[w]&&""!==e?(c.push(e),e=""):e+=String.fromCharCode(t[w]);""===e&&0!==c.length||c.push(e)}return n.values=c,!0}function R(e){const t=e[0],n=p(t,"TILEWIDTH"),a=p(t,"TILELENGTH"),i=p(t,"IMAGEWIDTH"),s=p(t,"IMAGELENGTH"),r=p(t,"BITSPERSAMPLE"),l=p(t,"SAMPLESPERPIXEL"),o=p(t,"SAMPLEFORMAT")??1,f=h(o,r),u=D(t),g=T(t,"GDAL_NODATA");let d=null;g?.length&&(d=g.map((e=>parseFloat(e))),d.some((e=>isNaN(e)))&&(d=null));const m=p(t,"COMPRESSION")??1;let y;switch(m){case 1:y="NONE";break;case 2:case 3:case 4:case 32771:y="CCITT";break;case 5:y="LZW";break;case 6:case 7:y="JPEG";break;case 32773:y="PACKBITS";break;case 8:case 32946:y="DEFLATE";break;case 34712:y="JPEG2000";break;case 34887:y="LERC";break;default:y=String(m)}let S=!0,A="";c.has(m)||(S=!1,A+="unsupported tag compression "+m),o>3&&(S=!1,A+="unsupported tag sampleFormat "+o),1!==r&&2!==r&&4!==r&&r%8!=0&&(S=!1,A+="unsupported tag bitsPerSample "+r);const M=w(t,"GEOASCIIPARAMS");let P;if(M){const e=M.split("|").find((e=>e.includes("ESRI PE String = "))),t=e?e.replace("ESRI PE String = ",""):"";P=t.startsWith("COMPD_CS")||t.startsWith("PROJCS")||t.startsWith("GEOGCS")?{wkid:null,wkt:t}:null}const O=I(t,"GEOTIEPOINTS"),b=I(t,"GEOPIXELSCALE"),L=I(t,"GEOTRANSMATRIX"),R=t.has("GEOKEYDIRECTORY")?t.get("GEOKEYDIRECTORY").data:null;let k,C,G=!1,v=!1;if(R){G=2===p(R,"GTRasterTypeGeoKey");const e=p(R,"GTModelTypeGeoKey");if(2===e){const e=p(R,"GeographicTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e}),P||32767!==e||(v=!0,P={wkid:4326})}else if(1===e){const e=p(R,"ProjectedCSTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e})}}if(b&&O&&O.length>=6?(k=[b[0],0,O[3]-O[0]*b[0],0,-Math.abs(b[1]),O[4]-O[1]*b[1]],G&&(k[2]-=.5*k[0]+.5*k[1],k[5]-=.5*k[3]+.5*k[4])):L&&16===L.length&&(k=G?[L[0],L[1],L[3]-.5*L[0],L[4],L[5],L[7]-.5*L[5]]:[L[0],L[1],L[3],L[4],L[5],L[7]]),k){const e=[{x:0,y:s},{x:0,y:0},{x:i,y:s},{x:i,y:0}];let t,n=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let i=0;i<e.length;i++)t=E(e[i],k),n=t.x>n?n:t.x,r=t.x<r?r:t.x,a=t.y>a?a:t.y,l=t.y<l?l:t.y;C={xmin:n,xmax:r,ymin:a,ymax:l,spatialReference:P}}else C={xmin:-.5,ymin:.5-s,xmax:i-.5,ymax:.5,spatialReference:P};v&&(C.xmax-C.xmin>400||Math.max(Math.abs(C.xmin),Math.abs(C.xmax))>361)&&(P=null,C.spatialReference=null);const F=U(e);let B,W,H,Y,_;if(F.length>0){H=Math.round(Math.log(i/p(F[0],"IMAGEWIDTH"))/Math.LN2);const e=F[F.length-1];Y=F.length,B=p(e,"TILEWIDTH"),W=p(e,"TILELENGTH")}B=null!=Y&&Y>0?B||n:null,W=null!=Y&&Y>0?W||a:null,n&&(_=[{maxCol:Math.ceil(i/n)-1,maxRow:Math.ceil(s/a)-1,minRow:0,minCol:0}],F.forEach((e=>{_.push({maxCol:Math.ceil(p(e,"IMAGEWIDTH")/p(e,"TILEWIDTH"))-1,maxRow:Math.ceil(p(e,"IMAGELENGTH")/p(e,"TILELENGTH"))-1,minRow:0,minCol:0})})));const j=w(e[0],"GDAL_METADATA"),K=x(j);A+=" "+V({width:i,height:s,tileWidth:n,tileHeight:a,planes:l,ifds:e});const X=N(e).length===F.length+1,J=F?.length?F.map((e=>({x:i/p(e,"IMAGEWIDTH"),y:s/p(e,"IMAGELENGTH")}))):void 0;return{width:i,height:s,tileWidth:n,tileHeight:a,planes:l,isBSQ:u,pixelType:f,compression:y,noData:d,hasMaskBand:X,isSupported:S,pyramidResolutions:J,message:A,extent:C,isPseudoGeographic:v,affine:b?null:k,firstPyramidLevel:H,maximumPyramidLevel:Y,pyramidBlockWidth:B,pyramidBlockHeight:W,tileBoundary:_,metadata:K}}function D(e,t){const n=T(e,"PLANARCONFIGURATION");return n?2===n[0]:!!t&&t.isBSQ}function U(e){return e.filter((e=>1===p(e,"NEWSUBFILETYPE")))}function N(e){return e.filter((e=>{const t=!(4&~(p(e,"NEWSUBFILETYPE")??0)),n=4===p(e,"PHOTOMETRICINTERPRETATION");return t&&n}))}function k(e){const{littleEndian:t,isBigTiff:n,firstIFDPos:a}=F(e);let i=a;const s=[];do{const a=B(e,t,i,0,r.tiffTags,n?8:4);if(!a.success)break;s.push(a.ifd),i=a.nextIFD}while(i>0);return{...R(s),littleEndian:t,isBigTiff:n,ifds:s,pyramidIFDs:U(s),maskIFDs:N(s)}}function C(e,t,n){const a=e.getUint32(t,n),i=e.getUint32(t+4,n);return n?i*u+a:a*u+i}function G(e,t,n){let a=n?e.getInt32(t,n):e.getUint32(t,n),i=n?e.getUint32(t+4,n):e.getInt32(t+4,n);const s=(n?a:i)>=0?1:-1;n?a*=s:i*=s;return s*(n?i*u+a:a*u+i)}function v(e,t,n,a){return a?C(e,t,n):e.getUint32(t,n)}function F(e){const t=new DataView(e,0,16),n=t.getUint16(0,!1);let a=null;if(18761===n)a=!0;else{if(19789!==n)throw new Error("unexpected endianess byte");a=!1}const i=t.getUint16(2,a);if(42!==i&&43!==i)throw new Error("unexpected tiff identifier");let s=4;const r=43===i;if(r){const e=t.getUint16(s,a);if(s+=2,8!==e)throw new Error("unsupported bigtiff version");if(0!==t.getUint16(s,a))throw new Error("unsupported bigtiff version");s+=2}return{littleEndian:a,isBigTiff:r,firstIFDPos:v(t,s,a,r)}}function B(t,n,a,i=0,s=r.tiffTags,l=4){const o=d(t,n,a,i,s,l);let f;const u=o.ifd;if(u){if(r.ifdTags.forEach(((e,a)=>{u.has(a)&&(f=u.get(a),f.data=d(t,n,f.valueOffset-i,i,e).ifd)})),u.has("GEOKEYDIRECTORY")){f=u.get("GEOKEYDIRECTORY");const e=f.values;if(e&&e.length>4){const a=e[0]+"."+e[1]+"."+e[2];f.data=d(t,n,f.valueOffset+6-i,i,r.geoKeys,2).ifd,f.data&&f.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[a]})}}if(u.has("XMP")){f=u.get("XMP");const t=f.values;"number"==typeof t[0]&&7===f.type&&(f.values=[e(new Uint8Array(t))])}}return o}function V(e){const{width:t,height:n,tileHeight:a,tileWidth:i}=e,s=e.planes,r=i?i*a:t*n,l=p(e.ifds[0],"BITSPERSAMPLE");let o="";return r*s>2**30/(l>8?l/8:1)&&(o=i?"tiled tiff exceeding 1 gigabits per tile is not supported":"scanline tiff exceeding 1 gigabits is not supported"),o}function W(e,t,n,a,i){const s=a?4:1,r=n*s*i;a&&(e=new Uint8Array(e.buffer));for(let f=0;f<t;f++){const t=f*r;for(let n=i;n<r;n++)e[t+n]+=e[t+n-i]}if(!a)return e;const l=new Uint8Array(e.length),o=n*i;for(let f=0;f<t;f++){const t=f*r;for(let n=0;n<o;n++)for(let a=0;a<s;a++)l[t+n*s+a]=e[t+n+(s-a-1)*o]}return new Float32Array(l.buffer)}async function H(e,t){const{headerInfo:n,ifd:a,offsets:i,sizes:r}=t,l=[];for(let s=0;s<i.length;s++){r[s];const t=await M(e,n.littleEndian,a,i[s],r[s]||e.byteLength);l.push(t)}const o=D(a,n),f=p(a,"BITSPERSAMPLE"),u=h(p(a,"SAMPLEFORMAT")??1,f),c=p(a,"SAMPLESPERPIXEL")||n.planes,E=g(u),T=p(a,"TILEWIDTH"),I=p(a,"TILELENGTH"),w=p(a,"COMPRESSION")??1,d=T*I;let m;const y=[];let S=l[0];const A=34887===w;for(let s=0;s<c;s++){if(m=new E(d),l.length===c)S=l[s],S.length===d&&(m=S);else if(S.length)if(o||A)m=S.length===d?S:S.slice(d*s,d*(s+1));else for(let e=0;e<d;e++)m[e]=S[e*c+s];y.push(m)}const P=n.noData?n.noData[0]:t.noDataValue,O=n.metadata?n.metadata.statistics:null,x=O?O.map((e=>e.min)):null,L=O?O.map((e=>e.max)):null,R={pixelType:u,width:T,height:I,pixels:y,noDataValue:P};return null!=P?s(R,P):x&&L&&t.applyMinMaxConstraint&&(R.mask=b(y,x,L)),R}async function Y(e,t={}){const n=t.pyramidLevel||0,a=t.headerInfo||k(e),{ifds:i,noData:r}=a;if(0===i.length)throw new Error("no valid image file directory");const l=V(a);if(l)throw l;let o=null;const f=-1===n?i[i.length-1]:i[n],u=r??t.noDataValue;return o=a.tileWidth?await P(e,a,f):O(e,a,f),o?(null!=u&&s(o,u),o):o}export{Y as decode,H as decodeTileOrStrip,R as getImageInfo,N as getMaskIFDs,U as getPyramidIFDs,D as isBSQConfig,L as parseFieldValues,k as parseHeader,B as parseIFD,F as parseSignature};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as e}from"../../core/arrayUtils.js";import t from"../../core/Error.js";import{getReferenceEllipsoidFromWKID as i}from"../../geometry/ellipsoidUtils.js";import n from"../../geometry/Extent.js";import r from"../../geometry/Point.js";import l from"../../geometry/support/WKIDUnitConversion.js";import{isAxesOrderReversedForWkid as o}from"../ogc/crsUtils.js";import{visitXML as s}from"../ogc/xmlUtils.js";import a from"./LOD.js";import c from"./TileInfo.js";const u=90.71428571428571;function p(e){const i=e.replaceAll(/ows:/gi,"");if(!x("Contents",(new DOMParser).parseFromString(i,"text/xml").documentElement))throw new t("wmtslayer:wmts-capabilities-xml-is-not-valid","the wmts get capabilities response is not compliant",{text:e})}function f(e,i){e=e.replaceAll(/ows:/gi,"");const n=(new DOMParser).parseFromString(e,"text/xml").documentElement,r=new Map,l=new Map,o=x("Contents",n);if(!o)throw new t("wmtslayer:wmts-capabilities-xml-is-not-valid");const s=x("OperationsMetadata",n),a=s?.querySelector("[name='GetTile']"),c=a?.getElementsByTagName("Get"),u=c&&Array.prototype.slice.call(c),p=i.url?.indexOf("https"),f=void 0!==p&&p>-1;let d,m,h=i.serviceMode,T=i?.url;if(u?.length&&u.some((e=>{const t=x("Constraint",e);return!t||C("AllowedValues","Value",h,t)?(T=e.attributes[0].nodeValue,!0):(!t||C("AllowedValues","Value","RESTful",t)||C("AllowedValues","Value","REST",t)?m=e.attributes[0].nodeValue:t&&!C("AllowedValues","Value","KVP",t)||(d=e.attributes[0].nodeValue),!1)})),!T)if(m)T=m,h="RESTful";else if(d)T=d,h="KVP";else{const e=x("ServiceMetadataURL",n);T=e?.getAttribute("xlink:href")}const y=T.indexOf("1.0.0/");-1===y&&"RESTful"===h?T+="/":y>-1&&(T=T.slice(0,y)),"KVP"===h&&(T+=y>-1?"":"?"),f&&(T=T.replace(/^http:/i,"https:"));const R=w("ServiceIdentification>ServiceTypeVersion",n),S=w("ServiceIdentification>AccessConstraints",n),A=S&&/^none$/i.test(S)?null:S,V=g("Layer",o),E=g("TileMatrixSet",o),L=V.map((e=>{const t=w("Identifier",e);return r.set(t,e),M(t,e,E,f,R)}));return{copyright:A,dimensionMap:l,layerMap:r,layers:L,serviceMode:h,tileUrl:T}}function d(e){return e.layers.forEach((e=>{e.tileMatrixSets?.forEach((e=>{const t=e.tileInfo;t&&96!==t.dpi&&(t.lods?.forEach((i=>{i.scale=96*i.scale/t.dpi,i.resolution=j(t.spatialReference?.wkid,i.scale*u/96,e.id)})),t.dpi=96)}))})),e}function m(e){return e.nodeType===Node.ELEMENT_NODE}function x(e,t){for(let i=0;i<t.childNodes.length;i++){const n=t.childNodes[i];if(m(n)&&n.nodeName===e)return n}return null}function g(e,t){const i=[];for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];m(r)&&r.nodeName===e&&i.push(r)}return i}function h(t,i){const n=[];for(let e=0;e<i.childNodes.length;e++){const r=i.childNodes[e];m(r)&&r.nodeName===t&&n.push(r)}return n.map((e=>e.textContent)).filter(e)}function w(e,t){return e.split(">").forEach((e=>{t&&(t=x(e,t))})),t&&t.textContent}function C(e,t,i,n){let r;return Array.prototype.slice.call(n.childNodes).some((n=>{if(n.nodeName.includes(e)){const e=x(t,n),l=e?.textContent;if(l===i||i.split(":")&&i.split(":")[1]===l)return r=n,!0}return!1})),r}function M(e,t,i,n,r){const l=w("Abstract",t),o=h("Format",t);return{id:e,fullExtent:A(t),fullExtents:V(t),description:l,formats:o,styles:E(t,n),title:w("Title",t),tileMatrixSets:L(r,t,i)}}function T(e,t){const i=[],n=e.layerMap?.get(t);if(!n)return null;const r=g("ResourceURL",n),l=g("Dimension",n);let o,s,a,c;return l.length&&(o=w("Identifier",l[0]),s=h("Default",l[0])
|
|
5
|
+
import{isSome as e}from"../../core/arrayUtils.js";import t from"../../core/Error.js";import{getReferenceEllipsoidFromWKID as i}from"../../geometry/ellipsoidUtils.js";import n from"../../geometry/Extent.js";import r from"../../geometry/Point.js";import l from"../../geometry/support/WKIDUnitConversion.js";import{isAxesOrderReversedForWkid as o}from"../ogc/crsUtils.js";import{visitXML as s}from"../ogc/xmlUtils.js";import a from"./LOD.js";import c from"./TileInfo.js";const u=90.71428571428571;function p(e){const i=e.replaceAll(/ows:/gi,"");if(!x("Contents",(new DOMParser).parseFromString(i,"text/xml").documentElement))throw new t("wmtslayer:wmts-capabilities-xml-is-not-valid","the wmts get capabilities response is not compliant",{text:e})}function f(e,i){e=e.replaceAll(/ows:/gi,"");const n=(new DOMParser).parseFromString(e,"text/xml").documentElement,r=new Map,l=new Map,o=x("Contents",n);if(!o)throw new t("wmtslayer:wmts-capabilities-xml-is-not-valid");const s=x("OperationsMetadata",n),a=s?.querySelector("[name='GetTile']"),c=a?.getElementsByTagName("Get"),u=c&&Array.prototype.slice.call(c),p=i.url?.indexOf("https"),f=void 0!==p&&p>-1;let d,m,h=i.serviceMode,T=i?.url;if(u?.length&&u.some((e=>{const t=x("Constraint",e);return!t||C("AllowedValues","Value",h,t)?(T=e.attributes[0].nodeValue,!0):(!t||C("AllowedValues","Value","RESTful",t)||C("AllowedValues","Value","REST",t)?m=e.attributes[0].nodeValue:t&&!C("AllowedValues","Value","KVP",t)||(d=e.attributes[0].nodeValue),!1)})),!T)if(m)T=m,h="RESTful";else if(d)T=d,h="KVP";else{const e=x("ServiceMetadataURL",n);T=e?.getAttribute("xlink:href")}const y=T.indexOf("1.0.0/");-1===y&&"RESTful"===h?T+="/":y>-1&&(T=T.slice(0,y)),"KVP"===h&&(T+=y>-1?"":"?"),f&&(T=T.replace(/^http:/i,"https:"));const R=w("ServiceIdentification>ServiceTypeVersion",n),S=w("ServiceIdentification>AccessConstraints",n),A=S&&/^none$/i.test(S)?null:S,V=g("Layer",o),E=g("TileMatrixSet",o),L=V.map((e=>{const t=w("Identifier",e);return r.set(t,e),M(t,e,E,f,R)}));return{copyright:A,dimensionMap:l,layerMap:r,layers:L,serviceMode:h,tileUrl:T}}function d(e){return e.layers.forEach((e=>{e.tileMatrixSets?.forEach((e=>{const t=e.tileInfo;t&&96!==t.dpi&&(t.lods?.forEach((i=>{i.scale=96*i.scale/t.dpi,i.resolution=j(t.spatialReference?.wkid,i.scale*u/96,e.id)})),t.dpi=96)}))})),e}function m(e){return e.nodeType===Node.ELEMENT_NODE}function x(e,t){for(let i=0;i<t.childNodes.length;i++){const n=t.childNodes[i];if(m(n)&&n.nodeName===e)return n}return null}function g(e,t){const i=[];for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];m(r)&&r.nodeName===e&&i.push(r)}return i}function h(t,i){const n=[];for(let e=0;e<i.childNodes.length;e++){const r=i.childNodes[e];m(r)&&r.nodeName===t&&n.push(r)}return n.map((e=>e.textContent)).filter(e)}function w(e,t){return e.split(">").forEach((e=>{t&&(t=x(e,t))})),t&&t.textContent}function C(e,t,i,n){let r;return Array.prototype.slice.call(n.childNodes).some((n=>{if(n.nodeName.includes(e)){const e=x(t,n),l=e?.textContent;if(l===i||i.split(":")&&i.split(":")[1]===l)return r=n,!0}return!1})),r}function M(e,t,i,n,r){const l=w("Abstract",t),o=h("Format",t);return{id:e,fullExtent:A(t),fullExtents:V(t),description:l,formats:o,styles:E(t,n),title:w("Title",t),tileMatrixSets:L(r,t,i)}}function T(e,t){const i=[],n=e.layerMap?.get(t);if(!n)return null;const r=g("ResourceURL",n),l=g("Dimension",n);let o,s,a,c;return l.length&&(o=w("Identifier",l[0]),s=h("Default",l[0])),l.length>1&&(a=w("Identifier",l[1]),c=h("Default",l[1])),e.dimensionMap.set(t,{dimensions:s,dimensions2:c}),r.forEach((e=>{let t=e.getAttribute("template");if("tile"===e.getAttribute("resourceType")){if(o&&s.length)if(t.includes("{"+o+"}"))t=t.replace("{"+o+"}","{dimensionValue}");else{const e=t.toLowerCase().indexOf("{"+o.toLowerCase()+"}");e>-1&&(t=t.slice(0,e)+"{dimensionValue}"+t.slice(e+o.length+2))}if(a&&c.length)if(t.includes("{"+a+"}"))t=t.replace("{"+a+"}","{dimensionValue2}");else{const e=t.toLowerCase().indexOf("{"+a.toLowerCase()+"}");e>-1&&(t=t.slice(0,e)+"{dimensionValue2}"+t.slice(e+a.length+2))}i.push({template:t,format:e.getAttribute("format"),resourceType:"tile"})}})),i}function y(e,t,i,n,r,l,o,s){const a=R(e,t,n);if(!(a?.length>0))return"";const{dimensionMap:c}=e,u=c.get(t).dimensions?.[0],p=c.get(t).dimensions2?.[0];return a[o%a.length].template.replaceAll(/\{Style\}/gi,r??"").replaceAll(/\{TileMatrixSet\}/gi,i??"").replaceAll(/\{TileMatrix\}/gi,l).replaceAll(/\{TileRow\}/gi,""+o).replaceAll(/\{TileCol\}/gi,""+s).replaceAll(/\{dimensionValue\}/gi,u).replaceAll(/\{dimensionValue2\}/gi,p)}function R(e,t,i){const n=T(e,t),r=n?.filter((e=>e.format===i));return(r?.length?r:n)??[]}function S(e,t,i,n){const{dimensionMap:r}=e,l=T(e,t);let o="";if(l&&l.length>0){const e=r.get(t).dimensions?.[0],s=r.get(t).dimensions2?.[0];o=l[0].template,o.endsWith(".xxx")&&(o=o.slice(0,-4)),o=o.replaceAll(/\{Style\}/gi,n),o=o.replaceAll(/\{TileMatrixSet\}/gi,i),o=o.replaceAll(/\{TileMatrix\}/gi,"{level}"),o=o.replaceAll(/\{TileRow\}/gi,"{row}"),o=o.replaceAll(/\{TileCol\}/gi,"{col}"),o=o.replaceAll(/\{dimensionValue\}/gi,e),o=o.replaceAll(/\{dimensionValue2\}/gi,s)}return o}function A(e){const t=x("WGS84BoundingBox",e),i=t?w("LowerCorner",t).split(" "):["-180","-90"],n=t?w("UpperCorner",t).split(" "):["180","90"];return{xmin:parseFloat(i[0]),ymin:parseFloat(i[1]),xmax:parseFloat(n[0]),ymax:parseFloat(n[1]),spatialReference:{wkid:4326}}}function V(e){const t=[];return s(e,{BoundingBox:e=>{if(!e.getAttribute("crs"))return;const i=e.getAttribute("crs").toLowerCase(),n=I(i),r=i.includes("epsg")&&o(n.wkid);let l,a,c,u;s(e,{LowerCorner:e=>{[l,a]=e.textContent.split(" ").map((e=>Number.parseFloat(e))),r&&([l,a]=[a,l])},UpperCorner:e=>{[c,u]=e.textContent.split(" ").map((e=>Number.parseFloat(e))),r&&([c,u]=[u,c])}}),t.push({xmin:l,ymin:a,xmax:c,ymax:u,spatialReference:n})}}),t}function E(e,t){return g("Style",e).map((e=>{const i=x("LegendURL",e),n=x("Keywords",e),r=n?h("Keyword",n):[];let l=i?.getAttribute("xlink:href");t&&(l=l?.replace(/^http:/i,"https:"));return{abstract:w("Abstract",e),id:w("Identifier",e),isDefault:"true"===e.getAttribute("isDefault"),keywords:r,legendUrl:l,title:w("Title",e)}}))}function L(e,t,i){return g("TileMatrixSetLink",t).map((t=>b(e,t,i)))}function b(e,t,i){const n=x("TileMatrixSet",t).textContent,r=h("TileMatrix",t),l=i.find((e=>{const t=x("Identifier",e),i=t?.textContent;return!!(i===n||n.split(":")&&n.split(":")[1]===i)})),o=x("TileMatrixSetLimits",t),s=o&&g("TileMatrixLimits",o),a=new Map;if(s?.length)for(const c of s){const e=x("TileMatrix",c).textContent,t=+x("MinTileRow",c).textContent,i=+x("MaxTileRow",c).textContent,n=+x("MinTileCol",c).textContent,r=+x("MaxTileCol",c).textContent;a.set(e,{minCol:n,maxCol:r,minRow:t,maxRow:i})}const u=w("SupportedCRS",l).toLowerCase(),p=N(l,u),f=p.spatialReference,d=x("TileMatrix",l),m=[parseInt(w("TileWidth",d),10),parseInt(w("TileHeight",d),10)],M=[];if(r.length)r.forEach(((e,t)=>{const i=C("TileMatrix","Identifier",e,l);M.push(k(i,u,t,n,a))}));else{g("TileMatrix",l).forEach(((e,t)=>{M.push(k(e,u,t,n,a))}))}const T=F(e,l,p,m,M[0]).toJSON(),y=new c({dpi:96,spatialReference:f,size:m,origin:p,lods:M}).toJSON();return{id:n,fullExtent:T,tileInfo:y}}function I(e){e=e.toLowerCase();let t=parseInt(e.split(":").pop(),10);900913!==t&&3857!==t||(t=102100);const i=O(e);return null!=i&&(t=i),{wkid:t}}function N(e,t){return v(x("TileMatrix",e),t)}function v(e,t){const i=I(t),[n,l]=w("TopLeftCorner",e).split(" ").map((e=>parseFloat(e))),s=t.includes("epsg")&&o(i.wkid);return new r(s?{x:l,y:n,spatialReference:i}:{x:n,y:l,spatialReference:i})}function F(e,t,i,r,l){const o=x("BoundingBox",t);let s,a,c,u,p,f;if(o&&(s=w("LowerCorner",o).split(" "),a=w("UpperCorner",o).split(" ")),s&&s.length>1&&a&&a.length>1)c=parseFloat(s[0]),p=parseFloat(s[1]),u=parseFloat(a[0]),f=parseFloat(a[1]);else{const e=x("TileMatrix",t),n=parseInt(w("MatrixWidth",e),10),o=parseInt(w("MatrixHeight",e),10);c=i.x,f=i.y,u=c+n*r[0]*l.resolution,p=f-o*r[1]*l.resolution}return U(e,i.spatialReference,i)?new n(p,c,f,u,i.spatialReference):new n(c,p,u,f,i.spatialReference)}function U(e,t,i){return"1.0.0"===e&&o(t.wkid)&&!(i.spatialReference.isGeographic&&i.x<-90&&i.y>=-90)}var D;function O(e){return e.includes("crs84")||e.includes("crs:84")?D.CRS84:e.includes("crs83")||e.includes("crs:83")?D.CRS83:e.includes("crs27")||e.includes("crs:27")?D.CRS27:null}function k(e,t,i,n,r){const l=I(t),o=w("Identifier",e);let s=parseFloat(w("ScaleDenominator",e));const c=j(l.wkid,s,n);s*=96/u;const p=+w("MatrixWidth",e),f=+w("MatrixHeight",e),{maxCol:d=p-1,maxRow:m=f-1,minCol:x=0,minRow:g=0}=r.get(o)??{},{x:h,y:C}=v(e,t);return new a({cols:[x,d],level:i,levelValue:o,origin:[h,C],scale:s,resolution:c,rows:[g,m]})}function j(e,t,n){let r;return r=l.hasOwnProperty(""+e)?l.values[l[e]]:"default028mm"===n?6370997*Math.PI/180:i(e).metersPerDegree,7*t/25e3/r}!function(e){e[e.CRS84=4326]="CRS84",e[e.CRS83=4269]="CRS83",e[e.CRS27=4267]="CRS27"}(D||(D={}));export{y as getTileUrlFromResourceUrls,S as getTileUrlTemplateFromResourceUrls,R as getTileUrlTemplates,f as parseCapabilities,d as parseResourceInfo,p as validateCapabilities};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "4.32.0-next.
|
|
3
|
+
"version": "4.32.0-next.20250103",
|
|
4
4
|
"homepage": "https://js.arcgis.com",
|
|
5
5
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
6
6
|
"keywords": [
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@esri/arcgis-html-sanitizer": "~4.1.0",
|
|
29
|
-
"@esri/calcite-components": "~3.0.0-next.
|
|
29
|
+
"@esri/calcite-components": "~3.0.0-next.87",
|
|
30
30
|
"@vaadin/grid": "~24.6.0",
|
|
31
31
|
"@zip.js/zip.js": "~2.7.54",
|
|
32
32
|
"luxon": "~3.5.0",
|
|
33
|
-
"marked": "~15.0.
|
|
33
|
+
"marked": "~15.0.5",
|
|
34
34
|
"sortablejs": "~1.15.6"
|
|
35
35
|
},
|
|
36
36
|
"type": "module"
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../Color.js";import"../../../intl.js";import"../../../symbols.js";import t from"../../../core/Collection.js";import"../../../core/has.js";import n from"../../../core/Error.js";import{convertDateFormatToIntlOptions as o,formatDate as i}from"../../../intl/date.js";import{round as r}from"../../../renderers/support/numberUtils.js";import s from"../../../renderers/support/pointCloud/PointSizeSplatAlgorithm.js";import l from"../../heuristics/outline.js";import a from"../../statistics/classBreaks.js";import m from"../../statistics/summaryStatistics.js";import{getAgeExpressions as u}from"../../statistics/support/ageUtils.js";import{defaultBasemapGroups as c,isAnyDateField as f,defaultStatisticTypes as d,getBasemapId as p,getBasemapGroup as y}from"../../support/utils.js";import w from"../../../symbols/edges/SketchEdges3D.js";import h from"../../../symbols/edges/SolidEdges3D.js";import{getTimeZoneFormattingOptions as b,shortTimeZoneName as g}from"../../../time/timeZoneUtils.js";import{getBackgroundColorTheme as j}from"../../../views/support/colorUtils.js";import D from"../../../symbols/MeshSymbol3D.js";import S from"../../../symbols/FillSymbol3DLayer.js";import v from"../../../symbols/SimpleFillSymbol.js";import x from"../../../symbols/PolygonSymbol3D.js";import z from"../../../symbols/ExtrudeSymbol3DLayer.js";import T from"../../../symbols/SimpleLineSymbol.js";import U from"../../../symbols/LineSymbol3D.js";import L from"../../../symbols/LineSymbol3DLayer.js";import V from"../../../symbols/PathSymbol3DLayer.js";import k from"../../../symbols/SimpleMarkerSymbol.js";import F from"../../../symbols/PointSymbol3D.js";import I from"../../../symbols/IconSymbol3DLayer.js";import M from"../../../symbols/ObjectSymbol3DLayer.js";import{fetchMessageBundle as C}from"../../../intl/messages.js";import{substitute as Z}from"../../../intl/substitute.js";const B=/^(\d+(\.\d+)?)\s*(%)$/i,E=new e([0,0,0,.4]),P=new Set(["hours","minutes","seconds"]),A=[...c.light,...c.dark];function R(e,t,n,r){if("string"==typeof e){const t=n.getField(e);if(t&&f(t))return t.alias||t.name}else if("number"==typeof e||e instanceof Date){const s=null!=t&&P.has(t),l=o(s?"short-date-short-time":"short-date");if(r&&s){const t=n.layer,{timeZone:o}=b("preferredTimeZone"in t?t.preferredTimeZone:null,"datesInUnknownTimezone"in t&&t.datesInUnknownTimezone,r.timeZone,l,"date");return i(e,{...l,timeZone:o,timeZoneName:g})}return i(e,l)}return e}function Y(e,t,n){return e+t>0&&0>e-t&&n<0?0:e}function N(e,t,n,o){const{avg:i,stddev:r,min:s,max:l}=e,a=W(e,!!n,o??!0);let m=a?a[0]:s,u=a?a[1]:l;return a?{minDataValue:m,maxDataValue:u,defaultValuesUsed:!0}:("above"===t?m=Y(i,r,s):"below"===t&&(u=Y(i,r,s)),{minDataValue:m,maxDataValue:u,defaultValuesUsed:!1})}function W(e,t,n){let o,i;const r=$({statistics:e,isDate:t});return r.defaultValuesUsed?(o=r.min,i=r.max):!n||null!=e.avg&&e.stddev||(o=e.min,i=e.max),null!=o&&null!=i?[o,i]:null}function $(e){let t,n,o=e
|
|
5
|
+
import e from"../../../Color.js";import"../../../intl.js";import"../../../symbols.js";import t from"../../../core/Collection.js";import"../../../core/has.js";import n from"../../../core/Error.js";import{convertDateFormatToIntlOptions as o,formatDate as i}from"../../../intl/date.js";import{round as r}from"../../../renderers/support/numberUtils.js";import s from"../../../renderers/support/pointCloud/PointSizeSplatAlgorithm.js";import l from"../../heuristics/outline.js";import a from"../../statistics/classBreaks.js";import m from"../../statistics/summaryStatistics.js";import{getAgeExpressions as u}from"../../statistics/support/ageUtils.js";import{defaultBasemapGroups as c,isAnyDateField as f,defaultStatisticTypes as d,getBasemapId as p,getBasemapGroup as y}from"../../support/utils.js";import w from"../../../symbols/edges/SketchEdges3D.js";import h from"../../../symbols/edges/SolidEdges3D.js";import{getTimeZoneFormattingOptions as b,shortTimeZoneName as g}from"../../../time/timeZoneUtils.js";import{getBackgroundColorTheme as j}from"../../../views/support/colorUtils.js";import D from"../../../symbols/MeshSymbol3D.js";import S from"../../../symbols/FillSymbol3DLayer.js";import v from"../../../symbols/SimpleFillSymbol.js";import x from"../../../symbols/PolygonSymbol3D.js";import z from"../../../symbols/ExtrudeSymbol3DLayer.js";import T from"../../../symbols/SimpleLineSymbol.js";import U from"../../../symbols/LineSymbol3D.js";import L from"../../../symbols/LineSymbol3DLayer.js";import V from"../../../symbols/PathSymbol3DLayer.js";import k from"../../../symbols/SimpleMarkerSymbol.js";import F from"../../../symbols/PointSymbol3D.js";import I from"../../../symbols/IconSymbol3DLayer.js";import M from"../../../symbols/ObjectSymbol3DLayer.js";import{fetchMessageBundle as C}from"../../../intl/messages.js";import{substitute as Z}from"../../../intl/substitute.js";const B=/^(\d+(\.\d+)?)\s*(%)$/i,E=new e([0,0,0,.4]),P=new Set(["hours","minutes","seconds"]),A=[...c.light,...c.dark];function R(e,t,n,r){if("string"==typeof e){const t=n.getField(e);if(t&&f(t))return t.alias||t.name}else if("number"==typeof e||e instanceof Date){const s=null!=t&&P.has(t),l=o(s?"short-date-short-time":"short-date");if(r&&s){const t=n.layer,{timeZone:o}=b("preferredTimeZone"in t?t.preferredTimeZone:null,"datesInUnknownTimezone"in t&&t.datesInUnknownTimezone,r.timeZone,l,"date");return i(e,{...l,timeZone:o,timeZoneName:g})}return i(e,l)}return e}function Y(e,t,n){return e+t>0&&0>e-t&&n<0?0:e}function N(e,t,n,o){const{avg:i,stddev:r,min:s,max:l}=e,a=W(e,!!n,o??!0);let m=a?a[0]:s,u=a?a[1]:l;return a?{minDataValue:m,maxDataValue:u,defaultValuesUsed:!0}:("above"===t?m=Y(i,r,s):"below"===t&&(u=Y(i,r,s)),{minDataValue:m,maxDataValue:u,defaultValuesUsed:!1})}function W(e,t,n){let o,i;const r=$({statistics:e,isDate:t});return r.defaultValuesUsed?(o=r.min,i=r.max):!n||null!=e.avg&&e.stddev||(o=e.min,i=e.max),null!=o&&null!=i?[o,i]:null}function $(e){let t,n,o=e.statistics;if(o||(o={}),null==o.min)if(e.isDate){const e=q();t=e[0],n=e[1]}else t=0,n=100;else if(o.min===o.max)if(e.isDate){const e=q(o.min);t=e[0],n=e[1]}else o.min<0?(t=2*o.min,n=0):o.min>0?(t=0,n=2*o.min):(t=0,n=100);return{min:null!=t?t:o.min,max:null!=n?n:o.max,defaultValuesUsed:null!=t||null!=n}}function q(e){const t=("number"==typeof e?new Date(e):new Date).getUTCFullYear();let n=Date.UTC(t,0,1,12,0,0,0),o=Date.UTC(t,11,31,12,0,0,0);return"number"==typeof e&&(e<n&&(n=e),e>o&&(o=e)),[n,o]}function O({minDataValue:e,maxDataValue:t,defaultValuesUsed:n},o,i,r=!0){return n||"above"===i||"below"===i?H(e,t,5):J(o,r)}function _(e,t){const{avg:n,stddev:o}=e,i=e.min,s=e.max;if(null==n||null==o){const[n,o]=W(e,t,!0);return H(n,o,5)}const l=Y(n,o,i),a=s-l,m=l-i,u=Math.max(a,m);return r([l-u,l-u/2,l,u/2+l,l+u],{strictBounds:!0})}function G(e,t){const{min:n,max:o}=t,[i,s,l,a,m]=e,u=null!=n&&i<n,c=null!=o&&m>o;if(null==n||null==o||!u&&!c)return e;const f=u?n:i,d=c?o:m;return r([f,u?f+(l-f)/2:s,l,c?l+(d-l)/2:a,d],{strictBounds:!0})}function H(e,t,n){const o=(t-e)/(n-1),i=[e];for(let r=1;r<=n-2;r++)i.push(e+r*o);return i.push(t),r(i,{strictBounds:!0})}function J({min:e,max:t,avg:n,stddev:o},i=!0){if(null==e||null==t||null==n||null==o)return[];let s=n-o,l=n+o;s<e&&(s=e),l>t&&(l=t),i&&(n=s+(l-s)/2);let a=r([s,l],{strictBounds:!0});return s=a[0],l=a[1],a=[s,s+(n-s)/2,n,n+(l-n)/2,l],r(a,{strictBounds:!0})}function K(e,t,n){switch(t){case"point":case"multipoint":return n?"noDataSize"in e?e.noDataSize:null:"size"in e?e.size:null;case"polyline":return n?"noDataWidth"in e?e.noDataWidth:null:"width"in e?e.width:null;case"polygon":return"size"in e?e.size:null;default:return}}function Q(e,t,n){switch(t){case"point":case"multipoint":case"polygon":{if(!("outline"in e))return null;const t={color:e.outline.color,width:e.outline.width};if(null!=n&&t.color){const e=t.color.clone();e.a=n,t.color=e}return t}default:return}}function X(e,n){const{type:o,size:i,color:r,outline:s}=n;let l;switch(e){case"point":case"multipoint":if("2d"===o)l=new k({color:r,size:i,outline:{color:s.color,width:s.width}});else if("3d-flat"===o)l=new F({symbolLayers:new t([new I({size:i,resource:{primitive:"circle"},material:{color:r},outline:{color:s.color,size:s.width}})])});else if(o?.includes("3d-volumetric")){const e="3d-volumetric-uniform"===o,s=new M({height:i,resource:{primitive:e?"sphere":"cylinder"},material:{color:r}});e||(s.width=n.widthAndDepth,s.depth=n.widthAndDepth),l=new F({symbolLayers:new t([s])})}break;case"polyline":"2d"===o?l=new T({color:r,width:i}):"3d-flat"===o?l=new U({symbolLayers:new t([new L({size:i,material:{color:r}})])}):"3d-volumetric"===o&&(l=new U({symbolLayers:new t([new V({width:"number"==typeof i?i:parseFloat(i),height:"number"==typeof i?i:parseFloat(i),material:{color:r}})])}));break;case"polygon":"2d"===o?l=new v({color:r,outline:{color:s.color,width:s.width}}):"3d-flat"===o?l=new x({symbolLayers:new t([new S({material:{color:r},outline:{color:s.color,size:s.width}})])}):"3d-volumetric"===o&&(l=new x({symbolLayers:new t([new z({size:i,material:{color:r}})])}));break;case"mesh":{const e=n.meshInfo?.colorMixMode,o=n.meshInfo?.edgesType;l=new D({symbolLayers:new t([new S({material:{color:r,colorMixMode:e||null},edges:"solid"===o?new h({color:E}):"sketch"===o?new w({color:E}):null})])});break}}return l}function ee(e,t,o){const i=te({layer:e,fields:t});if(i.length)return new n(o,"Unknown fields: "+i.join(", ")+". You can only use fields defined in the layer schema");const r=ne({layer:e,fields:t});return r.length?new n(o,"Unsupported fields: "+r.join(", ")+". You can only use fields that are accessible to the renderer i.e. FieldUsageInfo.supportsRenderer must be true"):void 0}function te(e){const t=e.layer;return e.fields.filter((e=>!t.getField(e)))}function ne(e){const t=e.layer;return e.fields.filter((e=>{const n=t.getFieldUsageInfo(e);return!n||!n.supportsRenderer}))}async function oe(e,t){const n={layer:e.layer,view:e.view,filter:e.filter,signal:e.signal},[o,i]=await Promise.all([a(e).catch(ue),t?l(n).catch(ue):null]),r=W({min:o?.minValue,max:o?.maxValue,avg:null,stddev:null},!1,!1);return{result:r?await a({...e,classificationMethod:"equal-interval",numClasses:1,analyzeData:!1,minValue:r[0],maxValue:r[1],normalizationTotal:r[0]+r[1]}):o,defaultValuesUsed:!!r,outlineResult:i}}function ie(e){return m({outStatisticTypes:d,...e})}function re(e,t){let{minSize:n,maxSize:o}=e;if("height"===t){n=((o-n)/2+n)/(2*2.3),o*=2}return{minSize:n,maxSize:o}}function se(e){return B.test(e)}function le(e){if(null==e)return;const t=e.match(B),n=Number(t[1]);return"%"===t[3]?new s({scaleFactor:n/100}):void 0}function ae(e,t,n,o){e.startTime=t instanceof Date?t.getTime():t,e.endTime=n instanceof Date?n.getTime():n,e.units=o,e.field="string"==typeof t?t:"string"==typeof n?n:null}async function me(e,t){let n=null,o=null;if(!e&&!t)return{basemapId:n,basemapTheme:o};if(t&&(o=await j(t),e||(e=t.map?.basemap)),e&&(n=p(e,A,!1),n&&!o)){const e=y(n);null!=e&&(o=e)}return!n&&o&&(n="dark"===o?"dark-gray":"gray"),{basemapId:n,basemapTheme:o}}function ue(e){const t=e.name?.toLowerCase();if(!t||t?.includes(":insufficient-info")||t?.includes(":insufficient-data"))return null;throw e}async function ce(e,t){const{layer:n,startTime:o,endTime:i,view:r}=e,s=u({layer:n,startTime:o,endTime:i,unit:t}).valueExpression,l=await C("esri/smartMapping/t9n/smartMapping");return{valueExpression:s,title:Z(l[`ageInfo_${t}`],{unit:t,startTime:R(o,t,n,r),endTime:R(i,t,n,r)})}}export{G as clampAboveAndBelowStopValues,O as createDataValues,H as createDefaultStopValues,J as createStopValues,_ as createStopValuesForAboveBelow,X as createSymbol,ue as errorCallback,R as formatDate,Y as getBaseValueForAboveBelow,me as getBasemapInfo,oe as getClassBreaks,N as getDataRange,W as getDefaultDataRange,le as getPointSizeAlgorithm,re as getSizeRangeForAxis,ie as getSummaryStatistics,Q as getSymbolOutlineFromScheme,K as getSymbolSizeFromScheme,ce as getTitleAndExpressionForAgeRenderer,se as isValidPointSize,ae as updateAgeRendererAuthoringInfoVV,ee as verifyBasicFieldValidity};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clone as s}from"../../../core/lang.js";import{defaultBasemapGroups as e,getBasemapId as t,getBasemapGroup as a}from"../../support/utils.js";function p(s,e,p){let m=null,o=null;if(e&&(m=t(e,s,!1),m)){const s=a(m);null!=s&&(o=s)}return!m&&p&&(m="dark"===p?"dark-gray":"gray",o=p),m||o||(m="gray",o="light"),{basemapId:m,basemapTheme:o}}class m{constructor(s){const{name:t,label:a,description:p,schemes:m}=s;this.name=t,this.label=a,this.description=p,this.schemes=m;const o=s.basemapGroups||e;let r=[];
|
|
5
|
+
import{clone as s}from"../../../core/lang.js";import{defaultBasemapGroups as e,getBasemapId as t,getBasemapGroup as a}from"../../support/utils.js";function p(s,e,p){let m=null,o=null;if(e&&(m=t(e,s,!1),m)){const s=a(m);null!=s&&(o=s)}return!m&&p&&(m="dark"===p?"dark-gray":"gray",o=p),m||o||(m="gray",o="light"),{basemapId:m,basemapTheme:o}}class m{constructor(s){const{name:t,label:a,description:p,schemes:m}=s;this.name=t,this.label=a,this.description=p,this.schemes=m;const o=s.basemapGroups||e;let r=[];Object.keys(o).forEach((s=>{r=r.concat(o[s])})),this.supportedBasemaps=r,this.basemapGroups=o}isBasemapSupported(s){const e=t(s,this.supportedBasemaps);return!(!e||!this.supportedBasemaps.includes(e))}getRawSchemes(e){const{basemapId:t,basemapTheme:m}=p(this.supportedBasemaps,e.basemap,e.basemapTheme);let o=m;if(t){const s=a(t,this.basemapGroups);null!=s&&(o=s)}let r=e.geometryType;"multipoint"===r?r="point":"mesh"===r&&(r="polygon");const i=this.schemes[r]||this.schemes.default;return{schemesInfo:s(i[o]),basemapId:t,basemapTheme:m}}}export{m as default};
|
package/support/revision.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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const e="20250103",c="c6af93f891fa299d055c9b5e0eebc041b97468ed";export{e as buildDate,c as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../../../Color.js";import{multiplyOpacityToUnitRGBA as e,colorEquals as i,getContrast as s}from"../../../../../core/colorUtils.js";import a from"../../../../../core/Handles.js";import"../../../../../core/has.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{watch as o,sync as n}from"../../../../../core/reactiveUtils.js";import{screenPointObjectToArray as l}from"../../../../../core/screenUtils.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import _ from"../../../../../geometry/Point.js";import{Manipulator3D as u}from"../../Manipulator3D.js";import{createManipulatorMaterial as p}from"../../manipulatorUtils.js";import{RenderObject as c}from"../../RenderObject.js";import{PickResult as d}from"../support/PickRequest.js";import{LaserlineVisualElement as m}from"../../visualElements/LaserlineVisualElement.js";import{createSphereGeometry as w}from"../../../webgl-engine/lib/GeometryUtil.js";import{ManipulatorCollection as v}from"../../../../interactive/ManipulatorCollection.js";import{newToolIntersector as g}from"../../../../interactive/ToolIntersector.js";class y{constructor(t){this.vertexManipulators=[],this._destroyed=!1,this._isManipulatorsOwner=!0,this._visible=!0,this._listenerHandles=null,this._tempHandlePosition=h();const{analysisViewData:e,manipulators:i,toolState:s,view:a,visible:r}=t;this._analysisViewData=e,this._toolState=s,null!=i?(this._manipulators=i,this._isManipulatorsOwner=!1):this._manipulators=new v,this._view=a,this._intersector=g(a.state.viewingMode);const o=p(this._handleColor),n=[new c(w(o,1,32,32))],l=new u({view:a,renderObjects:n});l.available=!1,l.radius=D,l.interactive=!1,this._manipulators.add(l),this._cursorManipulator=l,this._cursorManipulatorMaterial=o,this._laserLine=new m({view:a,attached:!0,style:{glowWidth:V,glowFalloff:M,innerWidth:b},isDecoration:!0}),this._updateVisibility(r??!0)}destroy(){this._listenerHandles=r(this._listenerHandles),this._isManipulatorsOwner?this._manipulators=r(this._manipulators):this._manipulators=null,this._laserLine=r(this._laserLine),this._destroyed=!0}get destroyed(){return this._destroyed}get visible(){return this._visible}set visible(t){t?this.show():this.hide()}get testData(){}show(){this._setVisibility(!0)}hide(){this._setVisibility(!1)}_setVisibility(t){this._destroyed||this._visible===t||this._updateVisibility(t)}_updateVisibility(t){this._visible=t,this._laserLine.visible=t,t?(this._initializeListeners(),this._updateAll()):(this._destroyListeners(),this.vertexManipulators.forEach((({manipulator:t})=>this._removeVertexManipulator(t))),this.vertexManipulators=[],this._view.cursor=null)}vertexHandleAt(t,e){const i=this._manipulators.intersect(t,e);return i?.metadata}pick(t){const e=this._view.spatialReference,i=l(t.screenPoint);this._view.sceneIntersectionHelper.intersectToolIntersectorScreen(i,this._intersector);const s=this._intersector.results.min,a=h();if(!s.getIntersectionPoint(a))return null;const r=this._view.renderCoordsHelper.fromRenderCoords(a,new _({spatialReference:e}));return null==r?null:new d(a,r)}_updateAll(){this._visible&&(this._updateVertexManipulators(),this._updateLaserLine())}_createVertexManipulator(){const t=p(this._handleColor),e=[new c(w(t,1,32,32))],i=new u({view:this._view,renderObjects:e});return i.radius=D,this._manipulators.add(i),{manipulator:i,material:t}}_removeVertexManipulator(t){this._manipulators.remove(t)}_updateVertexManipulators(){const{viewData:t}=this._analysisViewData,e=this._analysisViewData.path?this._analysisViewData.path.vertices:[],i=this.vertexManipulators;f(i,e.length,(()=>this._createVertexManipulator()),(({manipulator:t})=>this._removeVertexManipulator(t))),i.forEach((({manipulator:i},s)=>{i.metadata=e[s],i.renderLocation=t.positionsRender[s],i.cursor=0===s&&"drawing"===this._toolState.polygonState?"crosshair":null})),"drawing"===this._toolState.polygonState&&null!=this._analysisViewData.stagedPoint?(this._cursorManipulator.available=!0,this._cursorManipulator.location=this._analysisViewData.stagedPoint):this._cursorManipulator.available=!1}get _handleColor(){return e(this._view.effectiveTheme.accentColor,.5)}_getFocusPoint(){const{lastDraggedVertex:t}=this._analysisViewData;switch(this._toolState.polygonState){case"drawing":return null!=this._analysisViewData.stagedPoint?this._analysisViewData.stagedPoint:null!=t?this._analysisViewData.path.getVertexPositionAsPoint(t):this._analysisViewData.path.lastPoint;case"editing":return null!=t?this._analysisViewData.path.getVertexPositionAsPoint(t):null;default:return this._analysisViewData.stagedPoint}}_updateLaserLine(){const t="measured"!==this._toolState.polygonState&&this._toolState.active,e=this._getFocusPoint();if(t&&null!=e){const t=this._tempHandlePosition;this._view.renderCoordsHelper.toRenderCoords(e,t),this._laserLine.heightManifoldTarget=t}else this._laserLine.heightManifoldTarget=null}_initializeListeners(){this._listenerHandles=new a,this._listenerHandles.add([o((()=>this._toolState.polygonState),(()=>this._updateLaserLine())),o((()=>this._analysisViewData.viewData),(()=>this._updateAll()),n),o((()=>({lastDraggedVertex:this._analysisViewData.lastDraggedVertex,cursorPoint:this._analysisViewData.stagedPoint})),(()=>this._updateLaserLine())),o((()=>this._toolState.active),(()=>this._updateAll())),o((()=>this._view.effectiveTheme.accentColor),(i=>{const a=e(i,.5);for(const{material:t}of this.vertexManipulators)t.setParameters({color:a});this._cursorManipulatorMaterial.setParameters({color:a});const r=t.toUnitRGB(i),o=t.toUnitRGB(s(i)),n=.75*i.a,l=this._laserLine,h=l.style;l.style={...h,glowColor:r,innerColor:o,globalAlpha:n}}),{initial:!0,equals:i})])}_destroyListeners(){this._listenerHandles=r(this._listenerHandles)}}function f(t,e,i,s){for(;t.length<e;)t.push(i());
|
|
5
|
+
import t from"../../../../../Color.js";import{multiplyOpacityToUnitRGBA as e,colorEquals as i,getContrast as s}from"../../../../../core/colorUtils.js";import a from"../../../../../core/Handles.js";import"../../../../../core/has.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{watch as o,sync as n}from"../../../../../core/reactiveUtils.js";import{screenPointObjectToArray as l}from"../../../../../core/screenUtils.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import _ from"../../../../../geometry/Point.js";import{Manipulator3D as u}from"../../Manipulator3D.js";import{createManipulatorMaterial as p}from"../../manipulatorUtils.js";import{RenderObject as c}from"../../RenderObject.js";import{PickResult as d}from"../support/PickRequest.js";import{LaserlineVisualElement as m}from"../../visualElements/LaserlineVisualElement.js";import{createSphereGeometry as w}from"../../../webgl-engine/lib/GeometryUtil.js";import{ManipulatorCollection as v}from"../../../../interactive/ManipulatorCollection.js";import{newToolIntersector as g}from"../../../../interactive/ToolIntersector.js";class y{constructor(t){this.vertexManipulators=[],this._destroyed=!1,this._isManipulatorsOwner=!0,this._visible=!0,this._listenerHandles=null,this._tempHandlePosition=h();const{analysisViewData:e,manipulators:i,toolState:s,view:a,visible:r}=t;this._analysisViewData=e,this._toolState=s,null!=i?(this._manipulators=i,this._isManipulatorsOwner=!1):this._manipulators=new v,this._view=a,this._intersector=g(a.state.viewingMode);const o=p(this._handleColor),n=[new c(w(o,1,32,32))],l=new u({view:a,renderObjects:n});l.available=!1,l.radius=D,l.interactive=!1,this._manipulators.add(l),this._cursorManipulator=l,this._cursorManipulatorMaterial=o,this._laserLine=new m({view:a,attached:!0,style:{glowWidth:V,glowFalloff:M,innerWidth:b},isDecoration:!0}),this._updateVisibility(r??!0)}destroy(){this._listenerHandles=r(this._listenerHandles),this._isManipulatorsOwner?this._manipulators=r(this._manipulators):this._manipulators=null,this._laserLine=r(this._laserLine),this._destroyed=!0}get destroyed(){return this._destroyed}get visible(){return this._visible}set visible(t){t?this.show():this.hide()}get testData(){}show(){this._setVisibility(!0)}hide(){this._setVisibility(!1)}_setVisibility(t){this._destroyed||this._visible===t||this._updateVisibility(t)}_updateVisibility(t){this._visible=t,this._laserLine.visible=t,t?(this._initializeListeners(),this._updateAll()):(this._destroyListeners(),this.vertexManipulators.forEach((({manipulator:t})=>this._removeVertexManipulator(t))),this.vertexManipulators=[],this._view.cursor=null)}vertexHandleAt(t,e){const i=this._manipulators.intersect(t,e);return i?.metadata}pick(t){const e=this._view.spatialReference,i=l(t.screenPoint);this._view.sceneIntersectionHelper.intersectToolIntersectorScreen(i,this._intersector);const s=this._intersector.results.min,a=h();if(!s.getIntersectionPoint(a))return null;const r=this._view.renderCoordsHelper.fromRenderCoords(a,new _({spatialReference:e}));return null==r?null:new d(a,r)}_updateAll(){this._visible&&(this._updateVertexManipulators(),this._updateLaserLine())}_createVertexManipulator(){const t=p(this._handleColor),e=[new c(w(t,1,32,32))],i=new u({view:this._view,renderObjects:e});return i.radius=D,this._manipulators.add(i),{manipulator:i,material:t}}_removeVertexManipulator(t){this._manipulators.remove(t)}_updateVertexManipulators(){const{viewData:t}=this._analysisViewData,e=this._analysisViewData.path?this._analysisViewData.path.vertices:[],i=this.vertexManipulators;f(i,e.length,(()=>this._createVertexManipulator()),(({manipulator:t})=>this._removeVertexManipulator(t))),i.forEach((({manipulator:i},s)=>{i.metadata=e[s],i.renderLocation=t.positionsRender[s],i.cursor=0===s&&"drawing"===this._toolState.polygonState?"crosshair":null})),"drawing"===this._toolState.polygonState&&null!=this._analysisViewData.stagedPoint?(this._cursorManipulator.available=!0,this._cursorManipulator.location=this._analysisViewData.stagedPoint):this._cursorManipulator.available=!1}get _handleColor(){return e(this._view.effectiveTheme.accentColor,.5)}_getFocusPoint(){const{lastDraggedVertex:t}=this._analysisViewData;switch(this._toolState.polygonState){case"drawing":return null!=this._analysisViewData.stagedPoint?this._analysisViewData.stagedPoint:null!=t?this._analysisViewData.path.getVertexPositionAsPoint(t):this._analysisViewData.path.lastPoint;case"editing":return null!=t?this._analysisViewData.path.getVertexPositionAsPoint(t):null;default:return this._analysisViewData.stagedPoint}}_updateLaserLine(){const t="measured"!==this._toolState.polygonState&&this._toolState.active,e=this._getFocusPoint();if(t&&null!=e){const t=this._tempHandlePosition;this._view.renderCoordsHelper.toRenderCoords(e,t),this._laserLine.heightManifoldTarget=t}else this._laserLine.heightManifoldTarget=null}_initializeListeners(){this._listenerHandles=new a,this._listenerHandles.add([o((()=>this._toolState.polygonState),(()=>this._updateLaserLine())),o((()=>this._analysisViewData.viewData),(()=>this._updateAll()),n),o((()=>({lastDraggedVertex:this._analysisViewData.lastDraggedVertex,cursorPoint:this._analysisViewData.stagedPoint})),(()=>this._updateLaserLine())),o((()=>this._toolState.active),(()=>this._updateAll())),o((()=>this._view.effectiveTheme.accentColor),(i=>{const a=e(i,.5);for(const{material:t}of this.vertexManipulators)t.setParameters({color:a});this._cursorManipulatorMaterial.setParameters({color:a});const r=t.toUnitRGB(i),o=t.toUnitRGB(s(i)),n=.75*i.a,l=this._laserLine,h=l.style;l.style={...h,glowColor:r,innerColor:o,globalAlpha:n}}),{initial:!0,equals:i})])}_destroyListeners(){this._listenerHandles=r(this._listenerHandles)}}function f(t,e,i,s){for(;t.length<e;)t.push(i());for(;t.length>e;){s(t.pop())}}const V=8,M=8,b=1,D=5;export{y 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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../core/has.js";import{Milliseconds as e}from"../../../core/time.js";class a{static isValidProfile(e){return e in a.profiles}static getDefaultProfile(){return has("esri-iPhone")?"low":"medium"}static apply(e,i){const o=a.profiles[e];i.graphics3D.maxTotalNumberOfFeatures=o.graphics3D.maxTotalNumberOfFeatures,i.graphics3D.maxNumberOfDrawCalls=o.graphics3D.maxNumberOfDrawCalls,i.graphics3D.maxTotalNumberOfVertices=o.graphics3D.maxTotalNumberOfVertices,i.graphics3D.polygonLodFactor=o.graphics3D.polygonLodFactor,i.graphics3D.polylineLodFactor=o.graphics3D.polylineLodFactor,i.graphics3D.snapshotAvailable=o.graphics3D.snapshotAvailable,i.graphics3D.skipHighSymbolLods=o.graphics3D.skipHighSymbolLods,i.graphics3D.uncompressedTextureDownsamplingEnabled=o.graphics3D.uncompressedTextureDownsamplingEnabled;const l=i.sceneService.object,t=o.sceneService.object;l.lodFactor=t.lodFactor,i.sceneService.point.lodFactor=o.sceneService.point.lodFactor,i.sceneService.integratedMesh.lodFactor=o.sceneService.integratedMesh.lodFactor,i.sceneService.pointCloud.lodFactor=o.sceneService.pointCloud.lodFactor,i.sceneService.uncompressedTextureDownsamplingEnabled=o.sceneService.uncompressedTextureDownsamplingEnabled,i.tiledSurface.lodBias=o.tiledSurface.lodBias,i.tiledSurface.angledSplitBias=o.tiledSurface.angledSplitBias,i.tiledSurface.vtlContentZoom=o.tiledSurface.vtlContentZoom,i.tiledSurface.elevationLevelDelta=o.tiledSurface.elevationLevelDelta,i.tiledSurface.reduceTileLevelDifferences=o.tiledSurface.reduceTileLevelDifferences,i.heatmap.pixelRatio=o.heatmap.pixelRatio,i.heatmap.maxTotalNumberOfFeatures=o.heatmap.maxTotalNumberOfFeatures,i.fadeDuration=o.fadeDuration,i.antialiasingEnabled=o.antialiasingEnabled,i.physicallyBasedRenderingEnabled=o.physicalBasedRenderingEnabled,i.highQualityTransparency=o.highQualityTransparency,i.highResolutionAtmosphere=o.highResolutionAtmosphere,i.reflections=o.reflections,i.ambientOcclusion=o.ambientOcclusion,i.memoryLimit=o.memoryLimit,i.additionalCacheMemory=o.additionalCacheMemory,i.frameRate=o.frameRate,i.maximumPixelRatio=o.maximumPixelRatio}}a.test={reset(){const e=o();for(const i of Object.keys(e))a.profiles[i]=e[i]}};const i={IPhone12Pro:120,GalaxyS20:200,FullHD:240,SurfacePro7:300,FullHDRetina:430};function o(){const a=!!has("esri-mobile"),o=!!has("ios"),l=e(400);return{low:{graphics3D:{maxTotalNumberOfFeatures:25e3,maxNumberOfDrawCalls:8e3,maxTotalNumberOfVertices:255e4,polygonLodFactor:.5,polylineLodFactor:1,snapshotAvailable:!1,skipHighSymbolLods:!0,uncompressedTextureDownsamplingEnabled:!0},heatmap:{pixelRatio:.125,maxTotalNumberOfFeatures:5e4},sceneService:{object:{lodFactor:.2},point:{lodFactor:1},integratedMesh:{lodFactor:.6},pointCloud:{lodFactor:.5},uncompressedTextureDownsamplingEnabled:!0},tiledSurface:{lodBias:-1,angledSplitBias:.5,vtlContentZoom:.75,elevationLevelDelta:3,reduceTileLevelDifferences:!0},fadeDuration:e(0),antialiasingEnabled:!1,physicalBasedRenderingEnabled:!1,highQualityTransparency:!1,highResolutionAtmosphere:!1,reflections:!1,ambientOcclusion:!1,memoryLimit:200+i.IPhone12Pro,additionalCacheMemory:0,frameRate:0,maximumPixelRatio:1},medium:{graphics3D:{maxTotalNumberOfFeatures:1e5,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:625e4,polygonLodFactor:a?.8:1,polylineLodFactor:a?1.2:1.5,snapshotAvailable:!o,skipHighSymbolLods:!1,uncompressedTextureDownsamplingEnabled:a},heatmap:{pixelRatio:.25,maxTotalNumberOfFeatures:13e4},sceneService:{object:{lodFactor:1},point:{lodFactor:1},integratedMesh:{lodFactor:1},pointCloud:{lodFactor:1},uncompressedTextureDownsamplingEnabled:a},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,elevationLevelDelta:3,reduceTileLevelDifferences:!has("disable-feature:reduce-map-tile-levels")},fadeDuration:l,antialiasingEnabled:!1,physicalBasedRenderingEnabled:!0,highQualityTransparency:!0,highResolutionAtmosphere:!1,reflections:!1,ambientOcclusion:!1,memoryLimit:a?600+i.GalaxyS20:750+i.FullHD,additionalCacheMemory:a?-100:150,frameRate:0,maximumPixelRatio:1},high:{graphics3D:{maxTotalNumberOfFeatures:1e5,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:125e5,polygonLodFactor:a?1.2:2,polylineLodFactor:a?1.2:2,snapshotAvailable:!o,skipHighSymbolLods:!1,uncompressedTextureDownsamplingEnabled:!1},heatmap:{pixelRatio:.5,maxTotalNumberOfFeatures:23e4},sceneService:{object:{lodFactor:1},point:{lodFactor:1},integratedMesh:{lodFactor:1},pointCloud:{lodFactor:1},uncompressedTextureDownsamplingEnabled:!1},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,elevationLevelDelta:2,reduceTileLevelDifferences:!has("disable-feature:reduce-map-tile-levels")},fadeDuration:l,antialiasingEnabled:!0,physicalBasedRenderingEnabled:!0,highQualityTransparency:!0,highResolutionAtmosphere:!0,reflections:!0,ambientOcclusion:!0,memoryLimit:a?900+i.SurfacePro7:1500+i.FullHDRetina,additionalCacheMemory:a?-150:0,frameRate:0,maximumPixelRatio:a?1:1/0}}}!function(e){e.profiles=o()}(a
|
|
5
|
+
import has from"../../../core/has.js";import{Milliseconds as e}from"../../../core/time.js";class a{static isValidProfile(e){return e in a.profiles}static getDefaultProfile(){return has("esri-iPhone")?"low":"medium"}static apply(e,i){const o=a.profiles[e];i.graphics3D.maxTotalNumberOfFeatures=o.graphics3D.maxTotalNumberOfFeatures,i.graphics3D.maxNumberOfDrawCalls=o.graphics3D.maxNumberOfDrawCalls,i.graphics3D.maxTotalNumberOfVertices=o.graphics3D.maxTotalNumberOfVertices,i.graphics3D.polygonLodFactor=o.graphics3D.polygonLodFactor,i.graphics3D.polylineLodFactor=o.graphics3D.polylineLodFactor,i.graphics3D.snapshotAvailable=o.graphics3D.snapshotAvailable,i.graphics3D.skipHighSymbolLods=o.graphics3D.skipHighSymbolLods,i.graphics3D.uncompressedTextureDownsamplingEnabled=o.graphics3D.uncompressedTextureDownsamplingEnabled;const l=i.sceneService.object,t=o.sceneService.object;l.lodFactor=t.lodFactor,i.sceneService.point.lodFactor=o.sceneService.point.lodFactor,i.sceneService.integratedMesh.lodFactor=o.sceneService.integratedMesh.lodFactor,i.sceneService.pointCloud.lodFactor=o.sceneService.pointCloud.lodFactor,i.sceneService.uncompressedTextureDownsamplingEnabled=o.sceneService.uncompressedTextureDownsamplingEnabled,i.tiledSurface.lodBias=o.tiledSurface.lodBias,i.tiledSurface.angledSplitBias=o.tiledSurface.angledSplitBias,i.tiledSurface.vtlContentZoom=o.tiledSurface.vtlContentZoom,i.tiledSurface.elevationLevelDelta=o.tiledSurface.elevationLevelDelta,i.tiledSurface.reduceTileLevelDifferences=o.tiledSurface.reduceTileLevelDifferences,i.heatmap.pixelRatio=o.heatmap.pixelRatio,i.heatmap.maxTotalNumberOfFeatures=o.heatmap.maxTotalNumberOfFeatures,i.fadeDuration=o.fadeDuration,i.antialiasingEnabled=o.antialiasingEnabled,i.physicallyBasedRenderingEnabled=o.physicalBasedRenderingEnabled,i.highQualityTransparency=o.highQualityTransparency,i.highResolutionAtmosphere=o.highResolutionAtmosphere,i.reflections=o.reflections,i.ambientOcclusion=o.ambientOcclusion,i.memoryLimit=o.memoryLimit,i.additionalCacheMemory=o.additionalCacheMemory,i.frameRate=o.frameRate,i.maximumPixelRatio=o.maximumPixelRatio}}a.test={reset(){const e=o();for(const i of Object.keys(e))a.profiles[i]=e[i]}};const i={IPhone12Pro:120,GalaxyS20:200,FullHD:240,SurfacePro7:300,FullHDRetina:430};function o(){const a=!!has("esri-mobile"),o=!!has("ios"),l=e(400);return{low:{graphics3D:{maxTotalNumberOfFeatures:25e3,maxNumberOfDrawCalls:8e3,maxTotalNumberOfVertices:255e4,polygonLodFactor:.5,polylineLodFactor:1,snapshotAvailable:!1,skipHighSymbolLods:!0,uncompressedTextureDownsamplingEnabled:!0},heatmap:{pixelRatio:.125,maxTotalNumberOfFeatures:5e4},sceneService:{object:{lodFactor:.2},point:{lodFactor:1},integratedMesh:{lodFactor:.6},pointCloud:{lodFactor:.5},uncompressedTextureDownsamplingEnabled:!0},tiledSurface:{lodBias:-1,angledSplitBias:.5,vtlContentZoom:.75,elevationLevelDelta:3,reduceTileLevelDifferences:!0},fadeDuration:e(0),antialiasingEnabled:!1,physicalBasedRenderingEnabled:!1,highQualityTransparency:!1,highResolutionAtmosphere:!1,reflections:!1,ambientOcclusion:!1,memoryLimit:200+i.IPhone12Pro,additionalCacheMemory:0,frameRate:0,maximumPixelRatio:1},medium:{graphics3D:{maxTotalNumberOfFeatures:1e5,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:625e4,polygonLodFactor:a?.8:1,polylineLodFactor:a?1.2:1.5,snapshotAvailable:!o,skipHighSymbolLods:!1,uncompressedTextureDownsamplingEnabled:a},heatmap:{pixelRatio:.25,maxTotalNumberOfFeatures:13e4},sceneService:{object:{lodFactor:1},point:{lodFactor:1},integratedMesh:{lodFactor:1},pointCloud:{lodFactor:1},uncompressedTextureDownsamplingEnabled:a},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,elevationLevelDelta:3,reduceTileLevelDifferences:!has("disable-feature:reduce-map-tile-levels")},fadeDuration:l,antialiasingEnabled:!1,physicalBasedRenderingEnabled:!0,highQualityTransparency:!0,highResolutionAtmosphere:!1,reflections:!1,ambientOcclusion:!1,memoryLimit:a?600+i.GalaxyS20:750+i.FullHD,additionalCacheMemory:a?-100:150,frameRate:0,maximumPixelRatio:1},high:{graphics3D:{maxTotalNumberOfFeatures:1e5,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:125e5,polygonLodFactor:a?1.2:2,polylineLodFactor:a?1.2:2,snapshotAvailable:!o,skipHighSymbolLods:!1,uncompressedTextureDownsamplingEnabled:!1},heatmap:{pixelRatio:.5,maxTotalNumberOfFeatures:23e4},sceneService:{object:{lodFactor:1},point:{lodFactor:1},integratedMesh:{lodFactor:1},pointCloud:{lodFactor:1},uncompressedTextureDownsamplingEnabled:!1},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,elevationLevelDelta:2,reduceTileLevelDifferences:!has("disable-feature:reduce-map-tile-levels")},fadeDuration:l,antialiasingEnabled:!0,physicalBasedRenderingEnabled:!0,highQualityTransparency:!0,highResolutionAtmosphere:!0,reflections:!0,ambientOcclusion:!0,memoryLimit:a?900+i.SurfacePro7:1500+i.FullHDRetina,additionalCacheMemory:a?-150:0,frameRate:0,maximumPixelRatio:a?1:1/0}}}!function(e){e.profiles=o()}(a);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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class n{}const t=n;function o(n,...t){let o="";for(let r=0;r<t.length;r++)o+=n[r]+t[r];return o+=n[n.length-1],o}function r(n,t,o=""){return n?t:o}!function(n){function t(n){return Math.round(n).toString()}function o(n){return n.toPrecision(8)}n.int=t,n.float=o}(o
|
|
5
|
+
class n{}const t=n;function o(n,...t){let o="";for(let r=0;r<t.length;r++)o+=n[r]+t[r];return o+=n[n.length-1],o}function r(n,t,o=""){return n?t:o}!function(n){function t(n){return Math.round(n).toString()}function o(n){return n.toPrecision(8)}n.int=t,n.float=o}(o);export{r as If,t as NoParameters,o as glsl};
|