@dp_unity/dpu-gis-viewer
Version:
DPU GIS Viewer version Beta
2 lines • 6.38 kB
JavaScript
/*! For license information please see chunk-G72WI3OZ.js.LICENSE.txt */
import{a as _}from"./chunk-RNF7TLFF.js";import{a as te}from"./chunk-CTRWX4F5.js";import{a as fe,b as j,f as Z,g as me}from"./chunk-M3A6SPGI.js";import{a as e,b as ie,c as ee,e as O}from"./chunk-S4VBGY2U.js";import{a as Q}from"./chunk-UCTPWOTZ.js";import{a as se}from"./chunk-N3A5CZ2S.js";import{a as le}from"./chunk-G75U3WZT.js";import{e as $}from"./chunk-3THTQ4QB.js";var Se={ROUNDED:0,MITERED:1,BEVELED:2},G=Object.freeze(Se),ue={};function P(e,t){if(!$(e))throw new le("identifier is required.");$(ue[e])||(ue[e]=!0,console.warn(se(t,e)))}P.geometryOutlines="Entity geometry outlines are unsupported on terrain. Outlines will be disabled. To enable outlines, disable geometry terrain clamping by explicitly setting height to 0.",P.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined. zIndex will be ignored",P.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height. heightReference will be ignored",P.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight. extrudedHeightReference will be ignored";var he=P,w=[new e,new e],Te=new e,Be=new e,Ce=new e,ze=new e,Ae=new e,be=new e,Oe=new e,ve=new e,De=new e,I=new e,W=new e,R={},re=new ie;function je(e,t){let n=new Array(e.length);for(let r=0;r<e.length;r++){let o=e[r];re=t.cartesianToCartographic(o,re),n[r]=re.height,e[r]=t.scaleToGeodeticSurface(o,o)}return n}function ne(t,n,r,o){let a,l=t[0],i=t[1],c=e.angleBetween(l,i),s=Math.ceil(c/o),u=new Array(s);if(n===r){for(a=0;a<s;a++)u[a]=n;return u.push(r),u}let d=(r-n)/s;for(a=1;a<s;a++){let e=n+a*d;u[a]=e}return u[0]=n,u.push(r),u}var X=new e,Y=new e;function He(t,n,r,o){let a=new te(r,o),l=a.projectPointOntoPlane(e.add(r,t,X),X),i=a.projectPointOntoPlane(e.add(r,n,Y),Y),c=ee.angleBetween(l,i);return i.x*l.y-i.y*l.x>=0?-c:c}var Me=new e(-1,0,0),H=new j,Ve=new j,oe=new O,Ne=O.IDENTITY.clone(),Fe=new e,Ge=new fe,de=new e;function v(t,n,r,o,a,l,i,c){let s=Fe,u=Ge;H=me.eastNorthUpToFixedFrame(t,a,H),s=j.multiplyByPointAsVector(H,Me,s),s=e.normalize(s,s);let d=He(s,n,t,a);oe=O.fromRotationZ(d,oe),de.z=l,H=j.multiplyTransformation(H,j.fromRotationTranslation(oe,de,Ve),H);let w=Ne;w[0]=i;for(let t=0;t<c;t++)for(let t=0;t<r.length;t+=3)u=e.fromArray(r,t,u),u=O.multiplyByVector(w,u,u),u=j.multiplyByPoint(H,u,u),o.push(u.x,u.y,u.z);return o}var Ie=new e;function ce(t,n,r,o,a,l,i){for(let c=0;c<t.length;c+=3)o=v(e.fromArray(t,c,Ie),n,r,o,a,l[c/3],i,1);return o}function Le(e,t){let n=e.length,r=new Array(6*n),o=0,a=t.x+t.width/2,l=t.y+t.height/2,i=e[0];r[o++]=i.x-a,r[o++]=0,r[o++]=i.y-l;for(let t=1;t<n;t++){i=e[t];let n=i.x-a,c=i.y-l;r[o++]=n,r[o++]=0,r[o++]=c,r[o++]=n,r[o++]=0,r[o++]=c}return i=e[0],r[o++]=i.x-a,r[o++]=0,r[o++]=i.y-l,r}function ge(e,t){let n=e.length,r=new Array(3*n),o=0,a=t.x+t.width/2,l=t.y+t.height/2;for(let t=0;t<n;t++)r[o++]=e[t].x-a,r[o++]=0,r[o++]=e[t].y-l;return r}var ye=new Z,we=new e,pe=new O;function xe(t,n,r,o,a,l,i,c,s,u){let d,w,g,m=e.angleBetween(e.subtract(n,t,I),e.subtract(r,t,W)),h=o===G.BEVELED?0:Math.ceil(m/Q.toRadians(5));if(d=a?O.fromQuaternion(Z.fromAxisAngle(e.negate(t,I),m/(h+1),ye),pe):O.fromQuaternion(Z.fromAxisAngle(t,m/(h+1),ye),pe),n=e.clone(n,we),h>0){let r=u?2:1;for(let o=0;o<h;o++)n=O.multiplyByVector(d,n,n),w=e.subtract(n,t,I),w=e.normalize(w,w),a||(w=e.negate(w,w)),g=l.scaleToGeodeticSurface(n,W),i=v(g,w,c,i,l,s,1,r)}else w=e.subtract(n,t,I),w=e.normalize(w,w),a||(w=e.negate(w,w)),g=l.scaleToGeodeticSurface(n,W),i=v(g,w,c,i,l,s,1,1),r=e.clone(r,we),w=e.subtract(r,t,I),w=e.normalize(w,w),a||(w=e.negate(w,w)),g=l.scaleToGeodeticSurface(r,W),i=v(g,w,c,i,l,s,1,1);return i}R.removeDuplicatesFromShape=function(e){let t=e.length,n=[];for(let r=t-1,o=0;o<t;r=o++){let t=e[r],a=e[o];ee.equals(t,a)||n.push(a)}return n},R.angleIsGreaterThanPi=function(t,n,r,o){let a=new te(r,o),l=a.projectPointOntoPlane(e.add(r,t,X),X),i=a.projectPointOntoPlane(e.add(r,n,Y),Y);return i.x*l.y-i.y*l.x>=0};var qe=new e,Pe=new e;R.computePositions=function(t,n,r,o,a){let l=o._ellipsoid,i=je(t,l),c=o._granularity,s=o._cornerType,u=a?Le(n,r):ge(n,r),d=a?ge(n,r):void 0,g=r.height/2,m=r.width/2,h=t.length,y=[],f=a?[]:void 0,p=Te,x=Be,E=Ce,P=ze,b=Ae,T=be,B=Oe,O=ve,j=De,S=t[0],z=t[1];P=l.geodeticSurfaceNormal(S,P),p=e.subtract(z,S,p),p=e.normalize(p,p),O=e.cross(P,p,O),O=e.normalize(O,O);let A,H,D=i[0],N=i[1];a&&(f=v(S,O,d,f,l,D+g,1,1)),j=e.clone(S,j),S=z,x=e.negate(p,x);for(let n=1;n<h-1;n++){let r=a?2:1;if(z=t[n+1],S.equals(z)){he("Positions are too close and are considered equivalent with rounding error.");continue}p=e.subtract(z,S,p),p=e.normalize(p,p),P=l.geodeticSurfaceNormal(S,P);let o=e.multiplyByScalar(P,e.dot(p,P),qe);e.subtract(p,o,o),e.normalize(o,o);let d=e.multiplyByScalar(P,e.dot(x,P),Pe);if(e.subtract(x,d,d),e.normalize(d,d),Q.equalsEpsilon(Math.abs(e.dot(o,d)),1,Q.EPSILON7))y=v(j,O,u,y,l,D+g,1,1),j=S;else{E=e.add(p,x,E),E=e.normalize(E,E),E=e.cross(E,P,E),E=e.cross(P,E,E),E=e.normalize(E,E);let t=1/Math.max(.25,e.magnitude(e.cross(E,x,I))),n=R.angleIsGreaterThanPi(p,x,S,l);n?(b=e.add(S,e.multiplyByScalar(E,t*m,E),b),T=e.add(b,e.multiplyByScalar(O,m,T),T),w[0]=e.clone(j,w[0]),w[1]=e.clone(T,w[1]),A=ne(w,D+g,N+g,c),H=_.generateArc({positions:w,granularity:c,ellipsoid:l}),y=ce(H,O,u,y,l,A,1),O=e.cross(P,p,O),O=e.normalize(O,O),B=e.add(b,e.multiplyByScalar(O,m,B),B),s===G.ROUNDED||s===G.BEVELED?xe(b,T,B,s,n,l,y,u,N+g,a):(E=e.negate(E,E),y=v(S,E,u,y,l,N+g,t,r)),j=e.clone(B,j)):(b=e.add(S,e.multiplyByScalar(E,t*m,E),b),T=e.add(b,e.multiplyByScalar(O,-m,T),T),w[0]=e.clone(j,w[0]),w[1]=e.clone(T,w[1]),A=ne(w,D+g,N+g,c),H=_.generateArc({positions:w,granularity:c,ellipsoid:l}),y=ce(H,O,u,y,l,A,1),O=e.cross(P,p,O),O=e.normalize(O,O),B=e.add(b,e.multiplyByScalar(O,-m,B),B),s===G.ROUNDED||s===G.BEVELED?xe(b,T,B,s,n,l,y,u,N+g,a):y=v(S,E,u,y,l,N+g,t,r),j=e.clone(B,j)),x=e.negate(p,x)}D=N,N=i[n+1],S=z}w[0]=e.clone(j,w[0]),w[1]=e.clone(S,w[1]),A=ne(w,D+g,N+g,c),H=_.generateArc({positions:w,granularity:c,ellipsoid:l}),y=ce(H,O,u,y,l,A,1),a&&(f=v(S,O,d,f,l,N+g,1,1)),h=y.length;let F=a?h+f.length:h,V=new Float64Array(F);return V.set(y),a&&V.set(f,h),V};var lt=R;export{G as a,he as b,lt as c};