UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 3.62 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{hasScaling as r,deg2rad as t}from"../../../core/mathUtils.js";import{normalFromMat4 as o,fromMat4 as e}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as i}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat3 as a,normalize as m}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isMars as c,isMoon as l}from"../../ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as u}from"../../projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as p}from"../../projection/projectBuffer.js";import{earth as y}from"../Ellipsoid.js";import{isCGCS2000 as d}from"../spatialReferenceUtils.js";import{y2lat as j}from"../webMercatorUtils.js";import{BufferViewVec3f as T,BufferViewVec3f64 as A}from"../buffer/BufferView.js";import{b as g,n as h}from"../../../chunks/vec3.js";import{t as b}from"../../../chunks/vec4.js";const E="Projection may be possible after calling projection.load().";function M(r,t,o,e){r.error(`Failed to project from (wkid:${t.wkid}) to (wkid:${o.wkid}).${e?" ":""}${e}`)}function w(r,t,o,e,n,i){return S(0,T.fromTypedArray(r),0,A.fromTypedArray(t),o,A.fromTypedArray(e),n,T.fromTypedArray(i))?i:null}function x(r,t,o,e,n,i){return S(1,T.fromTypedArray(r),0,A.fromTypedArray(t),o,A.fromTypedArray(e),n,T.fromTypedArray(i))?i:null}function V(r,t,o,e){return p(r,t,0,o,e,0)?o:null}function k(r,t,o,e){return p(r,t,0,o,e,0)?o:null}function v(t,e,n){return o(z,n),g(e,t,z),r(z)&&h(e,e),e}function B(t,o,n){return e(z,n),b(o,t,z),r(z)&&h(o,o,4),o}function R(r,o,e,n){const i=0===o;return $(r,o,e,(r,o)=>{const e=Math.cos(t(r));o[0]=i?e:1/e,o[1]=1},n)}function U(r,t,o,e){const n=0===t;return $(r,t,o,(r,t)=>{const o=Math.cosh(-r/y.radius);t[0]=1,t[1]=n?o:1/o},e)}function $(r,t,o,e,n){const i=0===t?3:4,f=[0,0];for(let a=0,m=1;a<r.length;a+=i,m+=3){e(o[m],f);const t=r[a]*f[0],s=r[a+1]*f[1],c=r[a+2],l=1/Math.sqrt(t*t+s*s+c*c);n[a]=t*l,n[a+1]=s*l,n[a+2]=c*l,4===i&&(n[a+3]=r[a+3])}return n}function _(r,t,o,e,n,i){if(!S(0,T.fromTypedArray(r,4*Float32Array.BYTES_PER_ELEMENT),1,A.fromTypedArray(t),o,A.fromTypedArray(e),n,T.fromTypedArray(i,4*Float32Array.BYTES_PER_ELEMENT)))return null;for(let f=3;f<r.length;f+=4)i[f]=r[f];return i}function F(r,t,o,e,n,i){if(!S(1,T.fromTypedArray(r,16),1,A.fromTypedArray(t),o,A.fromTypedArray(e),n,T.fromTypedArray(i,16)))return null;for(let f=3;f<r.length;f+=4)i[f]=r[f];return i}function P(r,t,n,f,a){switch(u(f,n,q,f),1===r&&i(q,q),t){case 0:return o(a,q);case 1:return e(a,q)}}function S(r,t,o,e,n,i,f,s){if(!t)return;const c=e.count;if(L(n))for(let m=0;m<c;m++)i.getVec(m,N),t.getVec(m,Y),a(Y,Y,P(r,o,N,f,z)),s.setVec(m,Y);else for(let l=0;l<c;l++){i.getVec(l,N),t.getVec(l,Y);const n=j(e.get(l,1));let c=Math.cos(n);1===o!=(0===r)&&(c=1/c),P(r,o,N,f,z),0===r?(z[0]*=c,z[1]*=c,z[2]*=c,z[3]*=c,z[4]*=c,z[5]*=c):(z[0]*=c,z[3]*=c,z[6]*=c,z[1]*=c,z[4]*=c,z[7]*=c),a(Y,Y,z),m(Y,Y),s.setVec(l,Y)}return s}function L(r){return r.isWGS84||d(r)||c(r)||l(r)}const N=s(),Y=s(),q=f(),z=n();export{E as loadProjectErrorMessage,M as logProjectionError,k as projectFromPCPF,x as projectNormalFromPCPF,w as projectNormalToPCPF,F as projectTangentFromPCPF,_ as projectTangentToPCPF,V as projectToPCPF,v as transformNormal,B as transformTangent,R as transformVectorENUPlateCarree,U as transformVectorWMPlateCarree};