@arcgis/core 4.25.0-next.20220821 → 4.25.0-next.20220824
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/analysis/DimensioningAnalysis.d.ts +4 -0
- package/analysis/LengthDimension.d.ts +4 -0
- package/arcade/featureset/support/shared.js +1 -1
- package/arcade/kernel.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0455c2cc352743827b6f.js +1 -0
- package/assets/esri/core/workers/chunks/{da13db62d54cbca350c3.js → 2909c5e28c05ddb007a0.js} +1 -1
- package/assets/esri/core/workers/chunks/2a2cad4a163777419b88.js +1 -0
- package/assets/esri/core/workers/chunks/2c783124624070505cf9.js +1 -0
- package/assets/esri/core/workers/chunks/31eab53447f47774354e.js +1 -0
- package/assets/esri/core/workers/chunks/{9dbe94a70624a5592690.js → 3e108ee81b5684f81cea.js} +1 -1
- package/assets/esri/core/workers/chunks/40bb4e2acbe5c3323715.js +1 -0
- package/assets/esri/core/workers/chunks/45397532008f955faf6f.js +2 -0
- package/assets/esri/core/workers/chunks/45397532008f955faf6f.js.LICENSE.txt +20 -0
- package/assets/esri/core/workers/chunks/4e045b0b3f49fcdecce0.js +1 -0
- package/assets/esri/core/workers/chunks/616a20dfd38f25453765.js +1 -0
- package/assets/esri/core/workers/chunks/{94784576d519d2440184.js → 69b8fef9bd487b8fb7c9.js} +1 -1
- package/assets/esri/core/workers/chunks/{32c7ea6e2068d5646988.js → 6e38ba64131c36edec43.js} +1 -1
- package/assets/esri/core/workers/chunks/6f99d0cdee66275cc68e.js +1 -0
- package/assets/esri/core/workers/chunks/{3485e2342f44e4d760a2.js → 70171492b13071b68db0.js} +1 -1
- package/assets/esri/core/workers/chunks/{b81c0d35f169a7df25c0.js → 8543c2f0a0eb67b101d7.js} +1 -1
- package/assets/esri/core/workers/chunks/8ba83fee56dd4f306d87.js +1 -0
- package/assets/esri/core/workers/chunks/{0f1fae79b5311d55c0da.js → 92f10a6f8eae3ecf5ac2.js} +1 -1
- package/assets/esri/core/workers/chunks/96673467342935d3d99a.js +1 -0
- package/assets/esri/core/workers/chunks/9f9418e4b1c39fe4571d.js +1 -0
- package/assets/esri/core/workers/chunks/a507e85f388b0504bb6a.js +1 -0
- package/assets/esri/core/workers/chunks/{8c2c1909359d794ac8fa.js → b0afc51c778d752488c6.js} +1 -1
- package/assets/esri/core/workers/chunks/{70dd8b67e69b084422a3.js → bfea5f112dc5bc08bb11.js} +1 -1
- package/assets/esri/core/workers/chunks/{2407a32902f012997e6a.js → c12c6d10edb4953145fa.js} +1 -1
- package/assets/esri/core/workers/chunks/{495dfd24894e8d5149c6.js → cfb3cfbc508840d2ea60.js} +1 -1
- package/assets/esri/core/workers/chunks/e8d0dbb6b6b241138fcf.js +1 -0
- package/assets/esri/core/workers/chunks/{a32c618ad62db6ecba67.js → e97ac86180a3381baf33.js} +1 -1
- package/assets/esri/core/workers/chunks/ef174d2fbcca4c3844d7.js +1 -0
- package/assets/esri/core/workers/chunks/f2cca221d9bea32f7594.js +1 -0
- package/assets/esri/core/workers/chunks/ff729a122ddffd95a6b5.js +1 -0
- package/chunks/Clouds.glsl.js +12 -12
- package/core/PerformanceSampler.js +1 -1
- package/core/imageUtils.js +5 -0
- package/geometry/support/MeshTexture.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/buffer.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/imageutils.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/index.js +1 -1
- package/geometry/support/meshUtils/loadExternal.js +1 -1
- package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/meshUtils/offset.js +1 -1
- package/geometry/support/meshUtils/rotate.js +1 -1
- package/geometry/support/meshUtils/scale.js +1 -1
- package/interfaces.d.ts +147 -4
- package/layers/RouteLayer.js +1 -1
- package/layers/graphics/data/projectionSupport.js +1 -1
- package/layers/graphics/data/spatialQuerySupport.js +1 -1
- package/layers/graphics/data/utils.js +1 -1
- package/layers/graphics/featureConversionUtils.js +1 -1
- package/layers/ogc/crsUtils.js +1 -1
- package/layers/support/FieldsIndex.js +1 -1
- package/layers/support/PromiseQueue.js +1 -1
- package/layers/support/TileInfo.js +1 -1
- package/layers/support/infoFor3D.js +0 -1
- package/layers/support/mediaUtils.js +1 -1
- package/layers/support/rasterDatasets/FunctionRaster.js +1 -1
- package/layers/support/rasterDatasets/pamParser.js +1 -1
- package/layers/support/rasterDatasets/wcsCapabilitiesParser.js +1 -1
- package/layers/support/rasterFunctions/AspectFunction.js +1 -1
- package/layers/support/rasterFunctions/BandArithmeticFunction.js +5 -0
- package/layers/support/rasterFunctions/BandArithmeticFunctionArguments.js +5 -0
- package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
- package/layers/support/rasterFunctions/ColormapFunction.js +1 -1
- package/layers/support/rasterFunctions/LocalFunction.js +5 -0
- package/layers/support/rasterFunctions/LocalFunctionArguments.js +5 -0
- package/layers/support/rasterFunctions/SlopeFunction.js +1 -1
- package/layers/support/rasterFunctions/StretchFunction.js +1 -1
- package/layers/support/rasterFunctions/bandIndexUtils.js +1 -1
- package/layers/support/rasterFunctions/customBandIndexUtils.js +5 -0
- package/layers/support/rasterFunctions/localUtils.js +1 -1
- package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
- package/layers/support/wmtsUtils.js +1 -1
- package/networks/Network.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/networks/support/NamedTraceConfiguration.js +1 -1
- package/package.json +3 -3
- package/portal/AssetMapFieldRole.js +5 -0
- package/renderers/DotDensityRenderer.js +1 -1
- package/renderers/support/utils.js +1 -1
- package/rest/networks/queryNamedTraceConfigurations.js +5 -0
- package/rest/networks/support/QueryNamedTraceConfigurationsParameters.js +5 -0
- package/rest/networks/support/QueryNamedTraceConfigurationsResult.js +5 -0
- package/rest/print.js +1 -1
- package/rest/support/GeneralizeParameters.js +1 -1
- package/rest/support/ImagePixelLocationParameters.js +1 -1
- package/rest/support/OffsetParameters.js +1 -1
- package/rest/support/PrintTemplate.js +1 -1
- package/rest/support/RelationParameters.js +1 -1
- package/rest/support/TopFeaturesQuery.js +1 -1
- package/rest/support/meshFeatureSet.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/GeometryWalker.js +1 -1
- package/symbols/cim/effects/EffectDashes.js +1 -1
- package/symbols/cim/effects/EffectWave.js +1 -1
- package/symbols/cim/placements/PlacementAlongLineSameSize.js +1 -1
- package/symbols/cim/placements/PlacementAtRatioPositions.js +1 -1
- package/views/2d/constraints/ZoomConstraint.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicMarkerTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLMarkerTemplate.js +1 -1
- package/views/2d/tiling/TileCache.js +1 -1
- package/views/2d/tiling/TileInfoView.js +1 -1
- package/views/3d/analysis/Dimensioning/LengthDimensionComputation.js +1 -1
- package/views/3d/analysis/Dimensioning/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/Dimensioning/settings.js +1 -1
- package/views/3d/environment/CloudsComposition.js +1 -1
- package/views/3d/environment/CloudsCompositionParameters.js +1 -1
- package/views/3d/environment/CloudsData.js +1 -1
- package/views/3d/environment/CloudsGenerator.js +1 -1
- package/views/3d/environment/CloudsTechnique.js +1 -1
- package/views/3d/environment/CloudsTechniqueConfiguration.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/support/StreamDataLoader.js +1 -1
- package/views/3d/support/earthUtils.js +1 -1
- package/views/3d/terrain/PatchGeometry.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PatchGeometryLUT.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +22 -13
- package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
- package/views/3d/webgl-engine/statistics/RendererPerformanceInfo.js +1 -1
- package/views/LayerViewManager.js +1 -1
- package/views/ViewAnimation.js +1 -1
- package/views/interactive/editGeometry/operations/AppendVertex.js +1 -1
- package/views/interactive/editGeometry/operations/RemoveVertices.js +1 -1
- package/views/interactive/editGeometry/operations/SplitEdge.js +1 -1
- package/views/layers/MapImageLayerView.js +1 -1
- package/views/layers/support/Geometry.js +1 -1
- package/views/support/screenshotUtils.js +1 -1
- package/views/webgl/Measurement.js +1 -1
- package/views/webgl/TimerPool.js +5 -0
- package/views/webgl/capabilities/DisjointTimerQuery.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureForm/support/formTemplateUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0c625803648e554f1fcf.js +0 -1
- package/assets/esri/core/workers/chunks/172c15e3dfa53554f591.js +0 -1
- package/assets/esri/core/workers/chunks/1e8e9967904da93c687e.js +0 -1
- package/assets/esri/core/workers/chunks/2efadbb06bf4a7f83f16.js +0 -1
- package/assets/esri/core/workers/chunks/30d7796ee6f7e4a6a3e1.js +0 -2
- package/assets/esri/core/workers/chunks/30d7796ee6f7e4a6a3e1.js.LICENSE.txt +0 -9
- package/assets/esri/core/workers/chunks/3281656a9bd3627e41ff.js +0 -1
- package/assets/esri/core/workers/chunks/3381b5454cd530cf940a.js +0 -1
- package/assets/esri/core/workers/chunks/4f4cb6d5b226ab5a38a1.js +0 -1
- package/assets/esri/core/workers/chunks/821a0754eae11421e56a.js +0 -1
- package/assets/esri/core/workers/chunks/8befbb2679e8285a8acd.js +0 -1
- package/assets/esri/core/workers/chunks/9e4c125d37ce66638b22.js +0 -1
- package/assets/esri/core/workers/chunks/a0750175b499a89fd07d.js +0 -1
- package/assets/esri/core/workers/chunks/c93d6bbe1af74d7bd7f9.js +0 -1
- package/assets/esri/core/workers/chunks/cc0a0782b8b9f6ec511e.js +0 -1
- package/assets/esri/core/workers/chunks/ef885b22ac8ec2695ad7.js +0 -1
- package/assets/esri/core/workers/chunks/f10379f663177a0150e9.js +0 -1
- package/assets/esri/core/workers/chunks/f351cccf879ba295acbc.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1065],{91231:(t,e,n)=>{n.d(e,{Ue:()=>me});var r=n(20102),s=n(43697),o=n(70586),i=n(5600),a=(n(67676),n(80442),n(75215),n(52011)),l=(n(92604),n(96674));let c=class extends l.wq{constructor(){super(...arguments),this.raster=void 0}};(0,s._)([(0,i.Cb)({json:{write:!0}})],c.prototype,"raster",void 0),c=(0,s._)([(0,a.j)("esri.layers.support.rasterFunctions.AspectFunctionArguments")],c);const u=c;var f;let p=f=class extends u{clone(){return new f({raster:this.raster})}};p=f=(0,s._)([(0,a.j)("esri.layers.support.rasterFunctions.AspectFunctionArguments")],p);const h=p;var m=n(90578);let y=class extends l.wq{constructor(){super(...arguments),this.functionArguments=null,this.readingBufferSize=0}bind(t,e=!1){const n=this._getRasterValues();for(let r=0;r<n.length;r++){const s=n[r];if(s&&"object"==typeof s&&"bind"in s&&(!s.rasterInfo||e)){const n=s.bind(t,e);if(!n.success)return n}}return!this.rasterInfo||e?(this.sourceRasterInfos=this._getSourceRasterInfos(t),this._bindSourceRasters()):{success:!0}}process(t){const e=this._getRasterValues().map((e=>this._readRasterValue(e,t)));return this._processPixels({...t,pixelBlocks:e})}getPrimaryRasters(){const t=[],e=[];return this._getPrimaryRasters(this,t,e),{rasters:t,rasterIds:e}}_getOutputPixelType(t){return"unknown"===this.outputPixelType?t:this.outputPixelType??t}_getRasterValues(){const{rasterArgumentNames:t}=this;return"rasters"===t[0]&&Array.isArray(this.functionArguments.rasters)?this.functionArguments.rasters:t.map((t=>this.functionArguments[t]))}_getSourceRasterInfos(t){const e=this._getRasterValues(),{rasterInfos:n,rasterIds:r}=t;return e.map((t=>t&&"object"==typeof t&&"bind"in t&&t.rasterInfo?t.rasterInfo:"string"==typeof t&&r.includes(t)?n[r.indexOf(t)]:n[0]))}_getPrimaryRasterId(t){return t?.url}_getPrimaryRasters(t,e=[],n=[]){for(let r=0;r<t.sourceRasters.length;r++){const s=t.sourceRasters[r];if("number"!=typeof s)if("bind"in s)this._getPrimaryRasters(s,e,n);else{const t=s,r=this._getPrimaryRasterId(t);n.includes(r)||(this.mainPrimaryRasterId===r?(e.unshift(t),n.unshift(r)):(e.push(t),n.push(r)))}}}_readRasterValue(t,e){const{primaryPixelBlocks:n}=e;if((0,o.Wi)(t)||"$$"===t){const t=n[0];return(0,o.Wi)(t)?null:t.clone()}if("string"==typeof t){const r=e.primaryRasterIds.indexOf(t);return-1===r?null:n[r]}if("number"==typeof t){const e=n[0];if((0,o.Wi)(e))return null;const r=new Float32Array(e.width*e.height);r.fill(t);const s=e.clone();return s.pixels=s.pixels.map((()=>r)),s}return t.process(e)}};(0,s._)([(0,i.Cb)({json:{write:!0}})],y.prototype,"functionName",void 0),(0,s._)([(0,i.Cb)({json:{write:!0}})],y.prototype,"functionArguments",void 0),(0,s._)([(0,i.Cb)()],y.prototype,"rasterArgumentNames",void 0),(0,s._)([(0,i.Cb)({json:{write:!0}}),(0,m.p)((t=>t?.toLowerCase()))],y.prototype,"outputPixelType",void 0),(0,s._)([(0,i.Cb)({json:{write:!0}})],y.prototype,"mainPrimaryRasterId",void 0),(0,s._)([(0,i.Cb)()],y.prototype,"sourceRasters",void 0),(0,s._)([(0,i.Cb)({json:{write:!0}})],y.prototype,"sourceRasterInfos",void 0),(0,s._)([(0,i.Cb)({json:{write:!0}})],y.prototype,"rasterInfo",void 0),(0,s._)([(0,i.Cb)({json:{write:!0}})],y.prototype,"readingBufferSize",void 0),y=(0,s._)([(0,a.j)("esri.layers.support.rasterFunctions.BaseRasterFunction")],y);const d=y;var g=n(63342);let x=class extends d{constructor(){super(...arguments),this.functionName="Aspect",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.isGCS=t.spatialReference.isGeographic,this.outputPixelType=this._getOutputPixelType("f32");const e=t.clone();return e.pixelType=this.outputPixelType,e.statistics=null,e.histograms=null,this.rasterInfo=e,{success:!0}}_processPixels(t){const e=t.pixelBlocks[0];if((0,o.Wi)(e))return null;const{extent:n}=t,r=n?{x:n.width/e.width,y:n.height/e.height}:{x:1,y:1};return(0,g.M_)(e,{resolution:r})}};(0,s._)([(0,i.Cb)({json:{write:!0,name:"rasterFunction"}})],x.prototype,"functionName",void 0),(0,s._)([(0,i.Cb)({type:h,json:{write:!0,name:"rasterFunctionArguments"}})],x.prototype,"functionArguments",void 0),(0,s._)([(0,i.Cb)()],x.prototype,"rasterArgumentNames",void 0),(0,s._)([(0,i.Cb)({json:{write:!0}})],x.prototype,"isGCS",void 0),x=(0,s._)([(0,a.j)("esri.layers.support.rasterFunctions.AspectFunction")],x);const w=x;var b=n(22974),C=n(36030),v=n(35454),_=n(5847);const A=new Set(["+","-","*","/","(",")"]);function M(t,e,n,r){if("number"==typeof n&&"number"==typeof r)return n+r;let s;if("number"==typeof n){s=r.length;const t=n;(n=new Float32Array(s)).fill(t)}else if(s=n.length,r.constructor===Number){const t=r;(r=new Float32Array(s)).fill(t)}const o=new Float32Array(s);switch(e){case"+":for(let e=0;e<s;e++)(null==t||t[e])&&(o[e]=n[e]+r[e]);break;case"-":for(let e=0;e<s;e++)(null==t||t[e])&&(o[e]=n[e]-r[e]);break;case"*":for(let e=0;e<s;e++)(null==t||t[e])&&(o[e]=n[e]*r[e]);break;case"/":for(let e=0;e<s;e++)(null==t||t[e])&&r[e]&&(o[e]=n[e]/r[e]);break;case"(":case")":throw"encountered error with custom band index equation"}return o}function S(t,e){t.splice(e,1);let n=0,r=0;do{n=0,r=0;for(let e=0;e<t.length;e++)if("("===t[e])n=e;else if(")"===t[e]){r=e;break}r===n+1&&t.splice(n,2)}while(r===n+1);return t}function R(t){if(1===t.length)return{opIndex:0,numIndex:0};let e=0,n=0;for(let r=0;r<t.length;r++)if("("===t[r])e=r;else if(")"===t[r]){n=r;break}const r=0===n?t:t.slice(e+1,n);let s=-1;for(let t=0;t<r.length;t++)if("*"===r[t]||"/"===r[t]){s=t;break}if(s>-1)n>0&&(s+=e+1);else{for(let t=0;t<r.length;t++)if("+"===r[t]||"-"===r[t]){s=t;break}n>0&&(s+=e+1)}let o=0;for(let e=0;e<s;e++)"("===t[e]&&o++;return{opIndex:s,numIndex:s-o}}var N=n(55914);const P=new v.X({0:"custom",1:"ndvi",2:"savi",3:"tsavi",4:"msavi",5:"gemi",6:"pvi",7:"gvitm",8:"sultan",9:"vari",10:"gndvi",11:"sr",12:"ndvi-re",13:"sr-re",14:"mtvi2",15:"rtvi-core",16:"ci-re",17:"ci-g",18:"ndwi",19:"evi",20:"iron-oxide",21:"ferrous-minerals",22:"clay-minerals",23:"wndwi",24:"bai",25:"nbr",26:"ndbi",27:"ndmi",28:"ndsi",29:"mndwi"},{useNumericKeys:!0});function T(t,e){if(!(0,N.nk)(t))return t;const{equation:n,method:r}=e,s=e.bandIndexes.map((t=>t-1)),{pixels:i,mask:a}=t;let l;switch(r){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":l=F(a,i[s[0]],i[s[1]]);break;case"ndwi":l=F(a,i[s[1]],i[s[0]]);break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":l=function(t,e,n){const r=n.length,s=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o]){const t=e[o],r=n[o];r&&(s[o]=t/r)}return[s]}(a,i[s[0]],i[s[1]]);break;case"ci-g":case"ci-re":l=function(t,e,n){const r=e.length,s=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o]){const t=e[o],r=n[o];r&&(s[o]=t/r-1)}return[s]}(a,i[s[0]],i[s[1]]);break;case"savi":l=function(t,e,n,r){const s=n.length,o=new Float32Array(s);for(let i=0;i<s;i++)if(null==t||t[i]){const t=n[i],s=e[i],a=s+t+r;a&&(o[i]=(s-t)/a*(1+r))}return[o]}(a,i[s[0]],i[s[1]],s[2]+1);break;case"tsavi":l=function(t,e,n,r,s,o){const i=n.length,a=new Float32Array(i),l=-s*r+o*(1+r*r);for(let o=0;o<i;o++)if(null==t||t[o]){const t=n[o],i=e[o],c=s*i+t+l;c&&(a[o]=r*(i-r*t-s)/c)}return[a]}(a,i[s[0]],i[s[1]],s[2]+1,s[3]+1,s[4]+1);break;case"msavi":l=function(t,e,n){const r=n.length,s=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o]){const t=n[o],r=e[o];s[o]=.5*(2*(r+1)-Math.sqrt((2*r+1)**2-8*(r-t)))}return[s]}(a,i[s[0]],i[s[1]]);break;case"gemi":l=function(t,e,n){const r=n.length,s=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o]){const t=n[o],r=e[o];if(1!==t){const e=(2*(r*r-t*t)+1.5*r+.5*t)/(r+t+.5);s[o]=e*(1-.25*e)-(t-.125)/(1-t)}}return[s]}(a,i[s[0]],i[s[1]]);break;case"pvi":l=function(t,e,n,r,s){const o=n.length,i=new Float32Array(o),a=Math.sqrt(1+r*r);for(let l=0;l<o;l++)if(null==t||t[l]){const t=n[l],o=e[l];i[l]=(o-r*t-s)/a}return[i]}(a,i[s[0]],i[s[1]],s[2]+1,s[3]+1);break;case"gvitm":l=function(t,e){const[n,r,s,o,i,a]=e,l=n.length,c=new Float32Array(l);for(let e=0;e<l;e++)(null==t||t[e])&&(c[e]=-.2848*n[e]-.2435*r[e]-.5436*s[e]+.7243*o[e]+.084*i[e]-1.18*a[e]);return[c]}(a,[i[s[0]],i[s[1]],i[s[2]],i[s[3]],i[s[4]],i[s[5]]]);break;case"sultan":l=function(t,e){const[n,,r,s,o,i]=e,a=n.length,l=new Float32Array(a),c=new Float32Array(a),u=new Float32Array(a);for(let e=0;e<a;e++)(null==t||t[e])&&(l[e]=i[e]?o[e]/i[e]*100:0,c[e]=n[e]?o[e]/n[e]*100:0,u[e]=s[e]?r[e]/s[e]*(o[e]/s[e])*100:0);return[l,c,u]}(a,[i[s[0]],i[s[1]],i[s[2]],i[s[3]],i[s[4]],i[s[5]]]);break;case"vari":l=function(t,e){const[n,r,s]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=r[e],a=o+t-s[e];a&&(i[e]=(o-t)/a)}return[i]}(a,[i[s[0]],i[s[1]],i[s[2]]]);break;case"mtvi2":l=function(t,e){const[n,r,s]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=r[e],a=s[e],l=Math.sqrt((2*t+1)**2-6*t-5*Math.sqrt(o)-.5);i[e]=1.5*(1.2*(t-a)-2.5*(o-a))*l}return[i]}(a,[i[s[0]],i[s[1]],i[s[2]]]);break;case"rtvi-core":l=function(t,e){const[n,r,s]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=r[e],a=s[e];i[e]=100*(t-o)-10*(t-a)}return[i]}(a,[i[s[0]],i[s[1]],i[s[2]]]);break;case"evi":l=function(t,e){const[n,r,s]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=r[e],a=t+6*o-7.5*s[e]+1;a&&(i[e]=2.5*(t-o)/a)}return[i]}(a,[i[s[0]],i[s[1]],i[s[2]]]);break;case"wndwi":l=function(t,e,n=.5){const[r,s,o]=e,i=s.length,a=new Float32Array(i);for(let e=0;e<i;e++)if(null==t||t[e])for(e=0;e<i;e++){const t=r[e],i=s[e],l=o[e],c=t+n*i+(1-n)*l;c&&(a[e]=(t-n*i-(1-n)*l)/c)}return[a]}(a,[i[s[0]],i[s[1]],i[s[2]]],s[3]??.5);break;case"bai":l=function(t,e,n){const r=n.length,s=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o])for(o=0;o<r;o++){const t=(.1-e[o])**2+(.06-n[o])**2;t&&(s[o]=1/t)}return[s]}(a,i[s[0]],i[s[1]]);break;case"custom":l=function(t,e,n){let r,{ops:s,nums:o}=function(t,e){(t=t.replace(/ /g,"")).startsWith("-")&&(t="0"+t),t.startsWith("+")&&(t=t.slice(1,t.length));const n=t.split(""),r=[],s=[];let o="";for(let t=0;t<n.length;t++){const i=n[t];if(A.has(i))""!==o&&s.push(parseFloat(o)),r.push(i),o="";else{if("b"===i.toLowerCase()){t++,o=i.concat(n[t]),s.push(e[parseInt(o[1],10)-1]),o="";continue}o=o.concat(i),t===n.length-1&&s.push(parseFloat(o))}}return{ops:r,nums:s}}(n,e);if(0===s.length){const t=1===o.length?o[0]:e[0];if(t instanceof Float32Array)return[t];const n=new Float32Array(e[0].length);return"number"==typeof t?n.fill(t):n.set(t),[n]}for(;s.length>0;){const{numIndex:e,opIndex:n}=R(s);if(r=M(t,s[n],o[e],o[e+1]),1===s.length)break;s=S(s,n),o.splice(e,2,r)}return[r]}(a,i,n);break;default:return t}const c=(0,o.pC)(a)?new Uint8Array(a.length):null;(0,o.pC)(a)&&c.set(a);const u=new _.Z({width:t.width,height:t.height,pixelType:"f32",pixels:l,mask:c});return u.updateStatistics(),u}function F(t,e,n){const r=n.length,s=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o]){const t=e[o],r=n[o],i=t+r;i&&(s[o]=(t-r)/i)}return[s]}var k;let j=k=class extends u{constructor(){super(...arguments),this.method="custom"}clone(){return new k({method:this.method,bandIndexes:this.bandIndexes,raster:(0,b.d9)(this.raster)})}};(0,s._)([(0,i.Cb)({json:{type:String,write:!0}})],j.prototype,"bandIndexes",void 0),(0,s._)([(0,C.J)(P)],j.prototype,"method",void 0),j=k=(0,s._)([(0,a.j)("esri.layers.support.rasterFunctions.BandArithmeticFunctionArguments")],j);const B=j;let E=class extends d{constructor(){super(...arguments),this.functionName="BandArithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0],e=t.clone();return e.pixelType=this.outputPixelType,e.statistics=null,e.histograms=null,e.bandCount="sultan"===this.functionArguments.method?t.bandCount:1,this.rasterInfo=e,{success:!0}}_processPixels(t){const e=t.pixelBlocks[0];if((0,o.Wi)(e))return e;const{method:n,bandIndexes:r}=this.functionArguments,s=r.split(" ").map((t=>parseFloat(t)));return T(e,{method:n,bandIndexes:s,equation:r})}};(0,s._)([(0,i.Cb)({json:{write:!0,name:"rasterFunction"}})],E.prototype,"functionName",void 0),(0,s._)([(0,i.Cb)({type:B,json:{write:!0,name:"rasterFunctionArguments"}})],E.prototype,"functionArguments",void 0),(0,s._)([(0,i.Cb)()],E.prototype,"rasterArgumentNames",void 0),E=(0,s._)([(0,a.j)("esri.layers.support.rasterFunctions.BandArithmeticFunction")],E);const I=E;var Z,G=n(71715),O=n(94593);let z=Z=class extends u{readColorRamp(t){return(0,O.i)(t)}clone(){return new Z({colormap:(0,b.d9)(this.colormap),colormapName:this.colormapName,colorRamp:this.colorRamp?.clone(),colorRampName:this.colorRampName})}};(0,s._)([(0,i.Cb)({type:[[Number]],json:{write:!0}})],z.prototype,"colormap",void 0),(0,s._)([(0,i.Cb)({type:String,json:{write:!0}})],z.prototype,"colormapName",void 0),(0,s._)([(0,i.Cb)({types:O.V,json:{write:!0}})],z.prototype,"colorRamp",void 0),(0,s._)([(0,G.r)("colorRamp")],z.prototype,"readColorRamp",null),(0,s._)([(0,i.Cb)({type:String,json:{write:!0}})],z.prototype,"colorRampName",void 0),z=Z=(0,s._)([(0,a.j)("esri.layers.support.rasterFunctions.StretchFunctionArguments")],z);const W=z;var L=n(93010);let D=class extends d{constructor(){super(...arguments),this.functionName="Colormap",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,error:"colormap-function: source data must be single band"};let{colormap:e,colorRamp:n}=this.functionArguments;if(e?.length||n&&(e=(0,L.XL)(n,256,!0)),!e?.length)return{success:!1,error:"colormap-function: missing colormap argument"};this.outputPixelType=this._getOutputPixelType("u8");const r=t.clone();return r.pixelType=this.outputPixelType,r.colormap=e,this.rasterInfo=r,{success:!0}}_processPixels(t){return t.pixelBlocks[0]}};(0,s._)([(0,i.Cb)({json:{write:!0,name:"rasterFunction"}})],D.prototype,"functionName",void 0),(0,s._)([(0,i.Cb)({type:W,json:{write:!0,name:"rasterFunctionArguments"}})],D.prototype,"functionArguments",void 0),(0,s._)([(0,i.Cb)()],D.prototype,"rasterArgumentNames",void 0),(0,s._)([(0,i.Cb)({json:{write:!0}})],D.prototype,"indexedColormap",void 0),D=(0,s._)([(0,a.j)("esri.layers.support.rasterFunctions.SlopeFunction")],D);const q=D;var X,V=n(30556);let J=X=class extends u{constructor(){super(...arguments),this.processAsMultiband=!1}writeRasters(t,e){e.rasters=t.map((t=>"number"==typeof t||"string"==typeof t?t:t.toJSON()))}clone(){return new X({method:this.operation,processAsMultiband:this.processAsMultiband,rasters:(0,b.d9)(this.rasters)})}};(0,s._)([(0,i.Cb)({json:{write:!0}})],J.prototype,"operation",void 0),(0,s._)([(0,i.Cb)({json:{write:!0}})],J.prototype,"rasters",void 0),(0,s._)([(0,V.c)("rasters")],J.prototype,"writeRasters",null),(0,s._)([(0,i.Cb)({json:{write:!0}})],J.prototype,"processAsMultiband",void 0),J=X=(0,s._)([(0,a.j)("esri.layers.support.rasterFunctions.LocalFunctionArguments")],J);const Y=J;var H;function U(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r[t]+s[t]);return i}function K(t,e,n){const[r]=t,s=r.length,o=_.Z.createEmptyBand("f32",s);return o.set(r),o}function $(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r[t]-s[t]);return i}function Q(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r[t]*s[t]);return i}function tt(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=0===s[t]?0:r[t]/s[t]);return i}function et(t,e,n){return tt(t,e,"f32")}function nt(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=0===s[t]?0:Math.floor(r[t]/s[t]));return i}function rt(t,e,n,r){const[s]=t,o=s.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r(s[t]));return i}function st(t,e,n,r){const[s,o]=t,i=s.length,a=_.Z.createEmptyBand(n,i);for(let t=0;t<i;t++)e&&!e[t]||(a[t]=r(s[t],o[t]));return a}function ot(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r[t]&s[t]);return i}function it(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r[t]<<s[t]);return i}function at(t,e,n){const[r]=t,s=r.length,o=_.Z.createEmptyBand(n,s);for(let t=0;t<s;t++)e&&!e[t]||(o[t]=~r[t]);return o}function lt(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r[t]|s[t]);return i}function ct(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r[t]>>s[t]);return i}function ut(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r[t]^s[t]);return i}function ft(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r[t]&&s[t]?1:0);return i}function pt(t,e,n){const[r]=t,s=r.length,o=_.Z.createEmptyBand(n,s);for(let t=0;t<s;t++)e&&!e[t]||(o[t]=r[t]?0:1);return o}function ht(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r[t]||s[t]?1:0);return i}function mt(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=(r[t]?1:0)^(s[t]?1:0));return i}function yt(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r[t]===s[t]?1:0);return i}function dt(t,e,n,r){const[s]=t,o=s.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r**s[t]);return i}function gt(t,e,n){return dt(t,e,n,10)}function xt(t,e,n){return dt(t,e,n,2)}function wt(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r[t]>s[t]?1:0);return i}function bt(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r[t]>=s[t]?1:0);return i}function Ct(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r[t]<s[t]?1:0);return i}function vt(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r[t]<=s[t]?1:0);return i}function _t(t,e,n){const[r]=t,s=r.length,o=_.Z.createEmptyBand(n,s);if(!e)return o;for(let t=0;t<s;t++)o[t]=e[t]?0:1;return o}function At(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r[t]%s[t]);return i}function Mt(t,e,n){const[r]=t,s=r.length,o=_.Z.createEmptyBand(n,s);for(let t=0;t<s;t++)e&&!e[t]||(o[t]=-r[t]);return o}function St(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=r[t]===s[t]?0:1);return i}function Rt(t,e,n){const[r,s]=t,o=r.length,i=_.Z.createEmptyBand(n,o),a=new Uint8Array(o);for(let t=0;t<o;t++)null!=e&&!e[t]||0!==r[t]||(i[t]=s[t],a[t]=255);return{band:i,mask:a}}function Nt(t,e,n){const[r,s,o]=t,i=r.length,a=_.Z.createEmptyBand(n,i);for(let t=0;t<i;t++)e&&!e[t]||(a[t]=r[t]?s[t]:o[t]);return a}function Pt(t,e,n){const r=t.length;if(r<2)return t[0];const[s]=t,o=s.length,i=_.Z.createEmptyBand(n,o);i.set(s);for(let n=0;n<o;n++)if(!e||e[n])for(let e=1;e<r;e++){const r=t[e];i[n]<r[n]&&(i[n]=r[n])}return i}function Tt(t,e,n){const r=t.length;if(r<2)return t[0];const[s]=t,o=s.length,i=_.Z.createEmptyBand(n,o);i.set(s);for(let n=0;n<o;n++)if(!e||e[n])for(let e=1;e<r;e++){const r=t[e];i[n]>r[n]&&(i[n]=r[n])}return i}function Ft(t,e,n){const r=t.length;if(r<2)return t[0];const[s]=t,o=s.length,i=_.Z.createEmptyBand(n,o);i.set(s);for(let n=0;n<o;n++)if(!e||e[n]){let e=i[n];for(let s=1;s<r;s++){const r=t[s];i[n]<r[n]&&(i[n]=r[n]),e>r[n]&&(e=r[n])}i[n]-=e}return i}function kt(t,e,n){const r=t.length;if(r<2)return t[0];const[s]=t,o=s.length,i=_.Z.createEmptyBand(n,o);i.set(s);for(let n=0;n<o;n++)if(!e||e[n]){for(let e=1;e<r;e++){const r=t[e];i[n]+=r[n]}i[n]/=r}return i}function jt(t,e,n){const r=t.length;if(r<2)return t[0];const[s]=t,o=s.length,i=_.Z.createEmptyBand(n,o);i.set(s);for(let n=0;n<o;n++)if(!e||e[n])for(let e=1;e<r;e++){const r=t[e];i[n]+=r[n]}return i}function Bt(t,e,n){const r=t.length;if(r<2)return t[0];const[s]=t,o=s.length,i=_.Z.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){const e=new Float32Array(r);let s=0;for(let o=0;o<r;o++){const r=t[o];s+=r[n],e[o]=r[n]}s/=r;let o=0;for(let t=0;t<r;t++)o+=(e[t]-s)*e[t]-s;i[n]=Math.sqrt(o/r-1)}return i}function Et(t,e,n){const r=t.length;if(r<2)return t[0];const s=Math.floor(r/2),[o]=t,i=o.length,a=_.Z.createEmptyBand(n,i),l=new Float32Array(r);for(let n=0;n<i;n++)if(!e||e[n]){for(let e=0;e<r;e++)l[e]=t[e][n];l.sort(),a[n]=l[s]}return a}function It(t,e,n){const r=t.length;if(r<2)return t[0];const[s]=t,o=s.length,i=_.Z.createEmptyBand(n,o),a=new Map;for(let n=0;n<o;n++)if(!e||e[n]){let e;a.clear();for(let s=0;s<r;s++)e=t[s][n],a.set(e,a.has(e)?a.get(e)+1:1);let s=0,o=0;for(const t of a.keys())s=a.get(t),s>o&&(o=s,e=t);i[n]=e}return i}function Zt(t,e,n){const r=t.length;if(r<2)return t[0];const[s]=t,o=s.length,i=_.Z.createEmptyBand(n,o),a=new Map;for(let n=0;n<o;n++)if(!e||e[n]){let e;a.clear();for(let s=0;s<r;s++)e=t[s][n],a.set(e,a.has(e)?a.get(e)+1:1);let s=0,o=t.length;for(const t of a.keys())s=a.get(t),s<o&&(o=s,e=t);i[n]=e}return i}function Gt(t,e,n){const r=t.length;if(r<2)return t[0];const[s]=t,o=s.length,i=_.Z.createEmptyBand(n,o),a=new Set;for(let n=0;n<o;n++)if(!e||e[n]){let e;a.clear();for(let s=0;s<r;s++)e=t[s][n],a.add(e);i[n]=a.size}return i}function Ot(t,e,n){return It(t,null,n)}function zt(t,e,n){return Zt(t,null,n)}function Wt(t,e,n){return Gt(t,null,n)}function Lt(t,e,n){return Pt(t,null,n)}function Dt(t,e,n){return Tt(t,null,n)}function qt(t,e,n){return Bt(t,null,n)}function Xt(t,e,n){return jt(t,null,n)}function Vt(t,e,n){return kt(t,null,n)}function Jt(t,e,n){return Et(t,null,n)}function Yt(t,e,n){return Ft(t,null,n)}!function(t){t[t.Plus=1]="Plus",t[t.Minus=2]="Minus",t[t.Times=3]="Times",t[t.SquareRoot=4]="SquareRoot",t[t.Power=5]="Power",t[t.ACos=6]="ACos",t[t.ASin=7]="ASin",t[t.ATan=8]="ATan",t[t.ATanH=9]="ATanH",t[t.Abs=10]="Abs",t[t.BitwiseAnd=11]="BitwiseAnd",t[t.BitwiseLeftShift=12]="BitwiseLeftShift",t[t.BitwiseNot=13]="BitwiseNot",t[t.BitwiseOr=14]="BitwiseOr",t[t.BitwiseRightShift=15]="BitwiseRightShift",t[t.BitwiseXOr=16]="BitwiseXOr",t[t.BooleanAnd=17]="BooleanAnd",t[t.BooleanNot=18]="BooleanNot",t[t.BooleanOr=19]="BooleanOr",t[t.BooleanXOr=20]="BooleanXOr",t[t.Cos=21]="Cos",t[t.CosH=22]="CosH",t[t.Divide=23]="Divide",t[t.EqualTo=24]="EqualTo",t[t.Exp=25]="Exp",t[t.Exp10=26]="Exp10",t[t.Exp2=27]="Exp2",t[t.GreaterThan=28]="GreaterThan",t[t.GreaterThanEqual=29]="GreaterThanEqual",t[t.Int=30]="Int",t[t.IsNull=31]="IsNull",t[t.Float=32]="Float",t[t.LessThan=33]="LessThan",t[t.LessThanEqual=34]="LessThanEqual",t[t.Ln=35]="Ln",t[t.Log10=36]="Log10",t[t.Log2=37]="Log2",t[t.Majority=38]="Majority",t[t.Max=39]="Max",t[t.Mean=40]="Mean",t[t.Med=41]="Med",t[t.Min=42]="Min",t[t.Minority=43]="Minority",t[t.Mod=44]="Mod",t[t.Negate=45]="Negate",t[t.NotEqual=46]="NotEqual",t[t.Range=47]="Range",t[t.RoundDown=48]="RoundDown",t[t.RoundUp=49]="RoundUp",t[t.SetNull=50]="SetNull",t[t.Sin=51]="Sin",t[t.SinH=52]="SinH",t[t.Square=53]="Square",t[t.Std=54]="Std",t[t.Sum=55]="Sum",t[t.Tan=56]="Tan",t[t.TanH=57]="TanH",t[t.Variety=58]="Variety",t[t.ACosH=59]="ACosH",t[t.ASinH=60]="ASinH",t[t.ATan2=61]="ATan2",t[t.FloatDivide=64]="FloatDivide",t[t.FloorDivide=65]="FloorDivide",t[t.MajorityIgnoreNoData=66]="MajorityIgnoreNoData",t[t.MaxIgnoreNoData=67]="MaxIgnoreNoData",t[t.MeanIgnoreNoData=68]="MeanIgnoreNoData",t[t.MedIgnoreNoData=69]="MedIgnoreNoData",t[t.MinIgnoreNoData=70]="MinIgnoreNoData",t[t.MinorityIgnoreNoData=71]="MinorityIgnoreNoData",t[t.RangeIgnoreNoData=72]="RangeIgnoreNoData",t[t.StdIgnoreNoData=73]="StdIgnoreNoData",t[t.SumIgnoreNoData=74]="SumIgnoreNoData",t[t.VarietyIgnoreNoData=75]="VarietyIgnoreNoData",t[t.Con=76]="Con"}(H||(H={}));const Ht=new Map,Ut=new Map,Kt=new Map;let $t=class extends d{constructor(){super(...arguments),this.functionName="Local",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0],{bandCount:n}=e,{processAsMultiband:r}=this.functionArguments;if(r&&t.some((t=>t.bandCount!==n)))return{success:!1,error:"local-function: input rasters do not have same band count"};this.outputPixelType=this._getOutputPixelType("f32");const s=e.clone();return s.pixelType=this.outputPixelType,s.statistics=null,s.histograms=null,r||(s.bandCount=1),this.rasterInfo=s,{success:!0}}_processPixels(t){const{pixelBlocks:e}=t;return e.some((t=>(0,o.Wi)(t)))?null:function(t,e,n={}){Ht.size||(Ht.set(4,Math.sqrt),Ht.set(6,Math.acos),Ht.set(7,Math.asin),Ht.set(8,Math.atan),Ht.set(9,Math.atanh),Ht.set(10,Math.abs),Ht.set(21,Math.cos),Ht.set(22,Math.cosh),Ht.set(25,Math.exp),Ht.set(30,Math.floor),Ht.set(35,Math.log),Ht.set(36,Math.log10),Ht.set(37,Math.log2),Ht.set(48,Math.floor),Ht.set(49,Math.ceil),Ht.set(51,Math.sin),Ht.set(52,Math.sinh),Ht.set(56,Math.tan),Ht.set(57,Math.tanh),Ht.set(59,Math.acosh),Ht.set(60,Math.asinh),Ht.set(65,Math.floor),Ut.set(5,Math.pow),Ut.set(61,Math.atan2),Kt.set(1,U),Kt.set(2,$),Kt.set(3,Q),Kt.set(11,ot),Kt.set(12,it),Kt.set(12,it),Kt.set(13,at),Kt.set(14,lt),Kt.set(15,ct),Kt.set(16,ut),Kt.set(17,ft),Kt.set(18,pt),Kt.set(19,ht),Kt.set(20,mt),Kt.set(23,tt),Kt.set(24,yt),Kt.set(26,gt),Kt.set(27,xt),Kt.set(28,wt),Kt.set(29,bt),Kt.set(31,_t),Kt.set(32,K),Kt.set(33,Ct),Kt.set(34,vt),Kt.set(44,At),Kt.set(45,Mt),Kt.set(46,St),Kt.set(64,et),Kt.set(65,nt),Kt.set(76,Nt),Kt.set(38,It),Kt.set(39,Pt),Kt.set(40,kt),Kt.set(41,Et),Kt.set(42,Tt),Kt.set(43,Zt),Kt.set(47,Ft),Kt.set(54,Bt),Kt.set(55,jt),Kt.set(58,Gt),Kt.set(66,Ot),Kt.set(67,Lt),Kt.set(68,Vt),Kt.set(69,Jt),Kt.set(70,Dt),Kt.set(71,zt),Kt.set(72,Yt),Kt.set(73,qt),Kt.set(74,Xt),Kt.set(75,Wt));const r=(0,o.Wg)(function(t){const e=t.map((t=>t.mask)).filter((t=>(0,o.pC)(t)));if(0===e.length)return null;const n=e[0].length,r=new Uint8Array(n);if(1===e.length)return r.set(e[0]),r;let s,i=e[0];for(let t=1;t<e.length;t++){s=e[t];for(let t=0;t<n;t++)r[t]=i[t]|s[t];i=s}return r}(t)),{processAsMultiband:s,outputPixelType:i="f32"}=n,a=s?t[0].pixels.length:1,l=[];let c;for(let n=0;n<a;n++){const s=t.map((t=>t.pixels[n]));let o;if(e===H.SetNull){const t=Rt(s,r,i);o=t.band,c=t.mask}else Kt.has(e)?o=Kt.get(e)(s,r,i):Ht.has(e)?o=rt(s,r,i,Ht.get(e)):Ut.has(e)&&(o=st(s,r,i,Ut.get(e)));if(null==o)return null;l.push(o)}c||e===H.IsNull||(c=r);const u=t[0];return new _.Z({width:u.width,height:u.height,pixelType:i,mask:c,pixels:l})}(e,this.functionArguments.operation,{processAsMultiband:this.functionArguments.processAsMultiband,outputPixelType:this.outputPixelType})}};(0,s._)([(0,i.Cb)({json:{write:!0,name:"rasterFunction"}})],$t.prototype,"functionName",void 0),(0,s._)([(0,i.Cb)({type:Y,json:{write:!0,name:"rasterFunctionArguments"}})],$t.prototype,"functionArguments",void 0),(0,s._)([(0,i.Cb)()],$t.prototype,"rasterArgumentNames",void 0),$t=(0,s._)([(0,a.j)("esri.layers.support.rasterFunctions.LocalFunction")],$t);const Qt=$t;var te;const ee=new v.X({0:"degree",1:"percent-rise",2:"adjusted"},{useNumericKeys:!0});let ne=te=class extends u{constructor(){super(...arguments),this.slopeType="degree",this.zFactor=1,this.pixelSizePower=.664,this.pixelSizeFactor=.024}clone(){return new te({slopeType:this.slopeType,zFactor:this.zFactor,pixelSizePower:this.pixelSizePower,pixelSizeFactor:this.pixelSizeFactor,raster:this.raster})}};(0,s._)([(0,C.J)(ee)],ne.prototype,"slopeType",void 0),(0,s._)([(0,i.Cb)({type:Number,json:{write:!0}})],ne.prototype,"zFactor",void 0),(0,s._)([(0,i.Cb)({type:Number,json:{name:"psPower",write:!0}})],ne.prototype,"pixelSizePower",void 0),(0,s._)([(0,i.Cb)({type:Number,json:{name:"psFactor",write:!0}})],ne.prototype,"pixelSizeFactor",void 0),ne=te=(0,s._)([(0,a.j)("esri.layers.support.rasterFunctions.SlopeFunctionArguments")],ne);const re=ne;let se=class extends d{constructor(){super(...arguments),this.functionName="Slope",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,t.statistics=null,t.histograms=null,this.rasterInfo=t,this.isGCS=t.spatialReference.isGeographic,{success:!0}}_processPixels(t){const e=t.pixelBlocks[0];if((0,o.Wi)(e))return null;const{zFactor:n,slopeType:r,pixelSizePower:s,pixelSizeFactor:i}=this.functionArguments,{isGCS:a}=this,{extent:l}=t,c=l?{x:l.width/e.width,y:l.height/e.height}:{x:1,y:1};return(0,g.yg)(e,{zFactor:n,slopeType:r,pixelSizePower:s,pixelSizeFactor:i,isGCS:a,resolution:c})}};(0,s._)([(0,i.Cb)({json:{write:!0,name:"rasterFunction"}})],se.prototype,"functionName",void 0),(0,s._)([(0,i.Cb)({type:re,json:{write:!0,name:"rasterFunctionArguments"}})],se.prototype,"functionArguments",void 0),(0,s._)([(0,i.Cb)()],se.prototype,"rasterArgumentNames",void 0),(0,s._)([(0,i.Cb)({json:{write:!0}})],se.prototype,"isGCS",void 0),se=(0,s._)([(0,a.j)("esri.layers.support.rasterFunctions.SlopeFunction")],se);const oe=se;var ie;const ae=new v.X({0:"none",3:"standard-deviation",4:"histogram-equalization",5:"min-max",6:"percent-clip",7:"sigmoid"},{useNumericKeys:!0});let le=ie=class extends u{constructor(){super(...arguments),this.computeGamma=!1,this.dynamicRangeAdjustment=!1,this.gamma=[],this.histograms=null,this.statistics=null,this.stretchType="none",this.useGamma=!1}writeStatistics(t,e,n){t?.length&&(Array.isArray(t[0])||(t=t.map((t=>[t.min,t.max,t.avg,t.stddev]))),e[n]=t)}clone(){return new ie({stretchType:this.stretchType,outputMin:this.outputMin,outputMax:this.outputMax,useGamma:this.useGamma,computeGamma:this.computeGamma,statistics:(0,b.d9)(this.statistics),gamma:(0,b.d9)(this.gamma),sigmoidStrengthLevel:this.sigmoidStrengthLevel,numberOfStandardDeviations:this.numberOfStandardDeviations,minPercent:this.minPercent,maxPercent:this.maxPercent,histograms:(0,b.d9)(this.histograms),dynamicRangeAdjustment:this.dynamicRangeAdjustment,raster:this.raster})}};(0,s._)([(0,i.Cb)({type:Boolean,json:{write:!0}})],le.prototype,"computeGamma",void 0),(0,s._)([(0,i.Cb)({type:Boolean,json:{name:"dra",write:!0}})],le.prototype,"dynamicRangeAdjustment",void 0),(0,s._)([(0,i.Cb)({type:[Number],json:{write:!0}})],le.prototype,"gamma",void 0),(0,s._)([(0,i.Cb)()],le.prototype,"histograms",void 0),(0,s._)([(0,i.Cb)({type:Number,json:{write:!0}})],le.prototype,"maxPercent",void 0),(0,s._)([(0,i.Cb)({type:Number,json:{write:!0}})],le.prototype,"minPercent",void 0),(0,s._)([(0,i.Cb)({type:Number,json:{write:!0}})],le.prototype,"numberOfStandardDeviations",void 0),(0,s._)([(0,i.Cb)({type:Number,json:{name:"max",write:!0}})],le.prototype,"outputMax",void 0),(0,s._)([(0,i.Cb)({type:Number,json:{name:"min",write:!0}})],le.prototype,"outputMin",void 0),(0,s._)([(0,i.Cb)({type:Number,json:{write:!0}})],le.prototype,"sigmoidStrengthLevel",void 0),(0,s._)([(0,i.Cb)({json:{type:[[Number]],write:!0}})],le.prototype,"statistics",void 0),(0,s._)([(0,V.c)("statistics")],le.prototype,"writeStatistics",null),(0,s._)([(0,C.J)(ae)],le.prototype,"stretchType",void 0),(0,s._)([(0,i.Cb)({type:Boolean,json:{write:!0}})],le.prototype,"useGamma",void 0),le=ie=(0,s._)([(0,a.j)("esri.layers.support.rasterFunctions.StretchFunctionArguments")],le);const ce=le;var ue=n(15612);let fe=class extends d{constructor(){super(...arguments),this.functionName="Stretch",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){this.lookup=null,this.cutOffs=null;const t=this.sourceRasterInfos[0],{pixelType:e}=t,{functionArguments:n}=this,{dynamicRangeAdjustment:r,gamma:s,useGamma:o}=n;if(!r&&["u8","u16","s8","s16"].includes(e)){const r=(0,ue.AV)(n.toJSON(),{rasterInfo:t});this.lookup=(0,ue.hE)({pixelType:e,...r,gamma:o?s:null})}else r&&(this.cutOffs=(0,ue.AV)(n.toJSON(),{rasterInfo:t}));this.outputPixelType=this._getOutputPixelType(e);const i=t.clone();return i.pixelType=this.outputPixelType,i.statistics=null,i.histograms=null,"u8"===this.outputPixelType&&(i.keyProperties.DataType="processed"),this.rasterInfo=i,{success:!0}}_processPixels(t){const e=t.pixelBlocks[0];if((0,o.Wi)(e))return e;const{lookup:n}=this;if(n)return(0,N.XV)(e,{...n,outputPixelType:this.rasterInfo.pixelType});const{functionArguments:r}=this,s=this.cutOffs||(0,ue.AV)(r.toJSON(),{rasterInfo:this.sourceRasterInfos[0],pixelBlock:e}),i=r.useGamma?r.gamma:null;return(0,ue.dy)(e,{...s,gamma:i,outputPixelType:this.outputPixelType})}};(0,s._)([(0,i.Cb)({json:{write:!0,name:"rasterFunction"}})],fe.prototype,"functionName",void 0),(0,s._)([(0,i.Cb)({type:ce,json:{write:!0,name:"rasterFunctionArguments"}})],fe.prototype,"functionArguments",void 0),(0,s._)([(0,i.Cb)()],fe.prototype,"rasterArgumentNames",void 0),(0,s._)([(0,i.Cb)({json:{write:!0}})],fe.prototype,"lookup",void 0),(0,s._)([(0,i.Cb)({json:{write:!0}})],fe.prototype,"cutOffs",void 0),fe=(0,s._)([(0,a.j)("esri.layers.support.rasterFunctions.StretchFunction")],fe);const pe=fe,he=new Map;function me(t,e){if("rasterFunction"in t)return ye(t,e);throw new r.Z("raster-function-helper","unsupported raster function json.")}function ye(t,e){const{rasterFunction:n,rasterFunctionArguments:s}=t,o=t.outputPixelType?.toLowerCase();if(!he.has(n))throw new r.Z("raster-function-helper",`unsupported raster function: ${n}`);const i=he.get(n),a=("function"==typeof i.ctor?i.ctor:i.ctor.default).fromJSON({...t,outputPixelType:o}),{rasterArgumentNames:l}=a,c=[],u=function(t,e){return"rasters"===e[0]&&Array.isArray(t.rasters)?t.rasters:e.map((e=>t[e]))}(s,l),f="rasters"===l[0],p=[];for(let t=0;t<u.length;t++){const n=u[t];let r;null==n||"string"==typeof n&&n.startsWith("$")?c.push(e?.raster):"string"==typeof n?e[n]&&c.push(e[n]):"number"!=typeof n&&"rasterFunction"in n&&(r=ye(n,e),f||(a.functionArguments[l[t]]=r),c.push(r)),f&&p.push(r??n)}if(f&&(a.functionArguments.rasters=p),e){a.sourceRasters=c;const t=e.raster?.url;t&&(a.mainPrimaryRasterId=t)}return a}he.set("Aspect",{desc:"Aspect Function",ctor:w,rasterArgumentNames:["raster"]}),he.set("Colormap",{desc:"Colormap Function",ctor:q,rasterArgumentNames:["raster"]}),he.set("Slope",{desc:"Slope Function",ctor:oe,rasterArgumentNames:["raster"]}),he.set("Stretch",{desc:"Stretch Function",ctor:pe,rasterArgumentNames:["raster"]}),he.set("BandArithmetic",{desc:"Band Arithmetic Function",ctor:I,rasterArgumentNames:["raster"]}),he.set("Local",{desc:"Local Function",ctor:Qt,rasterArgumentNames:["rasters"]})},73506:(t,e,n)=>{n.d(e,{Hq:()=>E,Mk:()=>m,P_:()=>I,Qp:()=>Z,VO:()=>C,kZ:()=>z,kr:()=>W,nF:()=>_,tB:()=>T,ut:()=>k,zD:()=>b}),n(66577);var r,s,o=n(20102),i=n(70586),a=n(67900),l=n(83305),c=n(44547),u=n(6570),f=n(94139),p=n(38913),h=n(82971);function m(t,e,n){return!(0,c.Up)(t,e,n)}function y(t,e,n){const r=m(t,e,n);if(r&&!(0,c.kR)())throw new o.Z("rasterprojectionhelper-project","projection engine is not loaded");return r}(s=r||(r={}))[s.None=0]="None",s[s.North=1]="North",s[s.South=2]="South",s[s.Both=3]="Both";const d=(t,e,n,r=0)=>{if(1===n[0])return[0,0];let s=1,o=-1,i=1,a=-1;for(let e=0;e<t.length;e+=2)isNaN(t[e])||(s=s>t[e]?t[e]:s,o=o>t[e]?o:t[e],i=i>t[e+1]?t[e+1]:i,a=a>t[e+1]?a:t[e+1]);const{cols:l,rows:c}=e,u=(o-s)/l/n[0],f=(a-i)/c/n[1],p=2*r;let h=0,m=!1,y=[0,0];for(let e=0;e<l-3;e++){for(let n=0;n<c-3;n++){const r=e*c*2+2*n,s=(t[r]+t[r+4]+t[r+4*c]+t[r+4*c+4])/4,o=(t[r+1]+t[r+5]+t[r+4*c+1]+t[r+4*c+5])/4,i=Math.abs((s-t[r+2*c+2])/u),a=Math.abs((o-t[r+2*c+3])/f);if(i+a>h&&(h=i+a,y=[i,a]),p&&h>p){m=!0;break}}if(m)break}return y},g={3395:20037508.342789244,3410:17334193.943686873,3857:20037508.342788905,3975:17367530.445161372,4087:20037508.342789244,4088:20015108.787169147,6933:17367530.445161372,32662:20037508.342789244,53001:20015086.79602057,53002:10007543.39801029,53003:20015086.79602057,53004:20015086.79602057,53016:14152803.599503474,53017:17333573.624304302,53034:20015086.79602057,53079:20015114.352186374,53080:20015114.352186374,54001:20037508.342789244,54002:10018754.171394624,54003:20037508.342789244,54004:20037508.342789244,54016:14168658.027268292,54017:17367530.44516137,54034:20037508.342789244,54079:20037508.342789244,54080:20037508.342789244,54100:20037508.342789244,54101:20037508.342789244},x=new Map,w=new Map;async function b(){if((0,c.kR)())return null;await(0,c.zD)()}function C(t,e,n,r=null){const s=t.spatialReference;if(s.equals(e))return t;y(s,e,r);const o=n.center,l=new u.Z({xmin:o.x-t.x/2,xmax:o.x+t.x/2,ymin:o.y-t.y/2,ymax:o.y+t.y/2,spatialReference:s}),f=(0,c.iV)(l,e,r),p=k(e);let h;if((0,i.Wi)(f)||(0,i.pC)(p)&&f.width>=p){const n=(0,a.c9)(s)/(0,a.c9)(e);h={x:t.x*n,y:t.y*n}}else h={x:f.width,y:f.height};return h}function v(t,e=.01){return(0,a.c9)(t)?e/(0,a.c9)(t):0}function _(t,e,n=null,r=!0){const s=t.spatialReference;if(s.equals(e))return t;y(s,e,n);const o=(0,c.iV)(t,e,n);if(!r||!o)return o;const a=j(s,!0),l=j(e,!0),u=v(s);return u&&(0,i.pC)(a)&&(0,i.pC)(l)&&(o.x>0&&Math.abs(t.x-a[0])<u?o.x-=l[1]-l[0]:o.x<0&&Math.abs(t.x-a[1])<u&&(o.x+=l[1]-l[0])),o}function A(t){const{inSR:e,outSR:n,datumTransformation:r,preferPE:s}=t;if(e.equals(n)){const{points:e}=N(t,null);return e}if(e.isWebMercator&&n.isWGS84||e.isWGS84&&n.isWebMercator)return function(t){const{cols:e,rows:n,xres:r,yres:s,usePixelCenter:o,inSR:i,outSR:a}=t;let{xmin:l,ymax:u}=t;o&&(l+=r/2,u-=s/2);const p=[],h=[],m=Math.max(e,n);for(let t=0;t<m;t++){const o=l+r*Math.min(e,t),m=u-s*Math.min(n,t),y=(0,c.iV)(new f.Z({x:o,y:m,spatialReference:i}),a);t<=e&&p.push(y.x),t<=n&&h.push(y.y)}const y=[];for(let t=0;t<e;t++)for(let e=0;e<n;e++)y.push([p[t],h[e]]);return y}(t);if(y(e,n,r)&&s){if(e.isGeographic)return M(t);const n=S(e);if((0,i.pC)(n))return M(t)}return function(t){const{points:e}=N(t,null),n=e.map((e=>new f.Z(e[0],e[1],t.inSR)));return(0,c.iV)(n,t.outSR,t.datumTransformation).map((t=>t?[t.x,t.y]:[NaN,NaN]))}(t)}function M(t){const{inSR:e,outSR:n,datumTransformation:r}=t,s=S(e),{points:o,mask:a}=N(t,s);if(!e.isGeographic){const t=e.wkid?l.e.coordsys(e.wkid):l.e.fromString(e.isGeographic?l.f.PE_TYPE_GEOGCS:l.f.PE_TYPE_PROJCS,e.wkt);l.g.projToGeog(t,o.length,o)}if((0,i.pC)(r)&&r.steps.length&&r.steps.forEach((t=>{const e=t.wkid?l.e.geogtran(t.wkid):l.e.fromString(l.f.PE_TYPE_GEOGTRAN,t.wkt);l.h.geogToGeog(e,o.length,o,null,t.isInverse?l.f.PE_TRANSFORM_2_TO_1:l.f.PE_TRANSFORM_1_TO_2)})),!n.isGeographic){const t=S(n,!0),e=(0,i.pC)(t)&&t.isEnvelope?[t.bbox[1],t.bbox[3]]:[-90,90];!function(t,e){const[n,r]=e;for(let e=0;e<t.length;e++){const s=t[e][1];(s<n||s>r)&&(t[e]=[NaN,NaN])}}(o,e);const r=n.wkid?l.e.coordsys(n.wkid):l.e.fromString(n.isGeographic?l.f.PE_TYPE_GEOGCS:l.f.PE_TYPE_PROJCS,n.wkt);l.g.geogToProj(r,o.length,o)}let c=o;if(a&&o.length!==a.length){c=[];for(let t=0,e=0;t<a.length;t++)a[t]?c.push(o[e++]):c.push([NaN,NaN])}return c}function S(t,e=!1){let n=t.wkid||t.wkt;if(!n||t.isGeographic)return null;if(n=String(n),x.has(n)){const t=x.get(n);return e?t?.gcs:t?.pcs}const r=t.wkid?l.e.coordsys(t.wkid):l.e.fromString(t.isGeographic?l.f.PE_TYPE_GEOGCS:l.f.PE_TYPE_PROJCS,t.wkt),s=R(r,v(t,1e-4)),o=R(r,0,!0);return x.set(n,{pcs:s,gcs:o}),e?o:s}function R(t,e=0,n=!1){const r=l.j.generate(t),s=n?t.horizonGcsGenerate():t.horizonPcsGenerate();if(!s?.length)return null;let o=!1,i=s.find((t=>1===t.getInclusive()&&1===t.getKind()));if(!i){if(i=s.find((t=>1===t.getInclusive()&&0===t.getKind())),!i)return null;o=!0}const a=n?0:(2===r.getNorthPoleLocation()?1:0)|(2===r.getSouthPoleLocation()?2:0),c=r.isPannableRectangle(),u=i.getCoord();if(o)return{isEnvelope:o,isPannable:c,vertices:u,coef:null,bbox:[u[0][0]-e,u[0][1]-e,u[1][0]+e,u[1][1]+e],poleLocation:a};let f=0;const p=[];let[h,m]=u[0],[y,d]=u[0];for(let t=0,e=u.length;t<e;t++){f++,f===e&&(f=0);const[n,r]=u[t],[s,o]=u[f];if(o===r)p.push([n,s,r,o,2]);else{const t=(s-n)/(o-r||1e-4),e=n-t*r;r<o?p.push([t,e,r,o,0]):p.push([t,e,o,r,1])}h=h<n?h:n,m=m<r?m:r,y=y>n?y:n,d=d>r?d:r}return{isEnvelope:!1,isPannable:c,vertices:u,coef:p,bbox:[h,m,y,d],poleLocation:a}}function N(t,e){const n=[],{cols:r,rows:s,xres:o,yres:a,usePixelCenter:l}=t;let{xmin:c,ymax:u}=t;if(l&&(c+=o/2,u-=a/2),(0,i.Wi)(e)){for(let t=0;t<r;t++)for(let e=0;e<s;e++)n.push([c+o*t,u-a*e]);return{points:n}}const f=new Uint8Array(r*s);if(e.isEnvelope){const{bbox:[t,i,l,p]}=e;for(let h=0,m=0;h<r;h++){const r=c+o*h,y=e.isPannable||r>=t&&r<=l;for(let t=0;t<s;t++,m++){const e=u-a*t;y&&e>=i&&e<=p&&(n.push([r,e]),f[m]=1)}}return{points:n,mask:f}}const{coef:p}=e,h=[];for(let t=0;t<s;t++){const e=u-a*t,n=[],r=[];for(let t=0;t<p.length;t++){const[s,o,i,a,l]=p[t];if(e===i&&i===a)n.push(s),n.push(o),r.push(2),r.push(2);else if(e>=i&&e<=a){const t=s*e+o;n.push(t),r.push(l)}}let s=n;if(n.length>2){let t=2===r[0]?0:r[0],e=n[0];s=[];for(let o=1;o<r.length;o++)2===r[o]&&o!==r.length-1||(r[o]!==t&&(s.push(0===t?Math.min(e,n[o-1]):Math.max(e,n[o-1])),t=r[o],e=n[o]),o===r.length-1&&s.push(0===r[o]?Math.min(e,n[o]):Math.max(e,n[o])));s.sort(((t,e)=>t-e))}else n[0]>n[1]&&(s=[n[1],n[0]]);h.push(s)}for(let t=0,e=0;t<r;t++){const r=c+o*t;for(let t=0;t<s;t++,e++){const s=u-a*t,o=h[t];if(2===o.length)r>=o[0]&&r<=o[1]&&(n.push([r,s]),f[e]=1);else if(o.length>2){let t=!1;for(let e=0;e<o.length;e+=2)if(r>=o[e]&&r<=o[e+1]){t=!0;break}t&&(n.push([r,s]),f[e]=1)}}}return{points:n,mask:f}}function P(t){const e=k(t[0].spatialReference);if(t.length<2||(0,i.Wi)(e))return t[0];let{xmin:n,xmax:r,ymin:s,ymax:o}=t[0];for(let n=1;n<t.length;n++){const i=t[n];r=i.xmax+e*n,s=Math.min(s,i.ymin),o=Math.max(o,i.ymax)}return new u.Z({xmin:n,xmax:r,ymin:s,ymax:o,spatialReference:t[0].spatialReference})}function T(t,e,n=null,s=!0){const o=t.spatialReference;if(o.equals(e))return t;const a=E(t),l=k(o,!0),f=k(e);if(0===a||(0,i.Wi)(l)||(0,i.Wi)(f)){const a=F(t,e,n,s);if((0,i.Wi)(l)&&(0,i.pC)(f)&&Math.abs(a.width-f)<v(e)&&(0,c.kR)()){const n=S(o);if((0,i.pC)(n)&&n.poleLocation===r.None&&t.width<(n.bbox[2]-n.bbox[0])/2)return function(t,e){const n=k(e);if((0,i.Wi)(n))return null;let{xmin:r,ymin:s,xmax:o,ymax:a}=t;const l=t.spatialReference,f=new p.Z({spatialReference:l,rings:[[[r,s],[o,s],[o,a],[r,a],[r,s]]]}),h=(0,c.iV)(f,e);if(2!==h.rings.length||!h.rings[0].length||!h.rings[1].length)return null;const{rings:m}=h,y=v(l),d=new u.Z({spatialReference:e});for(let t=0;t<2;t++){r=o=m[t][0][0],s=a=m[t][0][1];for(let e=0;e<m[t].length;e++)r=r>m[t][e][0]?m[t][e][0]:r,o=o<m[t][e][0]?m[t][e][0]:o,s=s>m[t][e][1]?m[t][e][1]:s,a=a<m[t][e][1]?m[t][e][1]:a;if(0===t)d.ymin=s,d.ymax=a,d.xmin=r,d.xmax=o;else if(d.ymin=Math.min(d.ymin,s),d.ymax=Math.max(d.ymax,a),Math.abs(o-n/2)<y)d.xmin=r,d.xmax=d.xmax+n;else{if(!(Math.abs(r+n/2)<y))return null;d.xmax=o+n}}return d}(t,e)||a}return a}const h=t.clone().normalize();if(1===h.length&&t.xmax<l&&t.xmax-l/2>v(o)){const{xmin:e,xmax:n}=t;for(let r=0;r<=a;r++){const s=0===r?e:-l/2,i=r===a?n-l*r:l/2;h[r]=new u.Z({xmin:s,xmax:i,ymin:t.ymin,ymax:t.ymax,spatialReference:o})}}return P(h.map((t=>F(t,e,n,s))).filter((t=>!!t)))}function F(t,e,n=null,r=!0,s=!0){const o=t.spatialReference;if(o.equals(e))return t;y(o,e,n);const a=(0,c.iV)(t,e,n);if(s&&e.isWebMercator&&a&&(a.ymax=Math.min(20037508.342787,a.ymax),a.ymin=Math.max(-20037508.342787,a.ymin),a.ymin>=a.ymax))return null;if(!r||!a)return a;const l=j(o,!0),u=j(e,!0);if((0,i.Wi)(l)||(0,i.Wi)(u))return a;const p=v(o,.001),h=v(o,500),m=v(e,.001);if(Math.abs(a.xmin-u[0])<m&&Math.abs(a.xmax-u[1])<m){const r=Math.abs(t.xmin-l[0]),s=Math.abs(l[1]-t.xmax);if(r<p&&s>h){a.xmin=u[0];const r=[];r.push(new f.Z(t.xmax,t.ymin,o)),r.push(new f.Z(t.xmax,(t.ymin+t.ymax)/2,o)),r.push(new f.Z(t.xmax,t.ymax,o));const s=r.map((t=>_(t,e,n))).filter((t=>!isNaN(t?.x))).map((t=>t.x));a.xmax=Math.max.apply(null,s)}if(s<p&&r>h){a.xmax=u[1];const r=[];r.push(new f.Z(t.xmin,t.ymin,o)),r.push(new f.Z(t.xmin,(t.ymin+t.ymax)/2,o)),r.push(new f.Z(t.xmin,t.ymax,o));const s=r.map((t=>_(t,e,n))).filter((t=>!isNaN(t?.x))).map((t=>t.x));a.xmin=Math.min.apply(null,s)}}else{const t=v(e,.001);Math.abs(a.xmin-u[0])<t&&(a.xmin=u[0]),Math.abs(a.xmax-u[1])<t&&(a.xmax=u[1])}return a}function k(t,e=!1){const n=e?20037508.342787:20037508.342788905;return t.isWebMercator?2*n:t.wkid&&t.isGeographic?360:2*g[t.wkid]||null}function j(t,e=!1){if(t.isGeographic)return[-180,180];const n=k(t,e);return(0,i.pC)(n)?[-n/2,n/2]:null}function B(t,e,n,r){let s=(t-e)/n;return s-Math.floor(s)!=0?s=Math.floor(s):r&&(s-=1),s}function E(t,e=!1){const n=k(t.spatialReference);if((0,i.Wi)(n))return 0;const r=e?0:-n/2,s=v(t.spatialReference),o=!e&&Math.abs(t.xmax-n/2)<s?n/2:t.xmax,a=!e&&Math.abs(t.xmin+n/2)<s?-n/2:t.xmin;return B(o,r,n,!0)-B(a,r,n,!1)}function I(t){const e=t.storageInfo.origin.x,n=k(t.spatialReference,!0);if((0,i.Wi)(n))return{originX:e,halfWorldWidth:null,pyramidsInfo:null};const r=n/2,{nativePixelSize:s,storageInfo:o,extent:a}=t,{maximumPyramidLevel:l,blockWidth:c,pyramidScalingFactor:u}=o;let f=s.x;const p=[],h=(0,i.pC)(t.transform)&&"gcs-shift"===t.transform.type,m=e+(h?0:r),y=h?n-e:r-e;for(let t=0;t<=l;t++){const t=(a.xmax-e)/f/c,n=t-Math.floor(t)==0?t:Math.ceil(t),r=y/f/c,s=r-Math.floor(r)==0?r:Math.ceil(r),o=Math.floor(m/f/c),i=Math.round(m/f)%c,l=(c-Math.round(y/f)%c)%c;p.push({resolutionX:f,blockWidth:c,datsetColumnCount:n,worldColumnCountFromOrigin:s,leftMargin:i,rightPadding:l,originColumnOffset:o}),f*=u}return{originX:e,halfWorldWidth:r,pyramidsInfo:p,hasGCSSShiftTransform:h}}function Z(t){const e=t.isAdaptive&&null==t.spacing;let n=t.spacing||[32,32],r=G(t),s={cols:r.size[0]+1,rows:r.size[1]+1};const o=r.outofBoundPointCount>0&&r.outofBoundPointCount<r.offsets.length/2;let a=r.outofBoundPointCount===r.offsets.length/2||e&&o?[0,0]:d(r.offsets,s,n,4);const c=(a[0]+a[1])/2,u=t.projectedExtent.spatialReference,f=t.srcBufferExtent.spatialReference;if(e&&(o||c>4)&&(m(u,f,t.datumTransformation)&&(u.isGeographic||(0,i.pC)(S(u))),n=[4,4],r=G({...t,spacing:n}),s={cols:r.size[0]+1,rows:r.size[1]+1},a=d(r.offsets,s,n,4)),r.error=a,n[0]>1&&(r.coefficients=O(r.offsets,s,o)),t.includeGCSGrid&&!u.isGeographic&&!u.isWebMercator)if(f.isGeographic)r.gcsGrid={offsets:r.offsets,coefficients:r.coefficients,spacing:n};else{const e=S(u);if((0,i.pC)(e)&&!e.isEnvelope){const e=function(t){if(!t||t.isGeographic)return t;const e=String(t.wkid||t.wkt);let n;return w.has(e)?n=w.get(e):(n=(t.wkid?l.e.coordsys(t.wkid):l.e.fromString(l.f.PE_TYPE_PROJCS,t.wkt)).getGeogcs().getCode(),w.set(e,n)),new h.Z({wkid:n})}(u),i=T(t.projectedExtent,e),{offsets:a}=G({...t,srcBufferExtent:i,spacing:n}),c=O(a,s,o);r.gcsGrid={offsets:a,coefficients:c,spacing:n}}}return r}function G(t){const{projectedExtent:e,srcBufferExtent:n,pixelSize:r,datumTransformation:s,rasterTransform:o}=t,a=e.spatialReference,l=n.spatialReference,c=y(a,l),{xmin:u,ymin:p,xmax:h,ymax:m}=e,d=k(l),g=(0,i.pC)(d)&&(t.hasWrapAround||"gcs-shift"===o?.type),x=t.spacing||[32,32],w=x[0]*r.x,b=x[1]*r.y,C=1===x[0],_=Math.ceil((h-u)/w-.1/x[0])+(C?0:1),M=Math.ceil((m-p)/b-.1/x[1])+(C?0:1),R=A({cols:_,rows:M,xmin:u,ymax:m,xres:w,yres:b,inSR:a,outSR:l,datumTransformation:s,preferPE:x[0]<=4,usePixelCenter:C}),N=[];let P,T=0;const F=C?-1:NaN,{xmin:j,xmax:B,ymax:E,width:I,height:Z}=n,G=v(l,500),O=(0,i.pC)(d)&&j>0&&B>d/2;let z=!1;if(c){const t=S(a);z=(0,i.pC)(t)&&t.poleLocation>0}for(let t=0;t<_;t++){const e=[];for(let n=0;n<M;n++){let r=R[t*M+n];if(g&&r[0]>B&&r[0]>d/2-G?r[0]-=d:g&&0===t&&r[0]<0&&O&&!o&&(r[0]+=d),!r||isNaN(r[0])||isNaN(r[1]))N.push(F),N.push(F),e.push(null),T++;else{if(o){const t=o.inverseTransform(new f.Z({x:r[0],y:r[1],spatialReference:l}));r=[t.x,t.y]}e.push(r),t>0&&g&&P[n]&&r[0]<P[n][0]&&(r[0]+=d,z&&r[0]>B&&r[0]>d&&(r[0]-=d)),N.push((r[0]-j)/I),N.push((E-r[1])/Z)}}P=e}return{offsets:N,error:null,coefficients:null,outofBoundPointCount:T,spacing:x,size:C?[_,M]:[_-1,M-1]}}function O(t,e,n){const{cols:r,rows:s}=e,o=new Float32Array((r-1)*(s-1)*2*6),i=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),a=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let e=0;e<r-1;e++){for(let n=0;n<s-1;n++){let l=e*s*2+2*n;const c=t[l],u=t[l+1],f=t[l+2],p=t[l+3];l+=2*s;const h=t[l],m=t[l+1],y=t[l+2],d=t[l+3];let g=0,x=12*(n*(r-1)+e);for(let t=0;t<3;t++)o[x++]=i[g++]*c+i[g++]*f+i[g++]*y;g=0;for(let t=0;t<3;t++)o[x++]=i[g++]*u+i[g++]*p+i[g++]*d;g=0;for(let t=0;t<3;t++)o[x++]=a[g++]*c+a[g++]*h+a[g++]*y;g=0;for(let t=0;t<3;t++)o[x++]=a[g++]*u+a[g++]*m+a[g++]*d}if(n)for(let t=0;t<o.length;t++)isNaN(o[t])&&(o[t]=-1)}return o}function z(t){const e=t.clone().normalize();return 1===e.length?e[0]:P(e)}function W(t,e,n){const{storageInfo:r,pixelSize:s}=e;let o,l=!1;const{pyramidResolutions:c}=r;if((0,i.pC)(c)&&c.length){const r=(t.x+t.y)/2,i=c[c.length-1],u=(i.x+i.y)/2,p=(s.x+s.y)/2;if(r<=p)o=0;else if(r>=u)o=c.length,l=r/u>8;else{let t,e=p;for(let s=1;s<=c.length;s++){if(t=(c[s-1].x+c[s-1].y)/2,r<=t){r===t?o=s:"down"===n?(o=s-1,l=r/e>8):o="up"===n||r-e>t-r||r/e>2?s:s-1;break}e=t}}const h=0===o?s:c[o-1];return l&&Math.min(h.x,h.y)*(0,a.c9)(e.spatialReference)>19567&&(l=!1),{pyramidLevel:o,pyramidResolution:new f.Z({x:h.x,y:h.y,spatialReference:e.spatialReference}),excessiveReading:l}}const u=Math.log(t.x/s.x)/Math.LN2,p=Math.log(t.y/s.y)/Math.LN2,h=e.storageInfo.maximumPyramidLevel||0;o="down"===n?Math.floor(Math.min(u,p)):"up"===n?Math.ceil(Math.max(u,p)):Math.round((u+p)/2),o<0?o=0:o>h&&(l=o>h+3,o=h);const m=2**o;return{pyramidLevel:o,pyramidResolution:new f.Z({x:m*e.nativePixelSize.x,y:m*e.nativePixelSize.y,spatialReference:e.spatialReference}),excessiveReading:l}}},48700:(t,e,n)=>{n.d(e,{Z:()=>l});var r=n(43697),s=n(96674),o=n(5600),i=(n(67676),n(80442),n(75215),n(52011));let a=class extends s.wq{get affectsPixelSize(){return!1}forwardTransform(t){return t}inverseTransform(t){return t}};(0,r._)([(0,o.Cb)()],a.prototype,"affectsPixelSize",null),(0,r._)([(0,o.Cb)({json:{write:!0}})],a.prototype,"spatialReference",void 0),a=(0,r._)([(0,i.j)("esri.layers.support.rasterTransforms.BaseRasterTransform")],a);const l=a},29680:(t,e,n)=>{n.d(e,{Z:()=>c});var r=n(43697),s=n(5600),o=(n(67676),n(80442),n(75215),n(36030)),i=n(52011),a=n(48700);let l=class extends a.Z{constructor(){super(...arguments),this.type="gcs-shift",this.tolerance=1e-8}forwardTransform(t){return"point"===(t=t.clone()).type?(t.x>180+this.tolerance&&(t.x-=360),t):(t.xmin>=180-this.tolerance?(t.xmax-=360,t.xmin-=360):t.xmax>180+this.tolerance&&(t.xmin=-180,t.xmax=180),t)}inverseTransform(t){return"point"===(t=t.clone()).type?(t.x<-this.tolerance&&(t.x+=360),t):(t.xmin<-this.tolerance&&(t.xmin+=360,t.xmax+=360),t)}};(0,r._)([(0,o.J)({GCSShiftXform:"gcs-shift"})],l.prototype,"type",void 0),(0,r._)([(0,s.Cb)()],l.prototype,"tolerance",void 0),l=(0,r._)([(0,i.j)("esri.layers.support.rasterTransforms.GCSShiftTransform")],l);const c=l},87390:(t,e,n)=>{n.d(e,{Z:()=>y});var r=n(43697),s=(n(66577),n(5600)),o=(n(67676),n(80442),n(75215),n(36030)),i=n(71715),a=n(52011),l=n(30556),c=n(48700),u=n(94139),f=n(6570);function p(t,e,n){const{x:r,y:s}=e;if(n<2)return{x:t[0]+r*t[2]+s*t[4],y:t[1]+r*t[3]+s*t[5]};if(2===n){const e=r*r,n=s*s,o=r*s;return{x:t[0]+r*t[2]+s*t[4]+e*t[6]+o*t[8]+n*t[10],y:t[1]+r*t[3]+s*t[5]+e*t[7]+o*t[9]+n*t[11]}}const o=r*r,i=s*s,a=r*s,l=o*r,c=o*s,u=r*i,f=s*i;return{x:t[0]+r*t[2]+s*t[4]+o*t[6]+a*t[8]+i*t[10]+l*t[12]+c*t[14]+u*t[16]+f*t[18],y:t[1]+r*t[3]+s*t[5]+o*t[7]+a*t[9]+i*t[11]+l*t[13]+c*t[15]+u*t[17]+f*t[19]}}function h(t,e,n){const{xmin:r,ymin:s,xmax:o,ymax:i,spatialReference:a}=e;let l=[];if(n<2)l.push({x:r,y:i}),l.push({x:o,y:i}),l.push({x:r,y:s}),l.push({x:o,y:s});else{let t=10;for(let e=0;e<t;e++)l.push({x:r,y:s+(i-s)*e/(t-1)}),l.push({x:o,y:s+(i-s)*e/(t-1)});t=8;for(let e=1;e<=t;e++)l.push({x:r+(o-r)*e/t,y:s}),l.push({x:r+(o-r)*e/t,y:i})}l=l.map((e=>p(t,e,n)));const c=l.map((t=>t.x)),u=l.map((t=>t.y));return new f.Z({xmin:Math.min.apply(null,c),xmax:Math.max.apply(null,c),ymin:Math.min.apply(null,u),ymax:Math.max.apply(null,u),spatialReference:a})}let m=class extends c.Z{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(t,e){const{coeffX:n,coeffY:r}=e;if(!n?.length||!r?.length||n.length!==r.length)return null;const s=[];for(let t=0;t<n.length;t++)s.push(n[t]),s.push(r[t]);return s}writeForwardCoefficients(t,e,n){const r=[],s=[];for(let e=0;e<t?.length;e++)e%2==0?r.push(t[e]):s.push(t[e]);e.coeffX=r,e.coeffY=s}get inverseCoefficients(){let t=this._get("inverseCoefficients");const e=this._get("forwardCoefficients");return!t&&e&&this.polynomialOrder<2&&(t=function(t){const[e,n,r,s,o,i]=t,a=r*i-o*s,l=o*s-r*i;return[(o*n-e*i)/a,(r*n-e*s)/l,i/a,s/l,-o/a,-r/l]}(e)),t}set inverseCoefficients(t){this._set("inverseCoefficients",t)}readInverseCoefficients(t,e){const{inverseCoeffX:n,inverseCoeffY:r}=e;if(!n?.length||!r?.length||n.length!==r.length)return null;const s=[];for(let t=0;t<n.length;t++)s.push(n[t]),s.push(r[t]);return s}writeInverseCoefficients(t,e,n){const r=[],s=[];for(let e=0;e<t?.length;e++)e%2==0?r.push(t[e]):s.push(t[e]);e.inverseCoeffX=r,e.inverseCoeffY=s}get affectsPixelSize(){return this.polynomialOrder>0}forwardTransform(t){if("point"===t.type){const e=p(this.forwardCoefficients,t,this.polynomialOrder);return new u.Z({x:e.x,y:e.y,spatialReference:t.spatialReference})}return h(this.forwardCoefficients,t,this.polynomialOrder)}inverseTransform(t){if("point"===t.type){const e=p(this.inverseCoefficients,t,this.polynomialOrder);return new u.Z({x:e.x,y:e.y,spatialReference:t.spatialReference})}return h(this.inverseCoefficients,t,this.polynomialOrder)}};(0,r._)([(0,s.Cb)({json:{write:!0}})],m.prototype,"polynomialOrder",void 0),(0,r._)([(0,s.Cb)()],m.prototype,"forwardCoefficients",void 0),(0,r._)([(0,i.r)("forwardCoefficients",["coeffX","coeffY"])],m.prototype,"readForwardCoefficients",null),(0,r._)([(0,l.c)("forwardCoefficients")],m.prototype,"writeForwardCoefficients",null),(0,r._)([(0,s.Cb)({json:{write:!0}})],m.prototype,"inverseCoefficients",null),(0,r._)([(0,i.r)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],m.prototype,"readInverseCoefficients",null),(0,r._)([(0,l.c)("inverseCoefficients")],m.prototype,"writeInverseCoefficients",null),(0,r._)([(0,s.Cb)()],m.prototype,"affectsPixelSize",null),(0,r._)([(0,o.J)({PolynomialXform:"polynomial"})],m.prototype,"type",void 0),m=(0,r._)([(0,a.j)("esri.layers.support.rasterTransforms.PolynomialTransform")],m);const y=m},87521:(t,e,n)=>{n.d(e,{j:()=>h,c:()=>m});var r=n(29680),s=n(43697),o=(n(92604),n(75215),n(67676),n(80442),n(20102),n(36030)),i=n(52011),a=n(48700);let l=class extends a.Z{constructor(){super(...arguments),this.type="identity"}};(0,s._)([(0,o.J)({IdentityXform:"identity"})],l.prototype,"type",void 0),l=(0,s._)([(0,i.j)("esri.layers.support.rasterTransforms.IdentityTransform")],l);const c=l;var u=n(87390);const f={GCSShiftXform:r.Z,IdentityXform:c,PolynomialXform:u.Z},p=Object.keys(f);function h(t){const e=t?.type;return!t||p.includes(e)}function m(t){const e=t?.type;if(!e)return null;const n=f[t?.type];if(n){const e=new n;return e.read(t),e}return null}}}]);
|
package/chunks/Clouds.glsl.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{lerp as t}from"../core/mathUtils.js";import{isSome as e}from"../core/maybe.js";import{c as
|
|
6
|
-
const int STEPS = ${
|
|
5
|
+
import{lerp as t}from"../core/mathUtils.js";import{isSome as e}from"../core/maybe.js";import{c as a}from"./mat3f64.js";import{RayMarchingSteps as o}from"../views/3d/environment/CloudsTechniqueConfiguration.js";import{ATLAS_SIZE as i,TILE_ROWS as n,TILE_SIZE as s,TEXTURE_SCALE as r,WEATHER_MAP_SCALE as l}from"../views/3d/environment/NoiseTextureAtlasDimensions.js";import{ScreenSpacePass as c}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.js";import{FloatPassUniform as d}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{NoParameters as u,glsl as f}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{Matrix3DrawUniform as m}from"../views/3d/webgl-engine/core/shaderModules/Matrix3DrawUniform.js";import{ShaderBuilder as p}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{Texture2DPassUniform as h}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";class g extends u{constructor(){super(...arguments),this.cloudRadius=0,this.cloudSize=0,this.detailSize=0,this.absorption=0,this.density=0,this.smoothness=0,this.cloudHeight=0,this.coverage=0}}class v extends u{constructor(){super(...arguments),this.viewMatrix=a()}}function y(a){const u=new p;u.include(c,!1);const g=u.fragment;return g.uniforms.add([new d("cloudRadius",(t=>t.cloudRadius)),new d("power",(e=>t(35,120,e.absorption))),new d("sigmaE",(t=>1+t.absorption)),new d("density",(e=>t(0,.3,e.density))),new d("cloudSize",(e=>t(0,.02,Math.max(.01,1-e.cloudSize)))),new d("detailSize",(e=>t(0,.2,Math.max(.01,1-e.detailSize)))),new d("smoothness",(e=>t(0,.5,1-e.smoothness))),new d("cloudHeight",(e=>t(0,1500,e.cloudHeight))),new d("coverage",(t=>t.coverage)),new m("view",(t=>t.viewMatrix)),new h("cloudShapeTexture",(t=>e(t.noiseTexture)?t.noiseTexture.textureAtlas:null))]),g.constants.add("halfCubeMapSize","float",.5*a.cubeMapSize),g.code.add(f`
|
|
6
|
+
const int STEPS = ${a.steps===o.SIXTEEN?f`16`:a.steps===o.HUNDRED?f`100`:f`200`};
|
|
7
7
|
const int STEPS_LIGHT = 6;
|
|
8
8
|
const float stepL = 300.0 / float(STEPS_LIGHT);
|
|
9
9
|
const float cloudStart = 1500.0;
|
|
@@ -85,18 +85,18 @@ return vec2((-b - sqrt(d)) / (2.0 * a), (-b + sqrt(d)) / (2.0 * a));
|
|
|
85
85
|
}
|
|
86
86
|
float HenyeyGreenstein(float g, float costh) {
|
|
87
87
|
return (1.0 / (4.0 * 3.1415)) * ((1.0 - g * g) / pow(1.0 + g * g - 2.0 * g * costh, 1.5));
|
|
88
|
-
}`),g.code.add("\n
|
|
88
|
+
}`),g.code.add("\n float multipleOctaves(float extinction, float mu, float stepL) {\n float attenuation = 1.0;\n float contribution = 1.0;\n float phaseAttenuation = 1.0;\n float luminance = 0.0;\n\n for (int i = 0; i < 4; i++) {\n float phase = mix(HenyeyGreenstein(0.0, mu), HenyeyGreenstein(0.3 * phaseAttenuation, mu), 0.7);\n luminance += contribution * phase * exp(-stepL * extinction * sigmaE * attenuation);\n attenuation *= 0.2;\n contribution *= 0.6;\n phaseAttenuation *= 0.5;\n }\n\n return luminance;\n }"),g.code.add(f`float lightRay(vec3 org, vec3 p, float phaseFunction, float mu, vec3 sunDirection) {
|
|
89
89
|
float lightRayDensity = clouds(p);
|
|
90
90
|
lightRayDensity += clouds(p + sunDirection * 1.0 * stepL);
|
|
91
91
|
lightRayDensity += clouds(p + sunDirection * 2.0 * stepL);
|
|
92
92
|
lightRayDensity += clouds(p + sunDirection * 3.0 * stepL);
|
|
93
93
|
lightRayDensity += clouds(p + sunDirection * 4.0 * stepL);
|
|
94
94
|
lightRayDensity += clouds(p + sunDirection * 5.0 * stepL);
|
|
95
|
-
|
|
95
|
+
float beersLaw = multipleOctaves(lightRayDensity, mu, stepL);
|
|
96
96
|
return mix(beersLaw * 2.0 * (1.0 - (exp(-stepL * lightRayDensity * 2.0 * sigmaE ))), beersLaw, 0.5 + 0.5 * mu);
|
|
97
|
-
}`),g.code.add(f`
|
|
97
|
+
}`),g.code.add(f`float mainRay(vec3 org, vec3 dir, vec3 sunDirection, float distToStart, float totalDistance, out float totalTransmittance) {
|
|
98
98
|
if (dir.z < 0.0) {
|
|
99
|
-
return
|
|
99
|
+
return 0.0;
|
|
100
100
|
}
|
|
101
101
|
totalTransmittance = 1.0;
|
|
102
102
|
float stepS = totalDistance / float(STEPS);
|
|
@@ -105,15 +105,15 @@ float mu = 0.5 + 0.5 * dot(sunDirection, dir);
|
|
|
105
105
|
float phaseFunction = mix(HenyeyGreenstein(-0.3, mu), HenyeyGreenstein(0.3, mu), 0.7);
|
|
106
106
|
vec3 p = org + distToStart * dir;
|
|
107
107
|
float dist = distToStart;
|
|
108
|
-
|
|
108
|
+
float shading = 0.0;
|
|
109
109
|
for (int i = 0; i < STEPS; i++) {
|
|
110
110
|
float sampleDensity = clouds(p);
|
|
111
111
|
float sampleSigmaE = sampleDensity * sigmaE;
|
|
112
112
|
if (sampleDensity > 0.0 ) {
|
|
113
113
|
float ambient = mix((1.2), (1.6), saturate((length(p) - cloudRadius - cloudStart) / cloudHeight));
|
|
114
|
-
|
|
114
|
+
float luminance = sampleDensity * (ambient + power * phaseFunction * lightRay(org, p, phaseFunction, mu, sunDirection));
|
|
115
115
|
float transmittance = exp(-sampleSigmaE * stepS);
|
|
116
|
-
|
|
116
|
+
shading += totalTransmittance * (luminance - luminance * transmittance) / sampleSigmaE;
|
|
117
117
|
totalTransmittance *= transmittance;
|
|
118
118
|
if (totalTransmittance <= 0.001) {
|
|
119
119
|
totalTransmittance = 0.0;
|
|
@@ -123,7 +123,7 @@ break;
|
|
|
123
123
|
dist += stepS;
|
|
124
124
|
p = org + dir * dist;
|
|
125
125
|
}
|
|
126
|
-
return
|
|
126
|
+
return shading;
|
|
127
127
|
}`),g.code.add(f`void main() {
|
|
128
128
|
vec3 rayDir = rayDirection(gl_FragCoord.xy);
|
|
129
129
|
rayDir = normalize(view * rayDir);
|
|
@@ -139,6 +139,6 @@ float distToStart = rayStartIntersect.y;
|
|
|
139
139
|
float totalDistance = rayEndIntersect.y - distToStart;
|
|
140
140
|
float totalTransmittance = 1.0;
|
|
141
141
|
vec3 sunDirection = normalize(vec3(0, 0, 1));
|
|
142
|
-
|
|
143
|
-
gl_FragColor = vec4(
|
|
142
|
+
float shading = 0.5 * mainRay(viewPos, rayDir, sunDirection, distToStart, totalDistance, totalTransmittance);
|
|
143
|
+
gl_FragColor = vec4(shading, totalTransmittance, shading, totalTransmittance);
|
|
144
144
|
}`),u}const w=Object.freeze(Object.defineProperty({__proto__:null,CloudsPassParameters:g,CloudsDrawParameters:v,build:y},Symbol.toStringTag,{value:"Module"}));export{g as C,v as a,w as b,y as c};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class
|
|
5
|
+
import{isSome as s}from"./maybe.js";class e{constructor(s,e=30){this.name=s,this._counter=0,this._samples=new Array(e)}record(e){s(e)&&(this._samples[++this._counter%this._samples.length]=e)}get median(){return this._samples.slice().sort(((s,e)=>s-e))[Math.floor(this._samples.length/2)]}get average(){return this._samples.reduce(((s,e)=>s+e),0)/this._samples.length}get last(){return this._samples[this._counter%this._samples.length]}}export{e as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
let t=null,n=!0;function e(t,e,r){if(!t||!e)throw new Error("Cannot construct image data without dimensions");if(n)try{return new ImageData(t,e)}catch(a){n=!1}return o(t,e,r)}function r(t,e,r,a){if(!e||!r)throw new Error("Cannot construct image data without dimensions");if(n)try{return new ImageData(t,e,r)}catch(c){n=!1}const i=o(e,r,a);return i.data.set(t,0),i}function a(){return t||(t=document.createElement("canvas"),t.width=1,t.height=1),t}function o(t,n,e){return e||(e=a()),e.getContext("2d").createImageData(t,n)}export{e as createEmptyImageData,r as wrapImageData};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import"../../core/has.js";import{
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import"../../core/has.js";import{wrapImageData as e}from"../../core/imageUtils.js";import{JSONSupport as a}from"../../core/JSONSupport.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import{ensureClass as s}from"../../core/accessorSupport/ensureType.js";import{reader as o}from"../../core/accessorSupport/decorators/reader.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{writer as i}from"../../core/accessorSupport/decorators/writer.js";import{t as l,w as c}from"../../chunks/persistableUrlUtils.js";var p;const d=new WeakMap;let h=0,u=p=class extends a{constructor(t){super(t),this.wrap="repeat"}get url(){return this._get("url")||null}set url(t){this._set("url",t),t&&this._set("data",null)}get data(){return this._get("data")||null}set data(t){this._set("data",t),t&&this._set("url",null)}writeData(t,e,a,r){if(t instanceof HTMLImageElement){const s={type:"image-element",src:l(t.src,r),crossOrigin:t.crossOrigin};e[a]=s}else if(t instanceof HTMLCanvasElement){const r=t.getContext("2d").getImageData(0,0,t.width,t.height),s={type:"canvas-element",imageData:this._encodeImageData(r)};e[a]=s}else if(t instanceof HTMLVideoElement){const s={type:"video-element",src:l(t.src,r),autoplay:t.autoplay,loop:t.loop,muted:t.muted,crossOrigin:t.crossOrigin,preload:t.preload};e[a]=s}else{const r={type:"image-data",imageData:this._encodeImageData(t)};e[a]=r}}readData(t){switch(t.type){case"image-element":{const e=new Image;return e.src=t.src,e.crossOrigin=t.crossOrigin,e}case"canvas-element":{const e=this._decodeImageData(t.imageData),a=document.createElement("canvas");return a.width=e.width,a.height=e.height,a.getContext("2d").putImageData(e,0,0),a}case"image-data":return this._decodeImageData(t.imageData);case"video-element":{const e=document.createElement("video");return e.src=t.src,e.crossOrigin=t.crossOrigin,e.autoplay=t.autoplay,e.loop=t.loop,e.muted=t.muted,e.preload=t.preload,e}default:return}}get transparent(){const t=this.data,e=this.url;if(t instanceof HTMLCanvasElement)return this._imageDataContainsTransparent(t.getContext("2d").getImageData(0,0,t.width,t.height));if(t instanceof ImageData)return this._imageDataContainsTransparent(t);if(e){const t=e.substr(e.length-4,4).toLowerCase(),a=e.substr(0,15).toLocaleLowerCase();if(".png"===t||"data:image/png;"===a)return!0}return!1}set transparent(t){this._overrideIfSome("transparent",t)}get contentHash(){const t="string"==typeof this.wrap?this.wrap:"object"==typeof this.wrap?`${this.wrap.horizontal}/${this.wrap.vertical}`:"",e=(e="")=>`d:${e},t:${this.transparent},w:${t}`;return null!=this.url?e(this.url):null!=this.data?this.data instanceof HTMLImageElement||this.data instanceof HTMLVideoElement?e(this.data.src):(d.has(this.data)||d.set(this.data,++h),e(d.get(this.data))):e()}clone(){const t={url:this.url,data:this.data,wrap:this._cloneWrap()};return new p(t)}cloneWithDeduplication(t){const e=t.get(this);if(e)return e;const a=this.clone();return t.set(this,a),a}_cloneWrap(){return"string"==typeof this.wrap?this.wrap:{horizontal:this.wrap.horizontal,vertical:this.wrap.vertical}}_encodeImageData(t){let e="";for(let a=0;a<t.data.length;a++)e+=String.fromCharCode(t.data[a]);return{data:btoa(e),width:t.width,height:t.height}}_decodeImageData(t){const a=atob(t.data),r=new Uint8ClampedArray(a.length);for(let e=0;e<a.length;e++)r[e]=a.charCodeAt(e);return e(r,t.width,t.height)}_imageDataContainsTransparent(t){for(let e=3;e<t.data.length;e+=4)if(255!==t.data[e])return!0;return!1}static from(t){return"string"==typeof t?new p({url:t}):t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLVideoElement?new p({data:t}):s(p,t)}};t([r({type:String,json:{write:c}})],u.prototype,"url",null),t([r({json:{write:{overridePolicy(){return{enabled:!this.url}}}}}),r()],u.prototype,"data",null),t([i("data")],u.prototype,"writeData",null),t([o("data")],u.prototype,"readData",null),t([r({type:Boolean,json:{write:{overridePolicy(){return{enabled:this._isOverridden("transparent")}}}}})],u.prototype,"transparent",null),t([r({json:{write:!0}})],u.prototype,"wrap",void 0),t([r({readOnly:!0})],u.prototype,"contentHash",null),u=p=t([n("esri.geometry.support.MeshTexture")],u);const m=u;export{m as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{eachAlways as e}from"../../../../../core/promiseUtils.js";import{BufferView as i}from"./bufferview.js";class r{constructor(e){this._gltf=e,this._bufferViews=[],this._isFinalized=!1,e.buffers||(e.buffers=[]),this.index=e.buffers.length;const i={byteLength:-1};e.buffers.push(i),this._buffer=i}addBufferView(e,r,t){if(this._finalizePromise)throw new Error("Cannot add buffer view after fiinalizing buffer");const f=new i(this,this._gltf,e,r,t);return this._bufferViews.push(f),f}getByteOffset(e){let i=0;for(const r of this._bufferViews){if(r===e)return i;i+=r.byteSize}throw new Error("Given bufferView was not present in this buffer")}getViewFinalizePromises(e){const i=[];for(const r of this._bufferViews){if(e&&r===e)return i;i.push(r.finalized)}return i}getArrayBuffer(){if(!this._isFinalized)throw new Error("Cannot get ArrayBuffer from Buffer before it is finalized");const e=this._getTotalSize(),i=new ArrayBuffer(e);let r=0;for(const t of this._bufferViews)t.writeOutToBuffer(i,r),r+=t.byteSize;return i}finalize(){if(this._finalizePromise)throw new Error(`Buffer ${this.index} was already finalized`);return this._finalizePromise=new Promise((i=>{i(e(this.getViewFinalizePromises()))})).then((()=>{this._isFinalized=!0;const e=this.getArrayBuffer();this._buffer.byteLength=e.byteLength,this._buffer.uri=e})),this._gltf.extras
|
|
5
|
+
import{eachAlways as e}from"../../../../../core/promiseUtils.js";import{BufferView as i}from"./bufferview.js";class r{constructor(e){this._gltf=e,this._bufferViews=[],this._isFinalized=!1,e.buffers||(e.buffers=[]),this.index=e.buffers.length;const i={byteLength:-1};e.buffers.push(i),this._buffer=i}addBufferView(e,r,t){if(this._finalizePromise)throw new Error("Cannot add buffer view after fiinalizing buffer");const f=new i(this,this._gltf,e,r,t);return this._bufferViews.push(f),f}getByteOffset(e){let i=0;for(const r of this._bufferViews){if(r===e)return i;i+=r.byteSize}throw new Error("Given bufferView was not present in this buffer")}getViewFinalizePromises(e){const i=[];for(const r of this._bufferViews){if(e&&r===e)return i;i.push(r.finalized)}return i}getArrayBuffer(){if(!this._isFinalized)throw new Error("Cannot get ArrayBuffer from Buffer before it is finalized");const e=this._getTotalSize(),i=new ArrayBuffer(e);let r=0;for(const t of this._bufferViews)t.writeOutToBuffer(i,r),r+=t.byteSize;return i}finalize(){if(this._finalizePromise)throw new Error(`Buffer ${this.index} was already finalized`);return this._finalizePromise=new Promise((i=>{i(e(this.getViewFinalizePromises()))})).then((()=>{this._isFinalized=!0;const e=this.getArrayBuffer();this._buffer.byteLength=e.byteLength,this._buffer.uri=e})),this._gltf.extras?.promises.push(this._finalizePromise),this._finalizePromise}_getTotalSize(){let e=0;for(const i of this._bufferViews)e+=i.byteSize;return e}}export{r as Buffer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import{isSome as t,isNone as s}from"../../../../../core/maybe.js";import{j as i}from"../../../../../chunks/quat.js";import{I as r,b as a}from"../../../../../chunks/quatf64.js";import{k as o}from"../../../../../chunks/vec3.js";import{Z as n,a as l,O as
|
|
5
|
+
import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import{isSome as t,isNone as s}from"../../../../../core/maybe.js";import{j as i}from"../../../../../chunks/quat.js";import{I as r,b as a}from"../../../../../chunks/quatf64.js";import{k as o}from"../../../../../chunks/vec3.js";import{Z as n,a as l,O as c}from"../../../../../chunks/vec3f64.js";import h from"../../../MeshMaterialMetallicRoughness.js";import{ungeoreferenceByTransform as u}from"../../georeference.js";import{Buffer as f}from"./buffer.js";import{computeOrigin as d,smoothNormals as p}from"./geometry.js";import{BufferOutputType as m,ImageOutputType as g,AttributeType as _,TargetBuffer as A,AlphaMode as x}from"./types.js";import{imageToArrayBuffer as R,imageToDataURI as T}from"./imageutils.js";import{DataType as E,TextureWrapMode as b}from"../../../../../views/webgl/enums.js";class M{constructor(e,t,s){this.params={},this._materialMap=new Array,this._imageMap=new Map,this._textureMap=new Map,this.gltf={asset:{version:"2.0",copyright:e.copyright,generator:e.generator},extras:{options:t,binChunkBuffer:null,promises:[]}},s&&(this.params=s),this._addScenes(e)}_addScenes(e){this.gltf.scene=e.defaultScene;const t=this.gltf.extras,s=t.options.bufferOutputType===m.GLB||t.options.imageOutputType===g.GLB;s&&(t.binChunkBuffer=new f(this.gltf)),e.forEachScene((e=>{this._addScene(e)})),s&&t.binChunkBuffer.finalize()}_addScene(e){this.gltf.scenes||(this.gltf.scenes=[]);const t={};e.name&&(t.name=e.name),e.forEachNode((e=>{t.nodes||(t.nodes=[]);const s=this._addNode(e);t.nodes.push(s)})),this.gltf.scenes.push(t)}_addNode(e){this.gltf.nodes||(this.gltf.nodes=[]);const t={};e.name&&(t.name=e.name);const s=e.translation;o(s,n)||(t.translation=l(s));const h=e.rotation;i(h,r)||(t.rotation=a(h));const u=e.scale;o(u,c)||(t.scale=l(u)),e.mesh&&e.mesh.vertexAttributes.position?t.mesh=this._addMesh(e.mesh):e.forEachNode((e=>{t.children||(t.children=[]);const s=this._addNode(e);t.children.push(s)}));const f=this.gltf.nodes.length;return this.gltf.nodes.push(t),f}_addMesh(e){this.gltf.meshes||(this.gltf.meshes=[]);const s={primitives:[]},i=this.gltf.extras,r=i.options.bufferOutputType===m.GLB;let a;a=r?i.binChunkBuffer:new f(this.gltf),this.params.origin||(this.params.origin=d(e));const o=u(e.vertexAttributes,e.transform,this.params.origin,{geographic:this.params.geographic,unit:"meters"});p(e,o),this._flipYZAxis(o);const n=a.addBufferView(E.FLOAT,_.VEC3,A.ARRAY_BUFFER);let l,c,h,g;o.normal&&(l=a.addBufferView(E.FLOAT,_.VEC3,A.ARRAY_BUFFER)),e.vertexAttributes.uv&&(c=a.addBufferView(E.FLOAT,_.VEC2,A.ARRAY_BUFFER)),o.tangent&&(h=a.addBufferView(E.FLOAT,_.VEC4,A.ARRAY_BUFFER)),e.vertexAttributes.color&&(g=a.addBufferView(E.UNSIGNED_BYTE,_.VEC4,A.ARRAY_BUFFER)),n.startAccessor("POSITION"),l&&l.startAccessor("NORMAL"),c&&c.startAccessor("TEXCOORD_0"),h&&h.startAccessor("TANGENT"),g&&g.startAccessor("COLOR_0");const x=o.position.length/3,{position:R,normal:T,tangent:b}=o,{color:M,uv:O}=e.vertexAttributes;for(let u=0;u<x;++u)n.push(R[3*u+0]),n.push(R[3*u+1]),n.push(R[3*u+2]),l&&t(T)&&(l.push(T[3*u+0]),l.push(T[3*u+1]),l.push(T[3*u+2])),c&&t(O)&&(c.push(O[2*u+0]),c.push(O[2*u+1])),h&&t(b)&&(h.push(b[4*u+0]),h.push(b[4*u+1]),h.push(b[4*u+2]),h.push(b[4*u+3])),g&&t(M)&&(g.push(M[4*u+0]),g.push(M[4*u+1]),g.push(M[4*u+2]),g.push(M[4*u+3]));const N=n.endAccessor(),C=this._addAccessor(n.index,N);let B,w,y,I,S;if(l){const e=l.endAccessor();B=this._addAccessor(l.index,e)}if(c){const e=c.endAccessor();w=this._addAccessor(c.index,e)}if(h){const e=h.endAccessor();y=this._addAccessor(h.index,e)}if(g){const e=g.endAccessor();I=this._addAccessor(g.index,e)}e.components&&e.components.length>0&&e.components[0].faces?(S=a.addBufferView(E.UNSIGNED_INT,_.SCALAR,A.ELEMENT_ARRAY_BUFFER),this._addMeshVertexIndexed(S,e.components,s,C,B,w,y,I)):this._addMeshVertexNonIndexed(e.components,s,C,B,w,y,I),n.finalize(),l&&l.finalize(),c&&c.finalize(),h&&h.finalize(),S&&S.finalize(),g&&g.finalize(),r||a.finalize();const F=this.gltf.meshes.length;return this.gltf.meshes.push(s),F}_flipYZAxis({position:e,normal:t,tangent:s}){this._flipYZBuffer(e,3),this._flipYZBuffer(t,3),this._flipYZBuffer(s,4)}_flipYZBuffer(e,t){if(!s(e))for(let s=1,i=2;s<e.length;s+=t,i+=t){const t=e[s],r=e[i];e[s]=r,e[i]=-t}}_addMaterial(e){if(null===e)return;const s=this._materialMap.indexOf(e);if(-1!==s)return s;this.gltf.materials||(this.gltf.materials=[]);const i={};switch(e.alphaMode){case"mask":i.alphaMode=x.MASK;break;case"auto":case"blend":i.alphaMode=x.BLEND}.5!==e.alphaCutoff&&(i.alphaCutoff=e.alphaCutoff),e.doubleSided&&(i.doubleSided=e.doubleSided),i.pbrMetallicRoughness={};const r=e=>e**2.1,a=e=>{const t=e.toRgba();return t[0]=r(t[0]/255),t[1]=r(t[1]/255),t[2]=r(t[2]/255),t};if(t(e.color)&&(i.pbrMetallicRoughness.baseColorFactor=a(e.color)),t(e.colorTexture)&&(i.pbrMetallicRoughness.baseColorTexture={index:this._addTexture(e.colorTexture)}),t(e.normalTexture)&&(i.normalTexture={index:this._addTexture(e.normalTexture)}),e instanceof h){if(t(e.emissiveTexture)&&(i.emissiveTexture={index:this._addTexture(e.emissiveTexture)}),t(e.emissiveColor)){const t=a(e.emissiveColor);i.emissiveFactor=[t[0],t[1],t[2]]}t(e.occlusionTexture)&&(i.occlusionTexture={index:this._addTexture(e.occlusionTexture)}),t(e.metallicRoughnessTexture)&&(i.pbrMetallicRoughness.metallicRoughnessTexture={index:this._addTexture(e.metallicRoughnessTexture)}),i.pbrMetallicRoughness.metallicFactor=e.metallic,i.pbrMetallicRoughness.roughnessFactor=e.roughness}else i.pbrMetallicRoughness.metallicFactor=1,i.pbrMetallicRoughness.roughnessFactor=1;const o=this.gltf.materials.length;return this.gltf.materials.push(i),this._materialMap.push(e),o}_addTexture(t){const s=this.gltf.textures??[];return this.gltf.textures=s,e(this._textureMap,t,(()=>{const e={sampler:this._addSampler(t),source:this._addImage(t)},i=s.length;return s.push(e),i}))}_addImage(e){const t=this._imageMap.get(e);if(null!=t)return t;this.gltf.images||(this.gltf.images=[]);const s={};if(e.url)s.uri=e.url;else{const t=e.data;s.extras=t;for(let e=0;e<this.gltf.images.length;++e)if(t===this.gltf.images[e].extras)return e;const i=this.gltf.extras;switch(i.options.imageOutputType){case g.GLB:{const e=i.binChunkBuffer.addBufferView(E.UNSIGNED_BYTE,_.SCALAR),r=R(t).then((({data:e,type:t})=>(s.mimeType=t,e)));e.writeAsync(r).then((()=>{e.finalize()})),s.bufferView=e.index;break}case g.DataURI:s.uri=T(t);break;default:i.promises.push(R(t).then((({data:e,type:t})=>{s.uri=e,s.mimeType=t})))}}const i=this.gltf.images.length;return this.gltf.images.push(s),this._imageMap.set(e,i),i}_addSampler(e){this.gltf.samplers||(this.gltf.samplers=[]);let t=b.REPEAT,s=b.REPEAT;if("string"==typeof e.wrap)switch(e.wrap){case"clamp":t=b.CLAMP_TO_EDGE,s=b.CLAMP_TO_EDGE;break;case"mirror":t=b.MIRRORED_REPEAT,s=b.MIRRORED_REPEAT}else{switch(e.wrap.vertical){case"clamp":s=b.CLAMP_TO_EDGE;break;case"mirror":s=b.MIRRORED_REPEAT}switch(e.wrap.horizontal){case"clamp":t=b.CLAMP_TO_EDGE;break;case"mirror":t=b.MIRRORED_REPEAT}}const i={wrapS:t,wrapT:s};for(let a=0;a<this.gltf.samplers.length;++a)if(JSON.stringify(i)===JSON.stringify(this.gltf.samplers[a]))return a;const r=this.gltf.samplers.length;return this.gltf.samplers.push(i),r}_addAccessor(e,t){this.gltf.accessors||(this.gltf.accessors=[]);const s={bufferView:e,byteOffset:t.byteOffset,componentType:t.componentType,count:t.count,type:t.type,min:t.min,max:t.max,name:t.name};t.normalized&&(s.normalized=!0);const i=this.gltf.accessors.length;return this.gltf.accessors.push(s),i}_addMeshVertexIndexed(e,t,s,i,r,a,o,n){for(const l of t){e.startAccessor("INDICES");for(let s=0;s<l.faces.length;++s)e.push(l.faces[s]);const t=e.endAccessor(),c={attributes:{POSITION:i},indices:this._addAccessor(e.index,t),material:this._addMaterial(l.material)};r&&"flat"!==l.shading&&(c.attributes.NORMAL=r),a&&(c.attributes.TEXCOORD_0=a),o&&"flat"!==l.shading&&(c.attributes.TANGENT=o),n&&(c.attributes.COLOR_0=n),s.primitives.push(c)}}_addMeshVertexNonIndexed(e,t,s,i,r,a,o){const n={attributes:{POSITION:s}};i&&(n.attributes.NORMAL=i),r&&(n.attributes.TEXCOORD_0=r),a&&(n.attributes.TANGENT=a),o&&(n.attributes.COLOR_0=o),e&&(n.material=this._addMaterial(e[0].material)),t.primitives.push(n)}}export{M as GLTF};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../../core/has.js";import e from"../../../../../core/Error.js";import{isSome as t,isNone as n}from"../../../../../core/maybe.js";import{isDataProtocol as r,dataComponents as a}from"../../../../../core/urlUtils.js";function i(e){const n=
|
|
5
|
+
import"../../../../../core/has.js";import e from"../../../../../core/Error.js";import{isSome as t,isNone as n}from"../../../../../core/maybe.js";import{isDataProtocol as r,dataComponents as a}from"../../../../../core/urlUtils.js";function i(e){const n=c(e);return t(n)?n.toDataURL():""}async function o(t){const r=c(t);if(n(r))throw new e("imageToArrayBuffer","Unsupported image type");const a=await m(t),i=await new Promise((e=>r.toBlob(e,a)));if(!i)throw new e("imageToArrayBuffer","Failed to encode image");return{data:await i.arrayBuffer(),type:a}}async function m(e){if(!(e instanceof HTMLImageElement))return"image/png";const t=e.src;if(r(t)){const e=a(t);return"image/jpeg"===e?.mediaType?e.mediaType:"image/png"}return/\.png$/i.test(t)?"image/png":/\.(jpg|jpeg)$/i.test(t)?"image/jpeg":"image/png"}function c(e){if(e instanceof HTMLCanvasElement)return e;if(e instanceof HTMLVideoElement)return null;const t=document.createElement("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");return e instanceof HTMLImageElement?n.drawImage(e,0,0,e.width,e.height):e instanceof ImageData&&n.putImageData(e,0,0),t}function s(e){const t=[],n=new Uint8Array(e);for(let r=0;r<n.length;r++)t.push(String.fromCharCode(n[r]));return"data:application/octet-stream;base64,"+btoa(t.join(""))}function g(e){if(e.byteLength<8)return!1;const t=new Uint8Array(e);return 137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]&&13===t[4]&&10===t[5]&&26===t[6]&&10===t[7]}export{s as encodeBase64DataUri,o as imageToArrayBuffer,i as imageToDataURI,c as imageTypeToCanvas,g as isArrayBufferPNG};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{eachAlways as e}from"../../../../../core/promiseUtils.js";import t from"../../../../Point.js";import{GLB as r}from"./glb.js";import{GLTF as o}from"./gltf.js";import{ImageOutputType as n,BufferOutputType as s}from"./types.js";export{AlphaMode,AttributeType,BufferOutputType,ColorMode,ImageOutputType,MeshMode}from"./types.js";import{isArrayBufferPNG as i,encodeBase64DataUri as u}from"./imageutils.js";export{Asset}from"./asset.js";export{Scene}from"./scene.js";export{Node}from"./node.js";const f="model.gltf",p="model.glb";function a(a,m,c){const l=new o(a,m=m||{},c);let g=l.params;g?g.origin||(g.origin=new t({x:-1,y:-1,z:-1})):g={origin:new t({x:-1,y:-1,z:-1})};const y=g.origin,d=l.gltf,j=d.extras
|
|
5
|
+
import{eachAlways as e}from"../../../../../core/promiseUtils.js";import t from"../../../../Point.js";import{GLB as r}from"./glb.js";import{GLTF as o}from"./gltf.js";import{ImageOutputType as n,BufferOutputType as s}from"./types.js";export{AlphaMode,AttributeType,BufferOutputType,ColorMode,ImageOutputType,MeshMode}from"./types.js";import{isArrayBufferPNG as i,encodeBase64DataUri as u}from"./imageutils.js";export{Asset}from"./asset.js";export{Scene}from"./scene.js";export{Node}from"./node.js";const f="model.gltf",p="model.glb";function a(a,m,c){const l=new o(a,m=m||{},c);let g=l.params;g?g.origin||(g.origin=new t({x:-1,y:-1,z:-1})):g={origin:new t({x:-1,y:-1,z:-1})};const y=g.origin,d=l.gltf,j=d.extras?.promises??[];let x=1,b=1,B=null;return e(j).then((()=>{const e={origin:y};delete d.extras;const t="number"==typeof m.jsonSpacing?m.jsonSpacing:4,o=JSON.stringify(d,((t,r)=>{if("extras"!==t){if(r instanceof ArrayBuffer){if(i(r))switch(m.imageOutputType){case n.DataURI:case n.GLB:break;case n.External:default:{const t=`img${b}.png`;return b++,e[t]=r,t}}switch(m.bufferOutputType){case s.DataURI:return u(r);case s.GLB:if(B)throw new Error("Already encountered an ArrayBuffer, there should only be one in the GLB format.");return void(B=r);case s.External:default:{const t=`data${x}.bin`;return x++,e[t]=r,t}}}return r}}),t);return m.bufferOutputType===s.GLB||m.imageOutputType===n.GLB?e[p]=new r(o,B).buffer:e[f]=o,e}))}function m(e,t){return a(e,{bufferOutputType:s.GLB,imageOutputType:n.GLB,jsonSpacing:0},t)}export{p as MODEL_NAME_GLB,f as MODEL_NAME_GLTF,m as exportGLB,a as exportGLTF};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Error.js";import{isSome as t,isNone as s}from"../../../core/maybe.js";import{whenOrAbort as r,eachAlwaysValues as o,isAborted as n,throwIfAborted as a}from"../../../core/promiseUtils.js";import{removeFile as i,makeRelative as l}from"../../../core/urlUtils.js";import c from"../../Point.js";async function
|
|
5
|
+
import e from"../../../core/Error.js";import{isSome as t,isNone as s}from"../../../core/maybe.js";import{whenOrAbort as r,eachAlwaysValues as o,isAborted as n,throwIfAborted as a}from"../../../core/promiseUtils.js";import{removeFile as i,makeRelative as l}from"../../../core/urlUtils.js";import c from"../../Point.js";async function u(e,s,o){const{loadGLTFMesh:n}=await r(import("./loadGLTFMesh.js"),o),a=await m(s,o),i=n(new c({x:0,y:0,z:0,spatialReference:e.spatialReference}),a.url,{resolveFile:f(a),useTransform:!0,signal:t(o)?o.signal:null});i.then((()=>a.dispose()),(()=>a.dispose()));const{vertexAttributes:l,components:u}=await i;e.vertexAttributes=l,e.components=u}function f(e){const t=i(e.url);return s=>{const r=l(s,t,t),o=r?r.replace(/^ *\.\//,""):null;return(o?e.files.get(o):null)??s}}async function m(e,t){return e instanceof Blob?y.fromBlob(e):"string"==typeof e?new y(e):Array.isArray(e)?p(e,t):w(e,t)}async function p(t,r){const i=new Map;let l=null;const c=await o(t.map((async e=>({name:e.name,source:await m(e instanceof Blob?e:e.source,r)})))),u=[];for(const e of c)e&&(n(r)?e.source.dispose():u.push(e));a(r);for(const{name:e,source:o}of u)(s(l)||/\.(gltf|glb)/i.test(e))&&(l=o.url),i.set(e,o.url),o.files&&o.files.forEach(((e,t)=>i.set(t,e)));if(s(l))throw new e("mesh-load-external:missing-files","Missing files to load external mesh source");return new y(l,(()=>u.forEach((({source:e})=>e.dispose()))),i)}async function w(e,t){const{default:s}=await r(import("../../../request.js"),t),o="string"==typeof e.multipart[0]?await Promise.all(e.multipart.map((async e=>(await s(e,{responseType:"array-buffer"})).data))):e.multipart;return y.fromBlob(new Blob(o))}class y{constructor(e,t=(()=>{}),s=new Map){this.url=e,this.dispose=t,this.files=s}static fromBlob(e){const t=URL.createObjectURL(e);return new y(t,(()=>URL.revokeObjectURL(t)))}}export{u as loadExternal};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../Color.js";import t from"../../../request.js";import{getOrCreateMapValue as r}from"../../../core/MapUtils.js";import{hasScaling as o}from"../../../core/mathUtils.js";import{isSome as n,unwrap as s,applySome as i,isNone as a}from"../../../core/maybe.js";import{b as
|
|
5
|
+
import e from"../../../Color.js";import t from"../../../request.js";import{getOrCreateMapValue as r}from"../../../core/MapUtils.js";import{hasScaling as o}from"../../../core/mathUtils.js";import{isSome as n,unwrap as s,applySome as i,isNone as a}from"../../../core/maybe.js";import{b as c}from"../../../chunks/mat3.js";import{c as u}from"../../../chunks/mat3f64.js";import{f as l}from"../../../chunks/vec3f64.js";import{f}from"../../../chunks/vec4f64.js";import m from"../MeshComponent.js";import p from"../MeshMaterialMetallicRoughness.js";import g from"../MeshTexture.js";import{MeshVertexAttributes as d}from"../MeshVertexAttributes.js";import{BufferViewVec4f as x,BufferViewVec4u8 as T,BufferViewVec4u16 as h,BufferViewVec3u8 as v,BufferViewVec3f as w,BufferViewVec3u16 as b,BufferViewVec3f64 as j,BufferViewVec2f as y}from"../buffer/BufferView.js";import{t as A,a as M,n as C,s as R,b as E}from"../../../chunks/vec32.js";import{t as k,n as B,s as F,a as $}from"../../../chunks/vec42.js";import{createBuffer as I}from"../buffer/utils.js";import{georeferenceByTransform as L}from"./georeference.js";import{DefaultLoadingContext as S}from"../../../views/3d/glTF/DefaultLoadingContext.js";import{load as N}from"../../../views/3d/glTF/loader.js";import{triangleFanToTriangles as O,triangleStripToTriangles as _,trianglesToTriangles as D}from"../../../views/3d/glTF/internal/indexUtils.js";import{generateIndexArray as G}from"../../../views/3d/webgl-engine/lib/geometryDataUtils.js";import{COLOR_GAMMA as P}from"../../../views/3d/webgl-engine/materials/DefaultMaterial_COLOR_GAMMA.js";import{PrimitiveType as U,TextureWrapMode as V}from"../../../views/webgl/enums.js";import{f as q,c as z}from"../../../chunks/vec33.js";import{f as K,c as Q}from"../../../chunks/vec43.js";import{n as H,f as J}from"../../../chunks/vec22.js";async function W(e,t,r){const o=new S(X(r)),s=(await N(o,t,r,!0)).model,i=s.lods.shift(),a=new Map,c=new Map;s.textures.forEach(((e,t)=>a.set(t,te(e)))),s.materials.forEach(((e,t)=>c.set(t,re(e,a))));const u=ee(i);for(const n of u.parts)oe(u,n,c);const{position:l,normal:f,tangent:m,color:p,texCoord0:g}=u.vertexAttributes,x={position:l.typedBuffer,normal:n(f)?f.typedBuffer:null,tangent:n(m)?m.typedBuffer:null,uv:n(g)?g.typedBuffer:null,color:n(p)?p.typedBuffer:null},T=L(x,e,r);return{transform:T.transform,components:u.components,spatialReference:e.spatialReference,vertexAttributes:new d({position:T.vertexAttributes.position,normal:T.vertexAttributes.normal,tangent:T.vertexAttributes.tangent,color:x.color,uv:x.uv})}}function X(e){const r=e?.resolveFile;return r?{busy:!1,request:async(e,o,s)=>{const i=r(e),a="image"===o?"image":"binary"===o?"array-buffer":"json";return(await t(i,{responseType:a,signal:n(s)?s.signal:null})).data}}:null}function Y(e,t){if(a(e))return"-";const o=e.typedBuffer;return`${r(t,o.buffer,(()=>t.size))}/${o.byteOffset}/${o.byteLength}`}function Z(e){return n(e)?e.toString():"-"}function ee(e){let t=0;const has={color:!1,tangent:!1,normal:!1,texCoord0:!1},o=new Map,n=new Map,s=[];for(const i of e.parts){const{attributes:{position:e,normal:a,color:c,tangent:u,texCoord0:l}}=i,f=`\n ${Y(e,o)}/\n ${Y(a,o)}/\n ${Y(c,o)}/\n ${Y(u,o)}/\n ${Y(l,o)}/\n ${Z(i.transform)}\n `;let m=!1;const p=r(n,f,(()=>(m=!0,{start:t,length:e.count})));m&&(t+=e.count),a&&(has.normal=!0),c&&(has.color=!0),u&&(has.tangent=!0),l&&(has.texCoord0=!0),s.push({gltf:i,writeVertices:m,region:p})}return{vertexAttributes:{position:I(j,t),normal:has.normal?I(w,t):null,tangent:has.tangent?I(x,t):null,color:has.color?I(T,t):null,texCoord0:has.texCoord0?I(y,t):null},parts:s,components:[]}}function te(e){return new g({data:e.data,wrap:ae(e.parameters.wrap)})}function re(t,r){const o=new e(le(t.color,t.opacity)),n=t.emissiveFactor?new e(fe(t.emissiveFactor)):null;return new p({color:o,colorTexture:s(i(t.textureColor,(e=>r.get(e)))),normalTexture:s(i(t.textureNormal,(e=>r.get(e)))),emissiveColor:n,emissiveTexture:s(i(t.textureEmissive,(e=>r.get(e)))),occlusionTexture:s(i(t.textureOcclusion,(e=>r.get(e)))),alphaMode:ie(t.alphaMode),alphaCutoff:t.alphaCutoff,doubleSided:t.doubleSided,metallic:t.metallicFactor,roughness:t.roughnessFactor,metallicRoughnessTexture:s(i(t.textureMetallicRoughness,(e=>r.get(e)))),colorTextureTransform:t.colorTextureTransform,normalTextureTransform:t.normalTextureTransform,occlusionTextureTransform:t.occlusionTextureTransform,emissiveTextureTransform:t.emissiveTextureTransform,metallicRoughnessTextureTransform:t.metallicRoughnessTextureTransform})}function oe(e,t,r){t.writeVertices&&ne(e,t);const o=t.gltf,n=se(o.indices||o.attributes.position.count,o.primitiveType),s=t.region.start;if(s)for(let i=0;i<n.length;i++)n[i]+=s;e.components.push(new m({faces:n,material:r.get(o.material),trustSourceNormals:!0}))}function ne(e,t){const{position:r,normal:s,tangent:i,color:a,texCoord0:l}=e.vertexAttributes,f=t.region.start,{attributes:m,transform:p}=t.gltf,g=m.position.count;if(A(r.slice(f,g),m.position,p),n(m.normal)&&n(s)){const e=c(u(),p),t=s.slice(f,g);M(t,m.normal,e),o(e)&&C(t,t)}else n(s)&&q(s,0,0,1,{dstIndex:f,count:g});if(n(m.tangent)&&n(i)){const e=c(u(),p),t=i.slice(f,g);k(t,m.tangent,e),o(e)&&B(t,t)}else n(i)&&K(i,0,0,1,1,{dstIndex:f,count:g});if(n(m.texCoord0)&&n(l)?H(l.slice(f,g),m.texCoord0):n(l)&&J(l,0,0,{dstIndex:f,count:g}),n(m.color)&&n(a)){const e=m.color,t=a.slice(f,g);if(4===e.elementCount)e instanceof x?F(t,e,255):e instanceof T?Q(t,e):e instanceof h&&$(t,e,8);else{K(t,255,255,255,255);const r=v.fromTypedArray(t.typedBuffer,t.typedBufferStride);e instanceof w?R(r,e,255):e instanceof v?z(r,e):e instanceof b&&E(r,e,8)}}else n(a)&&K(a.slice(f,g),255,255,255,255)}function se(e,t){switch(t){case U.TRIANGLES:return D(e,G);case U.TRIANGLE_STRIP:return _(e);case U.TRIANGLE_FAN:return O(e)}}function ie(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend"}}function ae(e){return{horizontal:ce(e.s),vertical:ce(e.t)}}function ce(e){switch(e){case V.CLAMP_TO_EDGE:return"clamp";case V.MIRRORED_REPEAT:return"mirror";case V.REPEAT:return"repeat"}}function ue(e){return e**(1/P)*255}function le(e,t){return f(ue(e[0]),ue(e[1]),ue(e[2]),t)}function fe(e){return l(ue(e[0]),ue(e[1]),ue(e[2]))}export{W as loadGLTFMesh};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Logger.js";import{isNone as t,isSome as r}from"../../../core/maybe.js";import{a as o,g as n}from"../../../chunks/vec3.js";import{c as s}from"../../../chunks/vec3f64.js";import i from"../MeshComponent.js";import a from"../MeshTransform.js";import{MeshVertexAttributes as l}from"../MeshVertexAttributes.js";import{georeferenceApplyTransform as f,ungeoreference as c}from"./georeference.js";const m=e.getLogger("esri.geometry.support.triangleMeshMerge");function u(e,r){if(0===e.length)return m.error("merge()","Must specify one more geometries to merge"),null;const o=e[0].spatialReference;for(const t of e){if(!t.spatialReference.equals(o))return m.error("merge()","Geometries must all be in the same spatial reference"),null;if(!t.loaded)return m.error("merge()","Geometries must all be loaded before merging"),null}const n=g(e);if(t(n))return null;const s=d(e),i=[],a={position:0,uv:0,normal:0,tangent:0,color:0},l=new Map,f=new Map;for(const t of e){const e=p(t,n);if(r&&r.reuseMaterials&&t.components)for(const r of t.components)r.material&&l.set(r.material,r.material);v(t,a,l,f,i),A("position",e,s,a,0),A("normal",e,s,a,0),A("tangent",e,s,a,0),A("uv",t.vertexAttributes,s,a,0),A("color",t.vertexAttributes,s,a,255)}return{vertexAttributes:s,components:i,transform:n.transform,spatialReference:o}}function g(e){let i=null,l=!0;const f=s();let c=0,u=!1;for(const n of e)if(!r(i)||!t(n.transform)&&n.transform.equals(i)||(l=!1),r(n.transform)){if(
|
|
5
|
+
import e from"../../../core/Logger.js";import{isNone as t,isSome as r}from"../../../core/maybe.js";import{a as o,g as n}from"../../../chunks/vec3.js";import{c as s}from"../../../chunks/vec3f64.js";import i from"../MeshComponent.js";import a from"../MeshTransform.js";import{MeshVertexAttributes as l}from"../MeshVertexAttributes.js";import{georeferenceApplyTransform as f,ungeoreference as c}from"./georeference.js";const m=e.getLogger("esri.geometry.support.triangleMeshMerge");function u(e,r){if(0===e.length)return m.error("merge()","Must specify one more geometries to merge"),null;const o=e[0].spatialReference;for(const t of e){if(!t.spatialReference.equals(o))return m.error("merge()","Geometries must all be in the same spatial reference"),null;if(!t.loaded)return m.error("merge()","Geometries must all be loaded before merging"),null}const n=g(e);if(t(n))return null;const s=d(e),i=[],a={position:0,uv:0,normal:0,tangent:0,color:0},l=new Map,f=new Map;for(const t of e){const e=p(t,n);if(r&&r.reuseMaterials&&t.components)for(const r of t.components)r.material&&l.set(r.material,r.material);v(t,a,l,f,i),A("position",e,s,a,0),A("normal",e,s,a,0),A("tangent",e,s,a,0),A("uv",t.vertexAttributes,s,a,0),A("color",t.vertexAttributes,s,a,255)}return{vertexAttributes:s,components:i,transform:n.transform,spatialReference:o}}function g(e){let i=null,l=!0;const f=s();let c=0,u=!1;for(const n of e)if(!r(i)||!t(n.transform)&&n.transform.equals(i)||(l=!1),r(n.transform)){if(i&&i.geographic!==n.transform.geographic)return m.error("merge()","Inconsistent geographic mode for provided geometries transform. Some are geographic while others are not, unable to merge geometries."),null;t(i)&&(i=n.transform),n.transform.geographic&&(u=!0),c++,o(f,f,n.transform.origin)}if(t(i))return{transform:null,rebake:!1};if(l)return{transform:i.clone(),rebake:!1};const g=n(f,f,1/c);return{transform:new a({origin:g,geographic:u}),rebake:!0}}function p(e,t){if(!t.rebake)return e.vertexAttributes;const o=f(e.vertexAttributes,e.transform,e.spatialReference);return r(t.transform)?c(o,t.transform.getOriginPoint(e.spatialReference),{geographic:t.transform.geographic}):o}function h(e,t){return t.normal>0&&!e.vertexAttributes.normal}function b(e,t,r){h(e,t)&&"source"===r.shading&&(r.shading="flat")}function v(e,t,r,o,n){if(e.components)for(const s of e.components){const i=s.cloneWithDeduplication(r,o),a=t.position/3;if(i.faces)for(let e=0;e<i.faces.length;e++)i.faces[e]+=a;else{i.faces=new Uint32Array(e.vertexAttributes.position.length/3);for(let e=0;e<i.faces.length;e++)i.faces[e]=e+a}b(e,t,i),n.push(i)}else if(e.vertexAttributes&&e.vertexAttributes.position){const r=e.vertexAttributes.position.length/3,o=new Uint32Array(r),s=t.position/3;for(let e=0;e<r;e++)o[e]=e+s;const a=new i({faces:o});b(e,t,a),n.push(a)}}function A(e,o,n,s,i){if(!o)return;const a=o.position;if(!a)return;const l=o[e],f=n[e];if(t(l)){let t=s[e];const o=y[e];if(r(f)){for(let e=0;e<a.length;e+=3)for(let r=0;r<o;r++)f[t++]=i;s[e]=t}}else r(f)&&r(l)&&(x(l,0,f,s[e],l.length),s[e]+=l.length)}function x(e,t,r,o,n){for(let s=0;s<n;s++)r[o++]=e[t++];return r}function w(e){let t=!1,r=!1,o=!1,n=!1;for(const s of e){const e=s.vertexAttributes;if(e&&e.position&&(e.uv&&(t=!0),e.normal&&(r=!0),e.tangent&&(n=!0),e.color&&(o=!0),r&&t&&o&&n))break}return{normal:r,uv:t,color:o,tangent:n}}function d(e){let t=0,r=0,o=0,n=0,s=0;const i=w(e);for(const a of e){const e=a.vertexAttributes;e&&e.position&&(t+=e.position.length,i.uv&&(r+=e.position.length/y.position*y.uv),i.normal&&(o+=e.position.length/y.position*y.normal),i.color&&(n+=e.position.length/y.position*y.color),i.tangent&&(s+=e.position.length/y.position*y.tangent))}return new l({position:new Float64Array(t),uv:r?new Float32Array(r):null,normal:o?new Float32Array(o):null,tangent:s?new Float32Array(s):null,color:n?new Uint8Array(n):null})}const y={position:3,normal:3,tangent:4,uv:2,color:4};export{u as merge};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../core/Logger.js";import{isSome as r}from"../../../core/maybe.js";import{f as e}from"../../../chunks/mat3.js";import{c as o}from"../../../chunks/mat3f64.js";import{c as i}from"../../../chunks/mat4f64.js";import{a as n,t as s}from"../../../chunks/vec3.js";import{c as a}from"../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as f}from"../../projection.js";import{getSphericalPCPF as m}from"../../projectionEllipsoid.js";import{isGeographicMesh as c}from"./geographicUtils.js";import{projectToPCPF as p,projectNormalToPCPF as g,projectTangentToPCPF as l,projectFromPCPF as u,projectNormalFromPCPF as h,projectTangentFromPCPF as j}from"./projection.js";function x(e,o,i){if(e.vertexAttributes&&e.vertexAttributes.position)if(r(e.transform))null!=i?.geographic&&i.geographic!==e.transform.geographic&&t.getLogger("esri.geometry.support.meshUtils.offset").warn(`Specifying the 'geographic' parameter (${i.geographic}) different from the Mesh transform setting (${e.transform.geographic}) is not supported`),A(e.transform,o);else{c(e.spatialReference,i)?v(e,o):b(e,o)}}function A(t,r){const e=t.origin;t.origin=n(a(),e,r)}function v(t,o){const i=t.spatialReference,n=t.vertexAttributes.position,a=t.vertexAttributes.normal,c=t.vertexAttributes.tangent,x=new Float64Array(n.length),A=r(a)?new Float32Array(a.length):null,v=r(c)?new Float32Array(c.length):null,b=t.extent.center,F=d;f(i,[b.x,b.y,b.z],k,m(i)),e(w,k),s(F,o,w),p(n,i,x),r(a)&&g(a,n,x,i,A),r(c)&&l(c,n,x,i,v),y(x,F),u(x,n,i),r(a)&&h(A,n,x,i,a),r(c)&&j(v,n,x,i,c),t.vertexAttributesChanged()}function b(t,r){y(t.vertexAttributes.position,r),t.vertexAttributesChanged()}function y(t,r){if(t)for(let e=0;e<t.length;e+=3)for(let o=0;o<3;o++)t[e+o]+=r[o]}const d=a(),k=i(),w=o();export{x as offset};
|
|
5
|
+
import t from"../../../core/Logger.js";import{isSome as r}from"../../../core/maybe.js";import{f as e}from"../../../chunks/mat3.js";import{c as o}from"../../../chunks/mat3f64.js";import{c as i}from"../../../chunks/mat4f64.js";import{a as n,t as s}from"../../../chunks/vec3.js";import{c as a}from"../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as f}from"../../projection.js";import{getSphericalPCPF as m}from"../../projectionEllipsoid.js";import{isGeographicMesh as c}from"./geographicUtils.js";import{projectToPCPF as p,projectNormalToPCPF as g,projectTangentToPCPF as l,projectFromPCPF as u,projectNormalFromPCPF as h,projectTangentFromPCPF as j}from"./projection.js";function x(e,o,i){if(e.vertexAttributes&&e.vertexAttributes.position)if(r(e.transform))null!=i?.geographic&&i.geographic!==e.transform.geographic&&t.getLogger("esri.geometry.support.meshUtils.offset").warn(`Specifying the 'geographic' parameter (${i.geographic}) different from the Mesh transform setting (${e.transform.geographic}) is not supported`),A(e.transform,o);else{c(e.spatialReference,i)?v(e,o):b(e,o)}}function A(t,r){const e=t.origin;t.origin=n(a(),e,r)}function v(t,o){const i=t.spatialReference,n=t.vertexAttributes.position,a=t.vertexAttributes.normal,c=t.vertexAttributes.tangent,x=new Float64Array(n.length),A=r(a)?new Float32Array(a.length):null,v=r(c)?new Float32Array(c.length):null,b=t.extent.center,F=d;f(i,[b.x,b.y,b.z],k,m(i)),e(w,k),s(F,o,w),p(n,i,x),r(a)&&r(A)&&g(a,n,x,i,A),r(c)&&r(v)&&l(c,n,x,i,v),y(x,F),u(x,n,i),r(a)&&r(A)&&h(A,n,x,i,a),r(c)&&r(v)&&j(v,n,x,i,c),t.vertexAttributesChanged()}function b(t,r){y(t.vertexAttributes.position,r),t.vertexAttributesChanged()}function y(t,r){if(t)for(let e=0;e<t.length;e+=3)for(let o=0;o<3;o++)t[e+o]+=r[o]}const d=a(),k=i(),w=o();export{x as offset};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../core/Logger.js";import{isSome as e,isNone as r}from"../../../core/maybe.js";import{f as o}from"../../../chunks/mat3.js";import{c as i}from"../../../chunks/mat3f64.js";import{d as n}from"../../../chunks/mat4.js";import{c as s}from"../../../chunks/mat4f64.js";import{s as a,b as c,a as f,t as p,m}from"../../../chunks/vec3.js";import{c as g,Z as l}from"../../../chunks/vec3f64.js";import{projectPointToVector as u,computeTranslationToOriginAndRotation as h}from"../../projection.js";import{getSphericalPCPF as j}from"../../projectionEllipsoid.js";import{create as v,compose as x,axis as A,angleRad as b}from"../axisAngleDegrees.js";import{isGeographicMesh as d}from"./geographicUtils.js";import{projectToPCPF as k,projectNormalToPCPF as y,projectTangentToPCPF as w,projectFromPCPF as R,projectNormalFromPCPF as F,projectTangentFromPCPF as L}from"./projection.js";const $=t.getLogger("esri.geometry.support.meshUtils.rotate");function z(t,r,o){if(!t.vertexAttributes||!t.vertexAttributes.position||0===r[3])return;const i=t.spatialReference;if(e(t.transform)){null!=o?.geographic&&o.geographic!==t.transform.geographic&&$.warn(`Specifying the 'geographic' parameter (${o.geographic}) different from the Mesh transform setting (${t.transform.geographic}) is not supported`);const e=o?.origin??t.transform.getOriginPoint(i);C(t.transform,r,e)}else{const e=o?.origin??t.origin;d(t.spatialReference,o)?I(t,r,e):U(t,r,e)}}function C(t,e,r){const o=a(E,r.x,r.y,r.z),i=c(E,o,t.origin);t.applyLocalInverse(i,M),t.rotation=x(t.rotation,e,v()),t.applyLocalInverse(i,i),c(i,i,M),t.translation=f(g(),t.translation,i)}function I(t,r,i){const n=t.spatialReference,s=j(n),a=Z;u(i,a,s)||u(t.origin,a,s);const c=t.vertexAttributes.position,f=t.vertexAttributes.normal,m=t.vertexAttributes.tangent,g=new Float64Array(c.length),l=e(f)?new Float32Array(f.length):null,v=e(m)?new Float32Array(m.length):null;h(s,a,P,s),o(S,P);const x=O;p(A(O),A(r),S),x[3]=r[3],k(c,n,g),e(f)&&y(f,c,g,n,l),e(m)&&w(m,c,g,n,v),D(g,x,3,a),R(g,c,n),e(f)&&(D(l,x,3),F(l,c,g,n,f)),e(m)&&(D(v,x,4),L(v,c,g,n,m)),t.vertexAttributesChanged()}function U(t,e,r){const o=Z;if(!u(r,o,t.spatialReference)){const e=t.origin;o[0]=e.x,o[1]=e.y,o[2]=e.z,$.error(`Failed to project specified origin (wkid:${r.spatialReference.wkid}) to mesh spatial reference (wkid:${t.spatialReference.wkid}).`)}D(t.vertexAttributes.position,e,3,o),D(t.vertexAttributes.normal,e,3),D(t.vertexAttributes.tangent,e,4),t.vertexAttributesChanged()}function D(t,e,o,i=l){if(!r(t)){n(P,b(e),A(e));for(let e=0;e<t.length;e+=o){for(let r=0;r<3;r++)E[r]=t[e+r]-i[r];m(E,E,P);for(let r=0;r<3;r++)t[e+r]=E[r]+i[r]}}}const E=g(),M=g(),O=v(),P=s(),S=i(),Z=g();export{z as rotate};
|
|
5
|
+
import t from"../../../core/Logger.js";import{isSome as e,isNone as r}from"../../../core/maybe.js";import{f as o}from"../../../chunks/mat3.js";import{c as i}from"../../../chunks/mat3f64.js";import{d as n}from"../../../chunks/mat4.js";import{c as s}from"../../../chunks/mat4f64.js";import{s as a,b as c,a as f,t as p,m}from"../../../chunks/vec3.js";import{c as g,Z as l}from"../../../chunks/vec3f64.js";import{projectPointToVector as u,computeTranslationToOriginAndRotation as h}from"../../projection.js";import{getSphericalPCPF as j}from"../../projectionEllipsoid.js";import{create as v,compose as x,axis as A,angleRad as b}from"../axisAngleDegrees.js";import{isGeographicMesh as d}from"./geographicUtils.js";import{projectToPCPF as k,projectNormalToPCPF as y,projectTangentToPCPF as w,projectFromPCPF as R,projectNormalFromPCPF as F,projectTangentFromPCPF as L}from"./projection.js";const $=t.getLogger("esri.geometry.support.meshUtils.rotate");function z(t,r,o){if(!t.vertexAttributes||!t.vertexAttributes.position||0===r[3])return;const i=t.spatialReference;if(e(t.transform)){null!=o?.geographic&&o.geographic!==t.transform.geographic&&$.warn(`Specifying the 'geographic' parameter (${o.geographic}) different from the Mesh transform setting (${t.transform.geographic}) is not supported`);const e=o?.origin??t.transform.getOriginPoint(i);C(t.transform,r,e)}else{const e=o?.origin??t.origin;d(t.spatialReference,o)?I(t,r,e):U(t,r,e)}}function C(t,e,r){const o=a(E,r.x,r.y,r.z),i=c(E,o,t.origin);t.applyLocalInverse(i,M),t.rotation=x(t.rotation,e,v()),t.applyLocalInverse(i,i),c(i,i,M),t.translation=f(g(),t.translation,i)}function I(t,r,i){const n=t.spatialReference,s=j(n),a=Z;u(i,a,s)||u(t.origin,a,s);const c=t.vertexAttributes.position,f=t.vertexAttributes.normal,m=t.vertexAttributes.tangent,g=new Float64Array(c.length),l=e(f)?new Float32Array(f.length):null,v=e(m)?new Float32Array(m.length):null;h(s,a,P,s),o(S,P);const x=O;p(A(O),A(r),S),x[3]=r[3],k(c,n,g),e(f)&&e(l)&&y(f,c,g,n,l),e(m)&&e(v)&&w(m,c,g,n,v),D(g,x,3,a),R(g,c,n),e(f)&&e(l)&&(D(l,x,3),F(l,c,g,n,f)),e(m)&&e(v)&&(D(v,x,4),L(v,c,g,n,m)),t.vertexAttributesChanged()}function U(t,e,r){const o=Z;if(!u(r,o,t.spatialReference)){const e=t.origin;o[0]=e.x,o[1]=e.y,o[2]=e.z,$.error(`Failed to project specified origin (wkid:${r.spatialReference.wkid}) to mesh spatial reference (wkid:${t.spatialReference.wkid}).`)}D(t.vertexAttributes.position,e,3,o),D(t.vertexAttributes.normal,e,3),D(t.vertexAttributes.tangent,e,4),t.vertexAttributesChanged()}function D(t,e,o,i=l){if(!r(t)){n(P,b(e),A(e));for(let e=0;e<t.length;e+=o){for(let r=0;r<3;r++)E[r]=t[e+r]-i[r];m(E,E,P);for(let r=0;r<3;r++)t[e+r]=E[r]+i[r]}}}const E=g(),M=g(),O=v(),P=s(),S=i(),Z=g();export{z as rotate};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Logger.js";import{isSome as t}from"../../../core/maybe.js";import{s as r,b as o,g as i,a as n}from"../../../chunks/vec3.js";import{c as s,Z as a}from"../../../chunks/vec3f64.js";import{projectPointToVector as c}from"../../projection.js";import{getSphericalPCPF as p}from"../../projectionEllipsoid.js";import{isGeographicMesh as f}from"./geographicUtils.js";import{projectToPCPF as g,projectNormalToPCPF as l,projectTangentToPCPF as m,projectFromPCPF as u,projectNormalFromPCPF as h,projectTangentFromPCPF as j}from"./projection.js";const v=e.getLogger("esri.geometry.support.meshUtils.scale");function d(e,r,o){if(!e.vertexAttributes||!e.vertexAttributes.position)return;const i=e.spatialReference;if(t(e.transform)){null!=o?.geographic&&o.geographic!==e.transform.geographic&&v.warn(`Specifying the 'geographic' parameter (${o.geographic}) different from the Mesh transform setting (${e.transform.geographic}) is not supported`);const t=o?.origin??e.transform.getOriginPoint(i);x(e.transform,r,t)}else{const t=f(e.spatialReference,o),i=o&&o.origin||e.origin;t?A(e,r,i):b(e,r,i)}}function x(e,t,a){const c=r(w,a.x,a.y,a.z),p=o(w,c,e.origin);e.applyLocalInverse(p,k);const f=i(s(),e.scale,t);e.scale=f,e.applyLocalInverse(p,p),o(p,p,k),e.translation=n(s(),e.translation,p)}function A(e,r,o){const i=e.spatialReference,n=p(i),s=R;c(o,s,n)||c(e.origin,s,n);const a=e.vertexAttributes.position,f=e.vertexAttributes.normal,v=e.vertexAttributes.tangent,d=new Float64Array(a.length),x=t(f)?new Float32Array(f.length):null,A=t(v)?new Float32Array(v.length):null;g(a,i,d),t(f)&&l(f,a,d,i,x),t(v)&&m(v,a,d,i,A),y(d,r,s),u(d,a,i),t(f)&&h(x,a,d,i,f),t(v)&&j(A,a,d,i,v),e.vertexAttributesChanged()}function b(e,t,r){const o=R;if(!c(r,o,e.spatialReference)){const t=e.origin;o[0]=t.x,o[1]=t.y,o[2]=t.z,v.error(`Failed to project specified origin (wkid:${r.spatialReference.wkid}) to mesh spatial reference (wkid:${e.spatialReference.wkid}).`)}y(e.vertexAttributes.position,t,o),e.vertexAttributesChanged()}function y(e,t,r=a){if(e)for(let o=0;o<e.length;o+=3){for(let t=0;t<3;t++)w[t]=e[o+t]-r[t];i(w,w,t);for(let t=0;t<3;t++)e[o+t]=w[t]+r[t]}}const w=s(),k=s(),R=s();export{d as scale};
|
|
5
|
+
import e from"../../../core/Logger.js";import{isSome as t}from"../../../core/maybe.js";import{s as r,b as o,g as i,a as n}from"../../../chunks/vec3.js";import{c as s,Z as a}from"../../../chunks/vec3f64.js";import{projectPointToVector as c}from"../../projection.js";import{getSphericalPCPF as p}from"../../projectionEllipsoid.js";import{isGeographicMesh as f}from"./geographicUtils.js";import{projectToPCPF as g,projectNormalToPCPF as l,projectTangentToPCPF as m,projectFromPCPF as u,projectNormalFromPCPF as h,projectTangentFromPCPF as j}from"./projection.js";const v=e.getLogger("esri.geometry.support.meshUtils.scale");function d(e,r,o){if(!e.vertexAttributes||!e.vertexAttributes.position)return;const i=e.spatialReference;if(t(e.transform)){null!=o?.geographic&&o.geographic!==e.transform.geographic&&v.warn(`Specifying the 'geographic' parameter (${o.geographic}) different from the Mesh transform setting (${e.transform.geographic}) is not supported`);const t=o?.origin??e.transform.getOriginPoint(i);x(e.transform,r,t)}else{const t=f(e.spatialReference,o),i=o&&o.origin||e.origin;t?A(e,r,i):b(e,r,i)}}function x(e,t,a){const c=r(w,a.x,a.y,a.z),p=o(w,c,e.origin);e.applyLocalInverse(p,k);const f=i(s(),e.scale,t);e.scale=f,e.applyLocalInverse(p,p),o(p,p,k),e.translation=n(s(),e.translation,p)}function A(e,r,o){const i=e.spatialReference,n=p(i),s=R;c(o,s,n)||c(e.origin,s,n);const a=e.vertexAttributes.position,f=e.vertexAttributes.normal,v=e.vertexAttributes.tangent,d=new Float64Array(a.length),x=t(f)?new Float32Array(f.length):null,A=t(v)?new Float32Array(v.length):null;g(a,i,d),t(f)&&t(x)&&l(f,a,d,i,x),t(v)&&t(A)&&m(v,a,d,i,A),y(d,r,s),u(d,a,i),t(f)&&t(x)&&h(x,a,d,i,f),t(v)&&t(A)&&j(A,a,d,i,v),e.vertexAttributesChanged()}function b(e,t,r){const o=R;if(!c(r,o,e.spatialReference)){const t=e.origin;o[0]=t.x,o[1]=t.y,o[2]=t.z,v.error(`Failed to project specified origin (wkid:${r.spatialReference.wkid}) to mesh spatial reference (wkid:${e.spatialReference.wkid}).`)}y(e.vertexAttributes.position,t,o),e.vertexAttributesChanged()}function y(e,t,r=a){if(e)for(let o=0;o<e.length;o+=3){for(let t=0;t<3;t++)w[t]=e[o+t]-r[t];i(w,w,t);for(let t=0;t<3;t++)e[o+t]=w[t]+r[t]}}const w=s(),k=s(),R=s();export{d as scale};
|