UNPKG

@dp_unity/dpu-gis-viewer

Version:

DPU GIS Viewer version Beta

2 lines 6.73 kB
/*! For license information please see createCorridorOutlineGeometry.js.LICENSE.txt */ import{a as S}from"./chunk-W7OWWJQT.js";import{a as W}from"./chunk-G72WI3OZ.js";import"./chunk-RNF7TLFF.js";import"./chunk-E7HC3VTG.js";import{a as K}from"./chunk-5CC3QRYS.js";import"./chunk-CTRWX4F5.js";import"./chunk-Z7BLUZ7R.js";import{b as Q}from"./chunk-WJYW7YDO.js";import{a as it}from"./chunk-GJI4ZBKE.js";import"./chunk-RDAVO5OM.js";import"./chunk-PY4CW263.js";import"./chunk-RRZIPF5C.js";import{a as Z}from"./chunk-34ULWVZF.js";import{a as et}from"./chunk-24JYWT5N.js";import{b as I,c as tt,d as J}from"./chunk-LH3SUUXG.js";import{d as x}from"./chunk-K2M3OJ7Z.js";import"./chunk-M3A6SPGI.js";import{a as z}from"./chunk-D5HNP2LB.js";import{a as A,d as P}from"./chunk-S4VBGY2U.js";import{a as q}from"./chunk-UCTPWOTZ.js";import"./chunk-54PMPXZ4.js";import"./chunk-R62IKKEC.js";import{a as H}from"./chunk-N3A5CZ2S.js";import{b as M}from"./chunk-G75U3WZT.js";import{e as C}from"./chunk-3THTQ4QB.js";var ot=new A,nt=new A,rt=new A;function ft(t,e){for(let i=0;i<t.length;i++)t[i]=e.scaleToGeodeticSurface(t[i],t[i]);return t}function st(t,e){let i,r,o,s=[],n=t.positions,l=t.corners,a=t.endPositions,h=new et,u=0,p=0,f=0;for(r=0;r<n.length;r+=2)o=n[r].length-3,u+=o,f+=o/3*4,p+=n[r+1].length-3;for(u+=3,p+=3,r=0;r<l.length;r++){i=l[r];let t=l[r].leftPositions;C(t)?(o=t.length,u+=o,f+=o/3*2):(o=l[r].rightPositions.length,p+=o,f+=o/3*2)}let c,d=C(a);d&&(c=a[0].length-3,u+=c,p+=c,c/=3,f+=4*c);let g,m,y,_,b,k,P=u+p,T=new Float64Array(P),j=0,v=P-1,E=c/2,H=Z.createTypedArray(P/3,f+4),w=0;if(H[w++]=j/3,H[w++]=(v-2)/3,d){s.push(j/3),k=ot,b=nt;let t=a[0];for(r=0;r<E;r++)k=A.fromArray(t,3*(E-1-r),k),b=A.fromArray(t,3*(E+r),b),S.addAttribute(T,b,j),S.addAttribute(T,k,void 0,v),m=j/3,_=m+1,g=(v-2)/3,y=g-1,H[w++]=g,H[w++]=y,H[w++]=m,H[w++]=_,j+=3,v-=3}let O=0,R=n[O++],N=n[O++];for(T.set(R,j),T.set(N,v-N.length+1),o=N.length-3,s.push(j/3,(v-2)/3),r=0;r<o;r+=3)m=j/3,_=m+1,g=(v-2)/3,y=g-1,H[w++]=g,H[w++]=y,H[w++]=m,H[w++]=_,j+=3,v-=3;for(r=0;r<l.length;r++){let t;i=l[r];let a,h=i.leftPositions,u=i.rightPositions,p=rt;if(C(h)){for(v-=3,a=y,s.push(_),t=0;t<h.length/3;t++)p=A.fromArray(h,3*t,p),H[w++]=a-t-1,H[w++]=a-t,S.addAttribute(T,p,void 0,v),v-=3;s.push(a-Math.floor(h.length/6)),e===W.BEVELED&&s.push((v-2)/3+1),j+=3}else{for(j+=3,a=_,s.push(y),t=0;t<u.length/3;t++)p=A.fromArray(u,3*t,p),H[w++]=a+t,H[w++]=a+t+1,S.addAttribute(T,p,j),j+=3;s.push(a+Math.floor(u.length/6)),e===W.BEVELED&&s.push(j/3-1),v-=3}for(R=n[O++],N=n[O++],R.splice(0,3),N.splice(N.length-3,3),T.set(R,j),T.set(N,v-N.length+1),o=N.length-3,t=0;t<N.length;t+=3)_=j/3,m=_-1,y=(v-2)/3,g=y+1,H[w++]=g,H[w++]=y,H[w++]=m,H[w++]=_,j+=3,v-=3;j-=3,v+=3,s.push(j/3,(v-2)/3)}if(d){j+=3,v-=3,k=ot,b=nt;let t=a[1];for(r=0;r<E;r++)k=A.fromArray(t,3*(c-r-1),k),b=A.fromArray(t,3*r,b),S.addAttribute(T,k,void 0,v),S.addAttribute(T,b,j),_=j/3,m=_-1,y=(v-2)/3,g=y+1,H[w++]=g,H[w++]=y,H[w++]=m,H[w++]=_,j+=3,v-=3;s.push(j/3)}else s.push(j/3,(v-2)/3);return H[w++]=j/3,H[w++]=(v-2)/3,h.position=new J({componentDatatype:z.DOUBLE,componentsPerAttribute:3,values:T}),{attributes:h,indices:H,wallIndices:s}}function ct(t){let e=t.ellipsoid,i=st(S.computePositions(t),t.cornerType),r=i.wallIndices,o=t.height,s=t.extrudedHeight,n=i.attributes,l=i.indices,a=n.position.values,h=a.length,u=new Float64Array(h);u.set(a);let p=new Float64Array(2*h);if(a=Q.scaleToGeodeticHeight(a,o,e),u=Q.scaleToGeodeticHeight(u,s,e),p.set(a),p.set(u,h),n.position.values=p,h/=3,C(t.offsetAttribute)){let e=new Uint8Array(2*h);if(t.offsetAttribute===K.TOP)e=e.fill(1,0,h);else{let i=t.offsetAttribute===K.NONE?0:1;e=e.fill(i)}n.applyOffset=new J({componentDatatype:z.UNSIGNED_BYTE,componentsPerAttribute:1,values:e})}let f,c=l.length,d=Z.createTypedArray(p.length/3,2*(c+r.length));d.set(l);let g,m,A=c;for(f=0;f<c;f+=2){let t=l[f],e=l[f+1];d[A++]=t+h,d[A++]=e+h}for(f=0;f<r.length;f++)g=r[f],m=g+h,d[A++]=g,d[A++]=m;return{attributes:n,indices:d}}function V(t){let e=(t=H(t,H.EMPTY_OBJECT)).positions,i=t.width;M.typeOf.object("options.positions",e),M.typeOf.number("options.width",i);let r=H(t.height,0),o=H(t.extrudedHeight,r);this._positions=e,this._ellipsoid=P.clone(H(t.ellipsoid,P.default)),this._width=i,this._height=Math.max(r,o),this._extrudedHeight=Math.min(r,o),this._cornerType=H(t.cornerType,W.ROUNDED),this._granularity=H(t.granularity,q.RADIANS_PER_DEGREE),this._offsetAttribute=t.offsetAttribute,this._workerName="createCorridorOutlineGeometry",this.packedLength=1+e.length*A.packedLength+P.packedLength+6}V.pack=function(t,e,i){M.typeOf.object("value",t),M.typeOf.object("array",e),i=H(i,0);let r=t._positions,o=r.length;e[i++]=o;for(let t=0;t<o;++t,i+=A.packedLength)A.pack(r[t],e,i);return P.pack(t._ellipsoid,e,i),i+=P.packedLength,e[i++]=t._width,e[i++]=t._height,e[i++]=t._extrudedHeight,e[i++]=t._cornerType,e[i++]=t._granularity,e[i]=H(t._offsetAttribute,-1),e};var lt=P.clone(P.UNIT_SPHERE),R={positions:void 0,ellipsoid:lt,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,offsetAttribute:void 0};V.unpack=function(t,e,i){M.typeOf.object("array",t),e=H(e,0);let r=t[e++],o=new Array(r);for(let i=0;i<r;++i,e+=A.packedLength)o[i]=A.unpack(t,e);let s=P.unpack(t,e,lt);e+=P.packedLength;let n=t[e++],l=t[e++],a=t[e++],h=t[e++],u=t[e++],p=t[e];return C(i)?(i._positions=o,i._ellipsoid=P.clone(s,i._ellipsoid),i._width=n,i._height=l,i._extrudedHeight=a,i._cornerType=h,i._granularity=u,i._offsetAttribute=-1===p?void 0:p,i):(R.positions=o,R.width=n,R.height=l,R.extrudedHeight=a,R.cornerType=h,R.granularity=u,R.offsetAttribute=-1===p?void 0:p,new V(R))},V.createGeometry=function(t){let e=t._positions,i=t._width,r=t._ellipsoid;e=ft(e,r);let o=it(e,A.equalsEpsilon);if(o.length<2||i<=0)return;let s,n=t._height,l=t._extrudedHeight,a=!q.equalsEpsilon(n,l,0,q.EPSILON2),h={ellipsoid:r,positions:o,width:i,cornerType:t._cornerType,granularity:t._granularity,saveAttributes:!1};if(a)h.height=n,h.extrudedHeight=l,h.offsetAttribute=t._offsetAttribute,s=ct(h);else if(s=st(S.computePositions(h),h.cornerType),s.attributes.position.values=Q.scaleToGeodeticHeight(s.attributes.position.values,n,r),C(t._offsetAttribute)){let e=s.attributes.position.values.length,i=t._offsetAttribute===K.NONE?0:1,r=new Uint8Array(e/3).fill(i);s.attributes.applyOffset=new J({componentDatatype:z.UNSIGNED_BYTE,componentsPerAttribute:1,values:r})}let u=s.attributes,p=x.fromVertices(u.position.values,void 0,3);return new tt({attributes:u,indices:s.indices,primitiveType:I.LINES,boundingSphere:p,offsetAttribute:t._offsetAttribute})};var $=V;function ht(t,e){return C(e)&&(t=$.unpack(t,e)),t._ellipsoid=P.clone(t._ellipsoid),$.createGeometry(t)}var Ot=ht;export{Ot as default};