@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
1 lines • 15.6 kB
JavaScript
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[4314],{4151(t,e,s){s.d(e,{A:()=>i});class i{constructor(t=null,e=null,s=null){this.minValue=t,this.maxValue=e,this.noDataValue=s}}},5482(t,e,s){function i(t,e,s,i){var n,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,i);else for(var l=t.length-1;l>=0;l--)(n=t[l])&&(o=(r<3?n(o):r>3?n(e,s,o):n(e,s))||o);return r>3&&o&&Object.defineProperty(e,s,o),o}function n(t,e,s){if(null!=e){if("object"!=typeof e&&"function"!=typeof e)throw new TypeError("Object expected.");var i,n;if(s){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=e[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=e[Symbol.dispose],s&&(n=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");n&&(i=function(){try{n.call(this)}catch(t){return Promise.reject(t)}}),t.stack.push({value:e,dispose:i,async:s})}else s&&t.stack.push({async:!0});return e}s.d(e,{Cg:()=>i,hk:()=>o,mS:()=>n}),Object.create,Object.create;var r="function"==typeof SuppressedError?SuppressedError:function(t,e,s){var i=new Error(s);return i.name="SuppressedError",i.error=t,i.suppressed=e,i};function o(t){function e(e){t.error=t.hasError?new r(e,t.error,"An error was suppressed during disposal."):e,t.hasError=!0}var s,i=0;return function n(){for(;s=t.stack.pop();)try{if(!s.async&&1===i)return i=0,t.stack.push(s),Promise.resolve().then(n);if(s.dispose){var r=s.dispose.call(s.value);if(s.async)return i|=2,Promise.resolve(r).then(n,function(t){return e(t),n()})}else i|=1}catch(t){e(t)}if(1===i)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}},14140(t,e,s){s.d(e,{A:()=>f});var i,n=s(5482),r=s(49186),o=s(25482),l=s(4718),a=s(53966),h=s(91429),u=s(94778),c=s(4151);let f=class extends o.o{static{i=this}static createEmptyBand(t,e){return new(i.getPixelArrayConstructor(t))(e)}static combineBandMasks(t){if(t.length<2)return t[0];const e=t[0].length,s=new Uint8Array(e).fill(255);for(let i=0;i<t.length;i++){const n=t[i];for(let t=0;t<e;t++)n[t]||(s[t]=0)}return s}static getPixelArrayConstructor(t){let e;switch(t){case"u1":case"u2":case"u4":case"u8":e=Uint8Array;break;case"u16":e=Uint16Array;break;case"u32":e=Uint32Array;break;case"s8":e=Int8Array;break;case"s16":e=Int16Array;break;case"s32":e=Int32Array;break;case"f32":case"c64":case"c128":case"unknown":e=Float32Array;break;case"f64":e=Float64Array}return e}constructor(t){super(t),this.width=null,this.height=null,this.pixelType="f32",this.validPixelCount=null,this.mask=null,this.maskIsAlpha=!1,this.premultiplyAlpha=!1,this.statistics=null,this.depthCount=1}castPixelType(t){if(!t)return"f32";let e=t.toLowerCase();return["u1","u2","u4"].includes(e)?e="u8":["unknown","u8","s8","u16","s16","u32","s32","f32","f64"].includes(e)||(e="f32"),e}getPlaneCount(){return this.pixels?.length}addData(t){if(!t.pixels||t.pixels.length!==this.width*this.height)throw new r.A("pixelblock:invalid-or-missing-pixels","add data requires valid pixels array that has same length defined by pixel block width * height");this.pixels||(this.pixels=[]),this.statistics||(this.statistics=[]),this.pixels.push(t.pixels),this.statistics.push(t.statistics??new c.A)}getAsRGBA(){const t=new ArrayBuffer(this.width*this.height*4);switch(this.pixelType){case"s8":case"s16":case"u16":case"s32":case"u32":case"f32":case"f64":this._fillFromNon8Bit(t);break;default:this._fillFrom8Bit(t)}return new Uint8ClampedArray(t)}getAsRGBAFloat(){const t=new Float32Array(this.width*this.height*4);return this._fillFrom32Bit(t),t}updateStatistics(){if(!this.pixels)return;this.statistics=this.pixels.map(t=>function(t,e){let s=1/0,i=-1/0;const n=t.length;let r,o=0;if(null!=e)for(r=0;r<n;r++)e[r]&&(o=t[r],s=o<s?o:s,i=o>i?o:i);else for(r=0;r<n;r++)o=t[r],s=o<s?o:s,i=o>i?o:i;return new c.A(s,i)}(t,this.mask));const t=this.mask;let e=0;if(null!=t)for(let s=0;s<t.length;s++)t[s]&&e++;else e=this.width*this.height;this.validPixelCount=e}clamp(t){if(!t||"f64"===t||"f32"===t||!this.pixels)return;const[e,s]=(0,u.hP)(t),n=this.pixels,r=this.width*this.height,o=n.length;let l,a,h;const c=[];for(let u=0;u<o;u++){h=i.createEmptyBand(t,r),l=n[u];for(let t=0;t<r;t++)a=l[t],h[t]=a>s?s:a<e?e:a;c.push(h)}this.pixels=c,this.pixelType=t}extractBands(t){const{pixels:e,statistics:s}=this;if(null==t||0===t.length||!e||0===e.length)return this;const n=e.length,r=t.some(t=>t>=e.length),o=n===t.length&&!t.some((t,e)=>t!==e);if(r||o)return this;const l=this.bandMasks?.length===n?t.map(t=>this.bandMasks[t]):void 0;let{mask:a,validPixelCount:h}=this;const{width:u,height:c}=this;return l?.length&&(a=i.combineBandMasks(l),h=a.filter(t=>!!t).length),new i({pixelType:this.pixelType,width:u,height:c,mask:a,bandMasks:l,validPixelCount:h,maskIsAlpha:this.maskIsAlpha,pixels:t.map(t=>e[t]),statistics:s&&t.map(t=>s[t])})}clone(){const t=new i({width:this.width,height:this.height,pixelType:this.pixelType,maskIsAlpha:this.maskIsAlpha,validPixelCount:this.validPixelCount,premultiplyAlpha:this.premultiplyAlpha,depthCount:this.depthCount});let e;null!=this.mask&&(t.mask=new Uint8Array(this.mask)),this.noDataValues&&(t.noDataValues=[...this.noDataValues]),this.bandMasks&&(t.bandMasks=this.bandMasks.map(t=>new Uint8Array(t)));const s=i.getPixelArrayConstructor(this.pixelType);if(this.pixels&&this.pixels.length>0){t.pixels=[];const i=!!this.pixels[0].slice;for(e=0;e<this.pixels.length;e++)t.pixels[e]=i?this.pixels[e].slice():new s(this.pixels[e])}if(this.statistics)for(t.statistics=[],e=0;e<this.statistics.length;e++)t.statistics[e]=(0,l.o8)(this.statistics[e]);return t}getTransferableObject(){const{pixels:t,bandMasks:e,mask:s}=this;this.pixels=[],this.bandMasks=void 0,this.mask=void 0;const i=this.toJSON();this.pixels=t,this.bandMasks=e,this.mask=s,i.pixels=t?[...t]:t,i.bandMasks=e?[...e]:e,i.mask=s;const n=[];return[...t??[],s,...e??[]].filter(t=>null!=t&&ArrayBuffer.isView(t)).forEach(t=>{t&&!n.includes(t.buffer)&&n.push(t.buffer)}),{pixelBlock:i,transferList:n}}_fillFrom8Bit(t){const{mask:e,maskIsAlpha:s,premultiplyAlpha:i,pixels:n}=this;if(!t||!n?.length)return void a.A.getLogger(this).error("getAsRGBA()","Unable to convert to RGBA. The input pixel block is empty.");let r,o,l,h;r=o=l=n[0],n.length>=3?(o=n[1],l=n[2]):2===n.length&&(o=n[1]);const u=new Uint32Array(t),c=this.width*this.height;if(r.length===c)if(null!=e&&e.length===c)if(s)for(h=0;h<c;h++){const t=e[h];if(t){const e=t/255;u[h]=i?t<<24|l[h]*e<<16|o[h]*e<<8|r[h]*e:t<<24|l[h]<<16|o[h]<<8|r[h]}}else for(h=0;h<c;h++)e[h]&&(u[h]=255<<24|l[h]<<16|o[h]<<8|r[h]);else for(h=0;h<c;h++)u[h]=255<<24|l[h]<<16|o[h]<<8|r[h];else a.A.getLogger(this).error("getAsRGBA()","Unable to convert to RGBA. The pixelblock is invalid.")}_fillFromNon8Bit(t){const{pixels:e,mask:s,statistics:i}=this;if(!t||!e?.length)return void a.A.getLogger(this).error("getAsRGBA()","Unable to convert to RGBA. The input pixel block is empty.");const n=this.pixelType;let r=1,o=0,l=1;if(i&&i.length>0){for(const t of i)if(null!=t.minValue&&(o=Math.min(o,t.minValue)),null!=t.maxValue&&null!=t.minValue){const e=t.maxValue-t.minValue;l=Math.max(l,e)}r=255/l}else{let t=255;"s8"===n?(o=-128,t=127):"u16"===n?t=65535:"s16"===n?(o=-32768,t=32767):"u32"===n?t=4294967295:"s32"===n?(o=-2147483648,t=2147483647):"f32"===n?(o=-34e38,t=34e38):"f64"===n&&(o=-Number.MAX_VALUE,t=Number.MAX_VALUE),r=255/(t-o)}const h=new Uint32Array(t),u=this.width*this.height;let c,f,p,g,d;if(c=f=p=e[0],c.length!==u)return a.A.getLogger(this).error("getAsRGBA()","Unable to convert to RGBA. The pixelblock is invalid.");if(e.length>=2)if(f=e[1],e.length>=3&&(p=e[2]),null!=s&&s.length===u)for(g=0;g<u;g++)s[g]&&(h[g]=255<<24|(p[g]-o)*r<<16|(f[g]-o)*r<<8|(c[g]-o)*r);else for(g=0;g<u;g++)h[g]=255<<24|(p[g]-o)*r<<16|(f[g]-o)*r<<8|(c[g]-o)*r;else if(null!=s&&s.length===u)for(g=0;g<u;g++)d=(c[g]-o)*r,s[g]&&(h[g]=255<<24|d<<16|d<<8|d);else for(g=0;g<u;g++)d=(c[g]-o)*r,h[g]=255<<24|d<<16|d<<8|d}_fillFrom32Bit(t){const{pixels:e,mask:s}=this;if(!t||!e?.length)return a.A.getLogger(this).error("getAsRGBAFloat()","Unable to convert to RGBA. The input pixel block is empty.");let i,n,r,o;i=n=r=e[0],e.length>=3?(n=e[1],r=e[2]):2===e.length&&(n=e[1]);const l=this.width*this.height;if(i.length!==l)return a.A.getLogger(this).error("getAsRGBAFloat()","Unable to convert to RGBA. The pixelblock is invalid.");let h=0;if(null!=s&&s.length===l)for(o=0;o<l;o++)t[h++]=i[o],t[h++]=n[o],t[h++]=r[o],t[h++]=1&s[o];else for(o=0;o<l;o++)t[h++]=i[o],t[h++]=n[o],t[h++]=r[o],t[h++]=1}};(0,n.Cg)([(0,h.MZ)({json:{write:!0}})],f.prototype,"width",void 0),(0,n.Cg)([(0,h.MZ)({json:{write:!0}})],f.prototype,"height",void 0),(0,n.Cg)([(0,h.MZ)({json:{write:!0}})],f.prototype,"pixelType",void 0),(0,n.Cg)([(0,h.wg)("pixelType")],f.prototype,"castPixelType",null),(0,n.Cg)([(0,h.MZ)({json:{write:!0}})],f.prototype,"validPixelCount",void 0),(0,n.Cg)([(0,h.MZ)({json:{write:!0}})],f.prototype,"mask",void 0),(0,n.Cg)([(0,h.MZ)({json:{write:!0}})],f.prototype,"maskIsAlpha",void 0),(0,n.Cg)([(0,h.MZ)({json:{write:!0}})],f.prototype,"pixels",void 0),(0,n.Cg)([(0,h.MZ)()],f.prototype,"premultiplyAlpha",void 0),(0,n.Cg)([(0,h.MZ)({json:{write:!0}})],f.prototype,"statistics",void 0),(0,n.Cg)([(0,h.MZ)({json:{write:!0}})],f.prototype,"depthCount",void 0),(0,n.Cg)([(0,h.MZ)({json:{write:!0}})],f.prototype,"noDataValues",void 0),(0,n.Cg)([(0,h.MZ)({json:{write:!0}})],f.prototype,"bandMasks",void 0),f=i=(0,n.Cg)([(0,h.$K)("esri.layers.support.PixelBlock")],f)},34727(t,e,s){s.d(e,{$8:()=>M,Cc:()=>o,Hx:()=>d,Io:()=>x,KJ:()=>h,OS:()=>B,Sp:()=>f,XM:()=>u,YN:()=>c,ZH:()=>g,b6:()=>k,cU:()=>n,gg:()=>p,hs:()=>l,kU:()=>a,or:()=>C,pF:()=>F,pq:()=>P,qE:()=>r});const i=new Float32Array(1);function n(t){--t;for(let e=1;e<32;e<<=1)t|=t>>e;return t+1}function r(t,e,s){return Math.min(Math.max(t,e),s)}function o(t,e,s){return t+(e-t)*s}function l(t,e,s,i,n){return o(i,n,(t-e)/(s-e))}function a(t){return t*Math.PI/180}function h(t){return 180*t/Math.PI}function u(t){return Math.acos(r(t,-1,1))}function c(t){return Math.asin(r(t,-1,1))}function f(t,e,s=1e-6){return t===e||!(!Number.isFinite(t)||!Number.isFinite(e))&&(t>e?t-e:e-t)<=s}function p(t,e,s=1e-6){return!f(t,e,s)&&t>e}function g(t,e,s=1e-6){return!f(t,e,s)&&t<e}function d(t,e,s=1e-6){return f(t,e,s)||t>e}const m=new DataView(new ArrayBuffer(Float64Array.BYTES_PER_ELEMENT));function y(t){return m.setFloat64(0,t),m.getBigInt64(0)}const b=1000000n,A=w(1);function w(t){const e=y(t=Math.abs(t)),s=function(t){return m.setBigInt64(0,t),m.getFloat64(0)}(e<=b?b:e-b);return Math.abs(t-s)}function x(t,e,s=A){if(t===e)return!0;if(!Number.isFinite(t)||!Number.isFinite(e))return!1;if(null!=s&&w(Math.min(Math.abs(t),Math.abs(e)))<s)return Math.abs(t-e)<=s;const i=y(t),n=y(e);return i<0==n<0&&!((i<n?n-i:i-n)>b)}function k(t,e,s=1e-6){if(t===e)return!0;if(!Number.isFinite(t)||!Number.isFinite(e))return!1;const i=Math.abs(t-e),n=Math.abs(t),r=Math.abs(e);if(0===t||0===e||n<1e-12&&r<1e-12){if(i>.01*s)return!1}else if(i/(n+r)>s)return!1;return!0}function M(t){return v(Math.max(-P,Math.min(t,P)))}function v(t){return i[0]=t,i[0]}function C(t){const e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],s=t[3]*t[3]+t[4]*t[4]+t[5]*t[5],i=t[6]*t[6]+t[7]*t[7]+t[8]*t[8];return!(f(e,1)&&f(s,1)&&f(i,1))}function B(t,e){return(t%e+e)%e}const P=v(34028234663852886e22);function F(t,e,s){if(void 0===s||0===+s)return Math[t](e);if(e=+e,s=+s,isNaN(e)||"number"!=typeof s||s%1!=0)return NaN;let i=e.toString().split("e");return i=(e=Math[t](+(i[0]+"e"+(i[1]?+i[1]-s:-s)))).toString().split("e"),+(i[0]+"e"+(i[1]?+i[1]+s:s))}},91869(t,e,s){function i(t,e){for(const s of t.values())if(e(s))return!0;return!1}function n(t,e,s){const i=t.get(e);if(void 0!==i)return i;const n=s();return t.set(e,n),n}function r(t){const e=new Map;return s=>(e.has(s)||e.set(s,t(s)),e.get(s))}s.d(e,{Bj:()=>r,Bs:()=>i,tE:()=>n})},94778(t,e,s){s.d(e,{$p:()=>a,Sp:()=>h,X1:()=>r,hP:()=>n,yM:()=>l,zw:()=>o});const i={u1:[0,1],u2:[0,3],u4:[0,15],u8:[0,255],s8:[-128,127],u16:[0,65535],s16:[-32768,32767],u32:[0,4294967295],s32:[-2147483648,2147483647],f32:[-34028234663852886e22,34028234663852886e22],f64:[-Number.MAX_VALUE,Number.MAX_VALUE],unknown:void 0,c64:void 0,c128:void 0};function n(t){return i[t]??[-34028234663852886e22,34028234663852886e22]}function r(t,e){return null==t||null==e?"s32":t<0?t>=-128&&e<128?"s8":t>=-32768&&e<32768?"s16":"s32":e<256?"u8":e<65536?"u16":"u32"}function o(t){return(t?.startsWith("s")||t?.startsWith("u"))??!1}function l(t,e,s,i){let[r,l]=n(s);const a=o(s);return a&&(r-=1e-5,l+=1e-5),a?s.startsWith("u")?function(t,e,s,i){const[n,r]=i;for(let i=0;i<e.length;i++)if(e[i]){const o=t[i];o<n||o>r?e[i]=0:s[i]=o+.5|0}}(t,e,i,[r,l]):function(t,e,s,i){const[n,r]=i;for(let i=0;i<e.length;i++)if(e[i]){const o=t[i];o<n||o>r?e[i]=0:s[i]=o+(o>0?.5:-.5)|0}}(t,e,i,[r,l]):function(t,e,s,i){const[n,r]=i;for(let i=0;i<e.length;i++)if(e[i]){const o=t[i];o<n||o>r?e[i]=0:s[i]=o}}(t,e,i,[r,l])}function a(t,e){for(let s=0;s<e.length;s++)e[s]&&isNaN(t[s])&&(e[s]=0,t[s]=0)}function h(t,e,s){if(t.depthCount&&t.depthCount>1)return;const{pixels:i,statistics:r,pixelType:o}=t,l=i[0].length,a=t.bandMasks??[],h=t.mask??new Uint8Array(l).fill(255),u="f32"===o||"f64"===o,c=n(o);let f=!1;for(let t=0;t<i.length;t++){const n="number"==typeof e?e:e[t];if(null==n)continue;const l=r?.[t]?.minValue??c[0],p=r?.[t]?.maxValue??c[1];if(l>n+Number.EPSILON||p<n-Number.EPSILON)continue;const g=a[t]||h.slice(),d=i[t],m=s?.customFloatTolerance;if(u&&0!==m){let t=m;t||(t=Math.abs(n)>=9999999e31?2e-7*Math.abs(n):"f32"===o?2**-23:Number.EPSILON);for(let e=0;e<d.length;e++)g[e]&&Math.abs(d[e]-n)<t&&(d[e]=0,g[e]=0,h[e]=0,f=!0)}else for(let t=0;t<d.length;t++)g[t]&&d[t]===n&&(d[t]=0,g[t]=0,h[t]=0,f=!0);a[t]=g}if(f){const e=t.bandMasks||t.pixels.length>1?a:null;s?.matchAllNoData?t.mask=e&&e.length>1?function(t){if(t.length<2)return t[0];const e=t[0].length,s=new Uint8Array(e).fill(0);for(let i=0;i<t.length;i++){const n=t[i];for(let t=0;t<e;t++)n[t]&&(s[t]=255)}return s}(e):h:(t.bandMasks=e,t.mask=h)}f&&"updateStatistics"in t&&t.updateStatistics()}},96982(t,e,s){s.r(e),s.d(e,{convertPixelBlockToImageData:()=>o,getFacesWithVertexAttributes:()=>r,recomputePositions:()=>l});var i=s(34727),n=s(14140);function r({distance:t,yaw:e,horizontalFieldOfView:s,pitch:n,verticalFieldOfView:r,origin:o=[0,0,0],positionLength:l=25}){const a=l-1,h=l*l,u=new Float32Array(2*h),c=new Float64Array(3*h),f=new Float32Array(3*h).fill(0),p=new Uint32Array(a**2*6);for(let g=0,d=0;g<h;g++){const h=Math.floor(g/l),m=g%l,y=1-m/a,b=h/a,A=2*g,w=3*g;u[A]=y,u[A+1]=b;const x=n+r/2-b*r,k=(0,i.kU)(e-s/2+y*s),M=(0,i.kU)(x),v=Math.sin(M),C=Math.cos(M),B=[v*Math.sin(k),Math.cos(k)*v,-C];c[w]=o[0]+t*B[0],c[w+1]=o[1]+t*B[1],c[w+2]=o[2]+t*B[2],f[w]=-B[0],f[w+1]=-B[1],f[w+2]=-B[2],h!==a&&m!==a&&(p[d++]=g,p[d++]=g+l,p[d++]=g+l+1,p[d++]=g,p[d++]=g+l+1,p[d++]=g+1)}return{result:{position:c,uv:u,normal:f,faces:p},transferList:[c.buffer,u.buffer,f.buffer,p?.buffer]}}function o(t){const e=n.A.fromJSON(t);e.premultiplyAlpha=!0;const s=e.getAsRGBA(),i=e.width,r=e.height,o=new ImageData(s,i,r);return{result:o,transferList:[o.data.buffer]}}function l({oldDistance:t,newDistance:e,position:s,origin:i=[0,0,0]}){const n=s.length/3;for(let r=0;r<n;r+=3){const n=3*r;s[n]=i[0]+(s[n]-i[0])*(e/t),s[n+1]=i[1]+(s[n+1]-i[1])*(e/t),s[n+2]=i[2]+(s[n+2]-i[2])*(e/t)}return{result:s,transferList:[s.buffer]}}}}]);