georeference.11d1c93a.js 8.3 KB

1
  1. import{fs as ir,fD as sr,dj as lr,_ as T,$ as A,a0 as fr,cp as cr,E as x,ab as ur,fE as pr,fF as K,fG as q,fH as M,fI as w,fJ as yr,fK as I,fL as gr,a7 as mr,a as S,fM as hr,fN as Tr,fO as B,s as Ar,fP as k,d_ as D,dZ as H,fQ as $r,fy as dr,fR as Pr,fS as Fr,fT as Er,t as m,fU as C,fV as Q,fW as Mr,ci as Rr,fX as _r,fY as vr}from"./index.6c049565.js";import{e as X}from"./mat3f64.6d32a1d7.js";import{e as $,o as xr}from"./mat4f64.ff2a477c.js";import{v as z,y as wr,x as Cr}from"./quat.4f976512.js";import{e as U}from"./quatf64.4ae3e6f1.js";import{T as p,i as u}from"./BufferView.f5101c27.js";import{t as F,e as Or,r as d,o as rr}from"./vec33.9bd40b84.js";function E(r=br){return[r[0],r[1],r[2],r[3]]}function ct(r,t,e=E()){return ir(e,r),e[3]=t,e}function ut(r,t,e=E()){return z(R,r,Y(r)),z(J,t,Y(t)),wr(R,J,R),Nr(e,sr(Cr(e,R)))}function pt(r){return r}function Y(r){return lr(r[3])}function Nr(r,t){return r[3]=t,r}const br=[0,0,1,0],R=U(),J=U();E();var j;let g=j=class extends cr{constructor(r){super(r),this.origin=x(),this.translation=x(),this.rotation=E(),this.scale=ur(1,1,1),this.geographic=!0}get localMatrix(){const r=$();return z(Z,this.rotation,Y(this.rotation)),pr(r,Z,this.translation,this.scale),r}get localMatrixInverse(){return K($(),this.localMatrix)}applyLocal(r,t){return q(t,r,this.localMatrix)}applyLocalInverse(r,t){return q(t,r,this.localMatrixInverse)}project(r,t){const e=new Float64Array(r.length),o=p.fromTypedArray(e),n=p.fromTypedArray(r);if(this.geographic){const l=M(t),f=$();return w(t,this.origin,f,l),yr(f,f,this.localMatrix),F(o,n,f),I(e,l,0,e,t,0,e.length/3),e}const{localMatrix:a,origin:i}=this;gr(a,xr)?Or(o,n):F(o,n,a);for(let l=0;l<e.length;l+=3)e[l+0]+=i[0],e[l+1]+=i[1],e[l+2]+=i[2];return e}getOriginPoint(r){const[t,e,o]=this.origin;return new mr({x:t,y:e,z:o,spatialReference:r})}equals(r){return S(r)&&this.geographic===r.geographic&&hr(this.origin,r.origin)&&Tr(this.localMatrix,r.localMatrix)}clone(){const r={origin:B(this.origin),translation:B(this.translation),rotation:E(this.rotation),scale:B(this.scale),geographic:this.geographic};return new j(r)}};T([A({type:[Number],nonNullable:!0,json:{write:!0}})],g.prototype,"origin",void 0),T([A({type:[Number],nonNullable:!0,json:{write:!0}})],g.prototype,"translation",void 0),T([A({type:[Number],nonNullable:!0,json:{write:!0}})],g.prototype,"rotation",void 0),T([A({type:[Number],nonNullable:!0,json:{write:!0}})],g.prototype,"scale",void 0),T([A({type:Boolean,nonNullable:!0,json:{write:!0}})],g.prototype,"geographic",void 0),T([A()],g.prototype,"localMatrix",null),T([A()],g.prototype,"localMatrixInverse",null),g=j=T([fr("esri.geometry.support.MeshTransform")],g);const Z=U(),Lr=g;function O(r,t){var e;return r.isGeographic||r.isWebMercator&&((e=t==null?void 0:t.geographic)!=null?e:!0)}const N=Ar.getLogger("esri.geometry.support.meshUtils.normalProjection");function Br(r,t,e,o,n){return L(o)?(b(h.TO_PCPF,u.fromTypedArray(r),p.fromTypedArray(t),p.fromTypedArray(e),o,u.fromTypedArray(n)),n):(N.error("Cannot convert spatial reference to PCPF"),n)}function Sr(r,t,e,o,n){return L(o)?(b(h.FROM_PCPF,u.fromTypedArray(r),p.fromTypedArray(t),p.fromTypedArray(e),o,u.fromTypedArray(n)),n):(N.error("Cannot convert to spatial reference from PCPF"),n)}function zr(r,t,e){return I(r,t,0,e,M(t),0,r.length/3),e}function Yr(r,t,e){return I(r,M(e),0,t,e,0,r.length/3),t}function jr(r,t,e){if(m(r))return t;const o=p.fromTypedArray(r),n=p.fromTypedArray(t);return F(n,o,e),t}function Vr(r,t,e){if(m(r))return t;C(c,e);const o=u.fromTypedArray(r),n=u.fromTypedArray(t);return d(n,o,c),Q(c)||rr(n,n),t}function Gr(r,t,e){if(m(r))return t;C(c,e);const o=u.fromTypedArray(r,4*Float32Array.BYTES_PER_ELEMENT),n=u.fromTypedArray(t,4*Float32Array.BYTES_PER_ELEMENT);if(d(n,o,c),Q(c)||rr(n,n),r!==t)for(let a=3;a<r.length;a+=4)t[a]=r[a];return t}function Ir(r,t,e,o,n){if(!L(o))return N.error("Cannot convert spatial reference to PCPF"),n;b(h.TO_PCPF,u.fromTypedArray(r,4*Float32Array.BYTES_PER_ELEMENT),p.fromTypedArray(t),p.fromTypedArray(e),o,u.fromTypedArray(n,4*Float32Array.BYTES_PER_ELEMENT));for(let a=3;a<r.length;a+=4)n[a]=r[a];return n}function Ur(r,t,e,o,n){if(!L(o))return N.error("Cannot convert to spatial reference from PCPF"),n;b(h.FROM_PCPF,u.fromTypedArray(r,16),p.fromTypedArray(t),p.fromTypedArray(e),o,u.fromTypedArray(n,16));for(let a=3;a<r.length;a+=4)n[a]=r[a];return n}function b(r,t,e,o,n,a){if(!t)return;const i=e.count,l=M(n);if(tr(n))for(let f=0;f<i;f++)o.getVec(f,_),t.getVec(f,y),w(l,_,v,l),k(c,v),r===h.FROM_PCPF&&D(c,c),H(y,y,c),a.setVec(f,y);else for(let f=0;f<i;f++){o.getVec(f,_),t.getVec(f,y),w(l,_,v,l),k(c,v);const P=$r(e.get(f,1));let s=Math.cos(P);r===h.TO_PCPF&&(s=1/s),c[0]*=s,c[1]*=s,c[2]*=s,c[3]*=s,c[4]*=s,c[5]*=s,r===h.FROM_PCPF&&D(c,c),H(y,y,c),dr(y,y),a.setVec(f,y)}return a}function L(r){return tr(r)||Wr(r)}function tr(r){return r.isWGS84||Pr(r)||Fr(r)||Er(r)}function Wr(r){return r.isWebMercator}var h;(function(r){r[r.TO_PCPF=0]="TO_PCPF",r[r.FROM_PCPF=1]="FROM_PCPF"})(h||(h={}));const _=x(),y=x(),v=$(),c=X();function er(r,t,e){return O(t.spatialReference,e)?Hr(r,t,e):Dr(r,t,e)}function qr(r,t,e){const{position:o,normal:n,tangent:a}=r;if(m(t))return{position:o,normal:n,tangent:a};const i=t.localMatrix;return er({position:jr(o,new Float64Array(o.length),i),normal:S(n)?Vr(n,new Float32Array(n.length),i):null,tangent:S(a)?Gr(a,new Float32Array(a.length),i):null},t.getOriginPoint(e),{geographic:t.geographic})}function yt(r,t,e){var o;if(e!=null&&e.useTransform){const{position:n,normal:a,tangent:i}=r;return{vertexAttributes:{position:n,normal:a,tangent:i},transform:new Lr({origin:[t.x,t.y,(o=t.z)!=null?o:0],geographic:O(t.spatialReference,e)})}}return{vertexAttributes:er(r,t,e),transform:null}}function kr(r,t,e){return O(t.spatialReference,e)?nr(r,t,e):V(r,t,e)}function gt(r,t,e,o){if(m(t))return kr(r,e,o);const n=qr(r,t,e.spatialReference);return e.equals(t.getOriginPoint(e.spatialReference))?V(n,e,o):O(e.spatialReference,o)?nr(n,e,o):V(n,e,o)}function Dr(r,t,e){const o=new Float64Array(r.position.length),n=r.position,a=t.x,i=t.y,l=t.z||0,{horizontal:f,vertical:P}=W(e?e.unit:null,t.spatialReference);for(let s=0;s<n.length;s+=3)o[s+0]=n[s+0]*f+a,o[s+1]=n[s+1]*f+i,o[s+2]=n[s+2]*P+l;return{position:o,normal:r.normal,tangent:r.tangent}}function Hr(r,t,e){const o=t.spatialReference,n=or(t,e,G),a=new Float64Array(r.position.length),i=Jr(r.position,n,o,a),l=C(ar,n);return{position:i,normal:Zr(i,a,r.normal,l,o),tangent:Kr(i,a,r.tangent,l,o)}}function Jr(r,t,e,o){F(p.fromTypedArray(o),p.fromTypedArray(r),t);const n=new Float64Array(r.length);return Yr(o,n,e)}function Zr(r,t,e,o,n){if(m(e))return null;const a=new Float32Array(e.length);return d(u.fromTypedArray(a),u.fromTypedArray(e),o),Sr(a,r,t,n,a),a}function Kr(r,t,e,o,n){if(m(e))return null;const a=new Float32Array(e.length);d(u.fromTypedArray(a,4*Float32Array.BYTES_PER_ELEMENT),u.fromTypedArray(e,4*Float32Array.BYTES_PER_ELEMENT),o);for(let i=3;i<a.length;i+=4)a[i]=e[i];return Ur(a,r,t,n,a),a}function V(r,t,e){const o=new Float64Array(r.position.length),n=r.position,a=t.x,i=t.y,l=t.z||0,{horizontal:f,vertical:P}=W(e?e.unit:null,t.spatialReference);for(let s=0;s<n.length;s+=3)o[s+0]=(n[s+0]-a)/f,o[s+1]=(n[s+1]-i)/f,o[s+2]=(n[s+2]-l)/P;return{position:o,normal:r.normal,tangent:r.tangent}}function nr(r,t,e){const o=t.spatialReference;or(t,e,G);const n=K(tt,G),a=new Float64Array(r.position.length),i=Qr(r.position,o,n,a),l=C(ar,n);return{position:i,normal:Xr(r.normal,r.position,a,o,l),tangent:rt(r.tangent,r.position,a,o,l)}}function or(r,t,e){w(r.spatialReference,[r.x,r.y,r.z||0],e,M(r.spatialReference));const{horizontal:o,vertical:n}=W(t?t.unit:null,r.spatialReference);return Mr(e,e,[o,o,n]),e}function Qr(r,t,e,o){const n=zr(r,t,o),a=p.fromTypedArray(n),i=new Float64Array(n.length),l=p.fromTypedArray(i);return F(l,a,e),i}function Xr(r,t,e,o,n){if(m(r))return null;const a=Br(r,t,e,o,new Float32Array(r.length)),i=u.fromTypedArray(a);return d(i,i,n),a}function rt(r,t,e,o,n){if(m(r))return null;const a=Ir(r,t,e,o,new Float32Array(r.length)),i=u.fromTypedArray(a,4*Float32Array.BYTES_PER_ELEMENT);return d(i,i,n),a}function W(r,t){if(m(r))return et;const e=t.isGeographic?1:Rr(t),o=t.isGeographic?1:_r(t),n=vr(1,r,"meters");return{horizontal:n*e,vertical:n*o}}const G=$(),tt=$(),ar=X(),et={horizontal:1,vertical:1};export{Ur as L,zr as M,Yr as O,yt as _,Ir as a,kr as b,E as c,Y as d,ct as e,Lr as f,pt as g,Sr as h,gt as i,Br as j,qr as k,O as r,ut as v,er as x};