!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.NDSWebViewer=t():e.NDSWebViewer=t()}(window,function(){return i=[function(e,t,i){!function(t,e){var i,n;i=window,n="function"==typeof(n=i.atob)?n:"function"==typeof t?function(e){return new t(e,"base64").toString("binary")}:"object"==typeof i.base64js?function(e){e=i.base64js.b64ToByteArray(e);return Array.prototype.map.call(e,function(e){return String.fromCharCode(e)}).join("")}:function(){throw new Error("You're probably in an old browser or an iOS webworker. It might help to include beatgammit's base64-js.")},i.atob=n,e&&e.exports&&(e.exports=n)}.call(this,i(14).Buffer,i(19)(e))},function(e,t,i){e.exports=function n(r,o,s){function a(i,e){if(!o[i]){if(!r[i]){if(l)return l(i,!0);var t=new Error("Cannot find module '"+i+"'");throw t.code="MODULE_NOT_FOUND",t}t=o[i]={exports:{}};r[i][0].call(t.exports,function(e){var t=r[i][1][e];return a(t||e)},t,t.exports,n,r,o,s)}return o[i].exports}for(var l=!1,e=0;e>>6:(i<65536?t[r++]=224|i>>>12:(t[r++]=240|i>>>18,t[r++]=128|i>>>12&63),t[r++]=128|i>>>6&63),t[r++]=128|63&i);return t},i.buf2binstring=function(e){return c(e,e.length)},i.binstring2buf=function(e){for(var t=new l.Buf8(e.length),i=0,n=t.length;i>10&1023,o[s++]=56320|1023&i)}return c(o,s)},i.utf8border=function(e,t){for(var i=(t=(t=t||e.length)>e.length?e.length:t)-1;0<=i&&128==(192&e[i]);)i--;return!(i<0)&&0!==i&&i+d[e[i]]>t?i:t}},{"./common":3}],5:[function(e,t,i){t.exports=function(e,t,i,n){for(var r=65535&e|0,o=e>>>16&65535|0,s=0;0!==i;){for(i-=s=2e3>>1:i>>>1;e[t]=i}return e}();t.exports=function(e,t,i,n){var r=a,o=n+i;e^=-1;for(var s=n;s>>8^r[255&(e^t[s])];return-1^e}},{}],8:[function(e,F,t){var a,h=e("../utils/common"),l=e("./trees"),u=e("./adler32"),p=e("./crc32"),N=e("./messages"),d=0,c=4,f=0,m=-2,V=-1,j=4,U=2,g=8,k=9,i=286,_=30,G=19,z=2*i+1,W=15,v=3,A=258,y=A+v+1,E=42,M=113,w=1,x=2,I=3,b=4;function T(e,t){return e.msg=N[t],t}function S(e){return(e<<1)-(4e.avail_out?e.avail_out:i)&&(h.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending)&&(t.pending_out=0)}function C(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,P(e.strm)}function R(e,t){e.pending_buf[e.pending++]=t}function O(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var i,n,r=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-y?e.strstart-(e.w_size-y):0,d=e.window,c=e.w_mask,h=e.prev,u=e.strstart+A,p=d[o+s-1],f=d[o+s];e.prev_length>=e.good_match&&(r>>=2),a>e.lookahead&&(a=e.lookahead);do{if(d[(i=t)+s]===f&&d[i+s-1]===p&&d[i]===d[o]&&d[++i]===d[o+1]){for(o+=2,i++;d[++o]===d[++i]&&d[++o]===d[++i]&&d[++o]===d[++i]&&d[++o]===d[++i]&&d[++o]===d[++i]&&d[++o]===d[++i]&&d[++o]===d[++i]&&d[++o]===d[++i]&&ol&&0!=--r);return s<=e.lookahead?s:e.lookahead}function L(e){var t,i,n,r,o,s,a,l,d,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-y)){for(h.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=i=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--i;);for(t=i=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--i;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,d=void 0,d=o.avail_in,i=0===(d=l=v)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=(e.ins_h<=v&&(e.ins_h=(e.ins_h<=v)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-v),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=v){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=v&&(e.ins_h=(e.ins_h<=v&&e.match_length<=e.prev_length){for(r=e.strstart+e.lookahead-v,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-v),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=r&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(L(e),0===e.lookahead&&t===d)return w;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+i;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,C(e,!1),0===e.strm.avail_out))return w;if(e.strstart-e.block_start>=e.w_size-y&&(C(e,!1),0===e.strm.avail_out))return w}return e.insert=0,t===c?(C(e,!0),0===e.strm.avail_out?I:b):(e.strstart>e.block_start&&(C(e,!1),e.strm.avail_out),w)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,r),new s(8,16,32,32,r),new s(8,16,128,128,r),new s(8,32,128,256,r),new s(32,128,258,1024,r),new s(32,258,258,4096,r)],t.deflateInit=function(e,t){return X(e,t,g,15,8,0)},t.deflateInit2=X,t.deflateReset=H,t.deflateResetKeep=D,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?m:(e.state.gzhead=t,f)},t.deflate=function(e,t){var i,n,r,o;if(!e||!e.state||5>8&255),R(n,n.gzhead.time>>16&255),R(n,n.gzhead.time>>24&255),R(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),R(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(R(n,255&n.gzhead.extra.length),R(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(R(n,0),R(n,0),R(n,0),R(n,0),R(n,0),R(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),R(n,3),n.status=M)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=M,O(n,s),0!==n.strstart&&(O(n,e.adler>>>16),O(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(r=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>r&&(e.adler=p(e.adler,n.pending_buf,n.pending-r,r)),P(e),r=n.pending,n.pending!==n.pending_buf_size));)R(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>r&&(e.adler=p(e.adler,n.pending_buf,n.pending-r,r)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(e.adler=p(e.adler,n.pending_buf,n.pending-r,r)),P(e),r=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexr&&(e.adler=p(e.adler,n.pending_buf,n.pending-r,r)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(e.adler=p(e.adler,n.pending_buf,n.pending-r,r)),P(e),r=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexr&&(e.adler=p(e.adler,n.pending_buf,n.pending-r,r)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&P(e),n.pending+2<=n.pending_buf_size&&(R(n,255&e.adler),R(n,e.adler>>8&255),e.adler=0,n.status=M)):n.status=M),0!==n.pending){if(P(e),0===e.avail_out)return n.last_flush=-1,f}else if(0===e.avail_in&&S(t)<=S(i)&&t!==c)return T(e,-5);if(666===n.status&&0!==e.avail_in)return T(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==d&&666!==n.status){var s=2===n.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(L(e),0===e.lookahead)){if(t===d)return w;break}if(e.match_length=0,i=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(C(e,!1),0===e.strm.avail_out))return w}return e.insert=0,t===c?(C(e,!0),0===e.strm.avail_out?I:b):e.last_lit&&(C(e,!1),0===e.strm.avail_out)?w:x}(n,t):3===n.strategy?function(e,t){for(var i,n,r,o,s=e.window;;){if(e.lookahead<=A){if(L(e),e.lookahead<=A&&t===d)return w;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=v&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=v?(i=l._tr_tally(e,1,e.match_length-v),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(C(e,!1),0===e.strm.avail_out))return w}return e.insert=0,t===c?(C(e,!0),0===e.strm.avail_out?I:b):e.last_lit&&(C(e,!1),0===e.strm.avail_out)?w:x}(n,t):a[n.level].func(n,t);if(s!==I&&s!==b||(n.status=666),s===w||s===I)return 0===e.avail_out&&(n.last_flush=-1),f;if(s===x&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t)&&(B(n.head),0===n.lookahead)&&(n.strstart=0,n.block_start=0,n.insert=0),P(e),0===e.avail_out))return n.last_flush=-1,f}return t!==c||!(n.wrap<=0)&&(2===n.wrap?(R(n,255&e.adler),R(n,e.adler>>8&255),R(n,e.adler>>16&255),R(n,e.adler>>24&255),R(n,255&e.total_in),R(n,e.total_in>>8&255),R(n,e.total_in>>16&255),R(n,e.total_in>>24&255)):(O(n,e.adler>>>16),O(n,65535&e.adler)),P(e),0=i.w_size&&(0===o&&(B(i.head),i.strstart=0,i.block_start=0,i.insert=0),l=new h.Buf8(i.w_size),h.arraySet(l,t,d-i.w_size,i.w_size,0),t=l,d=i.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=d,e.next_in=0,e.input=t,L(i);i.lookahead>=v;){for(n=i.strstart,r=i.lookahead-(v-1);i.ins_h=(i.ins_h<>>=n=i>>>24,w-=n,0===(n=i>>>16&255))p[u++]=65535&i;else{if(!(16&n)){if(0==(64&n)){i=x[(65535&i)+(M&(1<>>=n,w-=n),w<15&&(M+=c[d++]<>>=n=i>>>24,w-=n,!(16&(n=i>>>16&255))){if(0==(64&n)){i=I[(65535&i)+(M&(1<>>=n,w-=n,(n=u-f)>3)<<3))-1,e.next_in=d-=r,e.next_out=u,e.avail_in=d>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new R.Buf16(320),this.work=new R.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=U,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new R.Buf32(n),t.distcode=t.distdyn=new R.Buf32(r),t.sane=1,t.back=-1,V):j}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):j}function l(e,t){var i,n;return!e||!e.state||(n=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(R.arraySet(e.window,t,i-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(r=e.wsize-e.wnext)&&(r=n),R.arraySet(e.window,t,i-n,r,e.wnext),(n-=r)?(R.arraySet(e.window,t,i-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=r,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,i.check=L(i.check,S,2,0),c=d=0,i.mode=2;else if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&d)<<8)+(d>>8))%31)e.msg="incorrect header check",i.mode=30;else if(8!=(15&d))e.msg="unknown compression method",i.mode=30;else{if(c-=4,w=8+(15&(d>>>=4)),0===i.wbits)i.wbits=w;else if(w>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<>8&1),512&i.flags&&(S[0]=255&d,S[1]=d>>>8&255,i.check=L(i.check,S,2,0)),c=d=0,i.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,d+=n[o++]<>>8&255,S[2]=d>>>16&255,S[3]=d>>>24&255,i.check=L(i.check,S,4,0)),c=d=0,i.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,d+=n[o++]<>8),512&i.flags&&(S[0]=255&d,S[1]=d>>>8&255,i.check=L(i.check,S,2,0)),c=d=0,i.mode=5;case 5:if(1024&i.flags){for(;c<16;){if(0===a)break e;a--,d+=n[o++]<>>8&255,i.check=L(i.check,S,2,0)),c=d=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&((p=a<(p=i.length)?a:p)&&(i.head&&(w=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),R.arraySet(i.head.extra,n,o,p,w)),512&i.flags&&(i.check=L(i.check,n,p,o)),a-=p,o+=p,i.length-=p),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===a)break e;for(p=0;w=n[o+p++],i.head&&w&&i.length<65536&&(i.head.name+=String.fromCharCode(w)),w&&p>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,d+=n[o++]<>>=7&c,c-=7&c,i.mode=27;else{for(;c<3;){if(0===a)break e;a--,d+=n[o++]<>>=1)){case 0:i.mode=14;break;case 1:P=C=void 0;var P,C=i;if(z){for(_=new R.Buf32(512),G=new R.Buf32(32),P=0;P<144;)C.lens[P++]=8;for(;P<256;)C.lens[P++]=9;for(;P<280;)C.lens[P++]=7;for(;P<288;)C.lens[P++]=8;for(H(F,C.lens,0,288,_,0,C.work,{bits:9}),P=0;P<32;)C.lens[P++]=5;H(N,C.lens,0,32,G,0,C.work,{bits:5}),z=!1}if(C.lencode=_,C.lenbits=9,C.distcode=G,C.distbits=5,i.mode=20,6!==t)break;d>>>=2,c-=2;break e;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}d>>>=2,c-=2}break;case 14:for(d>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,d+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&d,c=d=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(p=i.length){if(0===(p=l<(p=a>>=5,c-=5,i.ndist=1+(31&d),d>>>=5,c-=5,i.ncode=4+(15&d),d>>>=4,c-=4,286>>=3,c-=3}for(;i.have<19;)i.lens[B[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,I={bits:i.lenbits},x=H(0,i.lens,0,19,i.lencode,0,i.work,I),i.lenbits=I.bits,x){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have>>16&255,A=65535&T,!((g=T>>>24)<=c);){if(0===a)break e;a--,d+=n[o++]<>>=g,c-=g,i.lens[i.have++]=A;else{if(16===A){for(b=g+2;c>>=g,c-=g,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}w=i.lens[i.have-1],p=3+(3&d),d>>>=2,c-=2}else if(17===A){for(b=g+3;c>>=g)),d>>>=3,c=c-g-3}else{for(b=g+7;c>>=g)),d>>>=7,c=c-g-7}if(i.have+p>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;p--;)i.lens[i.have++]=w}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,I={bits:i.lenbits},x=H(F,i.lens,0,i.nlen,i.lencode,0,i.work,I),i.lenbits=I.bits,x){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,I={bits:i.distbits},x=H(N,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,I),i.distbits=I.bits,x){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,i.hold=d,i.bits=c,D(e,u),s=e.next_out,r=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,d=i.hold,c=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;v=(T=i.lencode[d&(1<>>16&255,A=65535&T,!((g=T>>>24)<=c);){if(0===a)break e;a--,d+=n[o++]<>y)])>>>16&255,A=65535&T,!(y+(g=T>>>24)<=c);){if(0===a)break e;a--,d+=n[o++]<>>=y,c-=y,i.back+=y}if(d>>>=g,c-=g,i.back+=g,i.length=A,0===v){i.mode=26;break}if(32&v){i.back=-1,i.mode=12;break}if(64&v){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&v,i.mode=22;case 22:if(i.extra){for(b=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;v=(T=i.distcode[d&(1<>>16&255,A=65535&T,!((g=T>>>24)<=c);){if(0===a)break e;a--,d+=n[o++]<>y)])>>>16&255,A=65535&T,!(y+(g=T>>>24)<=c);){if(0===a)break e;a--,d+=n[o++]<>>=y,c-=y,i.back+=y}if(d>>>=g,c-=g,i.back+=g,64&v){e.msg="invalid distance code",i.mode=30;break}i.offset=A,i.extra=15&v,i.mode=24;case 24:if(i.extra){for(b=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===l)break e;if(i.offset>(p=u-l)){if((p=i.offset-p)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}f=p>i.wnext?(p-=i.wnext,i.wsize-p):i.wnext-p,p>i.length&&(p=i.length),m=i.window}else m=r,f=s-i.offset,p=i.length;for(l-=p=lp?(m=O[L+s[y]],B[P+s[y]]):(m=96,0),l=1<<(f=A-I),E=d=1<>I)+(d-=l)]=f<<24|m<<16|g|0,0!==d;);for(l=1<>=1;if(S=0!==l?(S&l-1)+l:0,y++,0==--C[A]){if(A===M)break;A=t[i+s[y]]}if(w>>7)]}function r(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function H(e,t,i){e.bi_valid>n-i?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=i-n):(e.bi_buf|=t<>>=1,i<<=1,0<--t;);return i>>>1}function _(e,t,i){for(var n,r=new Array(T+1),o=0,s=1;s<=T;s++)r[s]=o=o+i[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=k(r[a]++,a))}}function G(e){for(var t=0;t>1;1<=i;i--)N(e,o,i);for(r=l;i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],N(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=n,o[2*r]=o[2*i]+o[2*n],e.depth[r]=(e.depth[i]>=e.depth[n]?e.depth[i]:e.depth[n])+1,o[2*i+1]=o[2*n+1]=r,e.heap[1]=r++,N(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,h,u,p,f,m=e,g=t.dyn_tree,v=t.max_code,A=t.stat_desc.static_tree,y=t.stat_desc.has_stree,E=t.stat_desc.extra_bits,M=t.stat_desc.extra_base,w=t.stat_desc.max_length,x=0,I=0;I<=T;I++)m.bl_count[I]=0;for(g[2*m.heap[m.heap_max]+1]=0,c=m.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*i])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return h;for(i=32;i>>3,(o=e.static_len+3+7>>>3)<=r&&(r=o)):r=o=i+5,i+4<=r&&-1!==t)Z(e,t,i,n);else if(4===e.strategy||o===r)H(e,2+(n?1:0),3),Y(e,I,S);else{H(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,i=e.d_desc.max_code+1,d=s+1;for(H(l,t-257,5),H(l,i-1,5),H(l,d-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(P[i]+p+1)]++,e.dyn_dtree[2*D(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){H(e,2,3),F(e,v,I),16===(e=e).bi_valid?(r(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":3}],15:[function(e,t,i){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],"/":[function(e,t,i){var n={};(0,e("./lib/utils/common").assign)(n,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=n},{"./lib/deflate":1,"./lib/inflate":2,"./lib/utils/common":3,"./lib/zlib/constants":6}]},{},[])("/")},function(e,t,i){function d(){}function c(e,t,i,n,r,o,s,a,l,d){for(var c,h,u=0,p=r;p!==s;p+=o)for(h=a;h!==d;h+=l,u++)c=t[u],e[4*(h+n*p)+3]=255,e[4*(h+n*p)+2]=i[3*c+0],e[4*(h+n*p)+1]=i[3*c+1],e[4*(h+n*p)+0]=i[3*c+2];return e}function h(e,t,i,n,r,o,s,a,l,d){for(var c,h,u=0,p=r;p!==s;p+=o)for(h=a;h!==d;h+=l,u+=2)c=t[u+0]|t[u+1]<<8,e[4*(h+n*p)+0]=(31744&c)>>7,e[4*(h+n*p)+1]=(992&c)>>2,e[4*(h+n*p)+2]=(31&c)>>3,e[4*(h+n*p)+3]=32768&c?0:255;return e}function u(e,t,i,n,r,o,s,a,l,d){for(var c,h=0,u=r;u!==s;u+=o)for(c=a;c!==d;c+=l,h+=3)e[4*(c+n*u)+3]=255,e[4*(c+n*u)+2]=t[h+0],e[4*(c+n*u)+1]=t[h+1],e[4*(c+n*u)+0]=t[h+2];return e}function p(e,t,i,n,r,o,s,a,l,d){for(var c,h=0,u=r;u!==s;u+=o)for(c=a;c!==d;c+=l,h+=4)e[4*(c+n*u)+2]=t[h+0],e[4*(c+n*u)+1]=t[h+1],e[4*(c+n*u)+0]=t[h+2],e[4*(c+n*u)+3]=t[h+3];return e}function f(e,t,i,n,r,o,s,a,l,d){for(var c,h,u=0,p=r;p!==s;p+=o)for(h=a;h!==d;h+=l,u++)c=t[u],e[4*(h+n*p)+0]=c,e[4*(h+n*p)+1]=c,e[4*(h+n*p)+2]=c,e[4*(h+n*p)+3]=255;return e}function m(e,t,i,n,r,o,s,a,l,d){for(var c,h=0,u=r;u!==s;u+=o)for(c=a;c!==d;c+=l,h+=2)e[4*(c+n*u)+0]=t[h+0],e[4*(c+n*u)+1]=t[h+0],e[4*(c+n*u)+2]=t[h+0],e[4*(c+n*u)+3]=t[h+1];return e}var n;d.Type={NO_DATA:0,INDEXED:1,RGB:2,GREY:3,RLE_INDEXED:9,RLE_RGB:10,RLE_GREY:11},d.Origin={BOTTOM_LEFT:0,BOTTOM_RIGHT:1,TOP_LEFT:2,TOP_RIGHT:3,SHIFT:4,MASK:48},d.prototype.open=function(e,t){var i=this,n=new XMLHttpRequest;n.overrideMimeType("text/plain"),n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){200===this.status&&(i.load(new Uint8Array(n.response)),t)&&t.call(i)},n.send(null)},d.prototype.load=function(e){var t=0;if(e.length<18)throw new Error("Targa::load() - Not enough data to contain header");this.header={idLength:e[t++],colorMapType:e[t++],imageType:e[t++],colorMapIndex:e[t++]|e[t++]<<8,colorMapLength:e[t++]|e[t++]<<8,colorMapDepth:e[t++],offsetX:e[t++]|e[t++]<<8,offsetY:e[t++]|e[t++]<<8,width:e[t++]|e[t++]<<8,height:e[t++]|e[t++]<<8,pixelDepth:e[t++],flags:e[t++]},this.header.hasEncoding=this.header.imageType===d.Type.RLE_INDEXED||this.header.imageType===d.Type.RLE_RGB||this.header.imageType===d.Type.RLE_GREY,this.header.hasColorMap=this.header.imageType===d.Type.RLE_INDEXED||this.header.imageType===d.Type.INDEXED,this.header.isGreyColor=this.header.imageType===d.Type.RLE_GREY||this.header.imageType===d.Type.GREY;var i=this.header;if(i.imageType===d.Type.NO_DATA)throw new Error("Targa::checkHeader() - No data");if(i.hasColorMap){if(256=e.length)throw new Error("Targa::load() - No data");this.header.hasColorMap&&(i=this.header.colorMapLength*(this.header.colorMapDepth>>3),this.palette=e.subarray(t,t+i),t+=i);var i=this.header.pixelDepth>>3,n=this.header.width*this.header.height,r=n*i;this.header.hasEncoding?this.imageData=function(e,t,i,n){for(var r,o,s,a=new Uint8Array(n),l=new Uint8Array(i),d=0;d>d.Origin.SHIFT;switch(e=e||(document?document.createElement("canvas").getContext("2d").createImageData(s,a):{width:s,height:a,data:new Uint8ClampedArray(s*a*4)}),a=l===d.Origin.TOP_LEFT||l===d.Origin.TOP_RIGHT?(n=0,r=1,a):(n=a-1,r=-1),l=l===d.Origin.TOP_LEFT||l===d.Origin.BOTTOM_LEFT?(t=0,i=1,s):(t=s-1,i=-1),this.header.pixelDepth){case 8:o=this.header.isGreyColor?f:c;break;case 16:o=this.header.isGreyColor?m:h;break;case 24:o=u;break;case 32:o=p}return o(e.data,this.imageData,this.palette,s,n,r,a,t,i,l),e},d.prototype.getCanvas=function(){var e=document.createElement("canvas"),t=e.getContext("2d"),i=t.createImageData(this.header.width,this.header.height);return e.width=this.header.width,e.height=this.header.height,t.putImageData(this.getImageData(i),0,0),e},d.prototype.getDataURL=function(e){return this.getCanvas().toDataURL(e||"image/png")},(n={}).exports=t,n.exports&&(n.exports.TGA=d)},function(e,t){THREE.RGBFormat=THREE.RGBAFormat,THREE.RGBIntegerFormat=THREE.RGBAIntegerFormat},function(e,t){THREE.Geometry=THREE.CompatibleGeometry,THREE.Geometry.prototype.applyMatrix=THREE.Geometry.prototype.applyMatrix4;var i=0;THREE.GeometryIdCount=function(){return i++}},function(e,t){THREE.Matrix3.prototype.getInverse=function(e,t){e&&e.isMatrix4&&console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.");var e=e.elements,i=this.elements,n=e[0],r=e[1],o=e[2],s=e[3],a=e[4],l=e[5],d=e[6],c=e[7],e=e[8],h=e*a-l*c,u=l*d-e*s,p=c*s-a*d,f=n*h+r*u+o*p;if(0==f){var m="THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0";if(!0===t)throw new Error(m);return console.warn(m),this.identity()}t=1/f;return i[0]=h*t,i[1]=(o*c-e*r)*t,i[2]=(l*r-o*a)*t,i[3]=u*t,i[4]=(e*n-o*d)*t,i[5]=(o*s-l*n)*t,i[6]=p*t,i[7]=(r*d-c*n)*t,i[8]=(a*n-r*s)*t,this}},function(e,t){THREE.Matrix4.prototype.getInverse=function(e,t){var i=this.elements,e=e.elements,n=e[0],r=e[1],o=e[2],s=e[3],a=e[4],l=e[5],d=e[6],c=e[7],h=e[8],u=e[9],p=e[10],f=e[11],m=e[12],g=e[13],v=e[14],e=e[15],A=u*v*c-g*p*c+g*d*f-l*v*f-u*d*e+l*p*e,y=m*p*c-h*v*c-m*d*f+a*v*f+h*d*e-a*p*e,E=h*g*c-m*u*c+m*l*f-a*g*f-h*l*e+a*u*e,M=m*u*d-h*g*d-m*l*p+a*g*p+h*l*v-a*u*v,w=n*A+r*y+o*E+s*M;if(0==w){var x="THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0";if(!0===t)throw new Error(x);return console.warn(x),this.identity()}t=1/w;return i[0]=A*t,i[1]=(g*p*s-u*v*s-g*o*f+r*v*f+u*o*e-r*p*e)*t,i[2]=(l*v*s-g*d*s+g*o*c-r*v*c-l*o*e+r*d*e)*t,i[3]=(u*d*s-l*p*s-u*o*c+r*p*c+l*o*f-r*d*f)*t,i[4]=y*t,i[5]=(h*v*s-m*p*s+m*o*f-n*v*f-h*o*e+n*p*e)*t,i[6]=(m*d*s-a*v*s-m*o*c+n*v*c+a*o*e-n*d*e)*t,i[7]=(a*p*s-h*d*s+h*o*c-n*p*c-a*o*f+n*d*f)*t,i[8]=E*t,i[9]=(m*u*s-h*g*s-m*r*f+n*g*f+h*r*e-n*u*e)*t,i[10]=(a*g*s-m*l*s+m*r*c-n*g*c-a*r*e+n*l*e)*t,i[11]=(h*l*s-a*u*s-h*r*c+n*u*c+a*r*f-n*l*f)*t,i[12]=M*t,i[13]=(h*g*o-m*u*o+m*r*p-n*g*p-h*r*v+n*u*v)*t,i[14]=(m*l*o-a*g*o-m*r*d+n*g*d+a*r*v-n*l*v)*t,i[15]=(a*u*o-h*l*o+h*r*d-n*u*d-a*r*p+n*l*p)*t,this}},function(e,t){THREE.Quaternion.prototype.inverse=function(){return this.conjugate().normalize()}},function(e,t){THREE.Object3D.prototype.applyMatrix=function(e){this.applyMatrix4(e)}},function(e,t){THREE.BufferGeometry.prototype.addAttribute=THREE.BufferGeometry.prototype.setAttribute,THREE.BufferGeometry.prototype.applyMatrix=THREE.BufferGeometry.prototype.applyMatrix4},function(e,t){THREE.Math=THREE.MathUtils},function(e,t){THREE.Triangle.normal=function(e,t,i){return THREE.Triangle.getNormal(e,t,i,new THREE.Vector3)}},function(e,t){THREE.Matrix4D=function(){THREE.Matrix4.call(this),this.elements=new Float64Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])},THREE.Matrix4D.prototype=Object.create(THREE.Matrix4.prototype)},function(e,t){THREE.Plane.prototype.transformProvidingInverse=function(e){var t=new THREE.Vector4(this.normal.x,this.normal.y,this.normal.z,this.constant);t.applyMatrix4(e.clone().transpose()),this.setComponents(t.x,t.y,t.z,t.w),this.normalize()}},function(e,O,L){!function(e){var I=L(16),o=L(17),a=L(18);function i(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function l(e,t){if(i()=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function u(e,t){if(h.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;var i=(e="string"!=typeof e?""+e:e).length;if(0===i)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return P(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return C(e).length;default:if(n)return P(e).length;t=(""+t).toLowerCase(),n=!0}}function t(e,t,i){var n,r=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((i=void 0===i||i>this.length?this.length:i)<=0)return"";if((i>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=i,l=o.length;(!a||a<0||l=e.length){if(r)return-1;i=e.length-1}else if(i<0){if(!r)return-1;i=0}if("string"==typeof t&&(t=h.from(t,n)),h.isBuffer(t))return 0===t.length?-1:m(e,t,i,n,r);if("number"==typeof t)return t&=255,h.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?(r?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,i):m(e,[t],i,n,r);throw new TypeError("val must be string, number or Buffer")}function m(e,t,i,n,r){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,i/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(r)for(var d=-1,c=i;c>8,r.push(i%256),r.push(n);return r}(t,e.length-i),e,i,n)}function b(e,t,i){i=Math.min(e.length,i);for(var n=[],r=t;r>>10&1023|55296),c=56320|1023&c),n.push(c),r+=h}var u=n,p=u.length;if(p<=A)return String.fromCharCode.apply(String,u);for(var f="",m=0;mt)&&(e+=" ... "),""},h.prototype.compare=function(e,t,i,n,r){if(!h.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===i&&(i=e?e.length:0),void 0===n&&(n=0),void 0===r&&(r=this.length),(t=void 0===t?0:t)<0||i>e.length||n<0||r>this.length)throw new RangeError("out of range index");if(r<=n&&i<=t)return 0;if(r<=n)return-1;if(i<=t)return 1;if(this===e)return 0;for(var o=(r>>>=0)-(n>>>=0),s=(i>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,r),d=e.slice(t,i),c=0;cthis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var d=this,c=e,h=t,u=i,p=(h=Number(h)||0,d.length-h);if((!u||p<(u=Number(u)))&&(u=p),(p=c.length)%2!=0)throw new TypeError("Invalid hex string");p/2e.length)throw new RangeError("Index out of range")}function M(e,t,i,n){t<0&&(t=65535+t+1);for(var r=0,o=Math.min(e.length-i,2);r>>8*(n?r:1-r)}function w(e,t,i,n){t<0&&(t=4294967295+t+1);for(var r=0,o=Math.min(e.length-i,4);r>>8*(n?r:3-r)&255}function x(e,t,i,n){if(i+n>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function T(e,t,i,n,r){return r||x(e,0,i,4),o.write(e,t,i,n,23,4),i+4}function S(e,t,i,n,r){return r||x(e,0,i,8),o.write(e,t,i,n,52,8),i+8}h.prototype.slice=function(e,t){var i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):i>>8):M(this,e,t,!0),t+2},h.prototype.writeUInt16BE=function(e,t,i){return e=+e,t|=0,i||E(this,e,t,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},h.prototype.writeUInt32LE=function(e,t,i){return e=+e,t|=0,i||E(this,e,t,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):w(this,e,t,!0),t+4},h.prototype.writeUInt32BE=function(e,t,i){return e=+e,t|=0,i||E(this,e,t,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):w(this,e,t,!1),t+4},h.prototype.writeIntLE=function(e,t,i,n){e=+e,t|=0,n||E(this,e,t,i,(n=Math.pow(2,8*i-1))-1,-n);var r=0,o=1,s=0;for(this[t]=255&e;++r>0)-s&255;return t+i},h.prototype.writeIntBE=function(e,t,i,n){e=+e,t|=0,n||E(this,e,t,i,(n=Math.pow(2,8*i-1))-1,-n);var r=i-1,o=1,s=0;for(this[t+r]=255&e;0<=--r&&(o*=256);)e<0&&0===s&&0!==this[t+r+1]&&(s=1),this[t+r]=(e/o>>0)-s&255;return t+i},h.prototype.writeInt8=function(e,t,i){return e=+e,t|=0,i||E(this,e,t,1,127,-128),h.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&(e=e<0?255+e+1:e),t+1},h.prototype.writeInt16LE=function(e,t,i){return e=+e,t|=0,i||E(this,e,t,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},h.prototype.writeInt16BE=function(e,t,i){return e=+e,t|=0,i||E(this,e,t,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},h.prototype.writeInt32LE=function(e,t,i){return e=+e,t|=0,i||E(this,e,t,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):w(this,e,t,!0),t+4},h.prototype.writeInt32BE=function(e,t,i){return e=+e,t|=0,i||E(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):w(this,e,t,!1),t+4},h.prototype.writeFloatLE=function(e,t,i){return T(this,e,t,!0,i)},h.prototype.writeFloatBE=function(e,t,i){return T(this,e,t,!1,i)},h.prototype.writeDoubleLE=function(e,t,i){return S(this,e,t,!0,i)},h.prototype.writeDoubleBE=function(e,t,i){return S(this,e,t,!1,i)},h.prototype.copy=function(e,t,i,n){if(i=i||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var r,o=(n=e.length-t>>=0,i=void 0===i?this.length:i>>>0,"number"==typeof(e=e||0))for(a=t;a>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;o.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return o}function C(e){return I.toByteArray(function(e){var t;if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function R(e,t,i,n){for(var r=0;r=t.length||r>=e.length);++r)t[r+i]=e[r];return r}}.call(this,L(15))},function(e,t){var i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){t.byteLength=function(e){var e=c(e),t=e[0],e=e[1];return 3*(t+e)/4-e},t.toByteArray=function(e){var t,i,n=c(e),r=n[0],n=n[1],o=new d(function(e,t){return 3*(e+t)/4-t}(r,n)),s=0,a=0>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(i)]<<2|l[e.charCodeAt(i+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(i)]<<10|l[e.charCodeAt(i+1)]<<4|l[e.charCodeAt(i+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},t.fromByteArray=function(e){for(var t,i=e.length,n=i%3,r=[],o=0,s=i-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return r.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[i-2]<<8)+e[i-1],r.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return r.join("")};for(var a=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,o=n.length;r>1,c=-7,h=i?r-1:0,u=i?-1:1,r=e[t+h];for(h+=u,o=r&(1<<-c)-1,r>>=-c,c+=a;0>=-c,c+=n;0>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,u=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?h/n:h*Math.pow(2,1-c))*n&&(s++,n/=2),d<=s+c?(a=0,s=d):1<=s+c?(a=(t*n-1)*Math.pow(2,r),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,r),s=0));8<=r;e[i+u]=255&a,u+=p,a/=256,r-=8);for(s=s<Math.abs(t.z))&&(this.activePlane=this.planes.XZ),"Y"===e&&(this.activePlane=this.planes.XY,Math.abs(t.x)>Math.abs(t.z))&&(this.activePlane=this.planes.YZ),"Z"===e&&(this.activePlane=this.planes.XZ,Math.abs(t.x)>Math.abs(t.y))&&(this.activePlane=this.planes.YZ),"XYZ"===e&&(this.activePlane=this.planes.XYZE),"XY"===e&&(this.activePlane=this.planes.XY),"YZ"===e&&(this.activePlane=this.planes.YZ),"XZ"===e&&(this.activePlane=this.planes.XZ)},this.showAxis=function(e,t){if(void 0!==e&&""!==e)switch(e){case"x":for(var i=0;iMath.abs(t.z))&&(this.activePlane=this.planes.XZ),"Y"===e&&(this.activePlane=this.planes.XY,Math.abs(t.x)>Math.abs(t.z))&&(this.activePlane=this.planes.YZ),"Z"===e&&(this.activePlane=this.planes.XZ,Math.abs(t.x)>Math.abs(t.y))&&(this.activePlane=this.planes.YZ),"XYZ"===e&&(this.activePlane=this.planes.XYZE)},this.init()}function Le(u){for(var l,e,h=u.lights,o=u.camera,t=u.scene,p=(this.viewer=u,new THREE.Group),s=(p.name="lightctrls",t.add(p),null),s=u.canvas2D||u.canvas3D,c=[],f=null,m=null,d=null,g=null,v=null,A=null,y=null,E=null,M=null,w=null,x=null,I=null,t=h.length,i=!1,n=.7,a=(s.width,s.height),b=new Array(t),r=null,T=2,S=.7,B=1e3,P=this,C=(this._scene=p,this._transformScene=new THREE.Scene,new THREE.TextureLoader(new THREE.LoadingManager)),R=0;Rl&&(l=a[d]);B=4*l,l/=10,P.setDirLength(2);for(var c=0;ca&&(a=s[l]);B=4*a;for(l=0;l=h.length)return!1;if("None"==t)this.setIconVisible(h[e],!1),this.setLightEnabled(h[e],!1),h[e].type="None";else if(this.setLightEnabled(h[e],!0),h[e].type!=t){"DirectionalLight"==h[e].type&&h[e]._followCamera&&(P.viewer.removeFrameListener(h[e]._followCameraListener),h[e]._followCamera=null);var i,n=null,r=(h[e]._iconVisible?(n=b[e].position,p.remove(b[e]),i=O(b[e]),D(b[e].children[i])):(p.remove(h[e]),n=h[e].position),h[e]._iconVisible);switch(t){case"DirectionalLight":h[e]=new THREE.DirectionalLight(16777215,1),h[e]._enabled=!0,h[e]._visible=!0,h[e]._iconVisible=!1,h[e]._followCamera=!1,h[e].position.copy(n),p.add(h[e]),I.detach();break;case"PointLight":h[e]=new THREE.PointLight(16777215),h[e]._enabled=!0,h[e]._visible=!0,h[e]._iconVisible=!1,h[e]._distance=50,h[e].distance=.5*B,h[e].position.copy(n),r?k(e):p.add(h[e]);break;case"HemisphereLight":h[e]=new THREE.HemisphereLight(16777215,16777215,1),h[e]._enabled=!0,h[e]._visible=!0,h[e]._iconVisible=!1,h[e].position.copy(n),r?_(e):p.add(h[e]);break;case"SpotLight":h[e]=new THREE.SpotLight(16777215,1),h[e]._enabled=!0,h[e]._visible=!0,h[e]._iconVisible=!1,h[e]._distance=50,h[e].distance=.5*B,h[e].position.copy(n),h[e].target.position.set(n.x,n.y-1,n.z),r?U(e):p.add(h[e])}h[e]._iconVisible&&(I.detach(),i=O(b[e]),I.attachTo(b[e].children[i])),u.render()}return!0},this.addLight=function(e){for(var t=u.controls.getBoundingBox(),i=t.min.x,n=t.min.y,r=t.min.z,o=t.max.x,s=t.max.y,t=t.max.z,a=new Array(3),l=(a[0]=s-n,a[1]=o-i,a[2]=t-r,a[0]),d=0;d<3;d++)a[d]>l&&(l=a[d]);B=4*l,l/=10;var c=h.length;switch(e){case"DirectionalLight":h[c]=new THREE.DirectionalLight(16777215,1),h[c]._enabled=!0,h[c]._visible=!0,h[c]._iconVisible=!1,h[c]._followCamera=!1,h[c].position.set(1,2,0),p.add(h[c]);break;case"PointLight":h[c]=new THREE.PointLight(16777215),h[c]._enabled=!0,h[c]._visible=!0,h[c]._iconVisible=!1,h[c]._distance=50,h[c].distance=.5*B,h[c].position.set(0,0,0),p.add(h[c]);break;case"HemisphereLight":h[c]=new THREE.HemisphereLight(16777215,16777215,1),h[c]._enabled=!0,h[c]._visible=!0,h[c]._iconVisible=!1,h[c].position.set(0,5,0),p.add(h[c]);break;case"SpotLight":h[c]=new THREE.SpotLight(16777215,1),h[c]._enabled=!0,h[c]._visible=!0,h[c]._iconVisible=!1,h[c]._distance=50,h[c].distance=.5*B,h[c].position.set(10,10,10),h[c].target.position.set(10,9,10),p.add(h[c]);break;case"None":h[c]=new THREE.DirectionalLight(16777215,1),h[c]._enabled=!1,h[c]._visible=!1,h[c]._iconVisible=!1,h[c]._followCamera=!1,h[c].position.set(1,2,0),h[c].type="None"}h[c]&&(h[c].position.set(i+(o-i)/2+l*c,s+l,r-l+l*c),h[c].updateMatrixWorld(!0)),u.render()},this.removeLight=function(e){var t,e=H(e);"DirectionalLight"==h[e].type&&h[e]._followCamera&&(P.viewer.removeFrameListener(h[e]._followCameraListener),h[e]._followCamera=null),h[e]._iconVisible?(p.remove(b[e]),t=O(b[e]),D(b[e].children[t])):p.remove(h[e]),b.splice(e,1),h.splice(e,1);for(var i,n=0;n=h.length?null:h[e]},this.showLightGizmo=function(e){var t,i;e._enabled&&e._iconVisible&&(i=H(e),t=O(b[i]),i=b[i].children[t],e._enabled?I.attachTo(i):I.detach())},this.getLightEnabled=function(e){if(null!=e)return e._enabled},this.setLightVisible=function(e,t){if(null==e)return!1;if(e._visible==t)return!0;if("DirectionalLight"==e.type)return!0;e._visible=t;var i=H(e),n=e.type;if(t){switch(n){case"DirectionalLight":null==f&&(f=new THREE.SpriteMaterial({map:m,side:THREE.DoubleSide,transparent:!0})),(s=new THREE.Sprite(f)).name="dirlightctrl";break;case"HemisphereLight":null==y&&(y=new THREE.SpriteMaterial({map:E,side:THREE.DoubleSide,transparent:!0})),(s=new THREE.Sprite(y)).name="hemilightctrl";break;case"PointLight":null==g&&(g=new THREE.SpriteMaterial({map:v,side:THREE.DoubleSide,transparent:!0})),(s=new THREE.Sprite(g)).name="pointlightctrl";break;case"SpotLight":null==x&&(x=new new THREE.SpriteMaterial({map:w,side:THREE.DoubleSide,transparent:!0})),(s=new THREE.Sprite(x)).name="spotlightctrl";var r=j();b[i].add(r)}o=O(b[i]);b[i].remove(b[i].children[o]),b[i].add(s),b[i].add(e),c.push(s)}else{b[i].remove(e);var o=O(b[i]),s=(D(b[i].children[o]),null);switch(n){case"DirectionalLight":null==d&&(d=new THREE.SpriteMaterial({map:null,side:THREE.DoubleSide,transparent:!0})),s=new THREE.Sprite(d);break;case"HemisphereLight":null==M&&(M=new THREE.SpriteMaterial({map:null,side:THREE.DoubleSide,transparent:!0})),s=new THREE.Sprite(M);break;case"PointLight":null==A&&(A=new THREE.SpriteMaterial({map:void 0,side:THREE.DoubleSide,transparent:!0})),s=new THREE.Sprite(A);break;case"SpotLight":null==l&&(l=new THREE.SpriteMaterial({map:void 0,side:THREE.DoubleSide,transparent:!0}));var s=new THREE.Sprite(l),a=F(b[i]);b[i].remove(b[i].children[a])}I.getCurrAttachObj()==b[i]&&I.detach();var o=O(b[i]);b[i].remove(b[i].children[o]),b[i].add(s)}},this.setLightEnabled=function(e,t){if(null==e)return!1;var i=H(e);if(e._enabled!=t){e._enabled=t;var n,r,o=e.type;switch(o){case"DirectionalLight":t?(e._iconVisible?p.add(b[i]):(p.add(e),p.add(e.target)),e._followCamera&&(n=new L(i),P.viewer.addFrameListener(n),e._followCameraListener=n)):(e._followCamera&&P.viewer.removeFrameListener(e._followCameraListener),e._iconVisible?p.remove(b[i]):(p.remove(e),p.remove(e.target)));break;case"PointLight":case"SpotLight":case"HemisphereLight":t?e._iconVisible?p.add(b[i]):(p.add(e),"SpotLight"==o&&p.add(e.target)):e._iconVisible?p.remove(b[i]):(p.remove(e),"SpotLight"==o&&p.remove(e.target))}t&&e._iconVisible?(r=O(b[i]),I.attachTo(b[i].children[r])):!t&&e._iconVisible&&null!=I&&I.getCurrAttachObj()==b[i]&&I.detach(),t&&P.setIconVisible(e,!0),u.render()}return!0},this.getLightParam=function(e){switch(e.type){case"PointLight":return this.getPointLightParam(e);case"DirectionalLight":return this.getDirLightParam(e);case"SpotLight":return this.getSpotLightParam(e);case"HemisphereLight":return this.getHemiLightParam(e);default:return null}},this.getPointLightParam=function(e){var t,i,n,r={};if(null!=e&&"PointLight"==e.type)return r.color=e.color.getHex(),r.intensity=e.intensity,r.distance=e._distance,t=new THREE.Vector3,i=new THREE.Quaternion,n=new THREE.Vector3,e.matrixWorld.decompose(t,i,n),r.position={},r.position.x=t.x,r.position.y=t.y,r.position.z=t.z,r.iconVisible=e._iconVisible,r},this.setPointLightParam=function(e,t){var i,n,r;return void 0!==t&&null!=e&&!!e._enabled&&"PointLight"==e.type&&(i=!1,n=H(e),e._visible&&(null!=t.color&&"null"!=t.color&&(r=parseInt(t.color),e.color=new THREE.Color(r),i=!0),null!=t.intensity&&"null"!=t.intensity&&(r=parseFloat(t.intensity),e.intensity=r,i=!0),null!=t.distance&&"null"!=t.distance&&(r=parseFloat(t.distance),e._distance=r,e.distance=r/100*B+.1,i=!0),null!=t.position)&&"null"!=t.position&&(r=null,r="[object String]"===Object.prototype.toString.call(t.position)?JSON.parse(t.position):t.position,(e._iconVisible?(b[n].position.set(r.x,r.y,r.z),b[n]):(e.position.set(r.x,r.y,r.z),e)).updateMatrixWorld(!0),i=!0),null!=t.visible&&"null"!=t.visible&&(n=null,"[object String]"===Object.prototype.toString.call(t.visible)?"true"==t.visible?n=!0:"false"==t.visible&&(n=!1):n=t.visible,this.setLightVisible(e,n),i=!0),null!=t.iconVisible&&"null"!=t.iconVisible&&(r=null,"[object String]"===Object.prototype.toString.call(t.iconVisible)?"true"==t.iconVisible?r=!0:"false"==t.iconVisible&&(r=!1):r=t.iconVisible,this.setIconVisible(e,r),i=!0),u.render(),i)},this.getDirLightParam=function(e){var t={};if(null!=e&&("DirectionalLight"==e.type||"None"==e.type))return t.color=e.color.getHex(),t.intensity=e.intensity,t.followCamera=e._followCamera,t.position={},t.position.x=e.position.x,t.position.y=e.position.y,t.position.z=e.position.z,t.target={},t.target.x=e.target.position.x,t.target.y=e.target.position.y,t.target.z=e.target.position.z,t.iconVisible=e._iconVisible,t.rotate=e.rotate,t.bias=e.bias,t},this.setDirLightParam=function(e,t){var i,n,r,o,s,a,l,d,c,h;return void 0!==t&&null!=e&&(i=H(e),!!e._enabled)&&"DirectionalLight"==e.type&&(n=!1,e._visible&&(null!=t.color&&"null"!=t.color&&(h=parseInt(t.color),e.color=new THREE.Color(h),n=!0),null!=t.intensity&&"null"!=t.intensity&&(h=parseFloat(t.intensity),e.intensity=h,n=!0),null!=t.followCamera&&"null"!=t.followCamera&&(h=null,"[object String]"===Object.prototype.toString.call(t.followCamera)?"true"==t.followCamera?h=!0:t.followCamera:h=t.followCamera,h?e._followCamera||(c=new L(i),e._followCameraListener=c,e.oldDir=e.target.getWorldPosition(),e.oldDir.sub(e.getWorldPosition()),e.oldDir.normalize(),P.viewer.addFrameListener(c),u.render()):e._followCamera&&(P.viewer.removeFrameListener(e._followCameraListener),c=new THREE.Vector3,void 0===e.oldDir&&(e.oldDir=e.target.getWorldPosition(),e.oldDir.sub(e.getWorldPosition()),e.oldDir.normalize()),c.addVectors(e.getWorldPosition(),e.oldDir),e.target.position.copy(c),e.target.updateMatrixWorld(!0),e._iconVisible)&&(c=I.getCurrAttachObj()==b[i],p.remove(b[i]),0<=(s=O(b[i]))&&D(b[i].children[s]),e.position.copy(b[i].position),G(i),c)&&0<=(s=O(b[i]))&&(c=b[i].children[s],I.attachTo(c)),e._followCamera=h,n=!0),null!=t.position&&"null"!=t.position&&(a=null,a="[object String]"===Object.prototype.toString.call(t.position)?JSON.parse(t.position):t.position,(e._iconVisible?(b[i].position.set(a.x,a.y,a.z),b[i]):(e.position.set(a.x,a.y,a.z),e)).updateMatrixWorld(!0),n=!0),null!=t.target&&"null"!=t.target&&t.position&&(l=null,l="[object String]"===Object.prototype.toString.call(t.target)?JSON.parse(t.target):t.target,e._iconVisible?(d=b[i].position,e.target.position.set(l.x-d.x,l.y-d.y,l.z-d.z)):e.target.position.set(l.x,l.y,l.z),e.target.updateMatrixWorld(!0),n=!0),null!=t.rotate&&"null"!=t.rotate&&((r=e.target.getWorldPosition()).sub(e.getWorldPosition()),r.normalize(),(o=new THREE.Vector3(-1,-1,0)).applyAxisAngle(new THREE.Vector3(0,1,0),t.rotate*Math.PI/180),o.normalize(),a=new THREE.Vector3,e._iconVisible?a.copy(b[i].position):a.copy(e.position),l=a.add(o),e._iconVisible?(d=b[i].position,e.target.position.set(l.x-d.x,l.y-d.y,l.z-d.z)):e.target.position.set(l.x,l.y,l.z),e.target.updateMatrixWorld(!0),e.rotate=t.rotate),null!=t.bias)&&"null"!=t.bias&&((r=e.target.getWorldPosition()).sub(e.getWorldPosition()),r.normalize(),o=new THREE.Vector3(r.x,0,r.z),s=(new THREE.Vector3).crossVectors(o,r),o.applyAxisAngle(s,t.bias*Math.PI/180),o.normalize(),a=new THREE.Vector3,e._iconVisible?a.copy(b[i].position):a.copy(e.position),l=a.add(o),e._iconVisible?(d=b[i].position,e.target.position.set(l.x-d.x,l.y-d.y,l.z-d.z)):e.target.position.set(l.x,l.y,l.z),e.target.updateMatrixWorld(!0),e.bias=t.bias),null!=t.visible&&"null"!=t.visible&&(c=null,"[object String]"===Object.prototype.toString.call(t.visible)?"true"==t.visible?c=!0:"false"==t.visible&&(c=!1):c=t.visible,this.setLightVisible(e,c),n=!0),null!=t.iconVisible&&"null"!=t.iconVisible&&(h=null,"[object String]"===Object.prototype.toString.call(t.iconVisible)?"true"==t.iconVisible?h=!0:"false"==t.iconVisible&&(h=!1):h=t.iconVisible,this.setIconVisible(e,h),n=!0),u.render(),n)},this.getSpotLightParam=function(e){var t,i,n,r={};if(null!=e&&"SpotLight"==e.type)return r.color=e.color.getHex(),r.intensity=e.intensity,r.distance=e._distance,r.angle=e.angle,r.penumbra=e.penumbra,t=new THREE.Vector3,i=new THREE.Quaternion,n=new THREE.Vector3,e.matrixWorld.decompose(t,i,n),r.position={},r.position.x=t.x,r.position.y=t.y,r.position.z=t.z,r.target={},e.target.matrixWorld.decompose(t,i,n),r.target.x=t.x,r.target.y=t.y,r.target.z=t.z,r.iconVisible=e._iconVisible,r},this.setSpotLightParam=function(e,t){var i,n,r;return void 0!==t&&null!=e&&!!e._enabled&&"SpotLight"==e.type&&(n=H(e),i=!1,e._visible&&(null!=t.color&&"null"!=t.color&&(r=parseInt(t.color),e.color=new THREE.Color(r),i=!0),null!=t.intensity&&"null"!=t.intensity&&(r=parseFloat(t.intensity),e.intensity=r,i=!0),null!=t.distance&&"null"!=t.distance&&(r=parseFloat(t.distance),e._distance=r,e.distance=r/100*B+.1,i=!0),null!=t.angle&&"null"!=t.angle&&(r=parseFloat(t.angle),e.angle=r,i=!0),null!=t.penumbra&&"null"!=t.penumbra&&(r=parseFloat(t.penumbra),e.penumbra=r,i=!0),null!=t.position&&"null"!=t.position&&(r=null,r="[object String]"===Object.prototype.toString.call(t.position)?JSON.parse(t.position):t.position,(e._iconVisible?(b[n].position.set(r.x,r.y,r.z),b[n]):(e.position.set(r.x,r.y,r.z),e)).updateMatrixWorld(!0),i=!0),null!=t.target)&&"null"!=t.target&&t.position&&(r=null,r="[object String]"===Object.prototype.toString.call(t.target)?JSON.parse(t.target):t.target,e._iconVisible?(n=b[n].position,e.target.position.set(r.x-n.x,r.y-n.y,r.z-n.z)):e.target.position.set(r.x,r.y,r.z),e.target.updateMatrixWorld(!0),i=!0),null!=t.visible&&"null"!=t.visible&&(n=null,"[object String]"===Object.prototype.toString.call(t.visible)?"true"==t.visible?n=!0:"false"==t.visible&&(n=!1):n=t.visible,this.setLightVisible(e,n),i=!0),null!=t.iconVisible&&"null"!=t.iconVisible&&(r=null,"[object String]"===Object.prototype.toString.call(t.iconVisible)?"true"==t.iconVisible?r=!0:"false"==t.iconVisible&&(r=!1):r=t.iconVisible,this.setIconVisible(e,r),i=!0),u.render(),i)},this.getHemiLightParam=function(e){var t,i,n,r={};if(null!=e&&"HemisphereLight"==e.type)return r.skyColor=e.color.getHex(),r.groundColor=e.groundColor.getHex(),r.intensity=e.intensity,t=new THREE.Vector3,i=new THREE.Quaternion,n=new THREE.Vector3,e.matrixWorld.decompose(t,i,n),r.position={},r.position.x=t.x,r.position.y=t.y,r.position.z=t.z,r.iconVisible=e._iconVisible,r},this.setHemiLightParam=function(e,t){var i,n,r;return void 0!==t&&null!=e&&!!e._enabled&&"HemisphereLight"==e.type&&(i=!1,n=H(e),e._visible&&(null!=t.skyColor&&"null"!=t.skyColor&&(r=parseInt(t.skyColor),e.color=new THREE.Color(r),i=!0),null!=t.groundColor&&"null"!=t.groundColor&&(r=parseInt(t.groundColor),e.groundColor=new THREE.Color(r),i=!0),null!=t.intensity&&"null"!=t.intensity&&(r=parseFloat(t.intensity),e.intensity=r,i=!0),null!=t.position)&&"null"!=t.position&&(r=null,r="[object String]"===Object.prototype.toString.call(t.position)?JSON.parse(t.position):t.position,(e._iconVisible?(b[n].position.set(r.x,r.y,r.z),b[n]):(e.position.set(r.x,r.y,r.z),e)).updateMatrixWorld(!0),i=!0),null!=t.visible&&"null"!=t.visible&&(n=null,"[object String]"===Object.prototype.toString.call(t.visible)?"true"==t.visible?n=!0:"false"==t.visible&&(n=!1):n=t.visible,this.setLightVisible(e,n),i=!0),null!=t.iconVisible&&"null"!=t.iconVisible&&(r=null,"[object String]"===Object.prototype.toString.call(t.iconVisible)?"true"==t.iconVisible?r=!0:"false"==t.iconVisible&&(r=!1):r=t.iconVisible,this.setIconVisible(e,r),i=!0),u.render(),i)},this.setLightParam=function(e,t){if(null==e||null==t)return!1;switch(e.type){case"DirectionalLight":return setDirLightParam(e,t);case"SpotLight":return setSpotLightParam(e,t);case"PointLight":return setPointLightParam(e,t);case"HemisphereLight":return setHemiLightParam(e,t)}},this.isLightEditControlSelected=function(){return!(null==I||!I.isActive())&&I.isSelected()}}function De(e){THREE.EventDispatcher.call(this);var t=this,i=null;this.viewer=e,this.render=function(){t.dispatchEvent({type:"render"})},this.update=function(){null!=i&&i.update()},this.onOpRender=function(){t.render()},this.onOpEvent=function(e){t.dispatchEvent({type:"event",event:e})},this.setOperator=function(e){t.releaseOperator(),e.create(),e.addEventListener("render",t.onOpRender),e.addEventListener("mouseEvent",t.onOpEvent),e.addEventListener("event",t.onOpEvent),i=e},this.getOperator=function(){return i},this.releaseOperator=function(){var e=i;null!=e&&(e.release(),e.removeEventListener("render",t.onOpRender),e.removeEventListener("mouseEvent",t.onOpEvent),e.removeEventListener("event",t.onOpEvent))}}function He(e,t,F){function N(){f.style.opacity="1.0",b=!1,requestAnimationFrame(A.render)}function V(e){var t;b||A.viewCubeMenuOpen||(t=Math.max(4*Math.abs((e.clientX-u.x)/u.w-.5)-1,0),e=Math.max(4*Math.abs((e.clientY-u.y)/u.h-.5)-1,0),t=Math.max(0,Math.min(Math.sqrt(t*t+e*e),1)),f.style.opacity=1-t*(1-A.inactiveOpacity))}function j(){f.style.opacity=A.inactiveOpacity,b=!0,A.render()}var U,k,r,_,i,c,G,z,o,W,h,s,a,l,u,A=this,p=(this.viewer=e).cameraControl,Y=(F||e).camera,f=(F||e).viewBoxDiv,n=(this.viewCubeMenuOpen=!1,{}),X=(this.boxSize=void 0===t?235:t,A.currentFace="front",["top,front","top,right","top,left","top,back","bottom,front","bottom,right","bottom,left","bottom,back","left,front","front,right","right,back","back,left"]),Q=["front,top,right","back,top,right","front,top,left","back,top,left","front,bottom,right","back,bottom,right","front,bottom,left","back,bottom,left"],y=null,d=(f.getBoundingClientRect(),A.camera=new THREE.PerspectiveCamera(45,window.innerWidth/window.innerHeight,1,2e3),this.originCamInfo={},[]),m=[],g=[],v=[],E=[],M=null,q=null,w=null,x=0,Z=0,K=!0,J=!1,$=!1,ee=!1,I=!1,b=!1,T=[],te=(this.width=0,this.height=0,this.animSpeed=500,this.animate=!0,this.compass=!1,this.viewScaleFactorCompass=1.5,this.viewScale=1,this.draggable=!1,this.wantHomeButton=!1,this.wantRollArrows=!0,this.wantContextMenu=!1,this.inactiveOpacity=.5,this.getPicSrc=function(e){e=e.split("/"),e=e[e.length-1];return"VCarrows.png"==e?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAArwAAAK8AFCrDSYAAAAIGNIUk0AAHxpAAB8jwAA/qkAAICUAAB5PAAA8TsAADeRAAAmhApr+WQAAAa2SURBVHja7J1PaJNnHMd/T5Jp98bM+i7TGrBZtzTtDoMGqlawUvQileKEIXqwOYkXRTxZFKQMlN6c6EXKDomHjl6cBMt2UMQeLBhIwUubZWtSR4wue42LeVddkmeHJKNIq++bv++f7wdCIeR9S9/vp7/f8z7v+z5hnHMC5sWCQwABAAQAEABAAAABAAQAEACYBpve/wDGGBHRV4yxY7zEOGI1eAUoh16h12KxHIvH492I0wQCMMaoMn3NGOu1WCzH4/F4d7FYRJpGF2C98HE9wwQCIHwTC4DwG3hstX4QVYRfdLvdsXV2Ey//zJRfKSLKcM5TEEDDAqj8zy+uV9GSyeQzIqJYLPY6k8kUwuFw/tGjR5ZoNGory5Eq/4xzzlcggD7LfrGalpZMJp+Fw+FX4XA4HwqFrJIk/UlEC0S0YIYKoYcWoLTnVyXAWkLcu3fvZTAYpGg0+rosw7xRZdB6C1Az4KuLAKuRJCl99+7dF2UZ0kQ0V64MKxBAW+E3RIDVxGKxp8Fg8FUgECiWRZgzggiaFcBqtX6XSCQ8Kmb4GipAhVwul52cnFwOBAIWSZIeE9EDPYuAClAl+Xz+zczMzNKZM2fe6rkiaPosgEoXelo2BlBTEa5evVogop855/MQoDUStESA1QPGS5cupUKhULIsQgoCNFeClgpQ4eHDh7+ePXs2L0nSLOf8AQSoIfhVE0FKJNCEAJW2cP78+UQoFJKI6EfOeQYCNF6CNa8FCIJQ6OnpKTgcDu7z+T7q6+sTOjs7BY/H42xGNThx4sQ/nPMJCNBgCYrFInV1dUWJaPydXbS/8+ogog5BEBz9/f35/fv3tw0ODm5plBButzu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C":"VCedge1.png"==e?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB90BEBUkDgOwdkQAAADtSURBVHja7ZsxDoQgEEU/FCbsAWmoOJmVjfdz3VjIFmpizOoB9r/XGBMk8GEmwzCGXGqT9NHGKilIavtT5/dx6JN+kEud9za6fHslSGrj0L9u+pkkBcUu6Y51mY/+H8Yz7W3O42insR1zSsqlvmVKLvUdH1bLgRBPW9eRhgCYAAJ4gwA4QXMBBAAAzuzJDNu5EwkSCT7l3/5++buECSAAAiAAAngLsF01ebIuMxkhAABwhgoRboe5G+QwhAAIgADWAlAm5x4H2JuA9Q7gMAQAYA01QoTChMKkxDgO4wPwAdY7wNkPRHsnGNx/n/8CGU1kteidCpYAAAAASUVORK5CYII=":"VChome.png"==e?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsSAAALEgHS3X78AAAAIGNIUk0AAH8nAAB4zgABAecAAH1lAAB+pAAA60MAADfoAAAl6h9/B7IAAAFxSURBVHja7JfNTcNAEEbfjK0IhOgBKSZpAKWLdEABlEQB3DnQBaKBRI6UDjig8BNld7lMJCeQZNfxwiUj+eCf2fe8sr+1JYTAf1bZpklEBLgBxnboCXgJLe6mbAkfAePZbHYN0O/3FVAReU6VkJTrm/C6rgfeewFQ1VBV1dRmIkkiWmAb7pzT5vmiKHwbCe0CDuCc07quB/ZcjKzneIEY+DES2hW8rYR2CW8joV3DUyU0BzxFQnPBYyU0JzxGQnPDD0mIbVnh+xJTgeKv4L/MRFGawLyqqt56RiaTyVUO+HA4nAPBtvlaIACPwIUtz3cJA228RBHiHrgHVsACCKXtvAHvwJldRMRA2xUi+16BT8ABqzKE4IFl422IrR8zENn3FUL4MB7ZH7pOvgdOAieBk0DO2vgvEJFz4BYYRITQb0F0KIymwEMziLYbesClrQt6AL5LQPbE8MJif7krPtUWpCIhWlOi29na41v9G+ao7wEA29D8X0f9dpYAAAAASUVORK5CYII=":"VChomeS.png"==e?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsSAAALEgHS3X78AAAAIGNIUk0AAH8nAAB4zgABAecAAH1lAAB+pAAA60MAADfoAAAl6h9/B7IAAAF8SURBVHja7JdNTsJAFIC/eW1QYzyFV+ACLgS27q1hJ3gCjsAJUHdGDuCWIgkX4ABsPIOLxh9+2uemNQURaGnLhpfMos30fd+bSV87RlXZZ9hpHjLGGLl5vUXsewCCeTN4vnzUNNWoaqIBGHHcptSHOhh7Ohh7KvWhiuM2AZM0nySu3HEbWKVOv1X+vd9vlcEqdcRxG8YYkySn7ArfVUKygO8iIVnB00pIlvA0EpI1PKmE5AFPIiF5wbeVkDzh20hI3vBNElIEfJ2ECXt77vB4VNoj8Kd3Qbf6IIBVJDy+EoBlAxb+rFdpj2oLE/KqPAp/1osENOhWroFTwJb68C1RouXKNkTwdHEOzIEPQO3wwgM+geMCduAd+AZ8YG6ragBMo7ehAIGJqn6FvGQ/JHnEQeAgcBDYu4CJn6aMMSfi9F6wjqq50PyJG3RrV/FGtNz5SsBZ+F34b3U0NhaKiY2Vn4Gw/3tR52XFZAkPrNaaRGlDo/4fyvzdgn3EzwAYdgRqNummZQAAAABJRU5ErkJggg==":"back.png"==e?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAVISURBVHhe7dx/aFVlHMfx73GXud9brIyVc63EICiFQMJoCRFSGLT+yBn0A2L9EBwOXVkt0zb3j6NJYdAigoqFEGo1NKhIsqh/Eu2PsCjbWM0gw91t3K5390fPOc+j1+nUhc/V55zP5wXn+D3PFTfv3rv3nrt75+UUIVhzzJ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"up.png"==e?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAJpSURBVHhe7d3PShtBAIDx2RBxRS0pFIIHwYMnH6J47LuUgt7Se8FCD3rxAXwKFS/iQ3jpxZsUpAkRaYQQm5BB2MuSGGGz830/GGY2t+x+7OYvm72MBWE14iwoA4AzADgDgDMAOAOAMwA4A4AzADgDgDMAOAOAMwA4A4AzADgDgDMAOAOAMwA4A4AzADgDgDMAOAOAMwA4A4AzADgDgDMAOAOAMwA4A4AzADgDgDMAOAOAMwA4A4AzADgDgDMAOAOAMwA4AyhxeP43ZFn2OnbHIzUGUKK11oyrqXZxMwkGAGcAcAYAZwBwBgBnAHAGAGcAcAYAZwBzSO+DYAOYSzfOKTGAEq32h7ia+hjn2TzGebklF8Dq58PCN3iLjIO94kk/xVusJhfA1qdWXFVtM87LzUsAXHIB3D/04kqzSC6A55vjMLkh+nuMk9v0b6zuJaBE708/rtJlAHAGAGcAcAYAZwBwBgBnAHAGAGcAcAYAZwBwBgBnAHAGAGcAcAYAZwBwBlAi3yj+L6CZ4N7KXiY/fqux67vncHH6PeTrxYO1qHylES5//wvXZz/jIyFsjwP49utHeOoPx1tv3239p0E4+volrO7sx0cqNAmgzjpX3cmRqN3oXnXiM6hW7U9qeU3Py41mHlfVqn0Ag+EoruplNBzEVbV8DVCBZXoNUPsAtJgE39hoHgYAZwBwBgBnAHAGAGcAcAYAZwBwBgBnAHAGAGcAcAYAZwBwBgBnAHAGAGcAcAYAZwBwBgBnAHAGAGcAcAYAZwBwBgBnAHAGAGcAcAYAZwBwBgBnAHAGAGcAcAYAZwBwBoAWwn8GG/BweZN80wAAAABJRU5ErkJggg==":void 0},function(e){e=e.getBoundingClientRect();return{x:e.left,y:e.top,w:e.width,h:e.height}}),F=function(e){e.preventDefault(),e.stopPropagation(),$=document.pointerLockElement===f||document.mozPointerLockElement===f||document.webkitPointerLockElement===f},e=function(e){return e},t=(this.getView=function(){return A.center.clone().sub(A.camera.position)},function(){var e=new THREE.Vector3(1,1,1);e.normalize(),e.multiplyScalar(A.viewScale),A.camera.position.copy(e),A.center=new THREE.Vector3(0,0,0),A.camera.up.set(0,1,0),A.camera.lookAt(A.center),A.originCamInfo.position=e,A.originCamInfo.center=A.center.clone(),A.originCamInfo.up=new THREE.Vector3(0,1,0)}),S=function(e){var t=new Image,i=(t.crossOrigin="anonymous",new THREE.Texture(t));return t.onload=function(){i.needsUpdate=!0,11<=++Z&&requestAnimationFrame(A.render)},Re.singleHTML?t.src=A.getPicSrc(e):t.src=e,i},ie=function(){var e,t,i=[],n=[];for(i[0]=P(0,0),i[1]=P(0,Math.PI/2),i[2]=P(0,-Math.PI/2),i[3]=P(0,Math.PI),i[4]=P(Math.PI/2,0),i[5]=P(Math.PI/2,Math.PI/2),i[6]=P(Math.PI/2,-Math.PI/2),i[7]=P(Math.PI/2,Math.PI),n[0]=B(0,0,0),n[1]=B(0,Math.PI/2,0),n[2]=B(0,-Math.PI/2,0),n[3]=B(0,Math.PI,0),n[4]=B(Math.PI/2,0,0),n[5]=B(Math.PI/2,Math.PI/2,0),n[6]=B(Math.PI/2,-Math.PI/2,0),n[7]=B(Math.PI/2,Math.PI,0),n[8]=B(0,0,Math.PI/2),n[9]=B(0,0,-Math.PI/2),n[10]=B(-Math.PI/2,0,-Math.PI/2),n[11]=B(-Math.PI,0,-Math.PI/2),d.push(ue(0,0)),d[0].name="front",g.push(d[0]),E.push(d[0]),r.add(d[0]),d.push(ue(0,Math.PI/2)),d[1].name="right",g.push(d[1]),E.push(d[1]),r.add(d[1]),d.push(ue(0,Math.PI)),d[2].name="back",g.push(d[2]),E.push(d[2]),r.add(d[2]),d.push(ue(0,-Math.PI/2)),d[3].name="left",g.push(d[3]),E.push(d[3]),r.add(d[3]),d.push(ue(Math.PI/2,0)),d[4].name="bottom",g.push(d[4]),E.push(d[4]),r.add(d[4]),d.push(ue(-Math.PI/2,0)),d[5].name="top",g.push(d[5]),E.push(d[5]),r.add(d[5]),e=d.length,t=0;t.25*i.length()&&(this.near=.25*i.length())):(this.near=-t,this.far=t),this.updateProjectionMatrix()},ve.prototype.setFarNear=function(e,t){this.far=e,this.near=t},ve.prototype.setOrthoNear=function(e){e=e.min.distanceTo(e.max);-e","#include ","#include ","#include ","#include ","void main() {","#include ","float totalSize = dashSize * dashNum + grapSize * (dashNum + pointNum) + pointSize * pointNum;","float modSize = mod( vLineDistance, totalSize );","bool grap = false;","for(float i = 1.0; i< 4.0; ++i){","if(i > dashNum){","break;","}","if(modSize < i * (grapSize + dashSize) && modSize > i * (grapSize + dashSize) - grapSize){","grap = true;","break;","}","}","if ( grap ) {","discard;","}","float dashlength = dashNum * (grapSize + dashSize);","for(float i = 1.0;i <4.0; ++i){","if(i > pointNum){","break;","}","if(modSize < i * (grapSize + pointSize) + dashlength && ","modSize > i * (grapSize + pointSize) - grapSize + dashlength){","grap = true;","break;","}","}","if ( grap ) {","discard;","}","vec3 outgoingLight = vec3( 0.0 );","vec4 diffuseColor = vec4( diffuse, opacity );","#include ","#include ","outgoingLight = diffuseColor.rgb;","gl_FragColor = vec4( outgoingLight, diffuseColor.a );","#include ","#include ","#include ","#include ","}"].join("\n"),vertexShader:["attribute float lineDistance;","varying float vLineDistance;","#include ","#include ","#include ","#include ","#include ","void main() {","#include ","vLineDistance = lineDistance;","vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","gl_Position = projectionMatrix * mvPosition;","#include ","#include ","#include ","}"].join("\n")}),Re.enableSelect=!1,Re.autoSwitchFirstPersonView=!1,Re.tangentEdgeVisible=!0,Re.enableArrowKeyOp=!0,Re.dynamicRotateCenter=!0,Re.NdsLoadWorkerUrl="./coreviewer/NDSRequestWorker.min.js",Re.enableOutlineEffect=!1,Re.enableBodyVolumeMeasure=!1,Re.enablePreSelectBrep=!1,Re.selectObjectWithPropertyOnly=!1,Re.enableDirectMove=!1,Re.enableDirectRotate=!1,Re.inAssemblyContext=!1,Re.inBIMContext=!1,Re.ScenarioEditor=!1,Re.ScenarioEditorid=-1,Re.AnimationEdit=!1,Re.StopPMIOcclusion=!0,Re.singleHTML=!1,Re.HideLeafBody=!1,Re.MatrixChange=!1,{REVISION:"01"}),je=(Se.StringTable=void 0,Se.SupportWebGL2=void 0,Se.setLanguage=function(e,t){var i,n,r;this.language=e,Se.StringTable=new StringTable(e),Re.singleHTML?Se.StringTable.tables=window.NdsLanguage:(i="coreViewer/language/en.js",n="coreViewer/language/",i=""+(n=t?t+n:n)+e+".js","zh-CN"==e&&(i=n+"zh.js"),(r=new XMLHttpRequest).open("GET",i),r.onload=function(){var e;200<=this.status&&this.status<300||0===this.status?(e=r.responseText.match(/= ({[^}]*})/))?(e=e[1].trim(),Se.StringTable.tables=JSON.parse(e)):console.error("No JSON found in the string."):console.error("语言配置文件有丢失")},r.onerror=function(){console.error("语言配置文件有丢失")},r.crossOrigin="anonymous",r.responseType="text",r.send())},Se.getLanguage=function(){var e=this.language,t=(e=e||"en").split("-"),i=(e=1i)return},Se.isEmptyObject=function(e){for(var t in e)return!1;return!0},Se.getObjectSize=function(e){var t,i=0;for(t in e)++i;return i},Se.disposeObject=function(e){if(0==e.children.length)e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose();else for(var t=0;to.x||r.y>o.y||r.z>o.z)return;m.controls.setBoundingBox(r,o)}i&&i.viewCapture&&m.computeVisibleBoundingBox(m.scene,r,o,{},void 0,!0);n=new THREE.Vector3,s=(n.x=.5*(o.x+r.x),n.y=.5*(o.y+r.y),n.z=.5*(o.z+r.z),new THREE.Vector3);(s=s.subVectors(o,r)).length()<1e-6&&s.set(1,1,1);var l=.5*s.length()/Math.sin(Math.PI/180*m.camera.fov*.5),s=(m.camera.IsPerspective()&&m.camera.aspect<1&&(l/=m.camera.aspect),0==l&&(l=1e-4),1!=Number(m.disratio)&&(l*=Number(m.disratio)),m.controls.getExplosionBoundingBox()||(m.camera.far=5*l,m.camera.setZoomToFitRatio(5),m.camera.far<1e3&&(m.camera.setZoomToFitRatio(1e3/l),m.camera.far=1e3),2e3.25*s.length()&&(m.camera.near=.25*s.length()),m.camera.perpNear>.25*s.length()&&(m.camera.perpNear=.25*s.length())),null),d=null;if(i?((s=i.dir.clone().normalize()).multiplyScalar(l),d=n.clone().sub(s)):((s=new THREE.Vector3(0,0,1).applyQuaternion(m.camera.quaternion)).multiplyScalar(l),(d=new THREE.Vector3).addVectors(n,s)),a||(m.groundShadow.updateGroundTransform(m.camera,m.controls.getBoundingBox()),m.is2DModel?m.camera.setOrthoNear(m.modelRootObject.boundingBox.clone()):m.camera.setOrthoNear(m.controls.getBoundingBox()),m.camera.getOrginalCameraInfo())||m.camera.setOrginalCameraInfo({center:n.clone(),up:i?i.up.clone():new THREE.Vector3(0,1,0),position:d}),!0===t&&m.camera.getOrginalCameraInfo()&&(n.copy(m.camera.getOrginalCameraInfo().center),d.copy(m.camera.getOrginalCameraInfo().position),m.camera.getOrginalCameraInfo().fov&&(m.camera.fov=m.camera.getOrginalCameraInfo().fov),m.camera.getOrginalCameraInfo().near&&m.camera.IsPerspective()==m.camera.getOrginalCameraInfo().isPerspective&&(m.camera.near=m.camera.getOrginalCameraInfo().near),m.camera.getOrginalCameraInfo().far)&&m.camera.IsPerspective()==m.camera.getOrginalCameraInfo().isPerspective&&(m.camera.far=m.camera.getOrginalCameraInfo().far),m.camera.updateProjectionMatrix(),m.camera.updateMatrixWorld(!0),i&&i.viewCapture){var c,l=1,l=m.camera.isPerspective?(c=new THREE.PerspectiveCamera(m.camera.fov,m.camera.aspect,m.camera.near,m.camera.far),1.3):(c=new THREE.OrthographicCamera(m.camera.left,m.camera.right,m.camera.top,m.camera.bottom,m.camera.near,m.camera.far),1.2);c.position.copy(d),c.up.copy(i.up),c.lookAt(n),c.updateProjectionMatrix(),c.updateMatrixWorld(!0);for(var s=new THREE.Box3(r,o),a=s.min,r=s.max,h=[new THREE.Vector3(a.x,a.y,a.z),new THREE.Vector3(a.x,a.y,r.z),new THREE.Vector3(a.x,r.y,a.z),new THREE.Vector3(a.x,r.y,r.z),new THREE.Vector3(r.x,a.y,a.z),new THREE.Vector3(r.x,a.y,r.z),new THREE.Vector3(r.x,r.y,a.z),new THREE.Vector3(r.x,r.y,r.z)],u=0;u.5*o.length()&&(m.camera.near=.25*o.length())),(n=new THREE.Vector3(0,0,1).applyQuaternion(m.camera.quaternion)).multiplyScalar(i),(o=new THREE.Vector3).addVectors(e,n),r||(m.groundShadow.updateGroundTransform(m.camera,m.controls.getBoundingBox()),m.camera.setOrthoNear(m.controls.getBoundingBox()),m.camera.getOrginalCameraInfo())||m.camera.setOrginalCameraInfo({center:e.clone(),up:new THREE.Vector3(0,1,0),position:o}),m.camera.updateProjectionMatrix(),void 0===t||t?(i={center:e,up:m.camera.up,position:o},v.startSmoothTranslation(i,w)):(m.camera.position.copy(o),m.camera.setCameraTarget(e),m.render(),w()),n=m.controls.getBoundingBox().containsPoint(o),r=m.getModelOperationMode(),Re.autoSwitchFirstPersonView&&"hall"!=r&&(n?"FirstPerson"!=r&&m.setModelOperationModeInternal("FirstPerson"):"FirstPerson"==r&&m.setModelOperationModeInternal(m.originalModelOperationMode)))},this.setModelUpDirection=function(e,t){var i=-1;0-.25*Math.PI&&e.latAngle<.25*Math.PI?a.applyAxisAngle(d,i):e.latAngle+=i,o.addVectors(r,a),this.adjustNearAndFar(),this.viewer.camera.lookAt(o),e.render(),A&&v.updateViewBoxCamDir()},this.calFarthestDistToCamera=function(){var e=this.viewer.controls.getExplosionBoundingBox(),t=(e=null==e?this.viewer.controls.getBoundingBox():e).getCenter(new THREE.Vector3),e=.5*(new THREE.Vector3).subVectors(e.max,e.min).length(),t=this.viewer.camera.position.distanceTo(t);return t+=e},this.pan=function(e,t,i){var n={x:1,y:1};if(this.viewer.viewManager){if(null!=this.viewer.camera.viewId)if(this.viewer.viewManager.getActiveView().viewId!=this.viewer.camera.viewId)return;n=this.viewer.viewManager.getPanScale()}var r=[e.downModelPnt.x,e.downModelPnt.y,e.downModelPnt.z],r=this.viewer.modelCoordToClientCoord(r),t=[r[0]+t.x*n.x,r[1]-t.y*n.y,r[2]],n=this.viewer.clientCoordToModelCoord(t),r=new THREE.Vector3(n[0],n[1],n[2]).clone();r.sub(e.downModelPnt),this.viewer.camera.position.add(r),this.center().add(r),!1!==i&&e.render()},this.moveForwardBack=function(e,t,i){var n=this.center(),r=this.viewer.camera.position,o=(r.distanceTo(n),new THREE.Vector3),n=(o.subVectors(n,r),.03);this.viewer.controls.getBoundingBox().containsPoint(this.viewer.camera.position)&&(n=.01),o.multiplyScalar(n),0==t&&o.negate(),this.viewer.camera.position.add(o),this.center().add(o),!1!==i&&m.render()},this.setBoundingBox=function(e,t){n.set(e,t),s=n.getCenter()},this.setBoundingBoxCenter=function(e){s=e},this.adjustNearAndFar=function(){var e,t,i;v.viewer.is2DModel||(e=null,e=(v.viewer.controls.getExplosionBoundingBox()?v.viewer.controls.getExplosionBoundingBox():s?n:v.viewer.controls.getBoundingBox()).clone(),v.viewer.pmiObject&&(i=v.viewer.calculatePMIBoundingBox())&&!e.containsBox(i)&&e.union(i),i=new THREE.Vector3,e.getCenter(i),e=e.min.distanceTo(e.max),t=v.viewer.camera.position.clone(),i=Math.abs(i.distanceTo(t))+1.2*e,v.viewer.camera.adjustNearFar(i,i))},this.zoom=function(e,t,i,n){if(this.viewer.is2DViewer)(o=this.camDisTo2DViewer())o)||(t.applyMatrix3(e.normalMatrix.getNormalMatrix(this.viewer.camera.matrix)),r=this.viewer.camera.IsPerspective(),this.viewer.camera.position.add(t),r&&this.center().add(t),this.adjustNearAndFar(),this.viewer.camera.updateProjectionMatrix(),!1!==n&&e.render());else{if(this.viewer.viewManager&&this.viewer.viewManager.getActiveView().is2DView)this.setZoomSpeed(this.viewer.viewManager.defaultMultiViewZoomSpeed);else if(this.setZoomSpeed(1.5),i){if(this.zoomByMouse(e,t,i,n))return}else if("hall"==this.viewer.getModelOperationMode())return void(0!=t.z&&(0this.viewer.camera.far&&(this.viewer.camera.far=i),!1!==n&&e.render()}},this.zoomByMouse=function(e,t,i,n){var r=this.viewer.renderer.domElement,o=this.viewer.renderer.getPixelRatio(),s=i.offsetX||i.clientX-this.viewer.container.getBoundingClientRect().left,a=i.offsetY||i.clientY-this.viewer.container.getBoundingClientRect().top,i=(i.srcElement&&i.srcElement!==this.viewer.renderer.domElement&&(s=i.clientX-this.viewer.container.getBoundingClientRect().left,a=i.clientY-this.viewer.container.getBoundingClientRect().top),null==i.srcElement&&i.target&&i.target!==this.viewer.renderer.domElement&&(s=i.clientX-this.viewer.container.getBoundingClientRect().left,a=i.clientY-this.viewer.container.getBoundingClientRect().top),this.viewer.viewManager&&(s=(i=this.viewer.viewManager.remapViewCoordinateToFullView(s,a))[0],a=i[1]),this.viewer.camera.position.clone()),l=(i.sub(this.center()),i.length()),s=(i.multiplyScalar(.7),i.add(this.center()),i.project(this.viewer.camera),new THREE.Vector3(s*o/r.width*2-1,2*-(a*o/r.height)+1,i.z)),a=this.viewer.camera.IsPerspective(),o=this.viewer.getModelOperationMode();if("hall"==o&&((r=this.viewer.controls.getBoundingBox().getCenter()).project(this.viewer.camera),s.copy(r)),s.unproject(this.viewer.camera),!isFinite(s.x)||!isFinite(s.y)||!isFinite(s.z))return!1;var i=this.viewer.camera.position.clone(),r=(i.sub(this.center()),i.length(),this.center().clone()),s=(r.sub(s),M),t=t.z,d=this.viewer.controls.getBoundingBox(),c=d.containsPoint(this.viewer.camera.position),c=(c&&t<0&&(s*=.6),Re.autoSwitchFirstPersonView&&"hall"!=o&&(c?"FirstPerson"!=o&&(this.viewer.setModelOperationModeInternal("FirstPerson"),e.latAngle=0):"FirstPerson"==o&&this.viewer.setModelOperationModeInternal(this.viewer.originalModelOperationMode)),this.viewer.camera.position.clone()),o=this.center().clone(),h=new THREE.Vector3,u=(h.x=(i.x+r.x)*s/t,h.y=(i.y+r.y)*s/t,h.z=(i.z+r.z)*s/t,new THREE.Vector3);u.x=r.x*s/t,u.y=r.y*s/t,u.z=r.z*s/t,c.add(h),o.add(u);var p,f,m,r=.8*d.min.distanceTo(d.max),s=(lthis.viewer.camera.far&&(this.viewer.camera.far=l),this.viewer.camera.updateProjectionMatrix(),a||(p=this.viewer.camera.getOrginalCameraInfo(),m=20/(f=new THREE.Vector3(p.position.x-p.center.x,p.position.y-p.center.y,p.position.z-p.center.z).length())*this.viewer.camera.position.clone().sub(this.center()).length(),this.viewer.dispatchEvent({type:"dischange",distance:m=(m=100= edgeVert;","float lengthSign = horzSpan ? -resolution.y : -resolution.x;","if(!horzSpan){"," lumaN = lumaW;"," lumaS = lumaE;","}","float gradientN = abs(lumaN - lumaM);","float gradientS = abs(lumaS - lumaM);","lumaN = (lumaN + lumaM) * 0.5;","lumaS = (lumaS + lumaM) * 0.5;","bool pairN = gradientN >= gradientS;","if(!pairN){"," lumaN = lumaS;"," gradientN = gradientS;"," lengthSign *= -1.0;","}","vec2 posN;","posN.x = vUv.x + (horzSpan ? 0.0 : lengthSign * 0.5);","posN.y = vUv.y + (horzSpan ? lengthSign * 0.5 : 0.0);","gradientN *= FXAA_SEARCH_THRESHOLD;","vec2 posP = posN;","vec2 offNP = horzSpan ? vec2(resolution.x, 0.0) : vec2(0.0, resolution.y);","float lumaEndN = lumaN;","float lumaEndP = lumaN;","bool doneN = false;","bool doneP = false;","posN += offNP * vec2(-1.0, -1.0);","posP += offNP * vec2( 1.0, 1.0);","for(int i = 0; i < FXAA_SEARCH_STEPS; i++) {"," if(!doneN) lumaEndN = FxaaLuma(texture2D( tDiffuse, posN.xy).xyz);"," if(!doneP) lumaEndP = FxaaLuma(texture2D( tDiffuse, posP.xy).xyz);"," doneN = doneN || (abs(lumaEndN - lumaN) >= gradientN);"," doneP = doneP || (abs(lumaEndP - lumaN) >= gradientN);"," if(doneN && doneP) break;"," if(!doneN) posN -= offNP;"," if(!doneP) posP += offNP;","}","float dstN = horzSpan ? vUv.x - posN.x : vUv.y - posN.y;","float dstP = horzSpan ? posP.x - vUv.x : posP.y - vUv.y;","bool directionN = dstN < dstP;","lumaEndN = directionN ? lumaEndN : lumaEndP;","if(((lumaM - lumaN) < 0.0) == ((lumaEndN - lumaN) < 0.0))"," lengthSign = 0.0;","float spanLength = (dstP + dstN);","dstN = directionN ? dstN : dstP;","float subPixelOffset = (0.5 + (dstN * (-1.0/spanLength))) * lengthSign;","vec3 rgbF = texture2D(tDiffuse, vec2("," vUv.x + (horzSpan ? 0.0 : subPixelOffset),"," vUv.y + (horzSpan ? subPixelOffset : 0.0))).xyz;","gl_FragColor = vec4(FxaaLerp3(rgbL, rgbF, blendL), opacity);","}"].join("\n"),{uniforms:{tDiffuse:{type:"t",value:null},resolution:{type:"v2",value:new THREE.Vector2(1/1024,1/512)}},vertexShader:["void main() {","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec2 resolution;","#define FXAA_REDUCE_MIN (1.0/128.0)","#define FXAA_REDUCE_MUL (1.0/8.0)","#define FXAA_SPAN_MAX 8.0","void main() {","vec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;","vec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;","vec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;","vec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;","vec4 rgbaM = texture2D( tDiffuse, gl_FragCoord.xy * resolution );","vec3 rgbM = rgbaM.xyz;","vec3 luma = vec3( 0.299, 0.587, 0.114 );","float lumaNW = dot( rgbNW, luma );","float lumaNE = dot( rgbNE, luma );","float lumaSW = dot( rgbSW, luma );","float lumaSE = dot( rgbSE, luma );","float lumaM = dot( rgbM, luma );","float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );","float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );","vec2 dir;","dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));","dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));","float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );","float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );","dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),","max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),","dir * rcpDirMin)) * resolution;","vec4 rgbA = (1.0/2.0) * (","texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (1.0/3.0 - 0.5)) +","texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (2.0/3.0 - 0.5)));","vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (","texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (0.0/3.0 - 0.5)) +","texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (3.0/3.0 - 0.5)));","float lumaB = dot(rgbB, vec4(luma, 0.0));","if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {","gl_FragColor = rgbA;","} else {","gl_FragColor = rgbB;","}","}"].join("\n")}),Ye={uniforms:{tDiffuse:{type:"t",value:null},resolution:{type:"v2",value:new THREE.Vector2(1/1024,1/512)}},vertexShader:["uniform vec2 resolution;","varying vec2 vPos;","varying vec4 vPosPos;","void main() {","vPos = uv;","vPosPos.xy = uv + vec2(-0.5, -0.5) * resolution;","vPosPos.zw = uv + vec2( 0.5, 0.5) * resolution;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#define FXAA_EDGE_SHARPNESS (8.0)","#define FXAA_EDGE_THRESHOLD (0.125)","#define FXAA_EDGE_THRESHOLD_MIN (0.05)","#define FXAA_RCP_FRAME_OPT (0.50)","#define FXAA_RCP_FRAME_OPT2 (2.0)","uniform sampler2D tDiffuse;","uniform highp vec2 resolution;","varying vec2 vPos;","varying vec4 vPosPos;","float FxaaLuma(vec3 rgb) {","return dot(rgb, vec3(0.299, 0.587, 0.114));","}","void main() {","float lumaNw = FxaaLuma(texture2D(tDiffuse, vPosPos.xy).rgb);","float lumaSw = FxaaLuma(texture2D(tDiffuse, vPosPos.xw).rgb);","float lumaNe = FxaaLuma(texture2D(tDiffuse, vPosPos.zy).rgb) + 1.0/384.0;","float lumaSe = FxaaLuma(texture2D(tDiffuse, vPosPos.zw).rgb);","vec3 rgbM = texture2D(tDiffuse, vPos.xy).rgb;","float lumaM = FxaaLuma(rgbM.rgb);","float lumaMax = max(max(lumaNe, lumaSe), max(lumaNw, lumaSw));","float lumaMin = min(min(lumaNe, lumaSe), min(lumaNw, lumaSw));","float lumaMaxSubMinM = max(lumaMax, lumaM) - min(lumaMin, lumaM);","float lumaMaxScaledClamped = max(FXAA_EDGE_THRESHOLD_MIN, lumaMax * FXAA_EDGE_THRESHOLD);","if (lumaMaxSubMinM < lumaMaxScaledClamped) {","gl_FragColor = vec4(rgbM, 1.0);","return;","}","float dirSwMinusNe = lumaSw - lumaNe;","float dirSeMinusNw = lumaSe - lumaNw;","vec2 dir1 = normalize(vec2(dirSwMinusNe + dirSeMinusNw, dirSwMinusNe - dirSeMinusNw));","vec3 rgbN1 = texture2D(tDiffuse, vPos.xy - dir1 * FXAA_RCP_FRAME_OPT*resolution).rgb;","vec3 rgbP1 = texture2D(tDiffuse, vPos.xy + dir1 * FXAA_RCP_FRAME_OPT*resolution).rgb;","float dirAbsMinTimesC = min(abs(dir1.x), abs(dir1.y)) * FXAA_EDGE_SHARPNESS;","vec2 dir2 = clamp(dir1.xy / dirAbsMinTimesC, -2.0, 2.0);","vec3 rgbN2 = texture2D(tDiffuse, vPos.xy - dir2 * FXAA_RCP_FRAME_OPT2*resolution).rgb;","vec3 rgbP2 = texture2D(tDiffuse, vPos.xy + dir2 * FXAA_RCP_FRAME_OPT2*resolution).rgb;","vec3 rgbA = rgbN1 + rgbP1;","vec3 rgbB = ((rgbN2 + rgbP2) * 0.25) + (rgbA * 0.25);","float lumaB = FxaaLuma(rgbB);","if ((lumaB < lumaMin) || (lumaB > lumaMax))","gl_FragColor = vec4(rgbA * 0.5, 1.0);","else","gl_FragColor = vec4(rgbB, 1.0);","}"].join("\n")},Xe=new THREE.ShaderMaterial({defines:{MAX_RADIUS:4},uniforms:{tDiffuse:{value:null},texSize:{value:new THREE.Vector2(.5,.5)},direction:{value:new THREE.Vector2(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"#include varying vec2 vUv; uniform sampler2D tDiffuse; uniform vec2 texSize; uniform vec2 direction; uniform float kernelRadius; float gaussianPdf(in float x, in float sigma) { return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma; } void main() { vec2 invSize = 1.0 / texSize; float weightSum = gaussianPdf(0.0, kernelRadius); vec3 diffuseSum = texture2D( tDiffuse, vUv).rgb * weightSum; vec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS) * 0.5; vec2 uvOffset = delta; for( int i = 1; i <= MAX_RADIUS; i ++ ) { float w = gaussianPdf(uvOffset.x, kernelRadius); vec3 sample1 = texture2D( tDiffuse, vUv + uvOffset).rgb; vec3 sample2 = texture2D( tDiffuse, vUv - uvOffset).rgb; diffuseSum += ((sample1 + sample2) * w); weightSum += (2.0 * w); uvOffset += delta; } float alpha = texture2D( tDiffuse, vUv).a; gl_FragColor = vec4(diffuseSum/weightSum, alpha); }"}),Qe={uniforms:{tDiffuse:{value:null},resolution:{value:new THREE.Vector2}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include ","uniform sampler2D tDiffuse;","uniform vec2 resolution;","varying vec2 vUv;","bool IsSelected (vec3 color) {"," return (color.g<1e-8 && color.b < 1e-8 && color.r > 1e-3);","}","void main() {","float Alpha = 0.0;","vec2 texel = vec2( 0.5 / resolution.x, 0.5 / resolution.y );","texel = texel * vec2(2.0,2.0); ","bool Selected = false;","for( int i = -1; i <= 1;++i ) {","for (int j = -1; j <= 1; ++j){","Selected = IsSelected(texture2D( tDiffuse, vUv + texel * vec2( i,j ) ).rgb);","if (Selected) break;","}","if (Selected) break;","}","if(Selected)","Alpha = 1.0;","vec4 color = texture2D( tDiffuse, vUv);","float l = linearToRelativeLuminance( color.rgb );","gl_FragColor = vec4( l, l, l, Alpha );","}"].join("\n")},qe=new THREE.ShaderMaterial({uniforms:{tDiffuse:{value:null},resolution:{value:new THREE.Vector2},selectColor:{value:new THREE.Color}},vertexShader:["varying vec2 vUv;","void main() { ","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec2 resolution;","uniform vec3 selectColor;","varying vec2 vUv;","void main() {","vec2 texel = vec2( 1.0 / resolution.x, 1.0 / resolution.y );","texel = texel * vec2(0.3,0.3); ","vec3 colorDest = vec3(0.0,0.0,0.0);","const mat3 Gx = mat3( -1, -2, -1, 0, 0, 0, 1, 2, 1 );","const mat3 Gy = mat3( -1, 0, 1, -2, 0, 2, -1, 0, 1 );","float tx0y0 = texture2D( tDiffuse, vUv + texel * vec2( -1, -1 ) ).r;","float tx0y1 = texture2D( tDiffuse, vUv + texel * vec2( -1, 0 ) ).r;","float tx0y2 = texture2D( tDiffuse, vUv + texel * vec2( -1, 1 ) ).r;","float tx1y0 = texture2D( tDiffuse, vUv + texel * vec2( 0, -1 ) ).r;","float tx1y1 = texture2D( tDiffuse, vUv + texel * vec2( 0, 0 ) ).r;","float tx1y2 = texture2D( tDiffuse, vUv + texel * vec2( 0, 1 ) ).r;","float tx2y0 = texture2D( tDiffuse, vUv + texel * vec2( 1, -1 ) ).r;","float tx2y1 = texture2D( tDiffuse, vUv + texel * vec2( 1, 0 ) ).r;","float tx2y2 = texture2D( tDiffuse, vUv + texel * vec2( 1, 1 ) ).r;","float valueGx = Gx[0][0] * tx0y0 + Gx[1][0] * tx1y0 + Gx[2][0] * tx2y0 + ","Gx[0][1] * tx0y1 + Gx[1][1] * tx1y1 + Gx[2][1] * tx2y1 + ","Gx[0][2] * tx0y2 + Gx[1][2] * tx1y2 + Gx[2][2] * tx2y2; ","float valueGy = Gy[0][0] * tx0y0 + Gy[1][0] * tx1y0 + Gy[2][0] * tx2y0 + ","Gy[0][1] * tx0y1 + Gy[1][1] * tx1y1 + Gy[2][1] * tx2y1 + ","Gy[0][2] * tx0y2 + Gy[1][2] * tx1y2 + Gy[2][2] * tx2y2; ","float G = sqrt( ( valueGx * valueGx ) + ( valueGy * valueGy ) );","float Alpha = 1.0;","float select = texture2D( tDiffuse, vUv ).a;","if(G < 0.95) ","{","discard;","}","if( abs(select - 1.0) < 1e-6)","{","colorDest = selectColor;","}","gl_FragColor = vec4( colorDest, Alpha );","}"].join("\n"),blending:THREE.NormalBlending,depthTest:!1,depthWrite:!1,transparent:!0}),H={vertexShader:["void main() {\n","#ifdef USE_MODELMATRIXATTRIB\n\tmat4 ndsModelViewMatrix = viewMatrix * modelMatrixAttrib;\n\tgl_Position = projectionMatrix * ndsModelViewMatrix * vec4( position, 1.0 );\n#else\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n#endif\n","}"].join("\n"),fragmentShader:["const float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)","const float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)","const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );","const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );","const float ShiftRight8 = 1. / 256.;","vec4 packDepthToRGBA( const in float v ) {","vec4 r = vec4( fract( v * PackFactors ), v );","r.yzw -= r.xyz * ShiftRight8; // tidy overflow","return r * PackUpscale;","}","float unpackRGBAToDepth( const in vec4 v ) {","return dot( v, UnpackFactors );","}","void main() {","gl_FragColor = packDepthToRGBA( gl_FragCoord.z);","}"].join("\n")},S=(["varying vec4 mvPosition;","void main() {","#ifdef USE_MODELMATRIXATTRIB\n\tmat4 ndsModelViewMatrix = viewMatrix * modelMatrixAttrib;\n\tmvPosition = ndsModelViewMatrix * vec4( position, 1.0 );\n#else\n\tmvPosition = modelViewMatrix * vec4( position, 1.0 );\n#endif\n","gl_Position = projectionMatrix * mvPosition;","}"].join("\n"),["uniform float cameraNear;","uniform float cameraFar;","varying vec4 mvPosition;","void main() {","float depth = gl_FragCoord.z / gl_FragCoord.w;","depth =smoothstep( cameraNear, cameraFar, depth );","gl_FragColor = vec4( mvPosition.xyz, depth);","}"].join("\n"),["varying vec3 vNormal;","void main() {","#ifdef USE_MODELMATRIXATTRIB\n\tmat4 ndsModelViewMatrix = viewMatrix * modelMatrixAttrib;\n\tvNormal = normalize( mat3(ndsModelViewMatrix) * normal );\n\tgl_Position = projectionMatrix * ndsModelViewMatrix * vec4( position, 1.0 );\n#else\n\tvNormal = normalize( mat3(modelViewMatrix) * normal );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n#endif\n","}"].join("\n"),["varying vec3 vNormal;","void main() {","gl_FragColor = vec4( normalize(vNormal).xyz, 1.0);","}"].join("\n"),new THREE.Vector2(512,512),new THREE.Vector3(1,0,1),["varying vec2 vUv;","varying vec2 vExtent; ","vec2 getExtent() {"," vec2 extent;"," float a = projectionMatrix[2][2];"," float b = projectionMatrix[3][2];"," float nearOrthographic = (b + 1.0) / a;"," float farOrthographic = (b - 1.0) / a;"," float nearPerspective = b / (a - 1.0);"," float farPerspective = b / (a + 1.0);"," extent[0] = projectionMatrix[3][3] * nearOrthographic - projectionMatrix[2][3] * nearPerspective;"," extent[1] = projectionMatrix[3][3] * farOrthographic - projectionMatrix[2][3] * farPerspective;"," extent[1] -= extent[0];"," return extent;"," }","void main() {","vUv = uv;","vExtent = getExtent();","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),["varying vec2 vUv;","varying vec2 vExtent; ","uniform sampler2D tDiffuse;","uniform sampler2D tPosition;","uniform sampler2D tNormal;","uniform vec2 vSize;","uniform float fOccluderBias;","uniform vec3 vAttenuation;","uniform float fDistScale;","uniform float fOnlyAo;","uniform float fLumInfluence;","uniform float fRadiusNear;","uniform float fRadiusFar;","uniform float fIntensity;","#define nRadial 5 ","#define nAngular 5 ","#define minResolution 2e-4 ","float SamplePixels (vec3 srcPosition, vec3 srcNormal, vec2 uv)","{"," vec3 dstPosition = texture2D(tPosition, uv).xyz;"," vec3 positionVec = dstPosition - srcPosition;"," float len = length(positionVec);"," float intensity = fIntensity * max((dot(positionVec, srcNormal)- minResolution* vExtent[1])/len- fOccluderBias, 0.0);"," float dist = fDistScale * len / vExtent[1];"," float attenuation = 1.0 / (vAttenuation.x + (vAttenuation.y * dist) + vAttenuation.z*dist*dist);"," return intensity * attenuation ;","}","vec2 rand( const vec2 coord ) {","vec2 noise;","float nx = dot ( coord, vec2( 12.9898, 78.233 ) );","float ny = dot ( coord, vec2( 12.9898, 78.233 ) * 2.0 );","noise = clamp( fract ( 43758.5453 * sin( vec2( nx, ny ) ) ), 0.0, 1.0 );","return ( noise * 2.0 - 1.0 );","}","float getRandomAngle(vec2 pos) {","vec2 rnd = rand(pos);","return atan(rnd.y, rnd.x);","}","void main ()","{"," vec3 srcPosition = texture2D(tPosition, vUv).xyz;"," float srcDepth = texture2D(tPosition, vUv).w;"," vec3 srcNormal = texture2D(tNormal, vUv).xyz;"," float ao = 0.0;"," float radiusMax = fRadiusNear + (fRadiusFar- fRadiusNear) * srcDepth;"," float radiusMin = radiusMax/float(nRadial);"," float angleStep = 6.2831853/float(nAngular);"," vec2 texelSize= 1.0/vSize;"," float angle = getRandomAngle(vUv);"," for (int i = 0; i < nRadial; ++i)"," {"," float radius = radiusMin*float(i+1);"," for(int j=0; j< nAngular; ++j){"," vec2 offset = radius * vec2(cos(angle),sin(angle));"," offset *= texelSize; "," ao += SamplePixels(srcPosition, srcNormal, vUv + offset);"," angle += angleStep;"," }"," angle -= angleStep/2.0;"," }"," ao /= float(nRadial * nAngular);","\tao *= float(srcDepth < 1.0);"," ao = clamp(ao, 0.0, 1.0);","\tgl_FragColor.r = ao;"," gl_FragColor.a = 1.0;","}"].join("\n"),new THREE.Vector2(512,512),["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),["varying vec2 vUv;","uniform sampler2D tDiffuse;","uniform sampler2D tDiffuseOrginal;","uniform sampler2D tSSAOMap;","uniform vec2 vSize;","uniform float fOnlyAo;","uniform float fLumInfluence;","#define uFilterRadius 3","void main ()","{"," float occlusion = 0.0;"," float count = 0.0;"," vec2 texelSize= 1.0/vSize;"," for(int x= -uFilterRadius; x<= uFilterRadius; ++ x){"," for(int y = -uFilterRadius; y<= uFilterRadius; ++y){"," vec2 offset = vec2(x,y);"," float occulusionSample = texture2D(tSSAOMap, vUv + offset*texelSize).r;"," float weight = 1.0 / (1.0 + dot(offset, offset));"," occlusion += weight * occulusionSample;"," count += weight;"," }","}","occlusion /= count;","occlusion = clamp(occlusion, 0.0, 1.0);","occlusion = 1.0 - occlusion;","vec4 texelValue = texture2D(tDiffuseOrginal,vUv).rgba;","vec3 color = texelValue.rgb;","vec3 lumcoeff = vec3( 0.299, 0.587, 0.114 );","float lum = dot( color.rgb, lumcoeff );","vec3 luminance = vec3( lum );","vec3 aoResult = vec3( mix( vec3( occlusion ), vec3( 1.0 ), luminance * fLumInfluence ) );","if ( fOnlyAo == 1.0 )","\tgl_FragColor.xyz= aoResult;","else if ( fOnlyAo == 2.0 )"," gl_FragColor.xyz = color;","else","{"," gl_FragColor.xyz = color * aoResult;","}","gl_FragColor.w = texelValue.a;","}"].join("\n"),c.prototype={constructor:c,setSize:function(e,t){},render:function(e,t,i,n,r){console.error("Pass: .render() must be implemented in derived pass.")}},h.prototype=Object.create(c.prototype),Object.assign(h.prototype,{render:function(e,t,i,n,r){var o,s,a=e.context,l=e.state;l.buffers.color.setMask(!1),l.buffers.depth.setMask(!1),l.buffers.color.setLocked(!0),l.buffers.depth.setLocked(!0),s=this.inverse?(o=0,1):(o=1,0),l.buffers.stencil.setTest(!0),l.buffers.stencil.setOp(a.REPLACE,a.REPLACE,a.REPLACE),l.buffers.stencil.setFunc(a.ALWAYS,o,4294967295),l.buffers.stencil.setClear(s),e.render(this.scene,this.camera,i,this.clear),e.render(this.scene,this.camera,t,this.clear),l.buffers.color.setLocked(!1),l.buffers.depth.setLocked(!1),l.buffers.stencil.setFunc(a.EQUAL,1,4294967295),l.buffers.stencil.setOp(a.KEEP,a.KEEP,a.KEEP)}}),u.prototype=Object.create(c.prototype),Object.assign(u.prototype,{render:function(e,t,i,n,r){e.state.buffers.stencil.setTest(!1)}}),Fe.prototype=Object.assign(Object.create(c.prototype),{constructor:Fe,render:function(e,t,i,n,r,o){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=i.texture),this.quad.material=this.material,this.renderToColor&&n?e.render(this.scene,this.camera,n,this.clear):this.renderToScreen?e.render(this.scene,this.camera):e.render(this.scene,this.camera,t,this.clear)}}),Object.assign(Ne.prototype,{swapBuffers:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e},addPass:function(e){this.passes.push(e);var t=this.renderer.getSize();e.setSize(t.width,t.height)},insertPass:function(e,t){this.passes.splice(t,0,e)},render:function(e){this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2;for(var t,i,n=!1,r=this.passes.length,o=0;oe._leafBodyAttri._bodyBbox[t]&&(i[t]=e._leafBodyAttri._bodyBbox[t]),i[3+t]=n.geoms.length||e<0))return s(e),r.geoms[e]},this.getGeomIdFromUuid=function(e,t){return r.getGeomIdFromUuid(e,t)},this.getGeomFromUuid=function(e,t){e=r.getGeomIdFromUuid(e,t);return-1=this.geoms.length||e<0))return this.geoms[e]},getGeomIdFromUuid:function(e,t){var i=this.uuidToIdMap[e];if(i=i||this.uuidToIdMap[e.toUpperCase()])for(var n=0,n=0;n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? instanceDistanceStart : instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t#ifdef USE_MODELMATRIXATTRIB\n\t\t\t\tmat4 ndsModelViewMatrix = viewMatrix * modelMatrixAttrib;\n\t\t\t\t// camera space\n\t\t\t\tvec4 start = ndsModelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\t\tvec4 end = ndsModelViewMatrix * vec4( instanceEnd, 1.0 );\n\t\t\t#else\n\t\t\t\t// camera space\n\t\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\t\t\t#endif\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\t\t\n\t\t#ifdef USE_DASH\n\t\t\tuniform float patternLength;\n\t\t\tuniform float lineScale;\n\t\t\tuniform sampler2D uSampler;\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n float newDistance = vLineDistance/lineScale;\n float modSize = mod( newDistance, patternLength);\n vec3 value = texture2D(uSampler,vec2(modSize/patternLength,0.0)).rgb;\n if(value.r > 0.9){\n \tdiscard;\n }\n\t\t\t\tif(value.r <=0.9 && value.r >=0.8){\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\t\t\t\t}\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t"};var Ke=function(i){function e(e){var t=i.call(this,{type:"LineMaterial",uniforms:THREE.UniformsUtils.clone(THREE.ShaderLib.line.uniforms),vertexShader:THREE.ShaderLib.line.vertexShader,fragmentShader:THREE.ShaderLib.line.fragmentShader,clipping:!0})||this;return t.isLineMaterial=!0,t.setValues(e),t}var t,n,r;return n=i,(t=e).prototype=Object.create(n.prototype),k(t.prototype.constructor=t,n),t=e,(n=[{key:"color",get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},{key:"worldUnits",get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},{key:"linewidth",get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}},{key:"dashed",get:function(){return"USE_DASH"in this.defines},set:function(e){!0===e!==this.dashed&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},{key:"dashScale",get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},{key:"dashSize",get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},{key:"dashOffset",get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},{key:"gapSize",get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},{key:"opacity",get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms&&(this.uniforms.opacity.value=e)}},{key:"resolution",get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},{key:"alphaToCoverage",get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(e){this.defines&&(!0===e!==this.alphaToCoverage&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1))}},{key:"lineScale",get:function(){return this.uniforms.lineScale.value},set:function(e){this.uniforms.lineScale.value=e}},{key:"lineTypeId",get:function(){return this.uniforms.lineTypeId.value},set:function(e){this.uniforms.lineTypeId.value=e}},{key:"patternLength",get:function(){return this.uniforms.patternLength.value},set:function(e){this.uniforms.patternLength.value=e}},{key:"uSampler",get:function(){return this.uniforms.uSampler.value},set:function(e){this.uniforms.uSampler.value=e}}])&&U(t.prototype,n),r&&U(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}(THREE.ShaderMaterial);function _(e,t){return(_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}var Q,q,Z=new THREE.Vector3,K=new THREE.Vector3,ie=new THREE.Vector4,ne=new THREE.Vector4,re=new THREE.Vector4,oe=new THREE.Vector3,se=new THREE.Matrix4,ae=new THREE.Line3,le=new THREE.Vector3,de=new THREE.Box3,ce=new THREE.Sphere,he=new THREE.Vector4;function ue(e,t,i){return he.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),he.multiplyScalar(1/he.w),he.x=q/i.width,he.y=q/i.height,he.applyMatrix4(e.projectionMatrixInverse),he.multiplyScalar(1/he.w),Math.abs(Math.max(he.x,he.y))}var Je=function(i){function e(e,t){return void 0===e&&(e=new Ze),void 0===t&&(t=new Ke({color:16777215*Math.random()})),(e=i.call(this,e,t)||this).isLineSegments2=!0,e.type="LineSegments2",e}t=i,(n=e).prototype=Object.create(t.prototype),_(n.prototype.constructor=n,t);var t,n=e.prototype;return n.computeLineDistances=function(){for(var e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,n=new Float32Array(2*t.count),r=0,o=0,s=t.count;rx&&ne.z>x||(ie.z>x?(I=ie.z-ne.z,I=(ie.z-x)/I,ie.lerp(ne,I)):ne.z>x&&(I=ne.z-ie.z,b=(ne.z-x)/I,ne.lerp(ie,b)),ie.applyMatrix4(A),ne.applyMatrix4(A),ie.multiplyScalar(1/ie.w),ne.multiplyScalar(1/ne.w),ie.x*=y.x/2,ie.y*=y.y/2,ne.x*=y.x/2,ne.y*=y.y/2,ae.start.copy(ie),ae.start.z=0,ae.end.copy(ne),ae.end.z=0,b=ae.closestPointToPointParameter(oe,!0),ae.at(b,le),T=-1<=(T=MathUtils.lerp(ie.z,ne.z,b))&&T<=1,S=oe.distanceTo(le)<.5*q,T&&S&&(ae.start.fromBufferAttribute(M,B),ae.end.fromBufferAttribute(w,B),ae.start.applyMatrix4(E),ae.end.applyMatrix4(E),T=new THREE.Vector3,S=new THREE.Vector3,Q.distanceSqToSegment(ae.start,ae.end,S,T),v.push({point:S,pointOnLine:T,distance:Q.origin.distanceTo(S),object:g,face:null,faceIndex:B,uv:null,uv1:null})))}},e}(THREE.Mesh);function pe(e,t){return e-t}function fe(e){var i=this;this.boundingBox=new THREE.Box3,this.boundingSphere=new THREE.Sphere,this.children=[],this.meshes=null,this.lines=null,this.texts=null,this.parent=null,this.addSubTree=function(e){((e=e.isSpatialIndex?e:new rt(e)).root.parent=i).children.push(e.root);for(var t=i;t;)t.boundingBox.expandByPoint(e.root.boundingBox.min),t.boundingBox.expandByPoint(e.root.boundingBox.max),t=t.parent;return e.root},this.queryByRayCast=function(){function o(e,t,i){if(t.intersectsBox(e.boundingBox)){0<=e.meshSetId&&(i[i.length]=e.meshSetId);for(var n=0,r=e.children.length;nthis.geomId.length){for(var e=100<=e?e:100,r=new Float32Array(this.bboxes.length+6*e),o=0,s=this.bboxes.length;o=this.mats.length/2&&(t.geometry.refMeshesSameMaterial&&this.supportInstancedArrays&&!t.geometry.useSharedGlBuffer||(e-=this.mats.length/2)),t.material=this.mats[e],t.matrixWorld||(t.matrixWorld=new THREE.Matrix4),i.worldMatrix);t.matrixWorld.copy(e),t.matrixWorld.elements[12]+=n[0],t.matrixWorld.elements[13]+=n[1],t.matrixWorld.elements[14]+=n[2]},getSingleMesh:function(e){var t=this.supportInstancedArrays,e=(this.supportInstancedArrays=!1,this.getMesh(e));return this.supportInstancedArrays=t,e},getMeshMaterialByMeshId:function(t,e,i){var n,r,o,s=this,a=e;if(e||!(a=this.bodyNodes[t]).isHidden())return(e=i)||(e=this.geomManager.getGeomFromId(this.geomId[t])),i=a.getMaterialBodyNodeUUid(),(n=a.getUserMaterial())?(n.colors&&n.colors.forEach(function(e){e.meshId==t&&(n.color.copy(e.value),n.needsUpdate=!0,n.needsRefresh=!0)}),n.opacities&&n.opacities.forEach(function(e){e.meshId==t&&(n.opacity=e.value,0=this.mats.length/2&&(e.refMeshesSameMaterial&&this.supportInstancedArrays&&!e.useSharedGlBuffer||(i-=this.mats.length/2)),e=this.mats[i],o=this.matsCopy[i],0this.lineSegGeomId.length&&(e=100<=e?e:100,(r=new Int32Array(this.lineSegGeomId.length+e)).set(this.lineSegGeomId),this.lineSegGeomId=r,(r=new Int32Array(this.lineSegMaterialId.length+e)).set(this.lineSegMaterialId),this.lineSegMaterialId=r,(r=new Uint8Array(this.lineSegFlag.length+e)).set(this.lineSegFlag),this.lineSegFlag=r,this.lineSegBodyNodes=this.lineSegBodyNodes.concat(new Array(e)),this.lineSegBodyUuids=this.lineSegBodyUuids.concat(new Array(e)),t&&(this.lineSegObjectUuids=this.lineSegObjectUuids.concat(new Array(e))),i)&&((r=new Int32Array(this.lineSegMatrixId.length+e)).set(this.lineSegMatrixId),this.lineSegMatrixId=r),n)},deleteLineSegments:function(e){e.sort(pe).reverse(),this.nLineSegments-=e.length;var t=new Array,t=(t.extend(this.lineSegGeomId),t.deletefromIds(e),this.lineSegGeomId=new Int32Array(t),new Array),t=(t.extend(this.lineSegGeomUuid),t.deletefromIds(e),this.lineSegGeomUuid=t,new Array),t=(t.extend(this.lineSegMaterialId),t.deletefromIds(e),this.lineSegMaterialId=new Int32Array(t),new Array),t=(t.extend(this.lineSegFlag),t.deletefromIds(e),this.lineSegFlag=new Uint8Array(t),new Array),t=(t.extend(this.lineSegBodyUuids),t.deletefromIds(e),this.lineSegBodyUuids=t,new Array);t.extend(this.lineSegBodyNodes),t.deletefromIds(e),this.lineSegBodyNodes=t},setLineSegmentsFromGeomUuid:function(e,t,i,n,r,o){this.lineSegGeomUuid[e]=t,this.lineSegBodyUuids[e]=i,this.lineSegMaterialId[e]=n||-1,this.lineSegObjectUuids&&(this.lineSegObjectUuids[e]=r),this.lineSegMatrixId&&(this.lineSegMatrixId[e]=o)},calcLineSegmentsBox:function(){for(var e=0;er.leafBodyAttri.bodyBbox[3+s]&&(r.leafBodyAttri.bodyBbox[3+s]=o.max.getComponent(s));else for(s=0;s<3;++s)r.leafBodyAttri.bodyBbox[s]=o.min.getComponent(s),r.leafBodyAttri.bodyBbox[3+s]=o.max.getComponent(s)}}for(i=0;i=.9*t.maxMemory&&(t.stopLoading=!0,t.allGeomInMemory=!1)}return!0},getLineSegmentsWithState:function(e,t,i,n){void 0===n&&(n=void 0),r=e.lineSegIds?(o=e).lineSegIds[0]:e;var r,o,e={state:1,lineSegments:null,lineStyle:null};if((i=void 0===i?!1:i)&&this.instancedLineSegs.has(r))e.state=0;else if(this.isLineSegmentsLoaded(r)){this.instanceMats||(this.instanceMats=new Map);i=this.geomManager.getGeomFromId(this.lineSegGeomId[r]);if(0===i.drawRange.count)e.state=0;else if(!1===Re.tangentEdgeVisible&&i.tangentEdgeObject)e.state=0;else{var s=this.lineSegBodyNodes[r],a=void 0;if(s.getModel().NeedsMergeBodyNode&&!s.sketchBody){var l=s.parent.FirstVisibleNode||0;if(s.parent.children[l].isHidden()||s.unload){if(s.unload)return e.state=0,e;if(!s.parent.children[l].isSelected())return e.state=0,e;a=s.parent.children[l].isHidden(),s.parent.children[l].show()}}else if(s.isSelected()&&(a=s.isHidden(),s.show()),s.isHidden())return e.state=0,e;if(void 0!==n)if(s.renderMode!==n||!s.needOutlinePassRender)return a&&(s.hide(),s.getModel().NeedsMergeBodyNode)&&!s.sketchBody&&(l=s.parent.FirstVisibleNode||0,s.parent.children[l].hide()),e.state=-2,e;this.lineSegments.geometry=i,this.lineSegments.geometry.isInstancedBufferGeometry=!1;var l=null,i=this.lineSegMaterialId[r];if(-1d.max.x+i||t.origin.yd.max.y+i))&&(n||!1!==t.intersectsBox(d))){var d=new THREE.Vector3,c=new THREE.Quaternion,l=(a.decompose(l,c,d),new THREE.Matrix4),h=(l.getInverse(a),new THREE.Ray),u=(h.copy(t).applyMatrix4(l),{}),c=(u.distance=F,u.point=new THREE.Vector3,u.face=null,u.faceIndex=-1,u.meshId=-1,u.lineSegId=-1,i/((d.x+d.y+d.z)/3)),p=c*c,f=new THREE.Vector3,m=new THREE.Vector3,g=r.index,v=r.attributes.position;if(!g)return null;new THREE.Vector3;for(var A=new THREE.Vector3,y=new THREE.Vector3,l=new THREE.Plane(new THREE.Vector3(0,0,-1),0),E=new THREE.Vector3,M=(h.intersectPlane(l,E),new THREE.Vector3),w=new THREE.Vector3,x=r.drawRange.start,N=r.drawRange.start+r.drawRange.count;xs[p]&&(s[p]=u[p])}n.min.x+=o[0],n.min.y+=o[1],n.min.z+=o[2],n.max.x+=s[0],n.max.y+=s[1],n.max.z+=s[2],n.min.x+=a[0],n.min.y+=a[1],n.min.z+=a[2],n.max.x+=a[0],n.max.y+=a[1],n.max.z+=a[2]}if(this.visualStates.visible=e.intersectsBox(n),!this.visualStates.visible)for(var f=this.sptIndex.getNumMeshes(this.node),m=new THREE.Box3,g=0;g>1):r>>1,e[o]=n*i},Oe.calcSmoothNormals=function(e,t){for(var i,n,r,o,s,a,l,d,c,h,u,p=new Float32Array(t.length),f=0,m=e.length;f=this.len&&(this.offset-=this.len-4,this.offset>=this.count)&&(this.offset-=this.count+(Oe.isLittleEndian?1:-1))},Oe.BIMStream=function(e,t,i){this.data=e,this.offset=t,this.count=i,this.len=this.data.length},Oe.BIMStream.prototype.writeByte=function(e){this.data[this.offset]=e,this.offset+=this.count,this.offset>=this.len&&(this.offset=0)},Oe.Stream=function(e){this.data=e,this.dataView=new DataView(e.buffer),this.offset=0},Oe.Stream.prototype.TWO_POW_MINUS23=Math.pow(2,-23),Oe.Stream.prototype.TWO_POW_MINUS126=Math.pow(2,-126),Oe.Stream.prototype.readByte=function(){return 255&this.data[this.offset++]},Oe.Stream.prototype.readUInt8=function(){return this.dataView.getUint8(this.offset++,!0)},Oe.Stream.prototype.readInt32=function(){var e=this.dataView.getInt32(this.offset,!0);return this.offset+=4,e},Oe.Stream.prototype.readUInt32=function(){var e=this.dataView.getUint32(this.offset,!0);return this.offset+=4,e},Oe.Stream.prototype.readInt64=function(){var e=this.dataView.getUint32(this.offset,!0),t=(this.offset+=4,this.dataView.getUint32(this.offset,!0)),t=(this.offset+=4,BigInt(t)<=this._windowSize&&(this._pos=0),this._streamPos=this._pos}},A.OutWindow.prototype.releaseStream=function(){this.flush(),this._stream=null},A.OutWindow.prototype.setStream=function(e){this.releaseStream(),this._stream=e},A.OutWindow.prototype.init=function(e){e||(this._streamPos=0,this._pos=0)},A.OutWindow.prototype.copyBlock=function(e,t){var i=this._pos-e-1;for(i<0&&(i+=this._windowSize);t--;)i>=this._windowSize&&(i=0),this._buffer[this._pos++]=this._buffer[i++],this._pos>=this._windowSize&&this.flush()},A.OutWindow.prototype.putByte=function(e){this._buffer[this._pos++]=e,this._pos>=this._windowSize&&this.flush()},A.OutWindow.prototype.getByte=function(e){e=this._pos-e-1;return e<0&&(e+=this._windowSize),this._buffer[e]},A.RangeDecoder=function(){},A.RangeDecoder.prototype.setStream=function(e){this._stream=e},A.RangeDecoder.prototype.releaseStream=function(){this._stream=null},A.RangeDecoder.prototype.init=function(){var e=5;for(this._code=0,this._range=-1;e--;)this._code=this._code<<8|this._stream.readByte()},A.RangeDecoder.prototype.decodeDirectBits=function(e){for(var t,i=0,n=e;n--;)this._range>>>=1,t=this._code-this._range>>>31,this._code-=this._range&t-1,i=i<<1|1-t,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8);return i},A.RangeDecoder.prototype.decodeBit=function(e,t){var i=e[t],n=(this._range>>>11)*i;return(2147483648^this._code)<(2147483648^n)?(this._range=n,e[t]+=2048-i>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0):(this._range-=n,this._code-=n,e[t]-=i>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),1)},A.initBitModels=function(e,t){for(;t--;)e[t]=1024},A.BitTreeDecoder=function(e){this._models=[],this._numBitLevels=e},A.BitTreeDecoder.prototype.init=function(){A.initBitModels(this._models,1<>7&1,t<<=1,r=r<<1|(n=e.decodeBit(this._decoders,(1+i<<8)+r)),i!==n){for(;r<256;)r=r<<1|e.decodeBit(this._decoders,r);break}}while(r<256);return 255&r},A.LiteralDecoder=function(){},A.LiteralDecoder.prototype.create=function(e,t){var i;if(!this._coders||this._numPrevBits!==t||this._numPosBits!==e)for(this._numPosBits=e,this._posMask=(1<>>8-this._numPrevBits)]},A.Decoder=function(){this._outWindow=new A.OutWindow,this._rangeDecoder=new A.RangeDecoder,this._isMatchDecoders=[],this._isRepDecoders=[],this._isRepG0Decoders=[],this._isRepG1Decoders=[],this._isRepG2Decoders=[],this._isRep0LongDecoders=[],this._posSlotDecoder=[],this._posDecoders=[],this._posAlignDecoder=new A.BitTreeDecoder(4),this._lenDecoder=new A.LenDecoder,this._repLenDecoder=new A.LenDecoder,this._literalDecoder=new A.LiteralDecoder,this._dictionarySize=-1,this._dictionarySizeCheck=-1,this._posSlotDecoder[0]=new A.BitTreeDecoder(6),this._posSlotDecoder[1]=new A.BitTreeDecoder(6),this._posSlotDecoder[2]=new A.BitTreeDecoder(6),this._posSlotDecoder[3]=new A.BitTreeDecoder(6)},A.Decoder.prototype.setDictionarySize=function(e){return!(e<0||(this._dictionarySize!==e&&(this._dictionarySize=e,this._dictionarySizeCheck=Math.max(this._dictionarySize,1),this._outWindow.create(Math.max(this._dictionarySizeCheck,4096))),0))},A.Decoder.prototype.setLcLpPb=function(e,t,i){var n=1<>1)-1),o<14)l+=A.reverseDecode2(this._posDecoders,l-o-1,this._rangeDecoder,s);else if((l=(l+=this._rangeDecoder.decodeDirectBits(s-4)<<4)+this._posAlignDecoder.reverseDecode(this._rangeDecoder))<0){if(-1===l)break;return!1}}else l=o;if(u<=l||l>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(l,n),u+=n,p=this._outWindow.getByte(0)}return this._outWindow.flush(),this._outWindow.releaseStream(),this._rangeDecoder.releaseStream(),!0},A.Decoder.prototype.setDecoderProperties=function(e){var t;return!(e.size<5||(t=e.readByte(),!this.setLcLpPb(t%9,(t=~~(t/9))%5,~~(t/5))))&&(t=e.readByte(),t=(t=(t|=e.readByte()<<8)|e.readByte()<<16)+16777216*e.readByte(),this.setDictionarySize(t))},A.decompress=function(e,t,i,n){var r=new A.Decoder;if(!r.setDecoderProperties(e))throw"Incorrect stream properties";if(r.decode(t,i,n))return!0;throw"Error in data stream"},sn=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),tt=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]),"object"!=typeof WebAssembly?{supported:!1}:(e="B9h79tEBBBE8fV9gBB9gVUUUUUEU9gIUUUB9gEUEU9gIUUUEUIKQBEEEDDDILLVIEBEOWEUEC+Q/IEKR/LEdO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9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FC98gFGBbDJ1JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABKKKEBCJWKLZ9kBB",WebAssembly.validate(sn)&&(e="B9h79tEBBBEkL9gBB9gVUUUUUEU9gIUUUB9gEUEUIKQBBEBEEDDDILVE9wEEEVIEBEOWEUEC+Q/aEKR/LEdO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9f9kw9j9v9kw9WwvTw949C919m9mwvBDy9tw79o9v9wT9f9kw9j9v9kw69u9kw949C919m9mwvBLe9tw79o9v9wT9f9kw9j9v9kw69u9kw949Twg91w9u9jwBVl9tw79o9v9wT9f9kw9j9v9kws9p2Twv9P9jTBOk9tw79o9v9wT9f9kw9j9v9kws9p2Twv9R919hTBRl9tw79o9v9wT9f9kw9j9v9kws9p2Twvt949wBWL79iv9rBdQ/49TQLBZIK9+EVU8jJJJJBCZ9rHBCBHEINCBHDCBHIINABCWFADFAICJUAEAD4CEgGLe86BBAIALFHIADCEFGDCW9HMBKAEC+Q+YJJBFAI86BBAECITC+Q1JJBFAB8pIW83IBAECEFGECJD9HMBKK/s8jLhUD97EUO978jJJJJBCJ/KB9rGV8kJJJJBC9+HODNADCEFAL0MB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KAQCZP+rECZP+sEP/6EP/mEGQAQP/mEP/kEP/kEP/lEPXBBBBBBBBBBBBBBBBP+4EP/jEPXB/+fsB/+fsB/+fsB/+fsGKP/mEPXBBN0BBN0BBN0BBN0GRP/kEPXffBBffBBffBBffBBGMP9OAXAKP/mEARP/kECZP+rEP9QGXAQAKP/mEARP/kECZP+rEAdAKP/mEARP/kEAMP9OP9QGKPMBEZhDIoaLVcxORqlGRP5BAIPBLAPeB+t+J83IBAIARP5EAIPBLAPeE+t+J83IWAIAXAKPMWdkyQK8aeXM35pS8e8fGKP5BAIPBLAPeD+t+J83IZAIAKP5EAIPBLAPeI+t+J83IkKAWAIAO/8QBBKK+pDDIUE978jJJJJBC/AB9rHIDNADCD4AE2GLC98gGVtMBCBHDABHEINAEAEPBBBGOCWP+rECWP+sEP/6EAOCEP+sEPXBBJzBBJzBBJzBBJzP+uEPXBBJfBBJfBBJfBBJfP9OP/mEPKBBAECZFHEADCLFGDAV6MBKKDNAVAL9PMBAIALCIgGDCDTGEvCBC/ABAE9r/8KBAIABAVCDTFGVAE/8QBBDNADtMBAIAIPBLBGOCWP+rECWP+sEP/6EAOCEP+sEPXBBJzBBJzBBJzBBJzP+uEPXBBJfBBJfBBJfBBJfP9OP/mEPKLBKAVAIAE/8QBBKK9TEIUCBCBYDJ1JJBGEABCIFC98gFGBbDJ1JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIKKKEBCJWKLZ9tBB"),sn=WebAssembly.instantiate(function(e){for(var t=new Uint8Array(e.length),i=0;iH.boundingBox.max.x||H.boundingBox.min.y>H.boundingBox.max.y||H.boundingBox.min.z>H.boundingBox.max.z)&&P.equals(C)?(H.boundingBox=null,H.attributes.position&&H.computeBoundingBox()):H.boundingBox.set(P,C),0===R&&H.attributes.normal,H.boundingSphere=null,F&&F()}V&&V()},X.prototype.readBIMBufferVersion8=function(e,F,N,V){for(var j=e.readInt32(),U=(e.readInt32(),e.readInt32()),k=[],t=(NDSWebViewer.Viewer.renderer.context,0);tH.boundingBox.max.x||H.boundingBox.min.y>H.boundingBox.max.y||H.boundingBox.min.z>H.boundingBox.max.z)&&P.equals(C)?(H.boundingBox=null,H.attributes.position&&H.computeBoundingBox()):H.boundingBox.set(P,C),0===R&&H.attributes.normal,H.boundingSphere=null,F&&F()}V&&V()},X.prototype.readBIMBufferVersion9=function(e,F,N,V){for(var t,i,n,r,o,s,a=st,j=e.readInt32(),U=(e.readInt32(),e.readInt32()),k=[],l=(NDSWebViewer.Viewer.renderer.context,0);lH.boundingBox.max.x||H.boundingBox.min.y>H.boundingBox.max.y||H.boundingBox.min.z>H.boundingBox.max.z)&&P.equals(C)?(H.boundingBox=null,H.attributes.position&&H.computeBoundingBox()):H.boundingBox.set(P,C),0===R&&H.attributes.normal,H.boundingSphere=null,F&&F()}V&&V()},X.prototype.readBIMBufferVersion7_=function(e,F,N,V){for(var j=e.readInt32(),U=(e.readInt32(),e.readInt32()),k=[],t=0;t>>0,e.readInt32()>>>0,e.readInt32()>>>0,e.readInt32()>>>0],i="",n=0,n=0;n<4;++n){var r=t[n].toString(16);r.length<8&&(i+="00000000".slice(0,8-r.length)),i+=r}return i=0!=Re.ScenarioEditorid?Se.addSceneID(i):i},X.prototype.readUuid3=function(e){e=(e.readInt32()>>>0).toString();return e=0!=Re.ScenarioEditorid?Se.addSceneID(e):e},X.prototype.readBvhV1=function(e,t){for(var i,n,r=e.readInt32(),o=(t.setNumNodes(r),new Float32Array(6)),s=0,a=0;ae[3]||e[1]>e[4]||e[2]>e[5])},F=function(){u.min.fromArray(m,0),u.max.fromArray(m,3),u.applyMatrix4(i),m[0]=u.min.x,m[1]=u.min.y,m[2]=u.min.z,m[3]=u.max.x,m[4]=u.max.y,m[5]=u.max.z},A=0;Ae.length&&console.error("TGALoader: No data."),i+=Ce.id_length;var r=!1,o=!1,Re=!1;switch(Ce.image_type){case 9:o=r=!0;break;case 1:o=!0;break;case 10:r=!0;break;case 2:break;case 11:Re=r=!0;break;case 3:Re=!0}e=function(e,t,i,n,r){var o,s=i.pixel_size>>3,a=i.width*i.height*s;if(t&&(o=r.subarray(n,n+=i.colormap_length*(i.colormap_size>>3))),e)for(var l,d,c,h=new Uint8Array(a),u=0,p=new Uint8Array(s);u>4){default:case 2:a=e,r=n=0,s=o=1,l=t;break;case 0:n=0,a=e,r=t-(o=1),l=s=-1;break;case 3:n=e-1,a=o=-1,r=0,s=1,l=t;break;case 1:n=e-1,r=t-1,l=s=a=o=-1}if(Re)switch(Ce.pixel_size){case 8:for(var c,h,u=d,N=r,V=s,j=l,U=n,k=o,_=a,G=i,z=0,p=Ce.width,f=N;f!==j;f+=V)for(h=U;h!==_;h+=k,z++)c=G[z],u[4*(h+p*f)+0]=c,u[4*(h+p*f)+1]=c,u[4*(h+p*f)+2]=c,u[4*(h+p*f)+3]=255;break;case 16:for(var m,g=d,N=r,W=s,Y=l,X=n,Q=o,q=a,v=i,A=0,y=Ce.width,E=N;E!==Y;E+=W)for(m=X;m!==q;m+=Q,A+=2)g[4*(m+y*E)+0]=v[A+0],g[4*(m+y*E)+1]=v[A+0],g[4*(m+y*E)+2]=v[A+0],g[4*(m+y*E)+3]=v[A+1];break;default:console.error("TGALoader: Format not supported.")}else switch(Ce.pixel_size){case 8:for(var M,w,x=d,Z=r,K=s,J=l,$=n,ee=o,te=a,ie=i,ne=F,re=0,I=Ce.width,b=Z;b!==J;b+=K)for(w=$;w!==te;w+=ee,re++)M=ie[re],x[4*(w+I*b)+3]=255,x[4*(w+I*b)+2]=ne[3*M+0],x[4*(w+I*b)+1]=ne[3*M+1],x[4*(w+I*b)+0]=ne[3*M+2];break;case 16:for(var T,S,B=d,Z=r,oe=s,se=l,ae=n,le=o,de=a,ce=i,he=0,P=Ce.width,C=Z;C!==se;C+=oe)for(S=ae;S!==de;S+=le,he+=2)T=ce[he+0]+(ce[he+1]<<8),B[4*(S+P*C)+0]=(31744&T)>>7,B[4*(S+P*C)+1]=(992&T)>>2,B[4*(S+P*C)+2]=(31&T)>>3,B[4*(S+P*C)+3]=32768&T?0:255;break;case 24:for(var R,ue=d,pe=r,fe=s,me=l,ge=n,ve=o,Ae=a,ye=i,Ee=0,Me=Ce.width,O=pe;O!==me;O+=fe)for(R=ge;R!==Ae;R+=ve,Ee+=3)ue[4*(R+Me*O)+3]=255,ue[4*(R+Me*O)+2]=ye[Ee+0],ue[4*(R+Me*O)+1]=ye[Ee+1],ue[4*(R+Me*O)+0]=ye[Ee+2];break;case 32:for(var L,we=d,pe=r,xe=s,Ie=l,be=n,Te=o,Se=a,Be=i,D=0,Pe=Ce.width,H=pe;H!==Ie;H+=xe)for(L=be;L!==Se;L+=Te,D+=4)we[4*(L+Pe*H)+2]=Be[D+0],we[4*(L+Pe*H)+1]=Be[D+1],we[4*(L+Pe*H)+0]=Be[D+2],we[4*(L+Pe*H)+3]=Be[D+3];break;default:console.error("TGALoader: Format not supported.")}return d}(Ce.width,Ce.height,e.pixel_data,e.palettes);return{width:Ce.width,height:Ce.height,data:i,magFilter:THREE.NearestFilter,minFilter:THREE.NearestFilter}}},function(e){var s=this;this.is2DModel=e,this.metrics={},this.TextMaterial={},this.TextMaterialItalic={},this.TextMaterialBold={},this.TextMaterialIandB={},this.blendMaterial=null,this.newblendMaterial=null,this.shxMaterial=null,this.mappableUnit=4096,this.textSize=100,this.textUnit=parseInt(1.125*this.textSize),this.specialCodeArray=[],this.AddSpecialCode(),this.AttributeArray=[],this.HashTable=[],this.textString="",this.textPos=[],this.geometrytoRange=[],this.lines=[],this.objectuuidToGeo={},this.numTextGeom=0,this.ttfCompositeStride=6,this.ttfGeometryBuffers=[],this.shxCompositeStride=3,this.shxGeometryBuffers=[],this.genTTFGeometryBuffer=function(e){void 0===e&&(e=1024);e={compositeIBuffer:new THREE.InterleavedBuffer(new Float32Array(4*e*s.ttfCompositeStride),s.ttfCompositeStride),index:new THREE.Uint32BufferAttribute(new Uint32Array(6*e),1),bufferOffset:0,indexOffset:0};return e.compositePositionAttrib=new THREE.InterleavedBufferAttribute(e.compositeIBuffer,3,0,!1),e.compositeUvAttrib=new THREE.InterleavedBufferAttribute(e.compositeIBuffer,2,3,!1),e.compositeTextureAttrib=new THREE.InterleavedBufferAttribute(e.compositeIBuffer,1,5,!1),s.ttfGeometryBuffers[s.ttfGeometryBuffers.length]=e,s.ttfGeometryBuffers.length-1},this.getTTFGeometryBuffer=function(e){for(var t=-1,i=0,n=s.ttfGeometryBuffers.length;ig?this.textUnit/2-g:0,d=((l=l+d+I+28)+(x>>1)>this.mappableUnit&&(l=(l=14)+((d=0)>>1)+(x>>1)+28,c++),a.textAlign="center",a.fillText(p,l,this.textUnit*c),v>this.textUnit/2?v-this.textUnit/2:0),b=l,T=this.textUnit*c,I={height:1,width:f?1:(x+28)/this.textUnit,left:this.textUnit/2>g?(b-I-7)/this.mappableUnit:(b+g-this.textUnit/2-7)/this.mappableUnit,top:1-(T-this.textUnit+7)/this.mappableUnit,right:this.textUnit/2>g?(b-I+x+7)/this.mappableUnit:(b+g-this.textUnit/2+x+7)/this.mappableUnit,bottom:1-T/this.mappableUnit};i&&f&&(I.height=1.5,I.width=1.5),o&&(b=I.right-I.left,I.right-=(b*=.35)/2,I.left+=b/2,T=I.top-I.bottom,I.top-=(T*=.35)/2,I.bottom+=T/2),h[m]||(h[m]=new Object),h[m][p]=I}var S=null;return t&&((S=document.createElement("img")).src=ct.toDataURL("image/png")),S}),addHash:function(e){this.HashTable.push(e)},containHash:function(e){return-1!=this.HashTable.indexOf(e)},getHashKey:function(){return this.HashTable.concat()},SetTexture:function(e,t,i){this.textures=e;for(var n=0;n -0.5 && vtextureid < 0.5){","dist = texture2D(uSampler0, vUv).a;","}","if( vtextureid > 0.5 && vtextureid < 1.5){","dist = texture2D(uSampler1, vUv).a;","}","if( vtextureid > 1.5 && vtextureid < 2.5){","dist = texture2D(uSampler2, vUv).a;","}","if( vtextureid > 2.5 && vtextureid < 3.5){","dist = texture2D(uSampler3, vUv).a;","}","if( vtextureid > 3.5 && vtextureid < 4.5){","dist = texture2D(uSampler4, vUv).a;","}","float alpha = smoothstep(cBuffer - uGamma, cBuffer + uGamma, dist);","vec3 destColor = vColor;","if(destColor.r> 1.0){","destColor.r = 1.0;","alpha = 0.0;","}","if(destColor.g> 1.0){","destColor.r = 0.090;","destColor.g = 0.501;","destColor.b = 0.890;","}","gl_FragColor = vec4(destColor, alpha);","}"].join("\n")});if(1 -0.5 && vtextureid < 0.5){","dist = texture2D(uSampler0, vUv).a;","}","if( vtextureid > 0.5 && vtextureid < 1.5){","dist = texture2D(uSampler1, vUv).a;","}","if( vtextureid > 1.5 && vtextureid < 2.5){","dist = texture2D(uSampler2, vUv).a;","}","if( vtextureid > 2.5 && vtextureid < 3.5){","dist = texture2D(uSampler3, vUv).a;","}","if( vtextureid > 3.5 && vtextureid < 4.5){","dist = texture2D(uSampler4, vUv).a;","}","float alpha = smoothstep(cBuffer - uGamma, cBuffer + uGamma, dist);","vec3 destColor = diffuse;","if(destColor.r> 1.0){","destColor.r = 1.0;","alpha = 0.0;","}","if(destColor.g> 1.0){","destColor.r = 0.090;","destColor.g = 0.501;","destColor.b = 0.890;","}","gl_FragColor = vec4(destColor, alpha);","}"].join("\n")});if(1=M.superscriptbegin&&I<=M.superscriptend||M.subscript&&I>=M.subscriptbegin&&I<=M.subscriptend)&&(b.height*=.5,b.width*=.5,b.bearingX*=.5,b.bearingY*=.5,b.advanceX*=.5,b.advanceY*=.5),M.superscript&&I>=M.superscriptbegin&&I<=M.superscriptend&&(b.bearingY-=b.height),fx?b.height:x,l)break}}return"ttfLoad"==y.textLoad&&(y.addAttribute("position",C),y.addAttribute("uv",R),y.addAttribute("textureid",O),y.setIndex(u),y.drawRange.start=A,y.drawRange.count=6*m),y.rectWidth=w,y.rectHeight=x,d&&(T=new THREE.Euler,i&&T.setFromQuaternion(i),c<2&&(y.rotateZ(T.z),y.rotateY(T.y),y.rotateX(T.x),y.translate(t.x,t.y,t.z),this.AddObject(y,E,r)),M.underscode&&((S=new THREE.LineBasicMaterial).color.setRGB(n.r,n.g,n.b),(B=new THREE.Geometry).vertices.push(new THREE.Vector3(0,0,0),new THREE.Vector3(p,0,0)),B.rotateZ(T.z),B.rotateY(T.y),B.rotateX(T.x),B.translate(t.x,t.y-.1*b.height,t.z),(P=new THREE.LineSegments(B,S)).name=r,P.color=S.color.clone(),this.AddLine(P)),M.box&&((S=new THREE.LineBasicMaterial).color.setRGB(n.r,n.g,n.b),(B=new THREE.Geometry).vertices.push(new THREE.Vector3(p,f,0),new THREE.Vector3(p,0,0),new THREE.Vector3(p,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,f,0),new THREE.Vector3(0,f,0),new THREE.Vector3(p,f,0)),B.rotateZ(T.z),B.rotateY(T.y),B.rotateX(T.x),B.translate(t.x,t.y,t.z),(P=new THREE.LineSegments(B,S)).name=r,P.color=S.color.clone(),this.AddLine(P)),M.dash)&&((S=new THREE.LineBasicMaterial).color.setRGB(n.r,n.g,n.b),(B=new THREE.Geometry).vertices.push(new THREE.Vector3(0,f,0),new THREE.Vector3(p,f,0)),B.rotateZ(T.z),B.rotateY(T.y),B.rotateX(T.x),B.translate(t.x,t.y+.1*b.height,t.z),(P=new THREE.LineSegments(B,S)).name=r,P.color=S.color.clone(),this.AddLine(P)),y},AddShxTextInfo:function(e){this.shxTextArray.push(e)},ProcessShxText:function(e,t,i){null!=t&&(this.ShxData=t);for(var n=0;n=i.regResult.superscriptbegin&&h<=i.regResult.superscriptend||i.regResult.subscript&&h>=i.regResult.subscriptbegin&&h<=i.regResult.subscriptend)&&(p.height*=.5,p.width*=.5,p.bearingX*=.5,p.bearingY*=.5,p.advanceX*=.5,p.advanceY*=.5),i.regResult.superscript)&&h>=i.regResult.superscriptbegin&&h<=i.regResult.superscriptend&&(p.bearingY+=p.height);for(var f=p.height,m=p.width,g=p.shxRange[0],v=1;vMath.PI/2?(P-Math.PI)*C:P*C;M.set(0,0,1);for(var R=0;RMath.PI/2&&(E.addScaledVector(g,_),D.isShx||E.addScaledVector(w,G)),D.isShx&&D.shapeId<=0&&(w.y=Math.abs(w.y)),E.addScaledVector(g,D.offset.x),E.addScaledVector(w,D.offset.y),(130==D.shapeId||132==D.shapeId||133==D.shapeId)&&this.viewer.modelContentVersion<2&&E.addScaledVector(w,-w.y*G*.5),D.isShx&&2<=this.viewer.modelContentVersion?this.addShxTextAttribute(b,U,k,z,E,M,V+D.rotation):this.addTextAttribute(I,U,k,z,E,M,V+D.rotation)}}}}this.geomUUidToLineInfo[e.uuid]={lineTypeID:t,textGeom:null,textIsShx:!1,pointGeom:null,lineGeom:null,color:n,linewidth:r},0Math.PI/2?(I-Math.PI)*b:I*b;m.set(0,0,1);for(var S=0;SMath.PI/2&&(f.addScaledVector(c,O),R.isShx||f.addScaledVector(g,F)),R.isShx&&0==R.shapeId&&(g.y=Math.abs(g.y)),f.addScaledVector(c,R.offset.x),f.addScaledVector(g,R.offset.y),L.data.push(f.x,f.y,T+R.rotation)}}}}}return{styleText:v,stylePoint:A,styleLine:y}}}return{styleText:null,stylePoint:null,styleLine:null}}},this.addTextAttribute=function(e,t,i,n,r,o,s){for(var a=new THREE.Vector3,l=n.start,d=Math.min(n.count,i.count),c=i.array[l],h=c,u=l;ui.array[u]?i.array[u]:c,h=h>i.array[u]?h:i.array[u];for(var p=c;p<=h;p++)a.fromArray(t.array,6*p),a.applyAxisAngle(o,s),a.add(r),e.data.push(a.x),e.data.push(a.y),e.data.push(a.z),e.data.push(t.array[6*p+3]),e.data.push(t.array[6*p+4]),e.data.push(t.array[6*p+5]);for(var f=l;fi.array[u]?i.array[u]:c,h=h>i.array[u]?h:i.array[u];for(var p=c;p<=h;++p)a.fromArray(t.array,3*p),a.applyAxisAngle(o,s),a.add(r),e.data.push(a.x),e.data.push(a.y),e.data.push(a.z);for(var f=l;f 0.9){","discard;","}","vec3 outgoingLight = vec3( 0.0 );","vec4 diffuseColor = vec4( diffuse, opacity );","outgoingLight = diffuseColor.rgb;","gl_FragColor = vec4(outgoingLight, diffuseColor.a );","}"].join("\n"),vertexShader:["attribute float lineDistance;","varying float vLineDistance;","void main() {","vLineDistance = lineDistance;","#ifdef USE_MODELMATRIXATTRIB\n\tmat4 ndsModelViewMatrix = viewMatrix * modelMatrixAttrib;\n\tgl_Position = projectionMatrix * ndsModelViewMatrix * vec4( position, 1.0 );\n#else\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n#endif\n","}"].join("\n")}));return this.lineMaterials.push(e),e},this.getTextMaterial=function(){return this.viewer.SDFMaker.GetLineStyleMaterial(this.viewer.modelContentVersion)},this.getShxTextMaterial=function(){return 2<=this.viewer.modelContentVersion?this.viewer.SDFMaker.GetMaterial(G.SHX):this.getTextMaterial()},this.getPointMaterial=function(){return this.pointMaterial||(this.pointMaterial=new THREE.ShaderMaterial({uniforms:{diffuse:{value:new THREE.Color(16711680)},linewidth:{value:1}},vertexShader:["uniform float linewidth;","void main() { ","gl_PointSize = linewidth;","#ifdef USE_MODELMATRIXATTRIB\n\tmat4 ndsModelViewMatrix = viewMatrix * modelMatrixAttrib;\n\tgl_Position = projectionMatrix * ndsModelViewMatrix * vec4( position, 1.0 );\n#else\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n#endif\n","}"].join("\n"),fragmentShader:["#ifdef GL_ES","precision mediump float;","#endif","uniform vec3 diffuse;","void main(void) {","gl_FragColor = vec4(diffuse, 1.0);","}"].join("\n")}),0==Re.enableTextRenderingBothSide?this.pointMaterial.side=THREE.DoubleSide:this.pointMaterial.side=THREE.FrontSide),this.pointMaterial},this.getLineMaterial=function(){return this.lineMaterial||(this.lineMaterial=new THREE.ShaderMaterial({uniforms:{diffuse:{value:new THREE.Color(16711680)}},vertexShader:["void main() { ","#ifdef USE_MODELMATRIXATTRIB\n\tmat4 ndsModelViewMatrix = viewMatrix * modelMatrixAttrib;\n\tgl_Position = projectionMatrix * ndsModelViewMatrix * vec4( position, 1.0 );\n#else\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n#endif\n","}"].join("\n"),fragmentShader:["#ifdef GL_ES","precision mediump float;","#endif","uniform vec3 diffuse;","void main(void) {","gl_FragColor = vec4(diffuse, 1.0);","}"].join("\n")})),this.lineMaterial},this.getLineStyleArray=function(e){return this.uuidToLineStyle[e].linePattern},this.clearLineType=function(){for(var e=0;e>t;return e+1},function(e,t){this.viewer=e,this.type=2,this.version=0;function l(e,n){function t(e){for(var t=0,i=e.length;t=e.length?{done:!0}:{done:!1,value:e[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i=c.superscriptbegin&&x<=c.superscriptend||c.subscript&&x>=c.subscriptbegin&&x<=c.subscriptend)&&(O.height*=.5,O.width*=.5),O.height*=B,O.width*=B;var D=O.height*this.SDFMaker.GetTextOffset(I,e.textFont.name),U=(c.superscript&&x>=c.superscriptbegin&&x<=c.superscriptend&&(D-=O.height),l=Ae.globalModelId&&(Ae.globalModelId=this.id+1),this.dataVersion=-1,this.nodeRequestor=i.nodeRequestor||new St(this,{loadingManager:i.loadingManager,onLoadCallback:i.onLoadCallback,onRenderSettingCallback:i.onRenderSettingCallback,onBufferChunkCallback:i.onBufferChunkCallback,onLoadErrorCallback:i.onLoadErrorCallback}),this.modelUri=t,this.geomManager=new T(e),this.meshManager=new it(this.geomManager,this),this.referenceEntityDispManager=new me(this),this.position=new THREE.Vector3(0,0,0),this.rotation=new THREE.Vector3(0,0,0),this.scale=new THREE.Vector3(1,1,1),this.matrix=[],i.position&&(this.position.x=i.position.x,this.position.y=i.position.y,this.position.z=i.position.z),i.rotation&&(this.rotation.x=i.rotation.x,this.rotation.y=i.rotation.y,this.rotation.z=i.rotation.z),i.scale&&(this.scale.x=i.scale.x,this.scale.y=i.scale.y,this.scale.z=i.scale.z),i.matrix&&16==i.matrix.length&&(this.matrix=i.matrix),this.meshSets=[],this.sptIndex=new rt(null,this.meshManager),this.lineSegmentsSet=new R(this.meshManager),this.SHADED_WITH_EDGES=1,this.SHADED=2,this.WIREFRAME=3,this.HIDDEN_LINE_REMOVE=4,this.HIDDEN_LINE_VISIBLE=5,this.TRANSPARENT=6,this.drawMode=1,this.renderOnce=!1,this.renderMeshSetCount=0,this.spriteDirty=!0,this.SDFMaker=new G(this.viewer.is2DModel),this.pmiObject=null,this.rootBodyNode=null,this.bodyUuid2NodeMap={},this.meshUuid2GeomUuidMap={},this.fileguidTouuid={},this.objectidTouuid={},this.is2DModel=!1,this.needsPMI=void 0===i.needsPMI||i.needsPMI,this.needsAnimation=void 0===i.needsAnimation||i.needsAnimation,this.needsSketchModel=void 0===i.needsSketchModel||i.needsSketchModel,this.needsProperty=void 0===i.needsProperty||i.needsProperty,this.needsBRep=void 0===i.needsBRep||i.needsBRep,this.state=0,this.loadedProperty=!1,this.forceRenderAll=!1,this.wholeLeafBodyNodes=[],this.wholeRefEntityNodes=[],this.wholeCoordinateNodes=[],this.emptyBodyNodes=[],this.hasRawMesh=!1,this.transparentBodies=[],this.transparentBodiesDirty=!1,this.transparentBodyChanged=!1,this.containsOriginalTransparentBodies=!1,this.transparentizedBodies=[],this.transparentModeBodiesMap=new Map,this.selectedBodies=[],this.selectedBodiesDirty=!1,this.draggedBodies=[],this.hideBodies=[],this.UnloadNodes=[],this.pureLineBody=[],this.preselectedObject=null,this.hasHiddenBodies=!1,this.referenceEntityDirty=!1,this.explodeFactor=0,this.explodeFactorX=0,this.explodeFactorY=0,this.explodeFactorZ=0,this.explodeMode=Ae.EXPLODEMODE.NORMAL,this.explodeLevel=0,this.explodeObject=null,this.LeafbodyToFirstBodyMap=new Map,this.leafNodeCount=0,this.tempCenterBox=new THREE.Vector3,this.bodyNodeUUidToMaterial={},this.ModelUpMatrix4=[],this.NeedsMergeBodyNode=!1,this.sortMeshSets=(o=[],s=new THREE.Vector3,a=new THREE.Box3,l=new THREE.Vector3,d=new THREE.Vector3,function(e,t){for(var i=o.length=0,n=e.length;io)&&(Math.abs(s.BaseLine.start.x-s.BaseLine.end.x)<1e-6&&Math.abs(n.x-s.BaseLine.end.x)<1e-6||Math.abs(s.BaseLine.start.y-s.BaseLine.end.y)<1e-6&&Math.abs(n.y-s.BaseLine.end.y)<1e-6||Math.abs(s.BaseLine.start.z-s.BaseLine.end.z)<1e-6&&Math.abs(n.z-s.BaseLine.end.z)<1e-6)&&(t.distance=o,t.axis=r)}}}},calculatePMIBoundingBox:function(e){var l,d,c;e&&(l=new THREE.Vector3,d=new THREE.Quaternion,c=new THREE.Vector3,e.traverse(function(e){if(e.fixedPmi){for(var t=new THREE.Box3,i=0,n=0;ny.leafBodyAttri.bodyBbox[3+d]&&(y.leafBodyAttri.bodyBbox[3+d]=this.meshManager.bboxes[6*s+3+d])}}}for(var v=[],s=0;sf[0].distance+2*t&&(r.length=0)}return 0t[0].distance&&(o[0]=t[0],s.activeModel=e))}),o},intersectReferenceEntity:function(e,t){if(this.activeModel)return this.activeModel.intersectReferenceEntity(e,t)},setExplodeFactor:function(t,i){this.models.forEach(function(e){if(e.sketchFileUrl)return!0;e.setExplodeFactor(t,i)})},getExplodeTranslate:function(e,t){return this.viewer.currentSketchFileUrl?this.staticModel.getExplodeTranslate(e,t):this.activeModel?this.activeModel.getExplodeTranslate(e,t):void 0},getBodyTranslate:function(t){var i=[];return this.models.forEach(function(e){if(e.sketchFileUrl)return!0;e.rootBodyNode&&e.id==t.getModel().id&&(i=e.getBodyTranslate(t))}),i},getBodyTranslateWithoutExplode:function(e){return this.viewer.currentSketchFileUrl?this.staticModel.getBodyTranslateWithoutExplode(e):this.activeModel?this.activeModel.getBodyTranslateWithoutExplode(e):void 0},getBodyTransform:function(e){if(this.activeModel)return this.activeModel.getBodyTransform(e)},getLeafBodyBoundingBox:function(e){if(this.activeModel)return this.activeModel.getLeafBodyBoundingBox(e)},getLeafBodyBoundingBoxTrue:function(e){if(this.activeModel)return this.activeModel.getLeafBodyBoundingBoxTrue(e)},calculateMeshBodyBoundingBox:function(e){if(this.activeModel)return this.activeModel.calculateMeshBodyBoundingBox(e)},calculateLineBodyBoundingBox:function(e){if(this.activeModel)return this.activeModel.calculateLineBodyBoundingBox(e)},getBodyBoundingBox:function(t){var i=new THREE.Box3,n=this;return"parentNode"==t.type?t.children.forEach(function(e){i.union(n.getBodyBoundingBox(e))}):this.models.forEach(function(e){if(e.sketchFileUrl)return!0;e.rootBodyNode&&e.id==t.getModel().id&&(i=e.getBodyBoundingBox(t))}),i},getVisibleBodyBoundingBox:function(t,i){var n=new THREE.Box3,r=this;return i&&!t.visible||("parentNode"==t.type?t.children.forEach(function(e){i?e.visible&&n.union(r.getVisibleBodyBoundingBox(e)):n.union(r.getBodyBoundingBox(e))}):this.models.forEach(function(e){if(e.sketchFileUrl)return!0;e.id==t.getModel().id&&(i?child.visible&&(n=e.getVisibleBodyBoundingBox(t,i)):n=e.getBodyBoundingBox(t,i))})),n},getTotalVisibleBoundingBox:function(i){var n=new THREE.Box3;return this.models.forEach(function(e){if(e.sketchFileUrl)return!0;var t;(t=e.rootBodyNode?e.getVisibleBodyBoundingBox(e.rootBodyNode,i):t)&&n.union(t)}),n},getTotalBodyBoundingBox:function(){var i=new THREE.Box3;return this.models.forEach(function(e){if(e.sketchFileUrl)return!0;var t;(t=e.rootBodyNode?e.getBodyBoundingBox(e.rootBodyNode):t)&&i.union(t)}),i},getBodyBoundingBoxTrue:function(t){var i=null;return this.models.forEach(function(e){if(e.sketchFileUrl)return!0;e.id==t.getModel().id&&(i=e.getBodyBoundingBoxTrue(t))}),i},RemoveElement:function(e,t){if(this.activeModel)return this.activeModel.RemoveElement(e,t)},hasDraggedBodies:function(){var t=!1;return this.models.forEach(function(e){e.hasDraggedBodies()&&(t=!0)}),t},dragBody:function(t,i){this.models.forEach(function(e){e.id==t.getModel().id&&e.dragBody(t,i)})},restoreDraggedBody:function(t){this.models.forEach(function(e){e.id==t.getModel().id&&e.restoreDraggedBody(t)})},changeBodyColor:function(t,i,n,r){void 0===r&&(r=!1),this.models.forEach(function(e){e.id==t.getModel().id&&e.changeBodyColor(t,i,n,r)})},hasTransparentBodies:function(){var t=!1;return this.models.forEach(function(e){e.hasTransparentBodies()&&(t=!0)}),t},transparentBody:function(t,i,n){var r=this;"parentNode"==t.type?t.children.forEach(function(e){r.transparentBody(e,i,n)}):this.models.forEach(function(e){e.id==t.getModel().id&&e.transparentBody(t,i,n)})},opaqueBody:function(t){var i=this;"parentNode"==t.type?t.children.forEach(function(e){i.opaqueBody(e)}):this.models.forEach(function(e){e.id==t.getModel().id&&e.opaqueBody(t)})},transparentizeBodies:function(r){var t=this;1==r.length&&"parentNode"==r[0].type?body.children.forEach(function(e){t.transparentizeBodies([e])}):this.models.forEach(function(e){for(var t=[],i=0;i=n._clip.duration&&(n.reset(),v=new THREE.Clock),n.enabled=!0,n.paused=!t,n.play()}}},this.startSkeletonAnimationByUUID=function(e,t){if(this.bHasSkeletonAnimation)if(p=a=!1,null==e){if(null==t||t){g=this.skeletonAnimationObjects[0].actionSkinMeshs[0].actions[0]._clip.animationUUID;for(var i=0;i=o._clip.duration&&(o.reset(),v=new THREE.Clock),o.enabled=!0,o.paused=!t,o.play())}},this.startSolidAnimationByUUID=function(e,t){if(d&&0=n._clip.duration&&(n.reset(),v=new THREE.Clock),n.paused=!1,n.play(),a=p=!1,f=1e3/s.fps):n.paused=!0)}return s},this.getAnimationLoopModeByUUID=function(e){var t="loopRepeat";if(d&&0P.width&&(o.max.x=P.width),o.max.y>P.height&&(o.max.y=P.height),o.isEmpty()||(c=I.viewer.scene.overrideMaterial,h=I.viewer.renderer.getClearColor(I.viewer.oldClearColor).clone(),u=I.viewer.renderer.getClearAlpha(),I.viewer.scene.overrideMaterial=R,I.viewer.renderer.setClearColor(3),I.viewer.ndsModel&&(I.viewer.ndsModel.backupDirty(),I.viewer.ndsModel.setDirty(),I.viewer.ndsModel.setDrawMode(I.viewer.ndsModel.SHADED),I.viewer.scene.children.push(I.viewer.ndsModel),I.viewer.ndsModel.setOverrideMaterial(R,O,!1)),I.viewer.renderer.render(I.viewer.scene,I.viewer.camera,P,!0),I.viewer.scene.overrideMaterial=c,I.viewer.ndsModel&&(I.viewer.ndsModel.setOverrideMaterial(null,null,!1),I.viewer.ndsModel.resetDirty()),I.viewer.renderer.render(C,I.viewer.camera,P,!1),A=o.max.x-o.min.x,y=o.max.y-o.min.y,r=new Uint8Array(4*A*y),I.viewer.renderer.readRenderTargetPixels(P,o.min.x,P.height-o.max.y,A,y,r),I.viewer.renderer.setRenderTarget(null),I.viewer.renderer.setClearColor(h,u));for(p in b)if(f=b[p]){var m=!0;if("1"!=f.version){var g=T[f.uuid];if(g&&r)for(var v=g.material.color.getHex(""),A=o.max.x-o.min.x,y=o.max.y-o.min.y,m=!1,E=f.screenPosition.x-1;E<=f.screenPosition.x+1&&E<=o.max.x&&E>=o.min.x;++E){for(var M=f.screenPosition.y-1;M<=f.screenPosition.y+1&&M<=o.max.y&&M>=o.min.y;++M){var w=4*((y-(M-o.min.y))*A+(E-o.min.x)),w=r[w]<<16|r[1+w]<<8|r[2+w];if(Math.abs(w-v)<3){m=!0;break}}if(1==m)break}}else{var g=f.worldPosition.clone(),x=(g.clone(),I.viewer.camera.position.distanceTo(g)),x=new THREE.Raycaster(I.viewer.camera.position,g.sub(I.viewer.camera.position).normalize(),0,.9999*x).intersectObjects(I.viewer.selectionManager.getTargetList());0=t?n.style.visibility="visible":(n.style.visibility="hidden",u==i&&(u="")))}},this.setAnnotationsVisiblilityForAnimation=function(e){if(this.viewer.canvas2D)for(var t in h){var i=h[t];i&&"animation"==b[t].ownerType&&(i.style.visibility=e?"visible":"hidden")}},this.hideAllAnnotations=function(e){if(this.viewer.canvas2D)for(var t in d&&(this.viewer.canvas2D.getContext("2d").clearRect(d.min.x,d.min.y,d.max.x-d.min.x,d.max.y-d.min.y),d=null),u="",h){var i,n=h[t];n&&(i=!0,i=("animation"!=b[t].ownerType||e!=b[t].ownerUuid)&&i)&&(n.style.visibility="hidden")}},this.setAnnotationsVisibility=function(e){if(this.viewer.canvas2D){for(var t in r=!e,d&&(this.viewer.canvas2D.getContext("2d").clearRect(d.min.x,d.min.y,d.max.x-d.min.x,d.max.y-d.min.y),d=null),u="",h){t=h[t];t&&(t.style.visibility=e?"visible":"hidden")}I.viewer.render()}},this.isAnnotationsVisible=function(){r=!0;var e,t=0;for(e in h)if(h.hasOwnProperty(e)){t++;var i=h[e];if(i&&("visible"==i.style.visibility||i.style.hidemodel)){r=!1;break}}return!(r=0==t?!1:r)},this.getHotPoint=function(e,t){function i(e){return e.parent?e.parent.fileguid||i(e.parent):null}var n,r,o,s,a,l=this.viewer.renderer.getPixelRatio(),d=new THREE.Matrix4,c=(d.multiplyMatrices(this.viewer.camera.matrixWorld,d.getInverse(this.viewer.camera.projectionMatrix)),!1),h=new Object,u=this.viewer.selectionManager.getPickIntersects(e,t);return u&&0V.maxPrimitivesPerFrame)?(r=0,V.stopRenderingEarly=!0):V.stopRenderingEarly=!1}if(l&&0g+V.maxTrianglesPerFrame||A+1===y)&&(g=V.info.render.triangles,m=performance.now(),r-=m-v,v=m,f()))break}var M=e.getMeshSets();if(0==M.length&&(p=!1),0V.maxPrimitivesPerFrame)&&!(o=0)},c=e.getDrawModeHiddenEdge(),h=performance.now(),u=o,p=V.info.render.lines,f=0,m=e.meshManager.getNumInstancedLineSegs(),g=0;if(i){var v=e.getMeshSets();for(x=0,I=i.length;xp+V.maxLinesPerFrame||f===I)&&(p=V.info.render.lines,l=performance.now(),o=u-(l-h),d()))return o}if(i){v=e.getMeshSets();for(x=0,I=i.length;x=n.length,p&&e.renderOnce&&(e.renderOnce=e.getLineSegmentsSet().visualStates.dirty),null==e.renderOnce)&&(e.renderOnce=!0);e.renderOnce||(e.renderMeshSetCount=0)}(e,t,i,a,n,h[u],p)}e.forceRenderAll&&(e.forceRenderAll=!1),e.setDrawMode(o),e.viewer.changeRenderModeOnly(r),e.viewer.selectionManager.changeSelectColorByRenderMode()}}function F(e,t,i,n,r,o){if(void 0===r&&(r=""),void 0===o&&(o=!1),e.selectedBodiesDirty&&!Re.inBIMContext){for(var s=e.getSelectedBodies(),a=0,l=s.length;a varying vec2 vUv; uniform sampler2D colorTexture; uniform vec2 texSize; uniform vec2 direction; uniform float kernelRadius; float gaussianPdf(in float x, in float sigma) { return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma; } void main() { vec2 invSize = 1.0 / texSize; float weightSum = gaussianPdf(0.0, kernelRadius); vec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum; vec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS); vec2 uvOffset = delta; for( int i = 1; i <= MAX_RADIUS; i ++ ) { float w = gaussianPdf(uvOffset.x, kernelRadius); vec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb; vec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb; diffuseSum += ((sample1 + sample2) * w); weightSum += (2.0 * w); uvOffset += delta; } float alpha = texture2D( colorTexture, vUv).a; gl_FragColor = vec4(diffuseSum/weightSum, alpha); }"})},getOverlayMaterial:function(){return new THREE.ShaderMaterial({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeStrength:{value:1}},vertexShader:"varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"varying vec2 vUv; uniform sampler2D maskTexture; uniform sampler2D edgeTexture1; uniform float edgeStrength; void main() { vec4 edgeValue = texture2D(edgeTexture1, vUv); vec4 maskColor = texture2D(maskTexture, vUv); vec4 finalColor = edgeStrength * maskColor.r * edgeValue; gl_FragColor = finalColor; }",blending:THREE.NormalBlending,depthTest:!1,depthWrite:!1,transparent:!0})}}),_t.BlurDirectionX=new THREE.Vector2(1,0),_t.BlurDirectionY=new THREE.Vector2(0,1),Gt.prototype=Object.assign(Object.create(_t.prototype),{constructor:Gt,renderToMaskBuffer:function(e){if(0>t;return e+1},Yt.prototype=Object.create(THREE.EventDispatcher.prototype),Xt.prototype={constructor:Xt,load:function(t,e,n,r,o){function i(e){var i=e,e=(i&&i.preload(),new THREE.XHRLoader(s.manager));e.setCrossOrigin(this.crossOrigin),e.load(t,function(e){e=s.parse(e);e.traverse(function(e){var t;e instanceof THREE.Mesh&&e.material.name&&(t=i?i.create(e.material.name):null)&&(e.material=t)}),n(e)},r,o)}var s=this;e?new Yt(t.substr(0,t.lastIndexOf("/")+1)).load(e,i,r,o):i()},parse:function(e,t){function i(e,t,i){return new THREE.Vector3(e,t,i)}function r(e,t,i,n){return new THREE.Face3(e,t,i,n)}var o=0;function n(e,t){0n||o.pointer.y>r)&&(o.pointer2nd.x>n||o.pointer2nd.y>r))return void o.touchend(e)}}switch(o.state){case Ae.TOUCH.TOUCH_SINGLE:o.viewer.controls.getOperator().type!=o.type&&1!=e.force||o.onTouchSingleMove(e);break;case Ae.TOUCH.TOUCH_DOUBLE:o.onTouchDoubleMove(e)}o.pointerOld.copy(o.pointer),o.pointerOld2nd.copy(o.pointer2nd)}},this.touchend=function(e){if((!Re.enableBroadcast||Re.broadcastMajor)&&!(o.viewer.isClipTransformControlSelected()||"Lineargauge"==o.measureType&&o.MeasureOper.lineargaugediv&&"block"==o.MeasureOper.lineargaugediv.style.display)){switch(o.state){case Ae.TOUCH.TOUCH_SINGLE:var t=e.changedTouches[0].offsetX||e.changedTouches[0].clientX-o.viewer.container.getBoundingClientRect().left,i=e.changedTouches[0].offsetY||e.changedTouches[0].clientY-o.viewer.container.getBoundingClientRect().top;o.singleTouchEndPos.set(t,i),o.viewer.testMode&&(t=o.viewer.getCameraInfo(),console.log("相机信息: "+JSON.stringify(t))),o.onTouchSingleEnd(e);break;case Ae.TOUCH.TOUCH_DOUBLE:o.onTouchDoubleEnd(e)}o.state=-1}},this.touchcancel=function(e){o.state=-1},this.onKeyDown=function(e){switch(e.keyCode){case 38:Re.enableArrowKeyOp&&o.moveForwardBack(!0,!0);break;case 37:Re.enableArrowKeyOp&&o.pan(new THREE.Vector3(-20,0,0),!0);break;case 40:Re.enableArrowKeyOp&&o.moveForwardBack(!1,!0);break;case 39:Re.enableArrowKeyOp&&o.pan(new THREE.Vector3(20,0,0),!0);break;case 46:var t;"OpAnnotationNew"==o.type&&o.enableMove&&(o.clearFlag(!0),t=o.selectIDs.concat(),0!=o.selectID&&t.push(o.selectID),t.length)&&!Re.AnimationEdit&&o.deleteNoteAnnotation(t)}},this.onKeyUp=function(e){}}function $t(e){var r,E=e,o=null,s=null,a=null,l=!1,d=null,p=Number.MAX_VALUE,c=null,h=null;this.isSnapped=function(){return l},this.getSnappedType=function(){return d},this.getSnappedVertex=function(){return s},this.isEqualWithPrecision=function(e,t){return Math.abs(e-t)<=.001},this.isEqualVectorsWithPrecision=function(e,t){return Math.abs(e.x-t.x)<=.001&&Math.abs(e.y-t.y)<=.001&&Math.abs(e.z-t.z)<=.001},this.isInverseVectorsWithPrecision=function(e,t){return Math.abs(e.x+t.x)<=.001&&Math.abs(e.y+t.y)<=.001&&Math.abs(e.z+t.z)<=.001},this.trianglesSharedEdge=function(e,t,i,n,r,o){var s=!1,a=!1,l=!1;return(e.equals(n)||e.equals(r)||e.equals(o))&&(s=!0),(t.equals(n)||t.equals(r)||t.equals(o))&&(a=!0),(i.equals(n)||i.equals(r)||i.equals(o))&&(l=!0),!!(s&a||s&l||a&l)},this.getTrianglesOnSameFace=function(e,t,i,n){var r=!1,o=e.vertices.slice(),s=new THREE.Geometry,a=(s.vertices.push(t),s.vertices.push(i),s.vertices.push(n),s.faces.push(new THREE.Face3(0,1,2)),[]);do{for(var a=[],l=0;li.x||t.y>i.y||t.z>i.z||this.viewer.cameraControl.setBoundingBox(t,i))},Ee.prototype.onTouchSingleStart=function(e){g.prototype.onTouchSingleStart.call(this,e)},Ee.prototype.onTouchSingleMove=function(e){0<(this.viewer.ndsModel?this.viewer.selectionManager.getSelectedObjects():this.viewer.selectionManager.getSelectedMeshes()).length&&"move"==this.opMode?this.onOpDrag():g.prototype.onTouchSingleMove.call(this,e)},Ee.prototype.onTouchSingleEnd=function(e){this.state=-1,Math.abs(this.singleTouchEndPos.x-this.singleTouchStartPos.x)<1&&Math.abs(this.singleTouchEndPos.y-this.singleTouchStartPos.y)<1&&("move"==this.opMode||"default"==this.opMode?(this.viewer.selectionManager.selectByClick(this.singleTouchEndPos.x,this.singleTouchEndPos.y),this.render(!1,!1)):"restore"==this.opMode&&this.onOpRestore(this.singleTouchEndPos.x,this.singleTouchEndPos.y)),this.hideRotateCenterHelper()},0),ni=1,ri=2;function oi(e,t){for(var i=0;i\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t#ifdef USE_MODELMATRIXATTRIB\n\t\t\t\tmat4 ndsModelViewMatrix = viewMatrix * modelMatrixAttrib;\n\t\t\t\t// camera space\n\t\t\t\tvec4 start = ndsModelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\t\tvec4 end = ndsModelViewMatrix * vec4( instanceEnd, 1.0 );\n\t\t\t#else\n\t\t\t\t// camera space\n\t\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\t\t\t#endif\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t"};function ai(e){Me.call(this,e),this.measureClass="Distance"}function li(e){Me.call(this,e),this.measureClass="Hole"}function di(e){Me.call(this,e),this.measureClass="Edge"}function ci(e){Me.call(this,e),this.measureClass="Face"}function o(e){Me.call(this,e),this.measureClass="Angle"}function hi(e){Me.call(this,e),this.measureClass="BodyAndTotal"}function ui(e){Me.call(this,e),this.measureClass="Coordinate"}function pi(e){Me.call(this,e),this.measureClass="Lineargauge"}var fi=function(i){function e(e){var t=i.call(this,{type:"LineMaterialOrigin",uniforms:THREE.UniformsUtils.clone(THREE.ShaderLib.line.uniforms),vertexShader:THREE.ShaderLib.line.vertexShader,fragmentShader:THREE.ShaderLib.line.fragmentShader,clipping:!0})||this;return t.isLineMaterial=!0,t.setValues(e),t}var t,n,r;return n=i,(t=e).prototype=Object.create(n.prototype),si(t.prototype.constructor=t,n),t=e,(n=[{key:"color",get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},{key:"worldUnits",get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},{key:"linewidth",get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}},{key:"dashed",get:function(){return"USE_DASH"in this.defines},set:function(e){!0===e!==this.dashed&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},{key:"dashScale",get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},{key:"dashSize",get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},{key:"dashOffset",get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},{key:"gapSize",get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},{key:"opacity",get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms&&(this.uniforms.opacity.value=e)}},{key:"resolution",get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},{key:"alphaToCoverage",get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(e){this.defines&&(!0===e!==this.alphaToCoverage&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1))}}])&&oi(t.prototype,n),r&&oi(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}(THREE.ShaderMaterial),Me=(Ae.INFOTYPE={POINT:1,SECONDPOINT:2,POINTLINE:3,LINE:4,POINTPLANE:5,PLANE:6,SECONDLINE:7,LINEPLANE:8,PARALLELLINE:9,PARALLELPLANE:10,CIRCLE:11,SECONDCIRCLE:12,SECONDPLANE:13,AXISLINE:14,AXISPOINT:15,AXIS:16,AXISPLANE:17,FACE:18,CIRCLEANDLINE:19,FIRSTPOINT:20,BODY:21,LINEPOSITION:22,FIRMEASUREBODY:23,SECMEASUREBODY:24,MEASUREBODY:25,THIRDPOINT:26,ENDMEASURE:27,CANCELLINE:28,FIRSTLINE:29,MOUSEENTER:30,CROSSENTER:31,FIRSTPLANE:32,COORDINATEPOINT:33,CIRCLEA:34,LINEANDCIRCLE:35,FIRSTPARALLELPLANE:36,CLICKFIRSTPOINT:37,CLICKSECONDPOINT:38,PROJECTPLANE:39,SELECTPROJECTPLANE:40,PLACELINELOCATION:41,SELECTPLACELINELOCATION:42,FIRSTMESH:43,SECONDMESH:44,MEASURENOTICEBEGIN:45,AXISNOPARALLEL:46,NOPARALLEL:47,INTERSECT:48,LINEPARALLEL:49,PLANEPARALLELLINE:50,LINEPARALLELPLANE:51,PLANEPARALLEL:52,TWOAXISNOPARALLEL:53,NOBREP:54,NOCONJOINT:55,NOCLOSE:56,PLANENOPARALLEL:57,LINENOPARALLEL:58,NOTFACE:59,LOADDATE:60,TWOBODYPARALLEL:61,TWOBODYNOTPARALLEL:62,NOTFACEPARALLEL:63,NOTFACESECOND:64,MESHVERTICAL:65,AXISNOPARALLELLINE:66,NOBREPNOPLNE:67,BREPDATAERROR:68},Ae.MEASUREFLAG={pt2pt:1,pointtoline:2,pointtoface:4,axistopoint:8,linetoline:16,linetoface:32,facedist:64,axistoline:128,axistoface:256,holedist:512,Edge:512,perimeter:1024,LineAngle:2048,LineFaceAngle:4096,faceAngle:8192,radius:16384,contour:32768,contourarea:65536,Lineargauge:131072,coordinate:262144,bodyAngle:524288,bodyDistance:1048576,bodyEdgeLength:2097152,angle:4194304,pt2ptbim:8388608,LmPt2Pt:16777216,LmPt2Line:33554432,LmLine2Line:67108864,LmHole2Hole:134217728,LmAxis2Pt:268435456,LmAxis2Line:536870912,WallThickness:1073741824},function(e){this.viewer=e.viewer,this.OpMeasure=e,this.measureType="",this.measureClass="Base",this.InfoType=0,this.snappingTool=new $t(this.viewer),this.snappedPoint=null,this.textLines=[],this.POINTSIZE=3,this.LINEWIDTH=2,this.ARCWIDTH=2,this.CYLINDERWIDTH=14,this.cylinderRadiusBottom=.4,this.cylinderHeight=1.2,this.edgeInfo={startPos:null,endPos:null,selLineInfo:null,selLineObj:null,preSelLineInfo:null,preSelLineObj:null,startToClndLine:null,endToClndLine:null,clndToClndLine:null,lineType:"",boxToClndLine:null,centerToClndLine:null,fstClnd:null,sndClnd:null,fstClndPos:null,sndClndPos:null,selLineCenterPos:null,dimString:"",unit:"",textBox:null,textPos:null},this.holeInfo={firstHoleInfo:null,secondHoleInfo:null,preSelHoleInfo:null,preSelHoleObj:null,firstSelHoleObj:null,secondSelHoleObj:null,fstToClndLine:null,sndToClndLine:null,clndToClndLine:null,boxToClndLine:null,centerToClndLine:null,centerToClndLine2:null,fstClnd:null,sndClnd:null,fstClndPos:null,sndClndPos:null,selLineCenterPos:null,textBox:null,textPos:null,dimString:"",unit:""},this.distanceInfo={firstSelObj:null,firstSelInfo:null,secondSelObj:null,secondSelInfo:null,axisLineObj:null,secaxisLineObj:null,projectPlaneObj:null,projectPlaneInfo:null,projectPlane:null,projectFstPos:null,projectSecPos:null,projectFstClnd:null,projectSecClnd:null,firstPoint:null,secondPoint:null,preSelInfo:null,preSelObj:null,preSelInfoOld:null,fstToSndLine:null,FstToFstPointLine:null,SndToSndPointLine:null,fstToClndLine:null,sndToClndLine:null,clndToClndLine:null,boxToClndLine:null,fstClnd:null,sndClnd:null,fstClndPos:null,sndClndPos:null,dimStringPrefix:"",dimString:"",unit:"",textBox:null,textPos:null,XorY:0,mousePos:null},this.faceInfo={fstIntersect:null,sndIntersect:null,firstFaceInfo:null,secondFaceInfo:null,preSelFaceInfo:null,preSelFaceObj:null,fstSelFaceObj:null,sndSelFaceObj:null,fstToClndLine:null,sndToClndLine:null,clndToClndLine:null,boxToClndLine:null,fstClnd:null,sndClnd:null,fstToMidLine:null,midToClndLine:null,arcMeshes:[],arcCenter:null,midLineEndPt:null,fstClndPos:null,sndClndPos:null,dimString:"",unit:"",textBox:null,textPos:null,selFaceObjs:[],selFaceInfors:[]},this.lineAngleInfo={firstLineObj:null,firstLineInfo:null,secondLineObj:null,secondLineInfo:null,preSelLineInfo:null,preSelLineObj:null,fstClnd:null,sndClnd:null,fstClndPos:null,sndClndPos:null,arcMeshes:[],arcCenter:null,auxLine1:null,auxLine2:null,dimString:"",unit:"",textBox:null,textPos:null,twoPlane:!1,firstHelpPointobj:null,firstHelpPointInfo:null,secHelpPointobj:null,secHelpPointInfo:null,thrHelpPointobj:null,thrHelpPointInfo:null},this.lineContoursInfo={preSelLineInfo:null,preSelLineObj:null,prestart:new THREE.Vector2,preend:new THREE.Vector2,unit:"",divPos:null,divBox:null,perimeter:0,Contours:[],start:new THREE.Vector2,end:new THREE.Vector2},this.perimeterInfos=[],this.preSelectBody=null,this.preSelectBodyMat=null,this.contourdiv=null,this.coordinatediv=null,this.coordinatedivtextPos=null,this.coordinatedivdims=null,this.lineargaugediv=null,this.shadowdiv=null,this.materialLine=new THREE.MeshBasicMaterial({color:8190976,opacity:.8,transparent:!0,depthTest:!1,depthWrite:!1,side:THREE.DoubleSide}),this.appmaterialLine=new THREE.MeshBasicMaterial({color:16743724,opacity:.8,transparent:!0,depthTest:!1,depthWrite:!1,side:THREE.DoubleSide}),this.materialPoint=Re.selectedVertexMaterial,this.materialProjectPoint=new THREE.MeshBasicMaterial({color:65535,opacity:.8,transparent:!0,depthTest:!1,depthWrite:!1}),this.axisLine=new THREE.LineBasicMaterial({opacity:1,color:16711680,side:THREE.DoubleSide,depthTest:!1,depthWrite:!1,transparent:!1}),this.materialBoxLine=new THREE.LineBasicMaterial({opacity:.8,color:8190976,side:THREE.DoubleSide,depthTest:!1,depthWrite:!1,transparent:!0}),this.materialPreSelectMeshopacity=new THREE.MeshBasicMaterial({color:65535,side:THREE.DoubleSide,depthTest:!0,depthWrite:!0,transparent:!1});var d=this;this.touchstart=function(e){if(this.parentElement){switch(d.OpMeasure.unsteady=!0,d.measureType){case"PointToLine":case"PointToFace":case"AxisToPoint":case"LineToLine":case"LineToFace":case"faceDist":case"AxisToLine":case"AxisToFace":case"holeDist":case"pt2pt":case"pt2ptbim":d.OpMeasure.unsteadyType="Distance";break;case"radius":d.OpMeasure.unsteadyType="Radius";break;case"measureEdges":d.OpMeasure.unsteadyType="measureEdges";break;case"LineAngle":case"LineFaceAngle":case"faceAngle":case"angle":d.OpMeasure.unsteadyType="Angle";break;case"bodyAngle":case"bodyEdgeLength":case"bodyDistance":d.OpMeasure.unsteadyType=d.measureType;break;case"LmPt2Pt":case"LmPt2Line":case"LmLine2Line":case"LmHole2Hole":case"LmAxis2Pt":case"LmAxis2Line":d.OpMeasure.unsteadyType="Lineargauge3D";break;case"WallThickness":d.OpMeasure.unsteadyType="WallThickness";break;default:d.OpMeasure.unsteadyType=d.OpMeasure.unsteadyData[this.getAttribute("group")].measureType}d.OpMeasure.unsteadyuuid=this.getAttribute("group"),d.OpMeasure.unsteadyTextBox=this,d.OpMeasure.unsteadyMoving=!1,d.OpMeasure.startPoint=e.touches?[e.touches[0].clientX,e.touches[0].clientY]:[e.clientX,e.clientY],e.preventDefault()}},this.touchend=function(e){d.OpMeasure.unsteady=!1,d.OpMeasure.unsteadyuuid=null,d.OpMeasure.unsteadyMoving=!1,d.OpMeasure.startPoint=null,d.OpMeasure.unsteadyType="",e.preventDefault()},this.touchmove=function(e){var t=e.touches?[e.touches[0].clientX,e.touches[0].clientY]:[e.clientX,e.clientY],i=d.OpMeasure.startPoint,n=1.1*window.devicePixelRatio;t&&i&&(Math.abs(t[0]-i[0])>n||Math.abs(t[1]-i[1])>n)?(d.OpMeasure.startPoint=t,d.OpMeasure.unsteadyTextBox=this,d.OpMeasure.unsteadyMoving=!0,i=document.createEvent("HTMLEvents"),Se.isMobileDevice()?(i.initEvent("touchmove",!0,!0),i.touches=e.touches,i.force=!0,1==e.touches.length&&(d.OpMeasure.state=Ae.TOUCH.TOUCH_SINGLE)):(i.initEvent("mousemove",!0,!0),0===e.button&&(d.OpMeasure.state=Ae.MOUSE.NONE),i.offsetX=e.offsetX,i.clientX=e.clientX,i.offsetY=e.offsetY,i.clientY=e.clientY),(d.viewer.canvas2D||d.viewer.canvas3D).dispatchEvent(i),e.preventDefault()):Se.isMobileDevice()||d.OpMeasure.InfoType!=Ae.INFOTYPE.MOUSEENTER&&d.OpMeasure.InfoType!=Ae.INFOTYPE.CROSSENTER&&d.OpMeasure.PostInfo(Ae.INFOTYPE.MOUSEENTER)},this.mouseenter=function(){d.OpMeasure.InfoType!=Ae.INFOTYPE.MOUSEENTER&&d.OpMeasure.InfoType!=Ae.INFOTYPE.CROSSENTER&&d.OpMeasure.InfoType!=Ae.INFOTYPE.MEASURENOTICEBEGIN&&(d.InfoType=d.OpMeasure.InfoType),d.OpMeasure.PostInfo(Ae.INFOTYPE.MOUSEENTER),d.clearPreInfo()},this.mouseleave=function(e){d.OpMeasure.unsteady||d.OpMeasure.PostInfo(d.InfoType)},this.sectionCrossend=function(e){if(e&&e.preventDefault(),!d.OpMeasure.unsteadyMoving){d.OpMeasure.unsteadyuuid=this.parentElement.getAttribute("group");var t=d.OpMeasure.rootObject.getObjectByProperty("uuid",d.OpMeasure.unsteadyuuid);if("ellipse"==t.measureType){var i=this.parentElement.getAttribute("radiusType"),e=t.getObjectByProperty("objectType","radius"+i);t.children[0].remove(e);for(var n=t.children.length-1;-1r.drawRange.count)){if(this.viewer.ndsModel&&(o[0]+=r.drawRange.start/2,o[1]+=r.drawRange.start/2),r.isBufferGeometry){var s=o[1]-o[0]+1,a=r.index,l=r.attributes.position.array,d=new Float32Array(6*s);if(null!=a){for(var c=a.array,h=0,r=(this.edgeInfo.startPos=new THREE.Vector3,this.edgeInfo.endPos=new THREE.Vector3,this.edgeInfo.midPos=new THREE.Vector3,o[0]),u=o[1],p=(Math.round(.5*(r+u)),this.edgeInfo.thirdPos=null,this.edgeInfo.startPos.fromArray(l,3*c[2*r]),this.edgeInfo.endPos.fromArray(l,3*c[2*u+1]),this.edgeInfo.endPos.distanceTo(this.edgeInfo.startPos)<1e-7&&(this.edgeInfo.thirdPos=new THREE.Vector3,this.edgeInfo.thirdPos.fromArray(l,3*c[2*(u-1)])),0),f=r,m=u;f<=m;f++,h+=1){var g=c[2*f],v=c[2*f+1],A=new THREE.Vector3,y=new THREE.Vector3;A.fromArray(l,3*g),y.fromArray(l,3*v),d[6*h]=A.x,d[6*h+1]=A.y,d[6*h+2]=A.z,d[6*h+3]=y.x,d[6*h+4]=y.y,d[6*h+5]=y.z,p+=A.clone().distanceTo(y),y=A=null}for(var E=0,f=r;f<=u;f++){var g=c[2*f],v=c[2*f+1],A=new THREE.Vector3,y=new THREE.Vector3,M=(A.fromArray(l,3*g),y.fromArray(l,3*v),E);if(.5*p<(E+=A.clone().distanceTo(y))){var M=.5*p-M,w=y.clone().sub(A);w.normalize(),this.edgeInfo.midPos=A.clone().addScaledVector(w,M);break}}i=i||(0==t?Re.SelectedEdgeMaterial1:Re.preSelectedEdgeMaterial);s=new Ze,a=(s.setPositions(d),new Ke({linewidth:i.linewidth,opacity:i.opacity,color:i.color,depthTest:i.depthTest,depthWrite:i.depthWrite,side:THREE.DoubleSide})),o=this.viewer.renderer.getPixelRatio(),r=this.viewer.renderer.domElement.width/o,i=this.viewer.renderer.domElement.height/o,o=(a.resolution.set(r,i),(n=new Je(s,a)).objectType="SelLine",n.LineInfo=[],n.LineInfo.push(this.viewer.ndsModel.bodyUuid2NodeMap[e.bodyUuid].id),this.viewer.ndsModel.geomManager.uuidToIdMap[e.geometry.uuid][0]),r=(n.LineInfo.push(o),n.LineInfo.push(e.topolIndex),n.LineInfo.push(e.lineSegId),t?1:0);n.LineInfo.push(r),n.applyMatrix(e.matrixWorld),n.matrixWorldNeedsUpdate=!0,this.edgeInfo.startPos.applyMatrix4(e.matrixWorld),this.edgeInfo.endPos.applyMatrix4(e.matrixWorld),this.edgeInfo.midPos.applyMatrix4(e.matrixWorld),this.edgeInfo.thirdPos&&this.edgeInfo.thirdPos.applyMatrix4(e.matrixWorld)}}return n}this.OpMeasure.InfoType!=Ae.INFOTYPE.BREPDATAERROR&&0!=this.OpMeasure.InfoType&&(this.InfoType=this.OpMeasure.InfoType),this.OpMeasure.PostInfo(Ae.INFOTYPE.BREPDATAERROR)}},Me.prototype.createEllipse=function(e,t,i){if(e&&e.parentObj instanceof THREE.Line){var n,r=new THREE.Group,o=e.geometry,s=e.indexRange.concat(),a=(s[0]+=o.drawRange.start/2,s[1]+=o.drawRange.start/2,new THREE.Vector3),l=new THREE.Quaternion,d=new THREE.Vector3,a=(e.matrixWorld.decompose(a,l,d),Math.PI*(3*(e.radiusX+e.radiusY)-Math.sqrt((3*e.radiusX+e.radiusY)*(e.radiusX+3*e.radiusY))));if(o.isBufferGeometry){var l=s[1]-s[0]+1,c=o.index,h=o.attributes.position.array,u=new Float32Array(6*l);if(null!=c){for(var p=c.array,f=0,o=(this.edgeInfo.startPos=new THREE.Vector3,this.edgeInfo.endPos=new THREE.Vector3,this.edgeInfo.midPos=new THREE.Vector3,s[0]),m=s[1],g=(Math.round(.5*(o+m)),this.edgeInfo.thirdPos=null,this.edgeInfo.startPos.fromArray(h,3*p[2*o]),this.edgeInfo.endPos.fromArray(h,3*p[2*m+1]),this.edgeInfo.endPos.distanceTo(this.edgeInfo.startPos)<1e-7&&(this.edgeInfo.thirdPos=new THREE.Vector3,this.edgeInfo.thirdPos.fromArray(h,3*p[2*(m-1)])),0),v=o,A=m;v<=A;v++,f+=1){var y=p[2*v],E=p[2*v+1],M=new THREE.Vector3,w=new THREE.Vector3;M.fromArray(h,3*y),w.fromArray(h,3*E),u[6*f]=M.x,u[6*f+1]=M.y,u[6*f+2]=M.z,u[6*f+3]=w.x,u[6*f+4]=w.y,u[6*f+5]=w.z,g+=M.clone().distanceTo(w),w=M=null}for(var x=0,v=o;v<=m;v++){var y=p[2*v],E=p[2*v+1],M=new THREE.Vector3,w=new THREE.Vector3,I=(M.fromArray(h,3*y),w.fromArray(h,3*E),x);if(.5*g<(x+=M.clone().distanceTo(w))){var I=.5*g-I,b=w.clone().sub(M);b.normalize(),this.edgeInfo.midPos=M.clone().addScaledVector(b,I);break}}B=(new THREE.Plane).setFromCoplanarPoints(this.edgeInfo.startPos,this.edgeInfo.thirdPos||this.edgeInfo.endPos,this.edgeInfo.midPos),i=i||(0==t?Re.SelectedEdgeMaterial1:Re.preSelectedEdgeMaterial);var l=new Ze,c=(l.setPositions(u),new fi({linewidth:i.linewidth,opacity:i.opacity,color:i.color,depthTest:i.depthTest,depthWrite:i.depthWrite,side:THREE.DoubleSide})),s=this.viewer.renderer.getPixelRatio(),o=this.viewer.renderer.domElement.width/s,s=this.viewer.renderer.domElement.height/s,T=(c.resolution.set(o,s),(n=new Je(l,c)).objectType="EllipseCurve",n.computeLineDistances(),n.LineInfo=[],n.LineInfo.push(this.viewer.ndsModel.bodyUuid2NodeMap[e.bodyUuid].id),this.viewer.ndsModel.geomManager.uuidToIdMap[e.geometry.uuid][0]),S=(n.LineInfo.push(T),n.LineInfo.push(e.topolIndex),n.LineInfo.push(e.lineSegId),t?1:0);n.LineInfo.push(S),this.edgeInfo.startPos.applyMatrix4(e.matrixWorld),this.edgeInfo.endPos.applyMatrix4(e.matrixWorld),this.edgeInfo.midPos.applyMatrix4(e.matrixWorld),this.edgeInfo.thirdPos&&this.edgeInfo.thirdPos.applyMatrix4(e.matrixWorld),n.applyMatrix(e.matrixWorld),n.matrixWorldNeedsUpdate=!0}}if(!t){var o=new Float32Array(6),s=new Float32Array(6),l=new THREE.Vector3(e.center[0],e.center[1],e.center[2]),l=B.projectPoint(l),c=new THREE.Vector3(e.axisX[0],e.axisX[1],e.axisX[2]).normalize(),B=new THREE.Vector3(e.normal[0],e.normal[1],e.normal[2]).cross(c).normalize(),P=l.clone().addScaledVector(c,e.radiusX/d.x),c=l.clone().addScaledVector(c,-e.radiusX/d.x),P=(o[0]=P.x,o[1]=P.y,o[2]=P.z,o[3]=c.x,o[4]=c.y,o[5]=c.z,l.clone().addScaledVector(B,e.radiusY/d.y)),c=l.clone().addScaledVector(B,-e.radiusY/d.y),l=(s[0]=P.x,s[1]=P.y,s[2]=P.z,s[3]=c.x,s[4]=c.y,s[5]=c.z,i=i||(0==t?Re.SelectedEdgeMaterial1:Re.preSelectedEdgeMaterial),new Ze),B=(l.setPositions(o),new Ze),P=(B.setPositions(s),new fi({linewidth:i.linewidth,opacity:i.opacity,color:new THREE.Color(16743724),depthTest:i.depthTest,depthWrite:i.depthWrite,side:THREE.DoubleSide,dashed:!0,dashSize:1/d.x,gapSize:2/d.x})),c=this.viewer.renderer.getPixelRatio(),o=this.viewer.renderer.domElement.width/c,s=this.viewer.renderer.domElement.height/c,c=(P.resolution.set(o,s),new Je(l,P)),o=(c.objectType="radiusX",c.computeLineDistances(),c.applyMatrix(e.matrixWorld),c.matrixWorldNeedsUpdate=!0,new Je(B,P)),T=(o.objectType="radiusY",o.computeLineDistances(),o.applyMatrix(e.matrixWorld),o.matrixWorldNeedsUpdate=!0,r.add(n),r.add(c),r.add(o),r.objectType="EllipseLine",r.LineInfo=[],r.LineInfo.push(this.viewer.ndsModel.bodyUuid2NodeMap[e.bodyUuid].id),this.viewer.ndsModel.geomManager.uuidToIdMap[e.geometry.uuid][0]),S=(r.LineInfo.push(T),r.LineInfo.push(e.topolIndex),r.LineInfo.push(e.lineSegId),t?1:0);if(r.LineInfo.push(S),.01=h))break;if(c instanceof THREE.Line){h=a[d];a[d]=a[0],a[0]=h;break}}}return a},Me.prototype.createAndShowDistanceDimension=function(e,t){var i,n,r,o,s,a,l,d,c,h,u,p,f,m,g,v,A,y,E,M,w,x,I,b,T;this.distanceInfo.firstSelObj&&this.distanceInfo.secondSelObj&&(i=!1,r=((i=this.distanceInfo.firstSelInfo&&"plane"==this.distanceInfo.firstSelInfo.type&&this.distanceInfo.secondSelInfo&&"plane"==this.distanceInfo.secondSelInfo.type?!0:i)?(n=this.distanceInfo.firstSelInfo.intersect.clone(),this.distanceInfo.secondSelInfo.intersect):(n=this.distanceInfo.firstPoint.clone(),this.distanceInfo.secondPoint)).clone(),this.distanceInfo.fstClndPos||(this.distanceInfo.fstClndPos=this.distanceInfo.firstPoint.clone()),this.distanceInfo.sndClndPos||(this.distanceInfo.sndClndPos=this.distanceInfo.secondPoint.clone()),this.distanceInfo.textPos&&e&&((T=new THREE.Plane).setFromCoplanarPoints(n,this.distanceInfo.fstClndPos,this.distanceInfo.sndClndPos),T.normal.length()<1e-8&&T.setFromCoplanarPoints(n.clone().add(new THREE.Vector3(1,-1,1)),this.distanceInfo.fstClndPos,this.distanceInfo.sndClndPos),w=this.clientCoordToModelCoordOnPlane(e.x,e.y,T))&&(this.viewer.is2DModel&&(w.z=0),this.distanceInfo.textPos.copy(w)),this.distanceInfo.fstClnd&&this.distanceInfo.sndClnd?!i&&this.distanceInfo.textPos?(l=(new THREE.Vector3).subVectors(this.distanceInfo.sndClndPos,this.distanceInfo.fstClndPos),(o=this.getProjectPntToLine(r,this.distanceInfo.sndClndPos,this.distanceInfo.textPos.clone()))&&(1e-5<(w=o.clone().sub(r)).length()?(this.distanceInfo.sndClndPos.addVectors(r,w),this.distanceInfo.fstClndPos.subVectors(this.distanceInfo.sndClndPos,l)):(s=this.viewer.camera.position,a=(new THREE.Vector3).subVectors(s,this.distanceInfo.fstClndPos),(d=(l=(new THREE.Vector3).subVectors(this.distanceInfo.secondPoint,this.distanceInfo.firstPoint)).length())<1e-8?(d=(l=new THREE.Vector3(100,100,100)).length(),(c=(new THREE.Vector3).crossVectors(l,a)).normalize().multiplyScalar(Math.max(.001*d,1e-4)),this.distanceInfo.fstClndPos.add(c),this.distanceInfo.sndClndPos.sub(c)):((c=(new THREE.Vector3).crossVectors(l,a)).normalize().multiplyScalar(Math.max(.001*d,1e-4)),this.distanceInfo.fstClndPos.add(c),this.distanceInfo.sndClndPos.add(c))))):i&&(w=(new THREE.Vector3).subVectors(this.distanceInfo.sndClndPos,this.distanceInfo.fstClndPos),x=(new THREE.Vector3).subVectors(this.distanceInfo.textPos,this.distanceInfo.fstClndPos),(T=new THREE.Plane).setFromCoplanarPoints(n,r,this.distanceInfo.sndClndPos),(e=this.clientCoordToModelCoordOnPlane(e.x,e.y,T))&&(o=this.getProjectPntToLine(this.distanceInfo.secondSelInfo.intersect,this.distanceInfo.sndClndPos,e))&&this.distanceInfo.sndClndPos.copy(o),this.distanceInfo.fstClndPos=this.distanceInfo.sndClndPos.clone().sub(w),this.distanceInfo.textPos.copy(this.distanceInfo.fstClndPos.clone().add(x))):i?(T=(new THREE.Vector3).subVectors(r,n),(e=this.distanceInfo.firstSelInfo.worldNormal.clone()).normalize(),this.distanceInfo.fstClndPos=n.clone(),this.distanceInfo.sndClndPos=new THREE.Vector3,o=this.distanceInfo.dimString,o*=I=this.viewer.getUnitScale(this.distanceInfo.unit),o=Math.max(o,1e-4),0dis:"+c:"距离:"+c,this.distanceInfo.textBox.appendChild(u),e=document.createElement("p"),f=Math.abs(this.distanceInfo.firstPoint.x-this.distanceInfo.secondPoint.x),d=this.viewer.getDispalyModelUnit(f),e.innerHTML="X:"+(f*this.viewer.measuringScale*d.scale).toFixed(8)+this.getUnitStringmap(d.unit),this.distanceInfo.textBox.appendChild(e),m=document.createElement("p"),g=Math.abs(this.distanceInfo.firstPoint.z-this.distanceInfo.secondPoint.z),d=this.viewer.getDispalyModelUnit(g),m.innerHTML="Y:"+(g*this.viewer.measuringScale*d.scale).toFixed(8)+this.getUnitStringmap(d.unit),this.distanceInfo.textBox.appendChild(m),v=document.createElement("p"),A=Math.abs(this.distanceInfo.firstPoint.y-this.distanceInfo.secondPoint.y),d=this.viewer.getDispalyModelUnit(A),v.innerHTML="Z:"+(A*this.viewer.measuringScale*d.scale).toFixed(8)+this.getUnitStringmap(d.unit),this.distanceInfo.textBox.appendChild(v)):(this.distanceInfo.textBox=document.createElement("div"),this.distanceInfo.textBox.className="section10",this.distanceInfo.textBox.innerHTML=c,(y=document.createElement("div")).className="sectionPoint",this.distanceInfo.textBox.appendChild(y),(h=document.createElement("div")).className="sectionCross",this.distanceInfo.textBox.appendChild(h)),this.viewer.container.appendChild(this.distanceInfo.textBox)),this.distanceInfo.boxToClndLine&&(this.OpMeasure.rootObject.remove(this.distanceInfo.boxToClndLine),this.distanceInfo.boxToClndLine=null),E=this.distanceInfo.firstPoint.clone().add(this.distanceInfo.secondPoint).divideScalar(2),this.distanceInfo.boxToClndLine||(this.distanceInfo.boxToClndLine=this.createLineMesh2(E,this.distanceInfo.textPos,this.appmaterialLine,1),this.distanceInfo.boxToClndLine.name="unsteady",this.OpMeasure.rootObject.add(this.distanceInfo.boxToClndLine)),M=this.get2dPoint(this.distanceInfo.textPos.clone()),w=this.viewer.renderer.getPixelRatio(),this.distanceInfo.textBox.style.left=Math.round(M.x/w-49)+"px",this.distanceInfo.textBox.style.top=Math.round(M.y/w-26)+"px",1==t)&&((x={}).dimString=c,x.textPos=this.distanceInfo.textPos.clone(),x.textBox=this.distanceInfo.textBox,I=this,(b=new THREE.Group).objectType="Group",I.OpMeasure.rootObject.remove(I.distanceInfo.boxToClndLine),I.OpMeasure.rootObject.remove(I.distanceInfo.fstToSndLine),I.OpMeasure.rootObject.remove(I.distanceInfo.firstSelObj),I.OpMeasure.rootObject.remove(I.distanceInfo.secondSelObj),I.distanceInfo.FstToFstPointLine&&(I.OpMeasure.rootObject.remove(I.distanceInfo.FstToFstPointLine),b.add(I.distanceInfo.FstToFstPointLine)),I.distanceInfo.SndToSndPointLine&&(I.OpMeasure.rootObject.remove(I.distanceInfo.SndToSndPointLine),b.add(I.distanceInfo.SndToSndPointLine)),I.distanceInfo.axisLineObj&&(I.OpMeasure.rootObject.remove(I.distanceInfo.axisLineObj),b.add(I.distanceInfo.axisLineObj)),I.distanceInfo.secaxisLineObj&&(I.OpMeasure.rootObject.remove(I.distanceInfo.secaxisLineObj),b.add(I.distanceInfo.secaxisLineObj)),b.add(I.distanceInfo.fstToSndLine),b.add(I.distanceInfo.firstSelObj),b.add(I.distanceInfo.secondSelObj),I.OpMeasure.rootObject.add(b),Se.isMobileDevice()?(x.textBox.addEventListener("touchstart",this.touchstart,!1),x.textBox.addEventListener("touchend",this.touchend,!1),x.textBox.addEventListener("touchmove",this.touchmove,!1)):(x.textBox.addEventListener("mousedown",this.touchstart,!1),x.textBox.addEventListener("mouseup",this.touchend,!1),x.textBox.addEventListener("mousemove",this.touchmove,!1),x.textBox.addEventListener("mouseleave",this.mouseleave,!1),x.textBox.addEventListener("mouseenter",this.mouseenter,!1)),Se.isMobileDevice()?h.addEventListener("touchend",this.sectionCrossend,!1):(h.addEventListener("mousedown",this.sectionCrossend,!1),h.addEventListener("mouseleave",this.crossleave,!1),h.addEventListener("mouseenter",this.crossenter,!1)),(T={}).start=this.distanceInfo.textPos.clone(),T.end=E.clone(),T.uuid=b.uuid,this.OpMeasure.textLines.push(T),x.textBox.setAttribute("mobile","up"),x.textBox.setAttribute("group",b.uuid),this.OpMeasure.currentUuid=b.uuid,x.textBox.setAttribute("type","length"),x.textBox.setAttribute("dimString",this.distanceInfo.dimString),x.textBox.setAttribute("dimStringPrefix",this.distanceInfo.dimStringPrefix),x.textBox.setAttribute("unit",this.distanceInfo.unit),x.textBox.setAttribute("lineInfo",this.OpMeasure.textLines.length-1),this.OpMeasure.boxInfos.push(x),this.OpMeasure.unsteadyData[b.uuid]=this.DeepCopy(this.distanceInfo,"Distance"),this.OpMeasure.unsteadyData[b.uuid].p1=i,this.OpMeasure.unsteadyData[b.uuid].p2=n,this.clearDistanceInfo(!0),Se.isMobileDevice())&&this.ChangeMeasureFlag()},Me.prototype.changeMeasureDistance=function(e){var t=this.OpMeasure.unsteadyData[this.OpMeasure.unsteadyuuid],i=(t.textPos&&e&&((n=new THREE.Plane).setFromCoplanarPoints(t.p1,t.fstClndPos,t.sndClndPos),n.normal.length()<1e-8&&n.setFromCoplanarPoints(t.p2,t.fstClndPos,t.sndClndPos),n.normal.length()<1e-8&&n.setFromCoplanarPoints(t.p1.clone().add(new THREE.Vector3(1,-1,1)),t.fstClndPos,t.sndClndPos),n.normal.length()<1e-8&&n.setFromCoplanarPoints(t.p1,t.fstClndPos.clone().add(new THREE.Vector3(1,-1,1)),t.sndClndPos),n.normal.length()<1e-8&&n.setFromCoplanarPoints(t.p1,t.fstClndPos,t.sndClndPos.clone().add(new THREE.Vector3(1,-1,1))),e=this.clientCoordToModelCoordOnPlane(e.x,e.y,n))&&t.textPos.copy(e),null),i=("Lineargauge3D"==this.measureClass?t.fstClndPos.clone().add(t.sndClndPos):t.firstPoint.clone().add(t.secondPoint)).divideScalar(2),n=this.get2dPoint(t.textPos.clone()),e=this.get2dPoint(i.clone()),n=new THREE.Vector2(n.x-e.x,n.y-e.y);n.normalize(),n.y>=n.x/2&&n.y>=-n.x/2?(this.OpMeasure.unsteadyTextBox.childNodes[1].style.left="calc(50% - 6px)",this.OpMeasure.unsteadyTextBox.childNodes[1].style.top="-5.5px",this.OpMeasure.unsteadyTextBox.setAttribute("mobile","down")):n.y>n.x/2&&n.y<-n.x/2?(this.OpMeasure.unsteadyTextBox.childNodes[1].style.left="calc(100% - 4px)",this.OpMeasure.unsteadyTextBox.childNodes[1].style.top="calc(50% - 5.5px)",this.OpMeasure.unsteadyTextBox.setAttribute("mobile","right")):n.y-n.x/2&&(this.OpMeasure.unsteadyTextBox.childNodes[1].style.left="-5.5px",this.OpMeasure.unsteadyTextBox.childNodes[1].style.top="calc(50% - 5.5px)",this.OpMeasure.unsteadyTextBox.setAttribute("mobile","left"));for(var r=0;rAe.INFOTYPE.MEASURENOTICEBEGIN&&(this.OpMeasure.InfoType=Ae.INFOTYPE.MEASURENOTICEBEGIN),this.distanceInfo.preSelInfo=null,this.distanceInfo.preSelObj&&(this.OpMeasure.rootObject.remove(this.distanceInfo.preSelObj),this.distanceInfo.preSelObj=null),t)null==this.distanceInfo.firstSelInfo?(this.distanceInfo.firstSelInfo={type:"point",point:t},this.distanceInfo.firstPoint=this.distanceInfo.firstSelInfo.point):(this.distanceInfo.secondSelInfo={type:"point",point:t},this.distanceInfo.secondPoint=this.distanceInfo.secondSelInfo.point,this.calculateDistanceFromPoint(this.distanceInfo));else if(-1!=n.indexOf("point")&&-1==n.indexOf(e.type))s=e.intersect.clone(),null==this.distanceInfo.firstSelInfo?(this.distanceInfo.firstPoint=s,this.distanceInfo.firstSelInfo={type:"point",point:s}):(this.distanceInfo.secondSelInfo={type:"point",point:s},this.distanceInfo.secondPoint=this.distanceInfo.secondSelInfo.point,this.calculateDistanceFromPoint(this.distanceInfo));else if(this.distanceInfo.firstSelInfo){if(this.isTwoTopolInfoTheSame(this.distanceInfo.firstSelInfo,e))this.distanceInfo.firstSelObj&&(this.OpMeasure.rootObject.remove(this.distanceInfo.firstSelObj),this.distanceInfo.firstSelObj=null,this.distanceInfo.firstSelInfo=null),this.distanceInfo.axisLineObj&&(this.OpMeasure.rootObject.remove(this.distanceInfo.axisLineObj),this.distanceInfo.axisLineObj=null);else if(-1!=n.indexOf(e.type)||-1!=n.indexOf("point")){if("line"==this.distanceInfo.firstSelInfo.type){var a=this.getLineStartEndPoints(this.distanceInfo.firstSelInfo);if("line"==e.type){var l=this.getLineStartEndPoints(e);if(a&&l){(g=(new THREE.Vector3).subVectors(a.end,a.start)).normalize();(y=(new THREE.Vector3).subVectors(l.end,l.start)).normalize();var d=g.dot(y);if(1-Math.abs(d)<1e-4){if((M=(E=new THREE.Line3(a.start,a.end).closestPointToPoint(l.start,!1)).distanceTo(l.start))<1e-5)return void this.OpMeasure.PostInfo("bodyDistance"==this.measureType?Ae.INFOTYPE.TWOBODYNOTPARALLEL:Ae.INFOTYPE.INTERSECT);this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.secondSelInfo=e,this.distanceInfo.firstPoint=E,this.distanceInfo.secondPoint=l.start.clone()}else{var c=l.start.clone().sub(a.start),h=Math.pow(g.clone().cross(y).length(),2),u=c.clone().cross(y).dot(g.clone().cross(y))/h,p=c.clone().cross(g).dot(g.clone().cross(y))/h,f=g.clone().multiplyScalar(u).add(a.start),m=y.clone().multiplyScalar(p).add(l.start);if((M=f.distanceTo(m))<1e-5)return void this.OpMeasure.PostInfo("bodyDistance"==this.measureType?Ae.INFOTYPE.TWOBODYNOTPARALLEL:Ae.INFOTYPE.INTERSECT);this.distanceInfo.secondSelInfo=e,this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.firstPoint=f,this.distanceInfo.secondPoint=m}}}else"plane"==e.type?((g=(new THREE.Vector3).subVectors(a.end,a.start)).normalize(),Math.abs(e.worldNormal.dot(g))<1e-5?(this.distanceInfo.secondSelInfo=e,(v=new THREE.Plane).setFromNormalAndCoplanarPoint(e.worldNormal,e.worldOrigin),A=new THREE.Vector3,v.projectPoint(a.start,A),M=A.distanceTo(a.start),this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.firstPoint=a.start.clone(),this.distanceInfo.secondPoint=A):this.OpMeasure.PostInfo("bodyDistance"==this.measureType?Ae.INFOTYPE.TWOBODYNOTPARALLEL:Ae.INFOTYPE.PLANENOPARALLEL)):"circle"!=e.type&&"cylinder"!=e.type&&"cone"!=e.type||(l=this.getLineStartEndPoints(e),"bodyDistance"==this.measureType&&"circle"==e.type?a&&l&&(M=(E=new THREE.Line3(a.start,a.end).closestPointToPoint(l.start,!1)).distanceTo(l.start),this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.firstPoint=E,this.distanceInfo.secondPoint=l.start.clone(),this.distanceInfo.secondSelInfo=e):a&&l&&((g=(new THREE.Vector3).subVectors(a.end,a.start)).normalize(),(y=(new THREE.Vector3).subVectors(l.end,l.start)).normalize(),d=g.dot(y),1-Math.abs(d)<1e-4?(this.distanceInfo.secondSelInfo=e,M=(E=new THREE.Line3(a.start,a.end).closestPointToPoint(l.start,!1)).distanceTo(l.start),this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.firstPoint=E,this.distanceInfo.secondPoint=l.start.clone()):(c=l.start.clone().sub(a.start),h=Math.pow(g.clone().cross(y).length(),2),u=c.clone().cross(y).dot(g.clone().cross(y))/h,p=c.clone().cross(g).dot(g.clone().cross(y))/h,f=g.clone().multiplyScalar(u).add(a.start),m=y.clone().multiplyScalar(p).add(l.start),M=f.distanceTo(m),this.distanceInfo.secondSelInfo=e,this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.firstPoint=f,this.distanceInfo.secondPoint=m)))}else if("point"==this.distanceInfo.firstSelInfo.type||"bodyDistance"==this.measureType&&"circle"==this.distanceInfo.firstSelInfo.type)"bodyDistance"==this.measureType&&"circle"==this.distanceInfo.firstSelInfo.type?(a=this.getLineStartEndPoints(this.distanceInfo.firstSelInfo),this.distanceInfo.firstPoint=a.start.clone()):this.distanceInfo.firstPoint=this.distanceInfo.firstSelInfo.point,"line"==(this.distanceInfo.secondSelInfo=e).type?(a=this.getLineStartEndPoints(e))&&(M=(E=new THREE.Line3(a.start,a.end).closestPointToPoint(this.distanceInfo.firstPoint,!1)).distanceTo(this.distanceInfo.firstPoint),this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.secondPoint=E):"plane"==e.type?((v=new THREE.Plane).setFromNormalAndCoplanarPoint(e.worldNormal,e.worldOrigin),A=new THREE.Vector3,v.projectPoint(this.distanceInfo.firstPoint,A),M=A.distanceTo(this.distanceInfo.firstPoint),this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.secondPoint=A):"circle"!=e.type&&"cylinder"!=e.type&&"cone"!=e.type||("bodyDistance"==this.measureType&&"circle"==e.type?(a=this.getLineStartEndPoints(e))&&(M=a.start.distanceTo(this.distanceInfo.firstPoint),this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.secondPoint=a.start.clone()):(a=this.getLineStartEndPoints(e))&&(M=(E=new THREE.Line3(a.start,a.end).closestPointToPoint(this.distanceInfo.firstPoint,!1)).distanceTo(this.distanceInfo.firstPoint),this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.secondPoint=E));else if("plane"==this.distanceInfo.firstSelInfo.type)"line"==e.type?(a=this.getLineStartEndPoints(e))&&((g=(new THREE.Vector3).subVectors(a.end,a.start)).normalize(),Math.abs(this.distanceInfo.firstSelInfo.worldNormal.dot(g))<1e-5?((v=new THREE.Plane).setFromNormalAndCoplanarPoint(this.distanceInfo.firstSelInfo.worldNormal,this.distanceInfo.firstSelInfo.worldOrigin),A=new THREE.Vector3,v.projectPoint(a.start,A),M=A.distanceTo(a.start),this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.secondSelInfo=e,this.distanceInfo.firstPoint=A,this.distanceInfo.secondPoint=a.start.clone()):this.OpMeasure.PostInfo("bodyDistance"==this.measureType?Ae.INFOTYPE.TWOBODYNOTPARALLEL:Ae.INFOTYPE.LINENOPARALLEL)):"plane"==e.type?(o=this.distanceInfo.firstSelInfo.worldNormal,w=e.worldNormal.clone(),o.normalize(),w.normalize(),o=Math.abs(o.dot(w)),Math.abs(o-1)<1e-5?(this.distanceInfo.secondSelInfo=e,this.distanceInfo.firstPoint=this.distanceInfo.firstSelInfo.intersect,(v=new THREE.Plane).setFromNormalAndCoplanarPoint(e.worldNormal,e.worldOrigin),A=new THREE.Vector3,v.projectPoint(this.distanceInfo.firstPoint,A),M=A.distanceTo(this.distanceInfo.firstPoint),this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.secondPoint=A):this.OpMeasure.PostInfo("bodyDistance"==this.measureType?Ae.INFOTYPE.TWOBODYNOTPARALLEL:Ae.INFOTYPE.PLANENOPARALLEL)):"circle"!=e.type&&"cylinder"!=e.type&&"cone"!=e.type||(a=this.getLineStartEndPoints(e),"bodyDistance"==this.measureType&&"circle"==e.type?a&&((v=new THREE.Plane).setFromNormalAndCoplanarPoint(this.distanceInfo.firstSelInfo.worldNormal,this.distanceInfo.firstSelInfo.worldOrigin),A=new THREE.Vector3,v.projectPoint(a.start,A),M=A.distanceTo(a.start),this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.firstPoint=A,this.distanceInfo.secondPoint=a.start.clone(),this.distanceInfo.secondSelInfo=e):a&&((g=(new THREE.Vector3).subVectors(a.end,a.start)).normalize(),Math.abs(this.distanceInfo.firstSelInfo.worldNormal.dot(g))<1e-5?(this.distanceInfo.secondSelInfo=e,(v=new THREE.Plane).setFromNormalAndCoplanarPoint(this.distanceInfo.firstSelInfo.worldNormal,this.distanceInfo.firstSelInfo.worldOrigin),A=new THREE.Vector3,v.projectPoint(a.start,A),M=A.distanceTo(a.start),this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.firstPoint=A,this.distanceInfo.secondPoint=a.start.clone()):this.OpMeasure.PostInfo("bodyDistance"==this.measureType?Ae.INFOTYPE.TWOBODYNOTPARALLEL:Ae.INFOTYPE.AXISNOPARALLEL)));else if("circle"==this.distanceInfo.firstSelInfo.type||"cylinder"==this.distanceInfo.firstSelInfo.type||"cone"==this.distanceInfo.firstSelInfo.type){var g,v,A,a=this.getLineStartEndPoints(this.distanceInfo.firstSelInfo),l=this.getLineStartEndPoints(e);if("line"==e.type||"circle"==e.type||"cylinder"==e.type||"cone"==e.type){if("bodyDistance"==this.measureType&&"circle"==e.type)a&&l&&(M=(E=new THREE.Line3(a.start,a.end).closestPointToPoint(l.start,!1)).distanceTo(l.start),this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.secondSelInfo=e,this.distanceInfo.firstPoint=E,this.distanceInfo.secondPoint=l.start.clone());else if(a&&l){(g=(new THREE.Vector3).subVectors(a.end,a.start)).normalize();(y=(new THREE.Vector3).subVectors(l.end,l.start)).normalize();var y,d=g.dot(y);if(1-Math.abs(d)<1e-4){this.distanceInfo.secondSelInfo=e;var E,M=(E=new THREE.Line3(a.start,a.end).closestPointToPoint(l.start,!1)).distanceTo(l.start);this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.firstPoint=E,this.distanceInfo.secondPoint=l.start.clone()}else{if("bodyDistance"==this.measureType&&("line"==e.type||"cylinder"==e.type||"cone"==e.type)){c=l.start.clone().sub(a.start),h=Math.pow(g.clone().cross(y).length(),2),u=c.clone().cross(y).dot(g.clone().cross(y))/h,p=c.clone().cross(g).dot(g.clone().cross(y))/h,f=g.clone().multiplyScalar(u).add(a.start),m=y.clone().multiplyScalar(p).add(l.start);if((M=f.distanceTo(m))<1e-5)return void this.OpMeasure.PostInfo("bodyDistance"==this.measureType?Ae.INFOTYPE.TWOBODYNOTPARALLEL:Ae.INFOTYPE.INTERSECT);this.distanceInfo.secondSelInfo=e,this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.firstPoint=f,this.distanceInfo.secondPoint=m}if("circle"==e.type||"cylinder"==e.type||"cone"==e.type)return void this.OpMeasure.PostInfo("bodyDistance"==this.measureType?Ae.INFOTYPE.TWOBODYNOTPARALLEL:Ae.INFOTYPE.TWOAXISNOPARALLEL);c=l.start.clone().sub(a.start),h=Math.pow(g.clone().cross(y).length(),2),u=c.clone().cross(y).dot(g.clone().cross(y))/h,p=c.clone().cross(g).dot(g.clone().cross(y))/h,f=g.clone().multiplyScalar(u).add(a.start),m=y.clone().multiplyScalar(p).add(l.start);M=f.distanceTo(m),this.distanceInfo.secondSelInfo=e,this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.firstPoint=f,this.distanceInfo.secondPoint=m}}}else"plane"==e.type&&((g=(new THREE.Vector3).subVectors(a.end,a.start)).normalize(),Math.abs(e.worldNormal.dot(g))<1e-4?((v=new THREE.Plane).setFromNormalAndCoplanarPoint(e.worldNormal,e.worldOrigin),A=new THREE.Vector3,v.projectPoint(a.start,A),M=A.distanceTo(a.start),this.distanceInfo.dimString=M.toFixed(8),this.distanceInfo.secondSelInfo=e,this.distanceInfo.firstPoint=a.start.clone(),this.distanceInfo.secondPoint=A):this.OpMeasure.PostInfo("bodyDistance"==this.measureType?Ae.INFOTYPE.TWOBODYNOTPARALLEL:Ae.INFOTYPE.PLANENOPARALLEL))}var w=this.viewer.getDispalyModelUnit(M=M<1&&.999999a[0]&&l--,t.index),t=t.attributes.position.array;if(null!=d)return d=d.array,r=new THREE.Vector3,o=new THREE.Vector3,r.fromArray(t,3*d[2*a[0]]),o.fromArray(t,3*d[2*l]),a=(new THREE.Vector3).subVectors(r,n),t=(new THREE.Vector3).subVectors(o,n),s=(new THREE.Vector3).crossVectors(a,t),n.applyMatrix4(e.matrixWorld),s.applyQuaternion(i),s.normalize(),{center:n,axis:s}}return null},li.prototype.measureRadiusAndDiameter=function(e,t,i){if(""==this.holeInfo.unit&&(this.holeInfo.unit=this.getUnitString()),this.holeInfo.firstSelHoleObj)this.holeInfo.preSelHoleObj&&(this.OpMeasure.rootObject.remove(this.holeInfo.preSelHoleObj),this.holeInfo.preSelHoleObj=null,this.holeInfo.preSelHoleInfo=null);else{var n=this.viewer,e=this.doRaycasterPick(e,t,!0);if(e&&0!=e.length){if(0=r.x/2&&r.y>=-r.x/2?(this.OpMeasure.unsteadyTextBox.childNodes[1].style.left="calc(50% - 6px)",this.OpMeasure.unsteadyTextBox.childNodes[1].style.top="-5.5px",this.OpMeasure.unsteadyTextBox.setAttribute("mobile","down")):r.y>r.x/2&&r.y<-r.x/2?(this.OpMeasure.unsteadyTextBox.childNodes[1].style.left="calc(100% - 4px)",this.OpMeasure.unsteadyTextBox.childNodes[1].style.top="calc(50% - 5.5px)",this.OpMeasure.unsteadyTextBox.setAttribute("mobile","right")):r.y-r.x/2&&(this.OpMeasure.unsteadyTextBox.childNodes[1].style.left="-5.5px",this.OpMeasure.unsteadyTextBox.childNodes[1].style.top="calc(50% - 5.5px)",this.OpMeasure.unsteadyTextBox.setAttribute("mobile","left")),this.OpMeasure.viewer.render()},(di.prototype=Object.create(Me.prototype)).OperatorStart=function(e){switch(this.measureType=e,this.measureType){case"bodyEdgeLength":this.OpMeasure.PostInfo(Ae.INFOTYPE.MEASUREBODY);break;case"measureEdges":this.OpMeasure.PostInfo(Ae.INFOTYPE.LINEANDCIRCLE)}},di.prototype.onNMouseMove=function(e,t){var i=new THREE.Vector3(e,t,0);this.OpMeasure.unsteady?this.changeMeasureEdge(i):this.edgeInfo.selLineObj&&!Se.isMobileDevice()?this.createAndShowMeasureEdgesDimension(i):(this.measureEdges(e,t,!0),this.viewer.is2DModel?this.updateMeasureEdgesScene("true",i):this.update3DMeasureEdgesScene("true",i))},di.prototype.onLMouseClick=function(e,t,i){var n=new THREE.Vector3(e,t,0);this.edgeInfo.selLineObj?this.viewer.is2DModel?(this.createAndShowMeasureEdgesDimension(n,!0),this.OpMeasure.PostInfo(Ae.INFOTYPE.LINEANDCIRCLE)):this.createAndShow3DMeasureEdgesDimension(n,!0):(this.measureEdges(e,t,!1),this.viewer.is2DModel?(this.updateMeasureEdgesScene("false",n),this.edgeInfo.selLineObj&&this.OpMeasure.PostInfo(Ae.INFOTYPE.ENDMEASURE)):this.update3DMeasureEdgesScene("false",n))},di.prototype.createAndShowMeasureEdgesDimension=function(e,t){var i,n,r,o,s,a,l,d;"measureEdges"!=this.measureType&&"bodyEdgeLength"!=this.measureType||this.edgeInfo.selLineInfo&&this.edgeInfo.selLineObj&&(i=!1,(i=this.edgeInfo.thirdPos?!0:i)?((n=new THREE.Plane).setFromCoplanarPoints(this.edgeInfo.startPos,this.edgeInfo.midPos,this.edgeInfo.thirdPos),this.edgeInfo.textPos||(this.edgeInfo.textPos=this.edgeInfo.startPos.clone()),e&&((i=this.clientCoordToModelCoordOnPlane(e.x,e.y,n))&&(this.edgeInfo.textPos=i),this.edgeInfo.boxToClndLine&&this.OpMeasure.rootObject.remove(this.edgeInfo.boxToClndLine),this.edgeInfo.boxToClndLine=this.createLineMesh2(this.edgeInfo.startPos,this.edgeInfo.textPos,this.materialLine,1),this.OpMeasure.rootObject.add(this.edgeInfo.boxToClndLine))):(this.edgeInfo.fstClndPos||(this.edgeInfo.fstClndPos=this.edgeInfo.startPos.clone()),this.edgeInfo.sndClndPos||(this.edgeInfo.sndClndPos=this.edgeInfo.endPos.clone()),i=(new THREE.Vector3).subVectors(this.edgeInfo.endPos,this.edgeInfo.startPos),this.edgeInfo.fstClnd&&this.edgeInfo.sndClnd?e&&((n=new THREE.Plane).setFromCoplanarPoints(this.edgeInfo.startPos,this.edgeInfo.endPos,this.edgeInfo.fstClndPos),r=this.clientCoordToModelCoordOnPlane(e.x,e.y,n))&&(o=this.getProjectPntToLine(this.edgeInfo.startPos,this.edgeInfo.fstClndPos,r))&&(s=o.clone().sub(this.edgeInfo.startPos),this.edgeInfo.fstClndPos.addVectors(this.edgeInfo.startPos,s),this.edgeInfo.sndClndPos=this.edgeInfo.fstClndPos.clone().add(i)):"line"==this.edgeInfo.selLineInfo.type?(d=this.viewer.camera.getWorldDirection(),l=(new THREE.Vector3).crossVectors(i,d),l=this.getBaceFaceDir(l),a=(a=i.length())<1?.01:.5,l.normalize().multiplyScalar(a),this.edgeInfo.fstClndPos.add(l),this.edgeInfo.sndClndPos.add(l)):(s=(new THREE.Vector3).subVectors(this.edgeInfo.midPos,this.edgeInfo.startPos),1e-7<(s=(new THREE.Vector3).crossVectors(i,s)).lengthSq()?((s=(new THREE.Vector3).crossVectors(s,i)).normalize().multiplyScalar(.5),this.edgeInfo.fstClndPos.add(s),this.edgeInfo.sndClndPos.add(s)):(d=this.viewer.camera.getWorldDirection(),l=(new THREE.Vector3).crossVectors(i,d),(l=this.getBaceFaceDir(l)).normalize().multiplyScalar(.5),this.edgeInfo.fstClndPos.add(l),this.edgeInfo.sndClndPos.add(l))),this.edgeInfo.textPos?e&&((n=new THREE.Plane).setFromCoplanarPoints(this.edgeInfo.startPos,this.edgeInfo.endPos,this.edgeInfo.fstClndPos),r=this.clientCoordToModelCoordOnPlane(e.x,e.y,n))&&(o=this.getProjectPntToLine(this.edgeInfo.fstClndPos,this.edgeInfo.sndClndPos,r))&&this.edgeInfo.textPos.copy(o):this.edgeInfo.textPos=this.edgeInfo.sndClndPos.clone(),this.edgeInfo.startToClndLine&&this.OpMeasure.rootObject.remove(this.edgeInfo.startToClndLine),this.edgeInfo.startToClndLine=this.createLineMesh2(this.edgeInfo.startPos,this.edgeInfo.fstClndPos,this.materialLine,1),this.OpMeasure.rootObject.add(this.edgeInfo.startToClndLine),this.edgeInfo.endToClndLine&&this.OpMeasure.rootObject.remove(this.edgeInfo.endToClndLine),this.edgeInfo.endToClndLine=this.createLineMesh2(this.edgeInfo.endPos,this.edgeInfo.sndClndPos,this.materialLine,1),this.OpMeasure.rootObject.add(this.edgeInfo.endToClndLine),s=this.isPointBetweenIn(this.edgeInfo.textPos,this.edgeInfo.fstClndPos,this.edgeInfo.sndClndPos),this.edgeInfo.fstClnd&&this.OpMeasure.rootObject.remove(this.edgeInfo.fstClnd),i.normalize(),s?(this.edgeInfo.fstClnd=this.createCylinderMesh(this.edgeInfo.sndClndPos,this.edgeInfo.fstClndPos,this.materialLine),a=this.OpMeasure.getScale(this.edgeInfo.fstClnd,this.CYLINDERWIDTH),i.multiplyScalar(.5*this.edgeInfo.fstClnd.geometry.parameters.height),this.edgeInfo.fstClnd.oldPosition=this.edgeInfo.fstClndPos.clone(),this.edgeInfo.fstClnd.offsetPos=i.clone(),this.edgeInfo.fstClnd.position.addVectors(this.edgeInfo.fstClndPos,i.clone().multiplyScalar(a))):(this.edgeInfo.fstClnd=this.createCylinderMesh(this.edgeInfo.fstClndPos,this.edgeInfo.sndClndPos,this.materialLine),a=this.OpMeasure.getScale(this.edgeInfo.fstClnd,this.CYLINDERWIDTH),i.multiplyScalar(.5*this.edgeInfo.fstClnd.geometry.parameters.height),this.edgeInfo.fstClnd.oldPosition=this.edgeInfo.fstClndPos.clone(),this.edgeInfo.fstClnd.offsetPos=i.clone().multiplyScalar(-1),this.edgeInfo.fstClnd.position.subVectors(this.edgeInfo.fstClndPos,i.clone().multiplyScalar(a))),this.OpMeasure.rootObject.add(this.edgeInfo.fstClnd),this.edgeInfo.sndClnd&&this.OpMeasure.rootObject.remove(this.edgeInfo.sndClnd),s?(this.edgeInfo.sndClnd=this.createCylinderMesh(this.edgeInfo.fstClndPos,this.edgeInfo.sndClndPos,this.materialLine),this.edgeInfo.sndClnd.oldPosition=this.edgeInfo.sndClndPos.clone(),this.edgeInfo.sndClnd.offsetPos=i.clone().multiplyScalar(-1),this.edgeInfo.sndClnd.position.subVectors(this.edgeInfo.sndClndPos,i.clone().multiplyScalar(a))):(this.edgeInfo.sndClnd=this.createCylinderMesh(this.edgeInfo.sndClndPos,this.edgeInfo.fstClndPos,this.materialLine),this.edgeInfo.sndClnd.oldPosition=this.edgeInfo.sndClndPos.clone(),this.edgeInfo.sndClnd.offsetPos=i.clone(),this.edgeInfo.sndClnd.position.addVectors(this.edgeInfo.sndClndPos,i.clone().multiplyScalar(a))),this.OpMeasure.rootObject.add(this.edgeInfo.sndClnd),this.edgeInfo.clndToClndLine&&this.OpMeasure.rootObject.remove(this.edgeInfo.clndToClndLine),this.edgeInfo.clndToClndLine=this.createLineMesh2(this.edgeInfo.fstClndPos,this.edgeInfo.sndClndPos,this.materialLine,1),this.OpMeasure.rootObject.add(this.edgeInfo.clndToClndLine),this.edgeInfo.boxToClndLine&&this.OpMeasure.rootObject.remove(this.edgeInfo.boxToClndLine),this.edgeInfo.boxToClndLine=this.createLineMesh2(this.edgeInfo.fstClndPos,this.edgeInfo.textPos,this.materialLine,1),this.OpMeasure.rootObject.add(this.edgeInfo.boxToClndLine)),d="",d="⌒"==this.edgeInfo.dimString[0]?"⌒ "+(this.edgeInfo.dimString.slice(2)*this.viewer.measuringScale).toFixed(8)+this.edgeInfo.unit:(this.edgeInfo.dimString*this.viewer.measuringScale).toFixed(8)+this.edgeInfo.unit,this.edgeInfo.textBox||(this.edgeInfo.textBox=document.createElement("div"),this.edgeInfo.textBox.className="mearesult",this.viewer.container.appendChild(this.edgeInfo.textBox)),this.getAndShowTextBox(this.edgeInfo.textPos.clone(),d,this.edgeInfo.textBox),1==t)&&((l={}).dimString=d,l.textPos=this.edgeInfo.textPos.clone(),l.textBox=this.edgeInfo.textBox,l.textBox.setAttribute("type","length"),l.textBox.setAttribute("dimString",this.edgeInfo.dimString),l.textBox.setAttribute("dimStringPrefix",""),l.textBox.setAttribute("unit",this.edgeInfo.unit),this.OpMeasure.boxInfos.push(l),this.clearEdgeInfo(!0),Se.isMobileDevice()&&this.ChangeMeasureFlag(),Re.enableBroadcast&&Re.broadcastMajor&&this.OpMeasure.addmeasureTimes(),this.OpMeasure.measureEnd())},di.prototype.measureEdges=function(e,t,i){if(""==this.edgeInfo.unit&&(this.edgeInfo.unit=this.getUnitString()),this.edgeInfo.selLineObj)this.edgeInfo.preSelLineObj&&(this.OpMeasure.rootObject.remove(this.edgeInfo.preSelLineObj),this.edgeInfo.preSelLineObj=null,this.edgeInfo.preSelLineInfo=null);else{var n=this.viewer,e=this.doRaycasterPick(e,t,!0);if(e&&0!=e.length){if(0=e.x/2&&e.y>=-e.x/2?(this.OpMeasure.unsteadyTextBox.childNodes[1].style.left="calc(50% - 6px)",this.OpMeasure.unsteadyTextBox.childNodes[1].style.top="-5.5px",this.OpMeasure.unsteadyTextBox.setAttribute("mobile","down")):e.y>e.x/2&&e.y<-e.x/2?(this.OpMeasure.unsteadyTextBox.childNodes[1].style.left="calc(100% - 4px)",this.OpMeasure.unsteadyTextBox.childNodes[1].style.top="calc(50% - 5.5px)",this.OpMeasure.unsteadyTextBox.setAttribute("mobile","right")):e.y-e.x/2&&(this.OpMeasure.unsteadyTextBox.childNodes[1].style.left="-5.5px",this.OpMeasure.unsteadyTextBox.childNodes[1].style.top="calc(50% - 5.5px)",this.OpMeasure.unsteadyTextBox.setAttribute("mobile","left"));for(var s=0;sAe.INFOTYPE.MEASURENOTICEBEGIN&&(this.OpMeasure.InfoType=Ae.INFOTYPE.MEASURENOTICEBEGIN);var o,s,e=new THREE.Plane;if(this.lineAngleInfo.firstLineInfo.type==r.type)a=this.getLineStartEndPoints(this.lineAngleInfo.firstLineInfo),o=this.getLineStartEndPoints(r);else{"line"==this.lineAngleInfo.firstLineInfo.type?(a=this.getLineStartEndPoints(this.lineAngleInfo.firstLineInfo),(e=new THREE.Plane).setFromNormalAndCoplanarPoint(r.worldNormal,r.worldOrigin),s=r.intersect):"plane"==this.lineAngleInfo.firstLineInfo.type&&(a=this.getLineStartEndPoints(r),e.setFromNormalAndCoplanarPoint(this.lineAngleInfo.firstLineInfo.worldNormal,this.lineAngleInfo.firstLineInfo.worldOrigin),s=this.lineAngleInfo.firstLineInfo.intersect);var a,t=this.intersectLine(a.start,a.end,e);if(!t)return void("line"==r.type?this.OpMeasure.PostInfo("bodyAngle"==this.measureType?Ae.INFOTYPE.TWOBODYPARALLEL:Ae.INFOTYPE.LINEPARALLELPLANE):"plane"==r.type&&this.OpMeasure.PostInfo("bodyAngle"==this.measureType?Ae.INFOTYPE.TWOBODYPARALLEL:Ae.INFOTYPE.PLANEPARALLELLINE));var i=new THREE.Vector3,l=(e.projectPoint(a.start,i),new THREE.Vector3);e.projectPoint(a.end,l),o=i.distanceTo(l)<1e-5?{start:t,end:s}:i.distanceTo(t)<1e-4?{start:t,end:l}:{start:t,end:i}}a&&o&&((e=(new THREE.Vector3).subVectors(a.end,a.start)).normalize(),(s=(new THREE.Vector3).subVectors(o.end,o.start)).normalize(),l=e.dot(s),1-Math.abs(l)<1e-6?(this.lineAngleInfo.preSelLineInfo=null,this.lineAngleInfo.preSelLineObj&&(this.OpMeasure.rootObject.remove(this.lineAngleInfo.preSelLineObj),this.lineAngleInfo.preSelLineObj=null),this.OpMeasure.PostInfo("bodyAngle"==this.measureType?Ae.INFOTYPE.TWOBODYPARALLEL:Ae.INFOTYPE.LINEPARALLEL)):(this.lineAngleInfo.secondLineInfo=r,this.lineAngleInfo.firstLineInfo.start=a.start.clone(),this.lineAngleInfo.firstLineInfo.end=a.end.clone(),this.lineAngleInfo.secondLineInfo.start=o.start.clone(),this.lineAngleInfo.secondLineInfo.end=o.end.clone(),this.lineAngleInfo.preSelLineInfo=null,this.lineAngleInfo.preSelLineObj&&(this.OpMeasure.rootObject.remove(this.lineAngleInfo.preSelLineObj),this.lineAngleInfo.preSelLineObj=null)))}}else this.OpMeasure.PostInfo(Ae.INFOTYPE.NOTFACE);else-1!=n.indexOf(r.type)||-1==n.indexOf("plane")||"cylinder"!==r.type&&"other"!==r.type?-1!=n.indexOf(r.type)&&(this.lineAngleInfo.firstLineInfo=r,this.OpMeasure.InfoType>Ae.INFOTYPE.MEASURENOTICEBEGIN)&&(this.OpMeasure.InfoType=Ae.INFOTYPE.MEASURENOTICEBEGIN):this.OpMeasure.PostInfo(Ae.INFOTYPE.NOTFACE);else this.lineAngleInfo.preSelLineObj&&(this.OpMeasure.rootObject.remove(this.lineAngleInfo.preSelLineObj),this.lineAngleInfo.preSelLineObj=null,this.lineAngleInfo.preSelLineInfo=null)}}else this.lineAngleInfo.preSelLineObj&&(this.OpMeasure.rootObject.remove(this.lineAngleInfo.preSelLineObj),this.lineAngleInfo.preSelLineObj=null,this.lineAngleInfo.preSelLineInfo=null)}},o.prototype.updateLineAngleScene=function(e){var t;"LineAngle"!==this.measureType&&"LineFaceAngle"!==this.measureType&&"angle"!==this.measureType||(this.lineAngleInfo.firstLineObj&&this.lineAngleInfo.secondLineObj?this.lineAngleInfo.preSelLineObj&&(this.OpMeasure.rootObject.remove(this.lineAngleInfo.preSelLineObj),this.lineAngleInfo.preSelLineObj=null,this.lineAngleInfo.preSelLineInfo=null):!(!e||"true"!==e.toLowerCase())?this.lineAngleInfo.preSelLineInfo&&!this.lineAngleInfo.preSelLineObj&&("line"==this.lineAngleInfo.preSelLineInfo.type&&(t=this.createLine(this.lineAngleInfo.preSelLineInfo,!0)),t="plane"==this.lineAngleInfo.preSelLineInfo.type?this.createFace(this.lineAngleInfo.preSelLineInfo,!0):t)&&(this.OpMeasure.rootObject.add(t),this.lineAngleInfo.preSelLineObj=t):(this.lineAngleInfo.firstLineInfo&&!this.lineAngleInfo.firstLineObj&&("line"==this.lineAngleInfo.firstLineInfo.type&&(t=this.createLine(this.lineAngleInfo.firstLineInfo,!1)),"plane"==this.lineAngleInfo.firstLineInfo.type&&(t=this.createFace(this.lineAngleInfo.firstLineInfo,!1)),t="helpline"==this.lineAngleInfo.firstLineInfo.type?this.createLineMesh2(this.lineAngleInfo.firstLineInfo.start,this.lineAngleInfo.firstLineInfo.end,this.materialLine,1):t)&&(this.OpMeasure.rootObject.add(t),this.lineAngleInfo.firstLineObj=t),this.lineAngleInfo.secondLineInfo&&!this.lineAngleInfo.secondLineObj&&("line"==this.lineAngleInfo.secondLineInfo.type&&(t=this.createLine(this.lineAngleInfo.secondLineInfo,!1)),"plane"==this.lineAngleInfo.secondLineInfo.type&&(t=this.createFace(this.lineAngleInfo.secondLineInfo,!1)),t="helpline"==this.lineAngleInfo.secondLineInfo.type?this.createLineMesh2(this.lineAngleInfo.secondLineInfo.start,this.lineAngleInfo.secondLineInfo.end,this.materialLine,1):t)&&(this.OpMeasure.rootObject.add(t),this.lineAngleInfo.secondLineObj=t),this.lineAngleInfo.firstHelpPointInfo&&!this.lineAngleInfo.firstHelpPointobj&&(t=this.createPointMesh(this.lineAngleInfo.firstHelpPointInfo.point,this.materialPoint,this.POINTSIZE))&&(this.OpMeasure.rootObject.add(t),this.lineAngleInfo.firstHelpPointobj=t),this.lineAngleInfo.secHelpPointInfo&&!this.lineAngleInfo.secHelpPointobj&&(t=this.createPointMesh(this.lineAngleInfo.secHelpPointInfo.point,this.materialPoint,this.POINTSIZE))&&(this.OpMeasure.rootObject.add(t),this.lineAngleInfo.secHelpPointobj=t),this.lineAngleInfo.thrHelpPointInfo&&!this.lineAngleInfo.thrHelpPointobj&&(this.lineAngleInfo.secHelpPointobj&&(this.OpMeasure.rootObject.remove(this.lineAngleInfo.secHelpPointobj),this.lineAngleInfo.secHelpPointInfo=null),this.lineAngleInfo.firstHelpPointobj)&&(this.OpMeasure.rootObject.remove(this.lineAngleInfo.firstHelpPointobj),this.lineAngleInfo.firstHelpPointInfo=null)))},o.prototype.measurefaceAngle=function(e,t,i){if(""==this.lineAngleInfo.unit&&(this.lineAngleInfo.unit="°"),this.faceInfo.fstSelFaceObj&&this.faceInfo.sndSelFaceObj)this.faceInfo.preSelFaceObj&&(this.OpMeasure.rootObject.remove(this.faceInfo.preSelFaceObj),this.faceInfo.preSelFaceObj=null,this.faceInfo.preSelFaceInfo=null);else{this.viewer;var n=this.doRaycasterPick(e,t,!1);if(n){for(var r=0;rAe.INFOTYPE.MEASURENOTICEBEGIN&&(this.OpMeasure.InfoType=Ae.INFOTYPE.MEASURENOTICEBEGIN),this.faceInfo.firstFaceInfo)if(this.isTwoTopolInfoTheSame(this.faceInfo.firstFaceInfo,o))this.faceInfo.fstSelFaceObj&&(this.OpMeasure.rootObject.remove(this.faceInfo.fstSelFaceObj),this.faceInfo.fstSelFaceObj=null,this.faceInfo.firstFaceInfo=null);else{var s=this.faceInfo.firstFaceInfo.worldNormal.clone(),a=o.worldNormal.clone(),l=(s.normalize(),a.normalize(),s.dot(a)),s=null,a=null;if(Math.abs(Math.abs(l)-1)<1e-5)return this.OpMeasure.PostInfo("bodyAngle"==this.measureType?Ae.INFOTYPE.TWOBODYPARALLEL:Ae.INFOTYPE.PLANEPARALLEL),this.faceInfo.preSelFaceInfo=null,void(this.faceInfo.preSelFaceObj&&(this.OpMeasure.rootObject.remove(this.faceInfo.preSelFaceObj),this.faceInfo.preSelFaceObj=null));this.faceInfo.secondFaceInfo=o,this.faceInfo.sndIntersect=o.intersect,this.faceInfo.preSelFaceInfo=null,this.faceInfo.preSelFaceObj&&(this.OpMeasure.rootObject.remove(this.faceInfo.preSelFaceObj),this.faceInfo.preSelFaceObj=null)}else this.faceInfo.firstFaceInfo=o,this.faceInfo.fstIntersect=o.intersect,this.faceInfo.preSelFaceInfo=null,this.faceInfo.preSelFaceObj&&(this.OpMeasure.rootObject.remove(this.faceInfo.preSelFaceObj),this.faceInfo.preSelFaceObj=null);return}r++}1==i&&this.faceInfo.preSelFaceInfo&&(this.faceInfo.preSelFaceInfo=null,this.faceInfo.preSelFaceObj)&&(this.OpMeasure.rootObject.remove(this.faceInfo.preSelFaceObj),this.faceInfo.preSelFaceObj=null)}else this.faceInfo.preSelFaceObj&&(this.OpMeasure.rootObject.remove(this.faceInfo.preSelFaceObj),this.faceInfo.preSelFaceObj=null,this.faceInfo.preSelFaceInfo=null),this.viewer.outlinePass&&this.viewer.outlinePass.enabled&&(this.viewer.outlinePass.tempSelectedObjects.length=0)}},o.prototype.updateFaceAngleScene=function(e){var t,i,n,r,o;"faceAngle"===this.measureType&&(this.faceInfo.fstSelFaceObj&&this.faceInfo.sndSelFaceObj?this.faceInfo.preSelFaceObj&&(this.OpMeasure.rootObject.remove(this.faceInfo.preSelFaceObj),this.faceInfo.preSelFaceObj=null,this.faceInfo.preSelFaceInfo=null):(!(!e||"true"!==e.toLowerCase())?this.faceInfo.preSelFaceInfo&&!this.faceInfo.preSelFaceObj&&(t=this.createFace(this.faceInfo.preSelFaceInfo,!0))&&((e=[]).push(t),this.viewer.outlinePass&&this.viewer.outlinePass.enabled&&(this.viewer.outlinePass.tempSelectedObjects=e),this.OpMeasure.rootObject.add(t),this.faceInfo.preSelFaceObj=t):(this.faceInfo.firstFaceInfo&&!this.faceInfo.fstSelFaceObj&&(t=this.createFace(this.faceInfo.firstFaceInfo,!1))&&(this.OpMeasure.rootObject.add(t),this.faceInfo.fstSelFaceObj=t),this.faceInfo.secondFaceInfo&&!this.faceInfo.sndSelFaceObj&&(t=this.createFace(this.faceInfo.secondFaceInfo,!1))&&(this.OpMeasure.rootObject.add(t),this.faceInfo.sndSelFaceObj=t)),this.faceInfo.fstIntersect&&this.faceInfo.sndIntersect&&(e=this.faceInfo.fstIntersect,t=this.faceInfo.sndIntersect,this.lineAngleInfo.firstLineInfo=this.faceInfo.firstFaceInfo,this.lineAngleInfo.secondLineInfo=this.faceInfo.secondFaceInfo,i=this.faceInfo.firstFaceInfo.worldNormal.clone(),n=this.faceInfo.secondFaceInfo.worldNormal.clone(),i.normalize(),n.normalize(),r=new THREE.Vector3,o=new THREE.Vector3,this.getIntersectLineOfTwoPlane(e,i,t,n,r,o),this.lineAngleInfo.firstLineInfo.start=e.clone(),this.lineAngleInfo.firstLineInfo.end=r.clone(),this.getIntersectLineOfTwoPlane(t,n,e,i,r,o),this.lineAngleInfo.secondLineInfo.start=t.clone(),this.lineAngleInfo.secondLineInfo.end=r.clone())))},o.prototype.measureBodyAngle=function(e,t,i,n){if(""==this.lineAngleInfo.unit&&(this.lineAngleInfo.unit="°"),""==this.faceInfo.unit&&(this.faceInfo.unit="°"),this.lineAngleInfo.firstLineObj&&this.lineAngleInfo.secondLineObj)this.lineAngleInfo.preSelLineObj&&(this.OpMeasure.rootObject.remove(this.lineAngleInfo.preSelLineObj),this.lineAngleInfo.preSelLineObj=null,this.lineAngleInfo.preSelLineInfo=null);else{var r=this.viewer,e=this.doRaycasterPick(e,t,!0);if(e&&0!=e.length){t=null;if(t=r.ndsModel||e[0].object instanceof THREE.Line||e[0].object instanceof THREE.LineSegments?e[0]:t){r=this.getSelectInfoFromIntersect(t);if(r)if("bodyAngle"==this.measureType&&-1==n.indexOf(r.type))this.lineAngleInfo.preSelLineInfo=null,this.lineAngleInfo.preSelLineObj&&(this.OpMeasure.rootObject.remove(this.lineAngleInfo.preSelLineObj),this.lineAngleInfo.preSelLineObj=null);else if("line"!=r.type||this.Bline(r))if(1==i)this.isTwoTopolInfoTheSame(this.lineAngleInfo.preSelLineInfo,r)||-1!=n.indexOf(r.type)&&(this.lineAngleInfo.preSelLineInfo=r,this.lineAngleInfo.preSelLineObj)&&(this.OpMeasure.rootObject.remove(this.lineAngleInfo.preSelLineObj),this.lineAngleInfo.preSelLineObj=null);else if(this.lineAngleInfo.preSelLineInfo=null,this.lineAngleInfo.preSelLineObj&&(this.OpMeasure.rootObject.remove(this.lineAngleInfo.preSelLineObj),this.lineAngleInfo.preSelLineObj=null),this.lineAngleInfo.firstLineInfo){if(this.isTwoTopolInfoTheSame(this.lineAngleInfo.firstLineInfo,r))this.lineAngleInfo.firstLineObj&&(this.OpMeasure.rootObject.remove(this.lineAngleInfo.firstLineObj),this.lineAngleInfo.firstLineObj=null,this.lineAngleInfo.firstLineInfo=null);else if(-1==n.indexOf(r.type)&&-1!=n.indexOf("plane")&&"other"===r.type)this.OpMeasure.PostInfo(Ae.INFOTYPE.NOTFACE);else if(-1!=n.indexOf(r.type)){this.OpMeasure.InfoType>Ae.INFOTYPE.MEASURENOTICEBEGIN&&(this.OpMeasure.InfoType=Ae.INFOTYPE.MEASURENOTICEBEGIN);var o,e=new THREE.Plane;if("line"!=this.lineAngleInfo.firstLineInfo.type&&"cylinder"!=this.lineAngleInfo.firstLineInfo.type&&"cone"!=this.lineAngleInfo.firstLineInfo.type||"line"!=r.type&&"cylinder"!=r.type&&"cone"!=r.type){if("plane"==this.lineAngleInfo.firstLineInfo.type&&"plane"==r.type)return this.lineAngleInfo.twoPlane=!0,t=this.lineAngleInfo.firstLineInfo.worldNormal.clone(),i=r.worldNormal.clone(),t.normalize(),i.normalize(),t=t.dot(i),Math.abs(Math.abs(t)-1)<1e-5?(this.OpMeasure.PostInfo(Ae.INFOTYPE.TWOBODYPARALLEL),void(this.lineAngleInfo.twoPlane=!1)):(this.faceInfo.firstFaceInfo=this.lineAngleInfo.firstLineInfo,this.faceInfo.fstIntersect=this.lineAngleInfo.firstLineInfo.intersect,this.faceInfo.secondFaceInfo=r,this.faceInfo.sndIntersect=r.intersect,void(this.lineAngleInfo.secondLineInfo=r));"line"!=this.lineAngleInfo.firstLineInfo.type&&"cylinder"!=this.lineAngleInfo.firstLineInfo.type&&"cone"!=this.lineAngleInfo.firstLineInfo.type||"plane"!=r.type?"plane"!=this.lineAngleInfo.firstLineInfo.type||"line"!=r.type&&"cylinder"!=r.type&&"cone"!=r.type||(s=this.getLineStartEndPoints(r),e.setFromNormalAndCoplanarPoint(this.lineAngleInfo.firstLineInfo.worldNormal,this.lineAngleInfo.firstLineInfo.worldOrigin),o=this.lineAngleInfo.firstLineInfo.intersect):(s=this.getLineStartEndPoints(this.lineAngleInfo.firstLineInfo),(e=new THREE.Plane).setFromNormalAndCoplanarPoint(r.worldNormal,r.worldOrigin),o=r.intersect);var s,i=this.intersectLine(s.start,s.end,e);if(!i)return void("line"==r.type||"cylinder"==r.type||"cone"==r.type?this.OpMeasure.PostInfo("bodyAngle"==this.measureType?Ae.INFOTYPE.TWOBODYPARALLEL:Ae.INFOTYPE.LINEPARALLELPLANE):"plane"==r.type&&this.OpMeasure.PostInfo("bodyAngle"==this.measureType?Ae.INFOTYPE.TWOBODYPARALLEL:Ae.INFOTYPE.PLANEPARALLELLINE));var t=new THREE.Vector3,a=(e.projectPoint(s.start,t),new THREE.Vector3);e.projectPoint(s.end,a),o=t.distanceTo(a)<1e-5?{start:i,end:o}:t.distanceTo(i)<1e-4?{start:i,end:a}:{start:i,end:t}}else s=this.getLineStartEndPoints(this.lineAngleInfo.firstLineInfo),o=this.getLineStartEndPoints(r);s&&o&&((e=(new THREE.Vector3).subVectors(s.end,s.start)).normalize(),(a=(new THREE.Vector3).subVectors(o.end,o.start)).normalize(),i=e.dot(a),1-Math.abs(i)<1e-6?(this.lineAngleInfo.preSelLineInfo=null,this.lineAngleInfo.preSelLineObj&&(this.OpMeasure.rootObject.remove(this.lineAngleInfo.preSelLineObj),this.lineAngleInfo.preSelLineObj=null),"line"==this.lineAngleInfo.firstLineInfo.type&&"line"==r.type||"line"==this.lineAngleInfo.firstLineInfo.type&&"line"==r.type||"cylinder"!=this.lineAngleInfo.firstLineInfo.type&&"cone"!=this.lineAngleInfo.firstLineInfo.type||"cylinder"!=r.type&&"cone"!=r.type?this.OpMeasure.PostInfo("bodyAngle"==this.measureType?Ae.INFOTYPE.TWOBODYPARALLEL:Ae.INFOTYPE.LINEPARALLEL):this.OpMeasure.PostInfo("bodyAngle"==this.measureType?Ae.INFOTYPE.TWOBODYPARALLEL:Ae.INFOTYPE.AXISNOPARALLEL)):(this.lineAngleInfo.secondLineInfo=r,this.lineAngleInfo.firstLineInfo.start=s.start.clone(),this.lineAngleInfo.firstLineInfo.end=s.end.clone(),this.lineAngleInfo.secondLineInfo.start=o.start.clone(),this.lineAngleInfo.secondLineInfo.end=o.end.clone(),this.lineAngleInfo.preSelLineInfo=null,this.lineAngleInfo.preSelLineObj&&(this.OpMeasure.rootObject.remove(this.lineAngleInfo.preSelLineObj),this.lineAngleInfo.preSelLineObj=null)))}}else-1==n.indexOf(r.type)&&-1!=n.indexOf("plane")&&"other"===r.type?this.OpMeasure.PostInfo(Ae.INFOTYPE.NOTFACE):-1!=n.indexOf(r.type)&&(this.lineAngleInfo.firstLineInfo=r,this.OpMeasure.InfoType>Ae.INFOTYPE.MEASURENOTICEBEGIN)&&(this.OpMeasure.InfoType=Ae.INFOTYPE.MEASURENOTICEBEGIN);else this.lineAngleInfo.preSelLineObj&&(this.OpMeasure.rootObject.remove(this.lineAngleInfo.preSelLineObj),this.lineAngleInfo.preSelLineObj=null,this.lineAngleInfo.preSelLineInfo=null)}}else this.lineAngleInfo.preSelLineObj&&(this.OpMeasure.rootObject.remove(this.lineAngleInfo.preSelLineObj),this.lineAngleInfo.preSelLineObj=null,this.lineAngleInfo.preSelLineInfo=null)}},o.prototype.updateBodyAngleScene=function(e){var t,i,n,r,o;"bodyAngle"===this.measureType&&(this.lineAngleInfo.firstLineObj&&this.lineAngleInfo.secondLineObj?this.lineAngleInfo.preSelLineObj&&(this.OpMeasure.rootObject.remove(this.lineAngleInfo.preSelLineObj),this.lineAngleInfo.preSelLineObj=null,this.lineAngleInfo.preSelLineInfo=null):(!(!e||"true"!==e.toLowerCase())?this.lineAngleInfo.preSelLineInfo&&!this.lineAngleInfo.preSelLineObj&&("line"==this.lineAngleInfo.preSelLineInfo.type&&(t=this.createLine(this.lineAngleInfo.preSelLineInfo,!0)),"plane"==this.lineAngleInfo.preSelLineInfo.type&&(t=this.createFace(this.lineAngleInfo.preSelLineInfo,!0)),"cylinder"==this.lineAngleInfo.preSelLineInfo.type&&(t=this.createFace(this.lineAngleInfo.preSelLineInfo,!0)),t="cone"==this.lineAngleInfo.preSelLineInfo.type?this.createFace(this.lineAngleInfo.preSelLineInfo,!0):t)&&(this.OpMeasure.rootObject.add(t),this.lineAngleInfo.preSelLineObj=t):(this.lineAngleInfo.firstLineInfo&&!this.lineAngleInfo.firstLineObj&&("line"==this.lineAngleInfo.firstLineInfo.type&&(t=this.createLine(this.lineAngleInfo.firstLineInfo,!1)),"plane"==this.lineAngleInfo.firstLineInfo.type&&(t=this.createFace(this.lineAngleInfo.firstLineInfo,!1)),"cylinder"==this.lineAngleInfo.firstLineInfo.type&&(t=this.createFace(this.lineAngleInfo.firstLineInfo,!0)),t="cone"==this.lineAngleInfo.firstLineInfo.type?this.createFace(this.lineAngleInfo.firstLineInfo,!0):t)&&(this.OpMeasure.rootObject.add(t),this.lineAngleInfo.firstLineObj=t),this.lineAngleInfo.secondLineInfo&&!this.lineAngleInfo.secondLineObj&&("line"==this.lineAngleInfo.secondLineInfo.type&&(t=this.createLine(this.lineAngleInfo.secondLineInfo,!1)),"plane"==this.lineAngleInfo.secondLineInfo.type&&(t=this.createFace(this.lineAngleInfo.secondLineInfo,!1),this.faceInfo.fstSelFaceObj=this.lineAngleInfo.firstLineObj,this.faceInfo.sndSelFaceObj=t),"cylinder"==this.lineAngleInfo.secondLineInfo.type&&(t=this.createFace(this.lineAngleInfo.secondLineInfo,!0)),t="cone"==this.lineAngleInfo.secondLineInfo.type?this.createFace(this.lineAngleInfo.secondLineInfo,!0):t)&&(this.OpMeasure.rootObject.add(t),this.lineAngleInfo.secondLineObj=t)),this.faceInfo.fstIntersect&&this.faceInfo.sndIntersect&&(e=this.faceInfo.fstIntersect,t=this.faceInfo.sndIntersect,this.lineAngleInfo.firstLineInfo=this.faceInfo.firstFaceInfo,this.lineAngleInfo.secondLineInfo=this.faceInfo.secondFaceInfo,i=this.faceInfo.firstFaceInfo.worldNormal.clone(),n=this.faceInfo.secondFaceInfo.worldNormal.clone(),i.normalize(),n.normalize(),r=new THREE.Vector3,o=new THREE.Vector3,this.getIntersectLineOfTwoPlane(e,i,t,n,r,o),this.lineAngleInfo.firstLineInfo.start=e.clone(),this.lineAngleInfo.firstLineInfo.end=r.clone(),this.getIntersectLineOfTwoPlane(t,n,e,i,r,o),this.lineAngleInfo.secondLineInfo.start=t.clone(),this.lineAngleInfo.secondLineInfo.end=r.clone())))},(hi.prototype=Object.create(Me.prototype)).OperatorStart=function(e){if(this.measureType=e,!this.viewer.GeomEmpty)switch(this.measureType){case"TotalArea":for(var t=0;tY:"+parseFloat(this.snappedPoint.y.toFixed(4).toString()),n=this.snappedPoint.clone(),this.getAndShowTextBox(n.clone(),i,this.coordinatediv),this.coordinatedivtextPos=n,this.coordinatedivdims=i):(r=(a=this.viewer).renderer.domElement,o=a.renderer.getPixelRatio(),s=new THREE.Raycaster,a.camera.setCastRay(s,(e+l)*o/r.width*2-1,2*-((t+l)*o/r.height)+1),a=new THREE.Plane(new THREE.Vector3(0,0,-1),0),e=new THREE.Vector3,s.ray.intersectPlane(a,e),e&&(i="X:"+parseFloat(e.x.toFixed(4).toString())+"
Y:"+parseFloat(e.y.toFixed(4).toString()),n=e.clone(),this.getAndShowTextBox(n.clone(),i,this.coordinatediv),this.coordinatedivtextPos=n,this.coordinatedivdims=i))},ui.prototype.onLMouseClick=function(e,t,i){var n,r,o,s,a,l,d=document.createElement("div"),c=(d.className="mearesult",this.viewer.container.appendChild(d),48),h=(Se.isMobileDevice()&&this.viewer.is2DModel&&(c=0),new THREE.Vector3),t=(this.snappedPoint?(n="X:"+parseFloat(this.snappedPoint.x.toFixed(4).toString())+"
Y:"+parseFloat(this.snappedPoint.y.toFixed(4).toString()),r=this.snappedPoint.clone(),this.getAndShowTextBox(r.clone(),n,d),h.copy(this.snappedPoint),this.snappedPoint=null):(o=(l=this.viewer).renderer.domElement,s=l.renderer.getPixelRatio(),a=new THREE.Raycaster,l.camera.setCastRay(a,(e+c)*s/o.width*2-1,2*-((t+c)*s/o.height)+1),l=new THREE.Plane(new THREE.Vector3(0,0,-1),0),a.ray.intersectPlane(l,h),h&&(n="X:"+parseFloat(h.x.toFixed(4).toString())+"
Y:"+parseFloat(h.y.toFixed(4).toString()),r=h.clone(),this.getAndShowTextBox(r.clone(),n,d))),h&&(e=this.createPointMesh(h,this.materialPoint,10*this.POINTSIZE))&&this.OpMeasure.rootObject.add(e),{});t.dimString=n,t.textPos=r,t.textBox=d,t.textBox.setAttribute("type","coordinate"),t.textBox.setAttribute("dimString",n),this.OpMeasure.boxInfos.push(t),Se.isMobileDevice()&&this.ChangeMeasureFlag(),Re.enableBroadcast&&Re.broadcastMajor&&this.OpMeasure.addmeasureTimes(),this.OpMeasure.measureEnd()};function mi(){this.start=new THREE.Vector2,this.end=new THREE.Vector2,this.p1=-1,this.p2=-1}function gi(){this.edgeIndex=-1,this.Pos=-1}function vi(){this.dimString="",this.textBox=null,this.textPos=null,this.lineobj=null,this.start=new THREE.Vector2,this.end=new THREE.Vector2,this.lineInfo=null,this.LineSegments=[],this.intersectMouse=null,this.intersectPos=[]}(pi.prototype=Object.create(Me.prototype)).OperatorStart=function(e){var t,i,n,r;this.measureType=e,Se.isMobileDevice()&&this.viewer.is2DModel&&(t=this,Se.getLanguage(),this.lineargaugediv||(this.lineargaugediv=document.createElement("div"),this.lineargaugediv.className="tc-box ts-tc",(e=document.createElement("p")).innerHTML=Se.translateString("MEASURE_SELECTDIR"),(i=document.createElement("div")).className="ts-tcCnt",i.appendChild(e),(e=document.createElement("span")).innerHTML=Se.translateString("MEASURE_Horizontal"),e.onclick=function(){t.distanceInfo.XorY=0,t.lineargaugediv.style.display="none",t.shadowdiv.style.display="none",t.ShowLineargaugeDimension(null,!0,t.distanceInfo.XorY),t.OpMeasure.PostInfo(Ae.INFOTYPE.FIRSTPOINT),Re.enableBroadcast&&Re.broadcastMajor&&t.viewer.dispatchEvent({type:"broadcastEvent"})},(n=document.createElement("span")).innerHTML=Se.translateString("MEASURE_Vertical"),n.onclick=function(){t.distanceInfo.XorY=1,t.lineargaugediv.style.display="none",t.shadowdiv.style.display="none",t.ShowLineargaugeDimension(null,!0,t.distanceInfo.XorY),t.OpMeasure.PostInfo(Ae.INFOTYPE.FIRSTPOINT),Re.enableBroadcast&&Re.broadcastMajor&&t.viewer.dispatchEvent({type:"broadcastEvent"})},(r=document.createElement("div")).className="clearfix ts-tcBtn ts-tcBtn02",r.appendChild(e),r.appendChild(n),this.lineargaugediv.appendChild(i),this.lineargaugediv.appendChild(r),this.lineargaugediv.style.display="none",this.lineargaugediv.style.zIndex=10,this.viewer.container.appendChild(this.lineargaugediv),this.shadowdiv=document.createElement("div"),this.shadowdiv.className="shadowvtc",this.shadowdiv.style.display="none",this.viewer.container.appendChild(this.shadowdiv))),this.OpMeasure.PostInfo(Ae.INFOTYPE.FIRSTPOINT)},pi.prototype.onNMouseMove=function(e,t){var i,n,r,o,s,a=new THREE.Vector3(e,t,0);this.distanceInfo.firstSelObj&&this.distanceInfo.secondSelObj&&!Se.isMobileDevice()?(i=this.distanceInfo.firstPoint.clone(),n=this.distanceInfo.secondPoint.clone(),a&&(r=new THREE.Plane(new THREE.Vector3(0,0,-1),0),r=this.clientCoordToModelCoordOnPlane(a.x,a.y,r))&&(this.distanceInfo.mousePos||(this.distanceInfo.mousePos=r.clone()),s=o=!1,(o=this.distanceInfo.mousePos.yMath.min(i.y,n.y)&&this.distanceInfo.mousePos.xMath.min(i.x,n.x)?!0:o)!=(s=r.yMath.min(i.y,n.y)&&r.xMath.min(i.x,n.x)?!0:s)&&(i.yMath.min(this.distanceInfo.mousePos.y,r.y)||n.yMath.min(this.distanceInfo.mousePos.y,r.y)?this.distanceInfo.XorY=0:(i.xMath.min(this.distanceInfo.mousePos.x,r.x)||n.xMath.min(this.distanceInfo.mousePos.x,r.x))&&(this.distanceInfo.XorY=1)),this.distanceInfo.mousePos.set(r.x,r.y,0)),this.ShowLineargaugeDimension(a,!1,this.distanceInfo.XorY)):this.previewSnappedPoint(e,t,!0)},pi.prototype.onLMouseClick=function(e,t,i){var n=new THREE.Vector3(e,t,0);this.distanceInfo.firstSelObj&&this.distanceInfo.secondSelObj?(this.ShowLineargaugeDimension(n,!0,this.distanceInfo.XorY),this.OpMeasure.PostInfo(Ae.INFOTYPE.FIRSTPOINT)):(this.PtToPtMeasure(e,t,!1),this.updatePtToPtScene(),this.distanceInfo.firstSelObj&&this.distanceInfo.secondSelObj&&Se.isMobileDevice()&&(this.lineargaugediv.style.display="block",this.shadowdiv.style.display="block"))},pi.prototype.PtToPtMeasure=function(e,t,i){if(null!=this.snappedPoint)null==this.distanceInfo.firstPoint?this.distanceInfo.firstPoint=this.snappedPoint.clone():this.distanceInfo.secondPoint=this.snappedPoint.clone(),this.snappedPoint=null;else{var n=this.getIntersectsByPriorityOfLine(e,t);if(n&&0=n&&i.intersectMouse.Pos<=i.intersectPos[o].Pos){r=i.intersectPos[o].Pos;break}n=i.intersectPos[o].Pos}var s=i.LineSegments[0].start.distanceTo(i.LineSegments[0].end),a=i.LineSegments[0].end.clone().sub(i.LineSegments[0].start).normalize(),l=((p=[])[0]=i.LineSegments[0].start.x+n*s*a.x,p[1]=i.LineSegments[0].start.y+n*s*a.y,p[2]=0,p[3]=i.LineSegments[0].start.x+r*s*a.x,p[4]=i.LineSegments[0].start.y+r*s*a.y,p[5]=0,t==R.lineContoursInfo.Contours.length-1&&(e=new THREE.Vector3(p[3],p[4],p[5])),R.createContour(p));R.OpMeasure.rootObject.add(l),i.lineobj=l,i.textPos=new THREE.Vector3((p[0]+p[3])/2,(p[1]+p[4])/2,0),i.dimString=(r-n)*s}else{for(var n=0,d=0,r=i.LineSegments.length-1,c=1,o=0;on||i.intersectMouse.edgeIndex==n&&i.intersectMouse.Pos>d)&&(i.intersectMouse.edgeIndex=n&&i.intersectMouse.Pos<=i.intersectPos[o].Pos){r=i.intersectPos[o].Pos;break}n=i.intersectPos[o].Pos}var s=i.LineSegments[0].start.distanceTo(i.LineSegments[0].end),a=i.LineSegments[0].end.clone().sub(i.LineSegments[0].start).normalize(),l=((p=[])[0]=i.LineSegments[0].start.x+n*s*a.x,p[1]=i.LineSegments[0].start.y+n*s*a.y,p[2]=0,p[3]=i.LineSegments[0].start.x+r*s*a.x,p[4]=i.LineSegments[0].start.y+r*s*a.y,p[5]=0,t==this.lineContoursInfo.Contours.length-1&&(e=new THREE.Vector3(p[3],p[4],p[5])),this.createContour(p));this.OpMeasure.rootObject.add(l),i.lineobj=l,i.textPos=new THREE.Vector3((p[0]+p[3])/2,(p[1]+p[4])/2,0),i.dimString=(r-n)*s}else{for(var n=0,d=0,r=i.LineSegments.length-1,c=1,o=0;on||i.intersectMouse.edgeIndex==n&&i.intersectMouse.Pos>d)&&(i.intersectMouse.edgeIndexP.edgeIndex){x.intersectPos.splice(R,0,P),C=!0;break}if(x.intersectPos[R].edgeIndex==P.edgeIndex&&x.intersectPos[R].Pos>P.Pos){x.intersectPos.splice(R,0,P),C=!0;break}}C||x.intersectPos.push(P);var O=new gi;O.edgeIndex=l,O.Pos=_.s;for(C=!1,R=0;RO.edgeIndex){B.intersectPos.splice(R,0,O),C=!0;break}if(B.intersectPos[R].edgeIndex==O.edgeIndex&&B.intersectPos[R].Pos>O.Pos){B.intersectPos.splice(R,0,O),C=!0;break}}C||B.intersectPos.push(O),N=!0}}}E=y=null}if(N){e&&(this.lineContoursInfo.divPos=e);d=this.createLine(this.lineContoursInfo.preSelLineInfo,!1);this.OpMeasure.rootObject.add(d),x.intersectMouse=I,x.dimString=this.lineContoursInfo.preSelLineInfo.length,x.lineobj=d,x.lineInfo=this.lineContoursInfo.preSelLineInfo;(L=document.createElement("div")).className="mearesult",this.viewer.container.appendChild(L),x.textBox=L;var L,D,c=x.lineInfo.geometry;if((D=x.lineInfo.indexRange.concat())[0]+=c.drawRange.start/2,D[1]+=c.drawRange.start/2,c.isBufferGeometry){h=c.index,u=c.attributes.position.array;if(null!=h)for(p=h.array,f=0,m=M=D[0],g=w=D[1];m<=g;m++,f+=1){var H,v=p[2*m],A=p[2*m+1],y=new THREE.Vector3,E=new THREE.Vector3;y.fromArray(u,3*v),E.fromArray(u,3*A),y.x==E.x&&y.y==E.y?(f--,E=y=null):(y.applyMatrix4(x.lineInfo.matrixWorld),E.applyMatrix4(x.lineInfo.matrixWorld),(H=new mi).start.set(y.x,y.y),H.end.set(E.x,E.y),x.LineSegments.push(H),E=y=null)}}x.start.set(this.edgeInfo.startPos.x,this.edgeInfo.startPos.y),x.end.set(this.edgeInfo.endPos.x,this.edgeInfo.endPos.y),x.textPos=new THREE.Vector3((x.start.x+x.end.x)/2,(x.start.y+x.end.y)/2,0),this.lineContoursInfo.Contours.push(x),this.lineContoursInfo.start.copy(x.start),this.lineContoursInfo.end.copy(x.end),this.OpMeasure.PostInfo(Ae.INFOTYPE.CIRCLEANDLINE)}else this.OpMeasure.PostInfo(Ae.INFOTYPE.NOCONJOINT)}}}this.lineContoursInfo.preSelLineInfo=null}}else this.lineContoursInfo.preSelLineObj&&(this.OpMeasure.rootObject.remove(this.lineContoursInfo.preSelLineObj),this.lineContoursInfo.preSelLineObj=null,this.lineContoursInfo.preSelLineInfo=null),this.OpMeasure.PostInfo(Ae.INFOTYPE.CIRCLEANDLINE)},(s.prototype=Object.create(Me.prototype)).OperatorClear=function(e){this.allowType=[],this.selectProjectPlane=!1,this.matrxTrans=null,this.sectionCross=null,this.projectDirectionXorY=null,this.isBoxMoving=!1},s.prototype.OperatorStart=function(e){this.measureType=e,this.allowType=this.MeasurePostInfo(e,!0,!0),this.selectProjectPlane=!1,this.distanceInfo.projectPlane=null,this.matrxTrans=null,this.sectionCross=null,this.projectDirectionXorY=null,this.isBoxMoving=!1},s.prototype.MeasurePostInfo=function(e,t,i){var n=[];switch(e){case"LmPt2Pt":this.OpMeasure.PostInfo(t?Ae.INFOTYPE.CLICKFIRSTPOINT:Ae.INFOTYPE.CLICKSECONDPOINT),i&&(n=["point"]);break;case"LmPt2Line":this.OpMeasure.PostInfo(t?Ae.INFOTYPE.POINT:Ae.INFOTYPE.LINE),i&&(n=t?["point"]:["line"]);break;case"LmLine2Line":this.OpMeasure.PostInfo(t?Ae.INFOTYPE.FIRSTLINE:Ae.INFOTYPE.SECONDLINE),i&&(n=["line"]);break;case"LmHole2Hole":this.OpMeasure.PostInfo(t?Ae.INFOTYPE.CIRCLE:Ae.INFOTYPE.SECONDCIRCLE),i&&(n=["circle","cylinder"]);break;case"LmAxis2Pt":this.OpMeasure.PostInfo(t?Ae.INFOTYPE.POINT:Ae.INFOTYPE.AXIS),i&&(n=t?["point"]:["circle","cone","cylinder"]);break;case"LmAxis2Line":this.OpMeasure.PostInfo(t?Ae.INFOTYPE.AXIS:Ae.INFOTYPE.LINE),i&&(n=t?["circle","cone","cylinder"]:["line"])}return n},s.prototype.onNMouseMove=function(e,t){var i,n,r,o,s,a=new THREE.Vector3(e,t,0);this.OpMeasure.unsteady?this.changeMeasureDistance(a):this.distanceInfo.firstSelObj&&this.distanceInfo.secondSelObj||this.selectProjectPlane?null==this.distanceInfo.projectPlane?this.selectProjectPlane&&(this.LineargaugeMeasure(e,t,!0,["plane"]),this.updateLineargaugeMeasure(!0,!0)):Se.isMobileDevice()||(this.distanceInfo.projectFstPos&&this.distanceInfo.projectSecPos||(this.distanceInfo.projectFstPos=new THREE.Vector3,this.distanceInfo.projectSecPos=new THREE.Vector3,this.distanceInfo.projectPlane.projectPoint(this.distanceInfo.firstPoint,this.distanceInfo.projectFstPos),this.distanceInfo.projectPlane.projectPoint(this.distanceInfo.secondPoint,this.distanceInfo.projectSecPos),this.distanceInfo.projectFstClnd&&this.OpMeasure.rootObject.remove(this.distanceInfo.projectFstClnd),this.distanceInfo.projectFstClnd=this.createPointMesh(this.distanceInfo.projectFstPos,this.materialProjectPoint,this.POINTSIZE),this.OpMeasure.rootObject.add(this.distanceInfo.projectFstClnd),this.distanceInfo.projectSecClnd&&this.OpMeasure.rootObject.remove(this.distanceInfo.projectSecClnd),this.distanceInfo.projectSecClnd=this.createPointMesh(this.distanceInfo.projectSecPos,this.materialProjectPoint,this.POINTSIZE),this.OpMeasure.rootObject.add(this.distanceInfo.projectSecClnd)),this.matrxTrans||this.lineargaugeRotateOnly(this.distanceInfo.projectPlane),i=this.distanceInfo.projectFstPos.clone(),n=this.distanceInfo.projectSecPos.clone(),this.lineargaugeModelCoord2PlaneCoord(i),this.lineargaugeModelCoord2PlaneCoord(n),a&&(r=this.distanceInfo.projectPlane,r=this.clientCoordToModelCoordOnPlane(a.x,a.y,r),this.lineargaugeModelCoord2PlaneCoord(r),r)&&(this.distanceInfo.mousePos||(this.distanceInfo.mousePos=r.clone()),s=o=!1,(o=this.distanceInfo.mousePos.y+Math.min(i.y,n.y)&&this.distanceInfo.mousePos.x+Math.min(i.x,n.x)?!0:o)!=(s=r.y+Math.min(i.y,n.y)&&r.x+Math.min(i.x,n.x)?!0:s)&&(i.yMath.min(this.distanceInfo.mousePos.y,r.y)||n.yMath.min(this.distanceInfo.mousePos.y,r.y)?this.distanceInfo.XorY=0:(i.xMath.min(this.distanceInfo.mousePos.x,r.x)||n.xMath.min(this.distanceInfo.mousePos.x,r.x))&&(this.distanceInfo.XorY=1)),this.distanceInfo.mousePos.set(r.x,r.y,0)),this.ShowLineargaugeDimension(a,!1,this.distanceInfo.XorY)):(this.LineargaugeMeasure(e,t,!0,this.allowType),this.updateLineargaugeMeasure(!0,!1))},s.prototype.onLMouseClick=function(e,t,i){var n=new THREE.Vector3(e,t,0);this.distanceInfo.firstSelObj&&this.distanceInfo.secondSelObj||this.selectProjectPlane?null==this.distanceInfo.projectPlane?this.selectProjectPlane&&(this.LineargaugeMeasure(e,t,!1,["plane"]),this.updateLineargaugeMeasure(!1,!0),this.distanceInfo.projectPlane)&&this.LineargaugePostNotify():(this.matrxTrans||this.lineargaugeRotateOnly(this.distanceInfo.projectPlane),Se.isMobileDevice()||(this.ShowLineargaugeDimension(n,!0,this.distanceInfo.XorY),this.allowType=this.MeasurePostInfo(this.measureType,!0,!0),this.OpMeasure.measureEnd())):(this.LineargaugeMeasure(e,t,!1,this.allowType),this.updateLineargaugeMeasure(!1,!1))},s.prototype.LineargaugeMeasure=function(e,t,i,n){e=this.doRaycasterPick(e,t,!0);if(e&&0!=e.length)if(i)-1!=n.indexOf("point")&&(this.previewSnappedPoint2(e),null!=this.snappedPoint)?this.LineargaugeClearPreSelect():(t=e[0])&&(i=this.getSelectInfoFromIntersect(t))&&(-1==n.indexOf(i.type)||"line"==i.type&&!this.Bline(i)?this.LineargaugeClearPreSelect():null!=this.distanceInfo.preSelInfo&&this.isTwoTopolInfoTheSame(this.distanceInfo.preSelInfo,i)||(this.distanceInfo.preSelInfo=i,this.distanceInfo.preSelObj&&(this.OpMeasure.rootObject.remove(this.distanceInfo.preSelObj),this.distanceInfo.preSelObj=null)));else if(null!=this.snappedPoint&&-1!=n.indexOf("point"))null==this.distanceInfo.firstSelInfo?(this.distanceInfo.firstPoint=this.snappedPoint.clone(),this.distanceInfo.firstSelInfo={type:"point",point:this.snappedPoint},this.LineargaugePostNotify()):"point"==this.distanceInfo.firstSelInfo.type&&this.distanceInfo.firstSelObj&&this.isTwoPointTheSame(this.distanceInfo.firstSelInfo.point,this.snappedPoint)?(this.LineargaugeClearFirstSelect(),this.LineargaugePostNotify()):(this.distanceInfo.secondPoint=this.snappedPoint.clone(),this.distanceInfo.secondSelInfo={type:"point",point:this.snappedPoint},this.LineargaugePostSelectPorjectPlane()),this.snappedPoint=null;else{t=e[0];if(t){var r,o,s,a,l,d,c,i=this.getSelectInfoFromIntersect(t);if(i){if(-1!=n.indexOf("line")&&"line"==i.type&&!this.Bline(i))return void this.LineargaugeClearPreSelect();if(-1==n.indexOf(i.type)&&-1!=n.indexOf("point")){var e=i.intersect.clone();null==this.distanceInfo.firstSelInfo?(this.distanceInfo.firstPoint=e,this.distanceInfo.firstSelInfo={type:"point",point:e},this.LineargaugePostNotify()):(this.distanceInfo.secondSelInfo={type:"point",point:e},this.distanceInfo.secondPoint=e,this.LineargaugePostSelectPorjectPlane())}else if(-1!=n.indexOf(i.type)){if("plane"==i.type&&this.selectProjectPlane&&null==this.distanceInfo.projectPlane)return e=(new THREE.Plane).setFromNormalAndCoplanarPoint(i.worldNormal,i.worldOrigin),this.distanceInfo.projectPlaneInfo=i,this.LineargaugePostSelectPorjectPlane(e),void this.LineargaugeClearPreSelect();null==this.distanceInfo.firstSelInfo?(this.distanceInfo.firstSelInfo=i,this.LineargaugePostNotify()):this.distanceInfo.firstSelInfo&&(this.isTwoTopolInfoTheSame(this.distanceInfo.firstSelInfo,i)?(this.LineargaugeClearFirstSelect(),this.LineargaugePostNotify()):(e=null,"point"==(r=this.distanceInfo.firstSelInfo).type&&"line"==i.type?(s=this.getLineStartEndPoints(i))&&(d=new THREE.Line3(s.start,s.end).closestPointToPoint(this.distanceInfo.firstPoint,!1),this.distanceInfo.secondPoint=d,this.distanceInfo.secondSelInfo=i,s=(new THREE.Vector3).subVectors(s.start,s.end),e=(new THREE.Plane).setFromNormalAndCoplanarPoint(s,d).normalize()):"line"==r.type&&"line"==i.type?(s=this.getLineStartEndPoints(r),d=this.getLineStartEndPoints(i),s&&d&&((o=(new THREE.Vector3).subVectors(s.end,s.start)).normalize(),(c=(new THREE.Vector3).subVectors(d.end,d.start)).normalize(),a=o.dot(c),l=new THREE.Line3(s.start,s.end).closestPointToPoint(d.start,!1),1-Math.abs(a)<1e-7?(this.distanceInfo.secondSelInfo=i,this.distanceInfo.firstPoint=l,this.distanceInfo.secondPoint=d.start.clone(),e=(new THREE.Plane).setFromNormalAndCoplanarPoint(c,this.distanceInfo.secondPoint).normalize()):this.OpMeasure.PostInfo(Ae.INFOTYPE.LINENOPARALLEL))):"circle"!=r.type&&"cylinder"!=r.type||"circle"!=i.type&&"cylinder"!=i.type?"point"!=r.type||"circle"!=i.type&&"cylinder"!=i.type&&"cone"!=i.type?"circle"!=r.type&&"cylinder"!=r.type&&"cone"!=r.type||"line"!=i.type||(s=this.getLineStartEndPoints(r),d=this.getLineStartEndPoints(i),s&&d&&((o=(new THREE.Vector3).subVectors(s.end,s.start)).normalize(),(c=(new THREE.Vector3).subVectors(d.end,d.start)).normalize(),a=o.dot(c),l=new THREE.Line3(s.start,s.end).closestPointToPoint(d.start,!1),1-Math.abs(a)<1e-7?(this.distanceInfo.secondSelInfo=i,this.distanceInfo.firstPoint=l,this.distanceInfo.secondPoint=d.start.clone(),e=(new THREE.Plane).setFromNormalAndCoplanarPoint(c,this.distanceInfo.secondPoint).normalize()):this.OpMeasure.PostInfo(Ae.INFOTYPE.AXISNOPARALLELLINE))):(o=this.getLineStartEndPoints(i))&&(s=new THREE.Line3(o.start,o.end).closestPointToPoint(this.distanceInfo.firstPoint,!1),this.distanceInfo.secondPoint=s.clone(),this.distanceInfo.secondSelInfo=i,a=(new THREE.Vector3).subVectors(o.start,o.end),e=(new THREE.Plane).setFromNormalAndCoplanarPoint(a,s).normalize()):(l=this.getLineStartEndPoints(r),this.distanceInfo.firstPoint=l.start,d=this.getLineStartEndPoints(i),this.distanceInfo.secondPoint=d.start.clone(),this.distanceInfo.secondSelInfo=i,this.LineargaugePostSelectPorjectPlane()),e&&this.LineargaugePostSelectPorjectPlane(e)))}}else-1!=n.indexOf("point")&&(c=t.point,null==this.distanceInfo.firstSelInfo?(this.distanceInfo.firstPoint=c,this.distanceInfo.firstSelInfo={type:"point",point:c},this.LineargaugePostNotify()):(this.distanceInfo.secondSelInfo={type:"point",point:c},this.distanceInfo.secondPoint=c,this.LineargaugePostSelectPorjectPlane()))}this.LineargaugeClearPreSelect()}else this.LineargaugeClearPreSelect()},s.prototype.updateLineargaugeMeasure=function(e,t){var i;this.distanceInfo.firstSelObj&&this.distanceInfo.secondSelObj&&!t?this.LineargaugeClearPreSelect():e?this.distanceInfo.preSelInfo&&!this.distanceInfo.preSelObj&&("line"==this.distanceInfo.preSelInfo.type||"circle"==this.distanceInfo.preSelInfo.type?(i=this.createLine(this.distanceInfo.preSelInfo,!(i=null)))&&(this.OpMeasure.rootObject.add(i),this.distanceInfo.preSelObj=i):"plane"!=this.distanceInfo.preSelInfo.type&&"cylinder"!=this.distanceInfo.preSelInfo.type&&"cone"!=this.distanceInfo.preSelInfo.type||(i=this.createFace(this.distanceInfo.preSelInfo,!0))&&(this.OpMeasure.rootObject.add(i),this.distanceInfo.preSelObj=i)):(this.distanceInfo.firstSelInfo&&!this.distanceInfo.firstSelObj&&(this.LineargaugeClearPreSelect(),i=null,"point"==this.distanceInfo.firstSelInfo.type?i=this.createPointMesh(this.distanceInfo.firstSelInfo.point,this.materialPoint,this.POINTSIZE):"line"==this.distanceInfo.firstSelInfo.type||"circle"==this.distanceInfo.firstSelInfo.type?i=this.createLine(this.distanceInfo.firstSelInfo,!1):"plane"!=this.distanceInfo.firstSelInfo.type&&"cylinder"!=this.distanceInfo.firstSelInfo.type&&"cone"!=this.distanceInfo.firstSelInfo.type||(i=this.createFace(this.distanceInfo.firstSelInfo,!1),"cylinder"!=this.distanceInfo.firstSelInfo.type&&"cone"!=this.distanceInfo.firstSelInfo.type)||(this.distanceInfo.axisLineObj=this.createAxisLine(this.distanceInfo.firstSelInfo),this.OpMeasure.rootObject.add(this.distanceInfo.axisLineObj)),i)&&(this.OpMeasure.rootObject.add(i),this.distanceInfo.firstSelObj=i),this.distanceInfo.secondSelInfo&&!this.distanceInfo.secondSelObj&&(this.LineargaugeClearPreSelect(),i=null,"point"==this.distanceInfo.secondSelInfo.type?i=this.createPointMesh(this.distanceInfo.secondSelInfo.point,this.materialPoint,this.POINTSIZE):"line"==this.distanceInfo.secondSelInfo.type||"circle"==this.distanceInfo.secondSelInfo.type?i=this.createLine(this.distanceInfo.secondSelInfo,!1):"plane"!=this.distanceInfo.secondSelInfo.type&&"cylinder"!=this.distanceInfo.secondSelInfo.type&&"cone"!=this.distanceInfo.secondSelInfo.type||(i=this.createFace(this.distanceInfo.secondSelInfo,!1),"cylinder"!=this.distanceInfo.secondSelInfo.type&&"cone"!=this.distanceInfo.secondSelInfo.type)||(this.distanceInfo.secaxisLineObj=this.createAxisLine(this.distanceInfo.secondSelInfo),this.OpMeasure.rootObject.add(this.distanceInfo.secaxisLineObj)),i)&&(this.OpMeasure.rootObject.add(i),this.distanceInfo.secondSelObj=i),this.distanceInfo.projectPlaneInfo&&!this.distanceInfo.projectPlaneObj&&(this.LineargaugeClearPreSelect(),i=null,(i="plane"==this.distanceInfo.projectPlaneInfo.type?this.createFace(this.distanceInfo.projectPlaneInfo,!1):i)&&(this.OpMeasure.rootObject.add(i),this.distanceInfo.projectPlaneObj=i),this.lineargaugeRotateOnly(this.distanceInfo.projectPlane)),this.distanceInfo.firstSelObj&&this.distanceInfo.secondSelObj&&this.distanceInfo.projectPlane&&(this.LineargaugeClearPreSelect(),this.matrxTrans||this.lineargaugeRotateOnly(this.distanceInfo.projectPlane),Se.isMobileDevice()?null!=this.projectDirectionXorY?(this.ShowLineargaugeDimension(null,!0,this.projectDirectionXorY),this.LineargaugePostNotify()):this.OpMeasure.PostInfo(Ae.INFOTYPE.SELECTPLACELINELOCATION):(this.OpMeasure.PostInfo(Ae.INFOTYPE.PLACELINELOCATION),this.ShowLineargaugeDimension())))},s.prototype.ShowLineargaugeDimension=function(e,t,i,n){var r,o,s,a,l;this.distanceInfo.firstSelObj&&this.distanceInfo.secondSelObj&&(this.distanceInfo.projectFstPos&&this.distanceInfo.projectSecPos||(this.distanceInfo.projectFstPos=new THREE.Vector3,this.distanceInfo.projectSecPos=new THREE.Vector3,this.distanceInfo.projectPlane.projectPoint(this.distanceInfo.firstPoint,this.distanceInfo.projectFstPos),this.distanceInfo.projectPlane.projectPoint(this.distanceInfo.secondPoint,this.distanceInfo.projectSecPos),this.distanceInfo.projectFstClnd&&this.OpMeasure.rootObject.remove(this.distanceInfo.projectFstClnd),this.distanceInfo.projectFstClnd=this.createPointMesh(this.distanceInfo.projectFstPos,this.materialProjectPoint,this.POINTSIZE),this.OpMeasure.rootObject.add(this.distanceInfo.projectFstClnd),this.distanceInfo.projectSecClnd&&this.OpMeasure.rootObject.remove(this.distanceInfo.projectSecClnd),this.distanceInfo.projectSecClnd=this.createPointMesh(this.distanceInfo.projectSecPos,this.materialProjectPoint,this.POINTSIZE),this.OpMeasure.rootObject.add(this.distanceInfo.projectSecClnd)),null==i&&(i=0),n||(this.distanceInfo.fstClndPos?this.distanceInfo.fstClndPos.set(this.distanceInfo.projectFstPos.x,this.distanceInfo.projectFstPos.y,this.distanceInfo.projectFstPos.z):this.distanceInfo.fstClndPos=this.distanceInfo.projectFstPos.clone(),this.distanceInfo.sndClndPos?this.distanceInfo.sndClndPos.set(this.distanceInfo.projectSecPos.x,this.distanceInfo.projectSecPos.y,this.distanceInfo.projectSecPos.z):this.distanceInfo.sndClndPos=this.distanceInfo.projectSecPos.clone()),this.lineargaugeModelCoord2PlaneCoord(this.distanceInfo.fstClndPos),this.lineargaugeModelCoord2PlaneCoord(this.distanceInfo.sndClndPos),e?(n=this.distanceInfo.projectPlane,e=this.clientCoordToModelCoordOnPlane(e.x,e.y,n),this.lineargaugeModelCoord2PlaneCoord(e),e&&0==i?(this.distanceInfo.fstClndPos.y=e.y,this.distanceInfo.sndClndPos.y=e.y,this.distanceInfo.fstClndPos.z=0,this.distanceInfo.sndClndPos.z=0):e&&1==i&&(this.distanceInfo.fstClndPos.x=e.x,this.distanceInfo.sndClndPos.x=e.x,this.distanceInfo.fstClndPos.z=0,this.distanceInfo.sndClndPos.z=0)):0==i?(n=(this.distanceInfo.fstClndPos.y+this.distanceInfo.sndClndPos.y)/2,this.distanceInfo.fstClndPos.y=n,this.distanceInfo.sndClndPos.y=n,this.distanceInfo.fstClndPos.z=0,this.distanceInfo.sndClndPos.z=0):1==i&&(e=(this.distanceInfo.fstClndPos.x+this.distanceInfo.sndClndPos.x)/2,this.distanceInfo.fstClndPos.x=e,this.distanceInfo.sndClndPos.x=e,this.distanceInfo.fstClndPos.z=0,this.distanceInfo.sndClndPos.z=0),n=this.distanceInfo.fstClndPos.clone(),e=this.distanceInfo.sndClndPos.clone(),n.distanceTo(e)<1e-6&&(0==i?(n.x+=.5,e.x-=.5):(n.y+=.5,e.y-=.5)),this.lineargaugePlaneCoord2ModelCoord(this.distanceInfo.fstClndPos),this.lineargaugePlaneCoord2ModelCoord(this.distanceInfo.sndClndPos),this.lineargaugePlaneCoord2ModelCoord(n),this.lineargaugePlaneCoord2ModelCoord(e),this.distanceInfo.textPos?(this.distanceInfo.textPos.x=(this.distanceInfo.fstClndPos.x+this.distanceInfo.sndClndPos.x)/2,this.distanceInfo.textPos.y=(this.distanceInfo.fstClndPos.y+this.distanceInfo.sndClndPos.y)/2,this.distanceInfo.textPos.z=(this.distanceInfo.fstClndPos.z+this.distanceInfo.sndClndPos.z)/2):this.distanceInfo.textPos=new THREE.Vector3((this.distanceInfo.fstClndPos.x+this.distanceInfo.sndClndPos.x)/2,(this.distanceInfo.fstClndPos.y+this.distanceInfo.sndClndPos.y)/2,(this.distanceInfo.fstClndPos.z+this.distanceInfo.sndClndPos.z)/2),(r=(new THREE.Vector3).subVectors(e,n)).normalize(),this.distanceInfo.fstClnd&&this.OpMeasure.rootObject.remove(this.distanceInfo.fstClnd),this.distanceInfo.fstClnd=this.createCylinderMesh(e,this.distanceInfo.fstClndPos,this.appmaterialLine),s=this.OpMeasure.getScale(this.distanceInfo.fstClnd,this.CYLINDERWIDTH),r.multiplyScalar(.5*this.distanceInfo.fstClnd.geometry.parameters.height),this.distanceInfo.fstClnd.oldPosition=this.distanceInfo.fstClndPos.clone(),this.distanceInfo.fstClnd.offsetPos=r.clone(),this.distanceInfo.fstClnd.position.addVectors(this.distanceInfo.fstClndPos,r.clone().multiplyScalar(s)),this.distanceInfo.fstClnd.updateMatrixWorld(),this.OpMeasure.rootObject.add(this.distanceInfo.fstClnd),this.distanceInfo.sndClnd&&this.OpMeasure.rootObject.remove(this.distanceInfo.sndClnd),this.distanceInfo.sndClnd=this.createCylinderMesh(n,this.distanceInfo.sndClndPos,this.appmaterialLine),this.distanceInfo.sndClnd.oldPosition=this.distanceInfo.sndClndPos.clone(),this.distanceInfo.sndClnd.offsetPos=r.clone().multiplyScalar(-1),this.distanceInfo.sndClnd.position.subVectors(this.distanceInfo.sndClndPos,r.clone().multiplyScalar(s)),this.distanceInfo.sndClnd.updateMatrixWorld(),this.OpMeasure.rootObject.add(this.distanceInfo.sndClnd),this.distanceInfo.clndToClndLine&&this.OpMeasure.rootObject.remove(this.distanceInfo.clndToClndLine),this.distanceInfo.clndToClndLine=this.createLineMesh2(this.distanceInfo.fstClndPos,this.distanceInfo.sndClndPos,this.appmaterialLine,1),this.OpMeasure.rootObject.add(this.distanceInfo.clndToClndLine),this.distanceInfo.fstToClndLine&&this.OpMeasure.rootObject.remove(this.distanceInfo.fstToClndLine),this.distanceInfo.fstToClndLine=this.createLineMesh2(this.distanceInfo.projectFstPos,this.distanceInfo.fstClndPos,this.appmaterialLine,1),this.OpMeasure.rootObject.add(this.distanceInfo.fstToClndLine),this.distanceInfo.sndToClndLine&&this.OpMeasure.rootObject.remove(this.distanceInfo.sndToClndLine),this.distanceInfo.sndToClndLine=this.createLineMesh2(this.distanceInfo.projectSecPos,this.distanceInfo.sndClndPos,this.appmaterialLine,1),this.OpMeasure.rootObject.add(this.distanceInfo.sndToClndLine),this.distanceInfo.FstToFstPointLine&&this.OpMeasure.rootObject.remove(this.distanceInfo.FstToFstPointLine),this.distanceInfo.FstToFstPointLine=this.createLineMesh2(this.distanceInfo.projectFstPos,this.distanceInfo.firstPoint,this.appmaterialLine,1),this.OpMeasure.rootObject.add(this.distanceInfo.FstToFstPointLine),this.distanceInfo.SndToSndPointLine&&this.OpMeasure.rootObject.remove(this.distanceInfo.SndToSndPointLine),this.distanceInfo.SndToSndPointLine=this.createLineMesh2(this.distanceInfo.projectSecPos,this.distanceInfo.secondPoint,this.appmaterialLine,1),this.OpMeasure.rootObject.add(this.distanceInfo.SndToSndPointLine),r=this.distanceInfo.projectFstPos.clone(),s=this.distanceInfo.projectSecPos.clone(),this.lineargaugeModelCoord2PlaneCoord(r),this.lineargaugeModelCoord2PlaneCoord(s),this.distanceInfo.dimString=r.distanceTo(s),0==i?this.distanceInfo.dimString=Math.abs(r.x-s.x):1==i&&(this.distanceInfo.dimString=Math.abs(r.y-s.y)),this.distanceInfo.dimString<1&&.999999dis:"+r:"距离:"+r,this.distanceInfo.textBox.appendChild(s),a=document.createElement("p"),s=Math.abs(this.distanceInfo.firstPoint.x-this.distanceInfo.secondPoint.x),i=this.viewer.getDispalyModelUnit(s),a.innerHTML="X:"+(s*this.viewer.measuringScale*i.scale).toFixed(8)+this.getUnitStringmap(i.unit),this.distanceInfo.textBox.appendChild(a),s=document.createElement("p"),a=Math.abs(this.distanceInfo.firstPoint.z-this.distanceInfo.secondPoint.z),i=this.viewer.getDispalyModelUnit(a),s.innerHTML="Y:"+(a*this.viewer.measuringScale*i.scale).toFixed(8)+this.getUnitStringmap(i.unit),this.distanceInfo.textBox.appendChild(s),a=document.createElement("p"),s=Math.abs(this.distanceInfo.firstPoint.y-this.distanceInfo.secondPoint.y),i=this.viewer.getDispalyModelUnit(s),a.innerHTML="Z:"+(s*this.viewer.measuringScale*i.scale).toFixed(8)+this.getUnitStringmap(i.unit),this.distanceInfo.textBox.appendChild(a)):(this.distanceInfo.textBox=document.createElement("div"),this.distanceInfo.textBox.className="section10",this.distanceInfo.textBox.innerHTML=r,this.distanceInfo.textBox.setAttribute("mobile","up"),(l=document.createElement("div")).className="sectionPoint",this.distanceInfo.textBox.appendChild(l),this.sectionCross=document.createElement("div"),this.sectionCross.className="sectionCross",this.distanceInfo.textBox.appendChild(this.sectionCross),Se.isMobileDevice()||(this.distanceInfo.textBox.addEventListener("mousedown",this.clickBoxInfo,!1),(o=this).distanceInfo.textBox.addEventListener("click",function e(t){0===t.button&&Re.enableBroadcast&&Re.broadcastMajor&&o.viewer.dispatchEvent({type:"broadcastEvent"}),this.removeEventListener("click",e)},!1))),this.viewer.container.appendChild(this.distanceInfo.textBox)),this.getAndShowTextBox(this.distanceInfo.textPos.clone(),r,this.distanceInfo.textBox),null!=r&&(this.distanceInfo.textBox.childNodes[0].data=r),1==t)&&(Se.isMobileDevice()||this.distanceInfo.textBox.removeEventListener("mousedown",this.clickBoxInfo,!1),(s={}).dimString=r,s.textPos=this.distanceInfo.textPos.clone(),s.textBox=this.distanceInfo.textBox,i=this,(a=new THREE.Group).objectType="Group",i.distanceInfo.firstSelObj&&(i.OpMeasure.rootObject.remove(i.distanceInfo.firstSelObj),a.add(i.distanceInfo.firstSelObj)),i.distanceInfo.secondSelObj&&(i.OpMeasure.rootObject.remove(i.distanceInfo.secondSelObj),a.add(i.distanceInfo.secondSelObj)),i.distanceInfo.projectPlaneObj&&(i.OpMeasure.rootObject.remove(i.distanceInfo.projectPlaneObj),a.add(i.distanceInfo.projectPlaneObj)),i.distanceInfo.boxToClndLine&&(i.OpMeasure.rootObject.remove(i.distanceInfo.boxToClndLine),a.add(i.distanceInfo.boxToClndLine)),i.distanceInfo.axisLineObj&&(i.OpMeasure.rootObject.remove(i.distanceInfo.axisLineObj),a.add(i.distanceInfo.axisLineObj)),i.distanceInfo.secaxisLineObj&&(i.OpMeasure.rootObject.remove(i.distanceInfo.secaxisLineObj),a.add(i.distanceInfo.secaxisLineObj)),i.distanceInfo.projectFstClnd&&(i.OpMeasure.rootObject.remove(i.distanceInfo.projectFstClnd),a.add(i.distanceInfo.projectFstClnd)),i.distanceInfo.projectSecClnd&&(i.OpMeasure.rootObject.remove(i.distanceInfo.projectSecClnd),a.add(i.distanceInfo.projectSecClnd)),i.distanceInfo.fstClnd&&(i.OpMeasure.rootObject.remove(i.distanceInfo.fstClnd),a.add(i.distanceInfo.fstClnd)),i.distanceInfo.sndClnd&&(i.OpMeasure.rootObject.remove(i.distanceInfo.sndClnd),a.add(i.distanceInfo.sndClnd)),i.distanceInfo.clndToClndLine&&(i.OpMeasure.rootObject.remove(i.distanceInfo.clndToClndLine),a.add(i.distanceInfo.clndToClndLine)),i.distanceInfo.fstToClndLine&&(i.OpMeasure.rootObject.remove(i.distanceInfo.fstToClndLine),a.add(i.distanceInfo.fstToClndLine)),i.distanceInfo.sndToClndLine&&(i.OpMeasure.rootObject.remove(i.distanceInfo.sndToClndLine),a.add(i.distanceInfo.sndToClndLine)),i.distanceInfo.FstToFstPointLine&&(i.OpMeasure.rootObject.remove(i.distanceInfo.FstToFstPointLine),a.add(i.distanceInfo.FstToFstPointLine)),i.distanceInfo.SndToSndPointLine&&(i.OpMeasure.rootObject.remove(i.distanceInfo.SndToSndPointLine),a.add(i.distanceInfo.SndToSndPointLine)),i.OpMeasure.rootObject.add(a),Se.isMobileDevice()?(s.textBox.addEventListener("touchstart",this.touchstart,!1),s.textBox.addEventListener("touchend",this.touchend,!1),s.textBox.addEventListener("touchmove",this.touchmove,!1)):(s.textBox.addEventListener("mousedown",this.touchstart,!1),s.textBox.addEventListener("mouseup",this.touchend,!1),s.textBox.addEventListener("mousemove",this.touchmove,!1),s.textBox.addEventListener("mouseleave",this.mouseleave,!1),s.textBox.addEventListener("mouseenter",this.mouseenter,!1)),Se.isMobileDevice()?this.sectionCross.addEventListener("touchend",this.sectionCrossend,!1):(this.sectionCross.addEventListener("mousedown",this.sectionCrossend,!1),this.sectionCross.addEventListener("mouseleave",this.crossleave,!1),this.sectionCross.addEventListener("mouseenter",this.crossenter,!1)),(l={}).start=this.distanceInfo.textPos.clone(),l.end=this.distanceInfo.textPos.clone(),l.uuid=a.uuid,this.OpMeasure.textLines.push(l),s.textBox.setAttribute("mobile","up"),s.textBox.setAttribute("group",a.uuid),this.OpMeasure.currentUuid=a.uuid,s.textBox.setAttribute("type","length"),s.textBox.setAttribute("dimString",this.distanceInfo.dimString),s.textBox.setAttribute("dimStringPrefix",""),s.textBox.setAttribute("unit",this.distanceInfo.unit),s.textBox.setAttribute("lineInfo",this.OpMeasure.textLines.length-1),this.OpMeasure.boxInfos.push(s),this.OpMeasure.unsteadyData[a.uuid]=this.DeepCopy(this.distanceInfo,"Lineargauge3D"),this.OpMeasure.unsteadyData[a.uuid].p1=n,this.OpMeasure.unsteadyData[a.uuid].p2=e,this.sectionCross=null,this.matrxTrans=null,this.selectProjectPlane=!1,this.projectDirectionXorY=null,this.isBoxMoving=!1,!Se.isMobileDevice()&&"LmPt2Pt"!=this.measureType&&"LmHole2Hole"!=this.measureType||this.viewer.dispatchEvent({type:"Lineargauge3DMeasureEndEvent"}),this.clearDistanceInfo(!0),Se.isMobileDevice())&&(this.ChangeMeasureFlag(),this.OpMeasure.measureEnd())},s.prototype.LineargaugeClearPreSelect=function(){this.distanceInfo.preSelObj&&(this.OpMeasure.rootObject.remove(this.distanceInfo.preSelObj),this.distanceInfo.preSelObj=null,this.distanceInfo.preSelInfo=null)},s.prototype.LineargaugeClearProjectPlaneSelect=function(){this.distanceInfo.projectPlaneObj&&(this.OpMeasure.rootObject.remove(this.distanceInfo.projectPlaneObj),this.distanceInfo.projectPlaneObj=null,this.distanceInfo.projectPlaneInfo=null)},s.prototype.LineargaugeClearFirstSelect=function(){this.distanceInfo.firstSelObj&&(this.OpMeasure.rootObject.remove(this.distanceInfo.firstSelObj),this.distanceInfo.firstSelObj=null,this.distanceInfo.firstSelInfo=null),this.distanceInfo.axisLineObj&&(this.OpMeasure.rootObject.remove(this.distanceInfo.axisLineObj),this.distanceInfo.axisLineObj=null)},s.prototype.LineargaugePostSelectPorjectPlane=function(e){switch(this.measureType){case"LmPt2Pt":case"LmHole2Hole":this.distanceInfo.projectPlane?this.selectProjectPlane=!1:e?(this.distanceInfo.projectPlane=e,this.selectProjectPlane=!1,this.lineargaugeRotate(this.distanceInfo.projectPlane)):(this.OpMeasure.PostInfo(Ae.INFOTYPE.SELECTPROJECTPLANE),this.selectProjectPlane=!1);break;default:this.selectProjectPlane=!1,this.distanceInfo.projectPlane=e}},s.prototype.LineargaugePostNotify=function(){this.distanceInfo.firstSelInfo?this.distanceInfo.firstSelInfo&&!this.distanceInfo.secondSelInfo&&(this.allowType=this.MeasurePostInfo(this.measureType,!1,!0)):this.allowType=this.MeasurePostInfo(this.measureType,!0,!0)},s.prototype.lineargaugeRotate=function(e,t){e=this.viewer.cameraControl.rotateToPlane(e);this.distanceInfo.projectFstPos=null,this.distanceInfo.projectSecPos=null,this.matrxTrans=e,this.viewer.render(),this.LineargaugePostNotify(),this.distanceInfo.firstSelInfo&&this.distanceInfo.secondSelInfo&&(Se.isMobileDevice()?null!=this.projectDirectionXorY?this.lineargaugeSelectPlaceLine(this.projectDirectionXorY):this.OpMeasure.PostInfo(Ae.INFOTYPE.SELECTPLACELINELOCATION):(t&&this.ShowLineargaugeDimension(null,!1,this.distanceInfo.XorY),this.OpMeasure.PostInfo(Ae.INFOTYPE.PLACELINELOCATION)))},s.prototype.lineargaugeRotateOnly=function(e){e&&(e=this.viewer.cameraControl.rotateToPlane(e),this.distanceInfo.projectFstPos=null,this.distanceInfo.projectSecPos=null,this.viewer.render(),this.matrxTrans=e)},s.prototype.lineargaugeModelCoord2PlaneCoord=function(e){e.sub(this.matrxTrans.origin),e.applyMatrix3(this.matrxTrans.matrixInvert)},s.prototype.lineargaugePlaneCoord2ModelCoord=function(e){e.applyMatrix3(this.matrxTrans.matrix),e.add(this.matrxTrans.origin)},s.prototype.lineargaugeSelectPlaceLine=function(e){this.projectDirectionXorY=e,this.distanceInfo.firstSelInfo&&this.distanceInfo.secondSelInfo&&this.distanceInfo.projectPlane&&(this.matrxTrans||this.lineargaugeRotateOnly(this.distanceInfo.projectPlane),this.ShowLineargaugeDimension(null,!0,this.projectDirectionXorY),this.LineargaugePostNotify())},(a.prototype=Object.create(Me.prototype)).OperatorStart=function(e){this.measureType=e,this.allowType=["face"],this.OpMeasure.PostInfo(Ae.INFOTYPE.FIRSTMESH)},a.prototype.onNMouseMove=function(e,t){var i=new THREE.Vector3(e,t,0);this.OpMeasure.unsteady?this.changeMeasureDistance(i):this.distanceInfo.firstSelObj&&this.distanceInfo.secondSelObj||(this.WallThicknessMeasure(e,t,!0,this.allowType),this.updateWallThicknessMeasure(!0))},a.prototype.onLMouseClick=function(e,t,i){new THREE.Vector3(e,t,0);this.distanceInfo.firstSelObj&&this.distanceInfo.secondSelObj||(this.WallThicknessMeasure(e,t,!1,this.allowType),this.updateWallThicknessMeasure(!1))},a.prototype.WallThicknessMeasure=function(e,t,i,n){(e=this.doRaycasterPick(e,t,!1))&&0!=e.length?(t=e[0])&&(i?(e=this.getSelectInfoFromIntersect(t))&&(-1==n.indexOf(e.topolType)?this.WallThicknessClearPreSelect():null!=this.distanceInfo.preSelInfo&&this.isTwoTopolInfoTheSame(this.distanceInfo.preSelInfo,e)||(this.distanceInfo.preSelInfo=e,this.distanceInfo.preSelObj&&(this.OpMeasure.rootObject.remove(this.distanceInfo.preSelObj),this.distanceInfo.preSelObj=null))):((i=this.getSelectInfoFromIntersect(t))&&-1!=n.indexOf(i.topolType)&&(null==this.distanceInfo.firstSelInfo?this.distanceInfo.firstSelInfo=i:this.distanceInfo.firstSelInfo&&(this.isTwoTopolInfoTheSame(this.distanceInfo.firstSelInfo,i)?(this.distanceInfo.firstSelObj&&(this.OpMeasure.rootObject.remove(this.distanceInfo.firstSelObj),this.distanceInfo.firstSelObj=null,this.distanceInfo.firstSelInfo=null),this.OpMeasure.PostInfo(Ae.INFOTYPE.FIRSTMESH),this.WallThicknessClearPreSelect()):"cylinder"==this.distanceInfo.firstSelInfo.type&&"cylinder"==i.type?(this.CalcCircleWallThickness(this.distanceInfo.firstSelInfo,i)||this.CalcWallThickness(this.distanceInfo.firstSelInfo,i))&&(this.distanceInfo.secondSelInfo=i,this.distanceInfo.firstSelInfo.type="wallFace",this.distanceInfo.secondSelInfo.type="wallFace"):"plane"==this.distanceInfo.firstSelInfo.type&&"plane"==i.type?(this.CalcPlaneWallThickness(this.distanceInfo.firstSelInfo,i)||this.CalcWallThickness(this.distanceInfo.firstSelInfo,i))&&(this.distanceInfo.secondSelInfo=i,this.distanceInfo.firstSelInfo.type="wallFace",this.distanceInfo.secondSelInfo.type="wallFace"):this.CalcWallThickness(this.distanceInfo.firstSelInfo,i)&&(this.distanceInfo.secondSelInfo=i,this.distanceInfo.firstSelInfo.type="wallFace",this.distanceInfo.secondSelInfo.type="wallFace"))),this.WallThicknessClearPreSelect())):this.WallThicknessClearPreSelect()},a.prototype.updateWallThicknessMeasure=function(e){var t;this.distanceInfo.firstSelObj&&this.distanceInfo.secondSelObj?this.WallThicknessClearPreSelect():e?this.distanceInfo.preSelInfo&&!this.distanceInfo.preSelObj&&"face"==this.distanceInfo.preSelInfo.topolType&&(t=this.createFace(this.distanceInfo.preSelInfo,!0))&&(this.OpMeasure.rootObject.add(t),this.distanceInfo.preSelObj=t):(this.distanceInfo.firstSelInfo&&!this.distanceInfo.firstSelObj&&(this.WallThicknessClearPreSelect(),t=null,(t="face"==this.distanceInfo.firstSelInfo.topolType?this.createFace(this.distanceInfo.firstSelInfo,!1):t)&&(this.OpMeasure.rootObject.add(t),this.distanceInfo.firstSelObj=t),this.OpMeasure.PostInfo(Ae.INFOTYPE.SECONDMESH)),this.distanceInfo.secondSelInfo&&!this.distanceInfo.secondSelObj&&(this.WallThicknessClearPreSelect(),t=null,t="face"==this.distanceInfo.secondSelInfo.topolType?this.createFace(this.distanceInfo.secondSelInfo,!1):t)&&(this.OpMeasure.rootObject.add(t),this.distanceInfo.secondSelObj=t),this.distanceInfo.firstSelObj&&this.distanceInfo.secondSelObj&&(Re.enableBroadcast&&Re.broadcastMajor&&this.OpMeasure.addmeasureTimes(),this.createAndShow3DDistanceDimension(null,!0),this.OpMeasure.rootObject.remove(this.distanceInfo.firstSelObj),this.OpMeasure.rootObject.remove(this.distanceInfo.secondSelObj),this.distanceInfo.firstSelObj=null,this.distanceInfo.secondSelObj=null,this.distanceInfo.firstSelInfo=null,this.distanceInfo.secondSelInfo=null,this.OpMeasure.PostInfo(Ae.INFOTYPE.FIRSTMESH),this.OpMeasure.measureEnd()))},a.prototype.IntersectCylinderPoints=function(e,t,i,n){for(var r=e.geometry,o=i.geometry,s=r.index,a=o.index,l=e.indexRange.concat(),d=(l[0]+=r.drawRange.start/3,l[1]+=r.drawRange.start/3,i.indexRange.concat()),c=(d[0]+=o.drawRange.start/3,d[1]+=o.drawRange.start/3,new THREE.Vector3),h=new THREE.Vector3,u=new THREE.Vector3,p=new THREE.Vector3,f=new THREE.Vector3,m=new THREE.Vector3,g=new THREE.Vector3,v=new THREE.Vector3,A=new THREE.Vector3,y=(new THREE.Triangle,new THREE.Triangle),E=(new THREE.Vector3,new THREE.Vector3),M=l[0];M<=l[1];M++){var w=s.getX(T=3*M),x=s.getX(1+T),I=s.getX(2+T);c.fromBufferAttribute(r.attributes.position,w),h.fromBufferAttribute(r.attributes.position,x),u.fromBufferAttribute(r.attributes.position,I),c.applyMatrix4(e.matrixWorld),h.applyMatrix4(e.matrixWorld),u.applyMatrix4(e.matrixWorld),t.closestPointToPoint(c,!1,g),t.closestPointToPoint(h,!1,v),t.closestPointToPoint(u,!1,A);for(var b=d[0];b<=d[1];b++){var T,S,B,w=a.getX(T=3*b),x=a.getX(1+T),I=a.getX(2+T);if(p.fromBufferAttribute(o.attributes.position,w),f.fromBufferAttribute(o.attributes.position,x),m.fromBufferAttribute(o.attributes.position,I),p.applyMatrix4(i.matrixWorld),f.applyMatrix4(i.matrixWorld),m.applyMatrix4(i.matrixWorld),y.set(p,f,m),y.getNormal(E),this.IntersectLineToTriangle(g,c,y))return S=(new THREE.Vector3).subVectors(c,g).normalize(),{pt1:c,pt2:(new THREE.Vector3).copy(g).addScaledVector(S,i.radius)};if(this.IntersectLineToTriangle(v,h,y))return S=(new THREE.Vector3).subVectors(h,v).normalize(),{pt1:h,pt2:(new THREE.Vector3).copy(v).addScaledVector(S,i.radius)};if(this.IntersectLineToTriangle(A,u,y))return B=(new THREE.Vector3).subVectors(u,A).normalize(),{pt1:u,pt2:(new THREE.Vector3).copy(A).addScaledVector(B,i.radius)}}}return null},a.prototype.IntersectLineToTriangle=function(e,t,i){var n,t={origin:e,direction:(new THREE.Vector3).subVectors(t,e)},e=(new THREE.Vector3).subVectors(t.origin,i.a),r=(new THREE.Vector3).subVectors(i.b,i.a),i=(new THREE.Vector3).subVectors(i.c,i.a),o=(new THREE.Vector3).crossVectors(r,i),s=t.direction.dot(o);if(0 sy && py > ey ) return false; // above\n if ( py < sy && py < ey ) return false; // below\n\n float sx = start.x;\n float ex = end.x;\n if ( px > sx && px > ex ) return false; // right\n if ( px < sx && px < ex ) { // left\n\n if ( py == sy && prevDirection != thisDirection ) {\n\n return false;\n\n }\n\n return true;\n }\n\n float dx = ex - sx;\n float dy = ey - sy;\n float perpx = dy;\n float perpy = - dx;\n\n float pdx = px - sx;\n float pdy = py - sy;\n\n float dot = perpx * pdx + perpy * pdy;\n\n if ( sign( dot ) != sign( perpx ) ) {\n\n return true;\n\n }\n\n return false;\n }\n void main() {\n int crossings = 0;\n vec2 LindStart = lassoSegments[ lassolength - 2 ];\n vec2 LineEnd = lassoSegments[ lassolength - 1 ];\n bool prevDirection = LindStart.y > LineEnd.y; \n\n float _x = mod(float(vbodyId) ,10.0); //这个值要与this.segment 相同\n float _y = floor(float(vbodyId) / 10.0); \n\n float x = ((gl_FragCoord.x - _x * width)- width / 2.0) / width *2.0;\n float y = ((gl_FragCoord.y - _y * height ) - height / 2.0 ) / height *2.0;\n vec2 point = vec2(x,y);\n for ( int s = 0, l = lassolength - 1; s < l; s ++ ) {\n vec2 StartPoint = lassoSegments[ s ];\n if(StartPoint.x > 5.0) //大于1,就说明为10 ,表示套索点结束\n break;\n vec2 EndPoint = lassoSegments[ s + 1];\n bool thisDirection = StartPoint.y > EndPoint.y;\n if ( pointRayCrossesLine( point, StartPoint, EndPoint, prevDirection, thisDirection ) ) {\n \n crossings ++;\n \n }\n \n prevDirection = thisDirection;\n }\n float b = float(vbodyId + 1) / 100.0; //this.segment * this.segment\n vec3 destColor = vec3(1.0,0.0,b);\n if(crossings % 2 == 1)\n {\n destColor.r = 0.0;\n destColor.g = 1.0;\n }\n gl_FragColor = vec4(destColor, 1.0);;\n }\n "})}function Ei(e){this.viewer=e;var k=this,T=null,_=null,S=!1,G=null,B=null,P=null;this.broadcastInfo=null,this.initialization=!0,this.onTouchMove=function(e){if(!k.viewer.isClipTransformControlSelected()&&!k.viewer.isLightEditControlSelected()){switch(e.stopPropagation(),e.touches.length){case 1:var t=e.touches[0].offsetX||e.touches[0].clientX-k.viewer.container.getBoundingClientRect().left,i=e.touches[0].offsetY||e.touches[0].clientY-k.viewer.container.getBoundingClientRect().top;if(k.viewer.limitEventArea){var n=k.viewer.container.getBoundingClientRect().width,r=k.viewer.container.getBoundingClientRect().height;if(nn||k.pointer.y>r)&&(k.pointer2nd.x>n||k.pointer2nd.y>r))return}}if(null==T&&(T=new THREE.Vector2),"OpMeasure"==k.viewer.getCurrentOperatorID()){null==B&&(B=new THREE.Vector3);var o=k.viewer.controls.getOperator().MeasureOper.getIntersectsByPriorityOfLine(t,i),s=null;if(o&&0r?n.x=Math.max(n.x,-1*i[o].normal.x*i[o].constant):Math.abs(i[o].normal.y)>r?n.y=Math.max(n.y,-1*i[o].normal.y*i[o].constant):n.z=Math.max(n.z,-1*i[o].normal.z*i[o].constant);r=1e-6;var s,a=n.clone().sub(b.position),l=(a.x=Math.abs(a.x)ae.clipTransRotControls.length-1)){for(var t=0;tae.clipActiveId&&ae.planeNameToId[t]--;ae.clipTransRotControls[ae.clipActiveId].visible=!1,ae.clipTransRotControls[ae.clipActiveId].dispose(),fe.remove(ae.clipTransRotControls[ae.clipActiveId]),fe.remove(h[ae.clipActiveId]),ae.clipTransRotControls.splice(ae.clipActiveId,1),h.splice(ae.clipActiveId,1),ae.viewer.renderer.clippingPlanes.splice(ae.clipActiveId,1),3===c&&g(),ae.viewer.renderAllViews()}},this.renderClipScene=function(e,t){fe&&(e?ae.viewer.renderer.render(fe,ae.viewer.camera,e,t):ae.viewer.renderer.render(fe,ae.viewer.camera)),ae.viewer.renderStates.shouldRenderClipScene=!1},this.renderClipPlane=function(e,t){var i,n;p&&(i=ae.viewer.scene.overrideMaterial,ae.viewer.renderer.state.buffers.stencil.setTest(!0),n=ae.viewer.renderer.context,ae.viewer.renderer.state.buffers.stencil.setFunc(n.ALWAYS,1,255),ae.viewer.renderer.state.buffers.stencil.setOp(n.KEEP,n.KEEP,n.INCR),ae.viewer.scene.overrideMaterial=l,e?ae.viewer.renderer.render(ae.viewer.scene,ae.viewer.camera,e,t):ae.viewer.renderer.render(ae.viewer.scene,ae.viewer.camera),ae.viewer.renderer.state.buffers.stencil.setFunc(n.ALWAYS,1,255),ae.viewer.renderer.state.buffers.stencil.setOp(n.KEEP,n.KEEP,n.DECR),ae.viewer.scene.overrideMaterial=u,e?ae.viewer.renderer.render(ae.viewer.scene,ae.viewer.camera,e,!1):ae.viewer.renderer.render(ae.viewer.scene,ae.viewer.camera),ae.viewer.scene.overrideMaterial=i,ae.viewer.renderer.state.buffers.stencil.setFunc(n.EQUAL,1,255),ae.viewer.renderer.state.buffers.stencil.setOp(n.KEEP,n.KEEP,n.KEEP),e?ae.viewer.renderer.render(p,ae.viewer.camera,e,!1):ae.viewer.renderer.render(p,ae.viewer.camera),ae.viewer.renderer.state.buffers.stencil.setTest(!1))},this.isClipTransformControlSelected=function(){return!!ae.clipTransRotControl&&ae.clipTransRotControl.isSelected()},this.setClipTransControlMode=function(e){ae.clipModeState=e=void 0===e||"translate"!==e&&"rotate"!==e?"both":e;for(var t=0;t=r.customComments.length?null:r.customComments[e]},this.setCommentVisible=function(e,t){null==e||null==t||e<0||e>=r.customComments.length||null!=t&&(r.customComments[e].visible=t,r.viewer.render())},this.removeComment=function(e){null==e||e<0||e>=r.customComments.length||(r.customComments.splice(e,1),r.viewer.render())},this.removeAllComments=function(){var e=r.customComments.length;r.customComments.splice(0,e),r.viewer.render()},this.get2dPoint=function(e){var e=(new THREE.Vector3).copy(e),t=(e.project(r.viewer.camera),r.viewer.container.offsetWidth/2),i=r.viewer.container.offsetHeight/2;return{x:Math.round(e.x*t+t),y:Math.round(-e.y*i+i)}},this.setAllCommentsVisible=function(e){if(null!=e){for(var t=0;tMath.abs(t.z))&&(this.activePlane=this.planes.XZ),"Y"===e&&(this.activePlane=this.planes.XY,Math.abs(t.x)>Math.abs(t.z))&&(this.activePlane=this.planes.YZ),"Z"===e&&(this.activePlane=this.planes.XZ,Math.abs(t.x)>Math.abs(t.y))&&(this.activePlane=this.planes.YZ),"XYZ"===e&&(this.activePlane=this.planes.XYZE),"XY"===e&&(this.activePlane=this.planes.XY),"YZ"===e&&(this.activePlane=this.planes.YZ),"XZ"===e&&(this.activePlane=this.planes.XZ)},this.init()}function Ri(e){Pi.call(this);var t=new THREE.BufferGeometry,i=new Float32Array([-.1,0,0,0,.3,0,0,0,-.1,0,0,-.1,0,.3,0,.1,0,0,.1,0,0,0,.3,0,0,0,.1,0,0,.1,0,.3,0,-.1,0,0,-.1,0,0,0,-.3,0,0,0,-.1,0,0,-.1,0,-.3,0,.1,0,0,.1,0,0,0,-.3,0,0,0,.1,0,0,.1,0,-.3,0,-.1,0,0]),n=(t.addAttribute("position",new THREE.BufferAttribute(i,3)),new THREE.MeshBasicMaterial({color:16711680}));new THREE.Mesh(t,n).position.set(.5,0,0),t.addAttribute("position",new THREE.BufferAttribute(i,3)),(n=new THREE.Mesh(t,new y({color:16711680}))).scale.set(.5,.5,.5),n.position.set(0,0,.5),(i=new THREE.Mesh(t,new y({color:65280}))).scale.set(.5,.5,.5),i.rotateZ(Math.PI/2),i.position.set(0,0,.5);(t=new THREE.Mesh(t,new y({color:255}))).scale.set(.5,.5,.5),t.position.set(.5,0,0);var r=e?2*Math.PI:Math.PI;this.handleGizmos={X:[[new THREE.Mesh(new THREE.TorusGeometry(.5,.01,10,40,r),new y({color:16711680})),[0,0,0],[0,-Math.PI/2,-Math.PI/2]],[n]],Y:[[new THREE.Mesh(new THREE.TorusGeometry(.5,.01,10,40,Math.PI),new y({color:65280})),[0,0,0],[Math.PI/2,0,0]],[i]],Z:[[new THREE.Mesh(new THREE.TorusGeometry(.5,.01,10,40,Math.PI),new y({color:255})),[0,0,0],[0,0,-Math.PI/2]],[t]],XYZE:[[new THREE.Line(new function(e,t,i){var n=new THREE.BufferGeometry,r=[];i=i||1;for(var o=0;o<=64*i;++o)"x"===t&&r.push(0,Math.cos(o/32*Math.PI)*e,Math.sin(o/32*Math.PI)*e),"y"===t&&r.push(Math.cos(o/32*Math.PI)*e,0,Math.sin(o/32*Math.PI)*e),"z"===t&&r.push(Math.sin(o/32*Math.PI)*e,Math.cos(o/32*Math.PI)*e,0);return n.addAttribute("position",new THREE.Float32BufferAttribute(r,3)),n}(.5,"z",1),new E({color:7895160}))]]},this.pickerGizmos={X:[[new THREE.Mesh(new THREE.TorusGeometry(.5,.12,4,12,r),mn),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new THREE.Mesh(new THREE.TorusGeometry(.5,.12,4,12,Math.PI),mn),[0,0,0],[Math.PI/2,0,0]]],Z:[[new THREE.Mesh(new THREE.TorusGeometry(.5,.12,4,12,Math.PI),mn),[0,0,0],[0,0,-Math.PI/2]]],XYZE:[[new THREE.Mesh(new THREE.Geometry)]]},this.setActivePlane=function(e){"E"===e&&(this.activePlane=this.planes.XYZE),"X"===e&&(this.activePlane=this.planes.YZ),"Y"===e&&(this.activePlane=this.planes.XZ),"Z"===e&&(this.activePlane=this.planes.XY)},this.update=function(e,t){Pi.prototype.update.apply(this,arguments);this.handles,this.pickers;var i=new THREE.Matrix4,n=new THREE.Euler(0,0,1),r=new THREE.Quaternion,o=new THREE.Vector3(1,0,0),s=new THREE.Vector3(0,1,0),a=new THREE.Vector3(0,0,1),l=new THREE.Quaternion,d=new THREE.Quaternion,c=new THREE.Quaternion,h=t.clone();n.copy(this.planes.XY.rotation),r.setFromEuler(n),i.makeRotationFromQuaternion(r).getInverse(i),h.applyMatrix4(i),this.traverse(function(e){r.setFromEuler(n),"X"===e.name&&(l.setFromAxisAngle(o,Math.atan2(-h.y,h.z)),r.multiplyQuaternions(r,l),e.quaternion.copy(r)),"Y"===e.name&&(d.setFromAxisAngle(s,Math.atan2(h.x,h.z)),r.multiplyQuaternions(r,d),e.quaternion.copy(r)),"Z"===e.name&&(c.setFromAxisAngle(a,Math.atan2(h.y,h.x)),r.multiplyQuaternions(r,c),e.quaternion.copy(r))})},this.showAxis=function(e,t){if(void 0!==e&&""!==e)switch(e){case"x":this.handleGizmos.X[0][0].visible=t,this.handleGizmos.X[1][0].visible=t,this.pickerGizmos.X[0][0].visible=t;break;case"y":this.handleGizmos.Y[0][0].visible=t,this.handleGizmos.Y[1][0].visible=t,this.pickerGizmos.Y[0][0].visible=t;break;case"z":this.handleGizmos.Z[0][0].visible=t,this.handleGizmos.Z[1][0].visible=t,this.pickerGizmos.Z[0][0].visible=t;break;case"e":this.handleGizmos.XYZE[0][0].visible=t,this.pickerGizmos.XYZE[0][0].visible=t}},this.init(),e&&"translateX"==e[0]&&(this.showAxis("y",!1),this.showAxis("z",!1),this.showAxis("e",!1))}function Oi(){var i=this;THREE.Object3D.call(this),this._gizmoTranslate=new Ci,this._gizmoRotate=new Ri,this.add(this._gizmoTranslate),this.add(this._gizmoRotate),this._translatePickers=this._gizmoTranslate.pickers,this._rotatePickers=this._gizmoRotate.pickers,this.activePlane=this._gizmoTranslate.activePlane,this.highlight=function(e,t){"translate"==t?(this._gizmoRotate.highlight(null),this._gizmoTranslate.highlight(e)):"rotate"==t&&(this._gizmoTranslate.highlight(null),this._gizmoRotate.highlight(e))},this.setActivePlane=function(e,t){"translate"==i.pickType?(this._gizmoTranslate.setActivePlane(e,t),this.activePlane=this._gizmoTranslate.activePlane):"rotate"==i.pickType&&(this._gizmoRotate.setActivePlane(e,t),this.activePlane=this._gizmoRotate.activePlane)},this.update=function(e,t){this._gizmoTranslate.update(e,t),this._gizmoRotate.update(e,t)}}function Li(){Pi.call(this);var e=new THREE.BoxGeometry(.125,.125,.125),t=new THREE.Mesh(e);t.position.y=.5,t.updateMatrix(),e.applyMatrix(t.matrix);(t=new THREE.BufferGeometry).addAttribute("position",new THREE.Float32BufferAttribute([0,0,0,1,0,0],3));var i=new THREE.BufferGeometry,n=(i.addAttribute("position",new THREE.Float32BufferAttribute([0,0,0,0,1,0],3)),new THREE.BufferGeometry);n.addAttribute("position",new THREE.Float32BufferAttribute([0,0,0,0,0,1],3)),this.handleGizmos={X:[[new THREE.Mesh(e,new y({color:16711680})),[.5,0,0],[0,0,-Math.PI/2]],[new THREE.Line(t,new E({color:16711680}))]],Y:[[new THREE.Mesh(e,new y({color:65280})),[0,.5,0]],[new THREE.Line(i,new E({color:65280}))]],Z:[[new THREE.Mesh(e,new y({color:255})),[0,0,.5],[Math.PI/2,0,0]],[new THREE.Line(n,new E({color:255}))]],XYZ:[[new THREE.Mesh(new THREE.BoxGeometry(.125,.125,.125),new y({color:16777215,opacity:.25}))]]},this.pickerGizmos={X:[[new THREE.Mesh(new THREE.CylinderGeometry(.2,0,1,4,1,!1),mn),[.6,0,0],[0,0,-Math.PI/2]]],Y:[[new THREE.Mesh(new THREE.CylinderGeometry(.2,0,1,4,1,!1),mn),[0,.6,0]]],Z:[[new THREE.Mesh(new THREE.CylinderGeometry(.2,0,1,4,1,!1),mn),[0,0,.6],[Math.PI/2,0,0]]],XYZ:[[new THREE.Mesh(new THREE.BoxGeometry(.4,.4,.4),mn)]]},this.setActivePlane=function(e,t){var i=new THREE.Matrix4;t.applyMatrix4(i.getInverse(i.extractRotation(this.planes.XY.matrixWorld))),"X"===e&&(this.activePlane=this.planes.XY,Math.abs(t.y)>Math.abs(t.z))&&(this.activePlane=this.planes.XZ),"Y"===e&&(this.activePlane=this.planes.XY,Math.abs(t.x)>Math.abs(t.z))&&(this.activePlane=this.planes.YZ),"Z"===e&&(this.activePlane=this.planes.XZ,Math.abs(t.x)>Math.abs(t.y))&&(this.activePlane=this.planes.YZ),"XYZ"===e&&(this.activePlane=this.planes.XYZE)},this.init()}function Di(l,d,F,N,V){THREE.Object3D.call(this),d=void 0!==d?d:document,this.object=void 0,this.viewer=F,this.visible=!1,this.translationSnap=null,this.rotationSnap=null,this.space="world",this.size=.5,this.axis=null,this.pickType=null,this.newPosition=new THREE.Vector3,this.down=!1,this.opBall=N,this.piovtDir=null;var j,c=this,r="translate",n=!1,o={translate:new Ci(V),rotate:new Ri(V),both:new Oi,scale:new Li};for(j in o){var U=o[j];U.visible=j===r,this.add(U)}var s={type:"change"},k={type:"mouseDown"},_={type:"mouseUp",mode:r},G=(document.createEvent("HTMLEvents").initEvent("mousemove",!0,!0),{type:"objectChange"}),z=new THREE.Raycaster,W=new THREE.Vector2,i=new THREE.Vector3,a=new THREE.Vector3,Y=new THREE.Vector3,h=0,u=0,e=new THREE.Vector3,t=new THREE.Vector3,p=1,X=new THREE.Matrix4,f=new THREE.Vector3,m=new THREE.Matrix4,g=new THREE.Vector3,v=new THREE.Quaternion,A=new THREE.Vector3(1,0,0),y=new THREE.Vector3(0,1,0),E=new THREE.Vector3(0,0,1),M=new THREE.Quaternion,w=new THREE.Quaternion,x=new THREE.Quaternion,I=new THREE.Quaternion,b=new THREE.Quaternion,T=new THREE.Quaternion,S=new THREE.Vector3,Q=new THREE.Vector3,B=new THREE.Vector3,q=new THREE.Matrix4,P=new THREE.Matrix4,C=new THREE.Vector3(1,1,1),R=new THREE.Vector3,Z=new THREE.Euler,O=new THREE.Matrix4,K=new THREE.Vector3,J=new THREE.Euler;function L(e){var t,i;Re.enableBroadcast&&!Re.broadcastMajor||void 0===c.object||!0===n||void 0!==e.button&&0!==e.button||c.down||(i=e.changedTouches?e.changedTouches[0]:e,t=null,"both"!=r?t=H(i,o[r].pickers.children):(t=H(i,o[r]._rotatePickers.children))?c.pickType="rotate":(t=H(i,o[r]._translatePickers.children))&&(c.pickType="translate"),i=null,t&&(i=t.object.name,e.preventDefault()),c.axis!==i&&(c.axis=i,c.update(),c.dispatchEvent(s)))}function $(e){var t,i;Re.enableBroadcast&&!Re.broadcastMajor||(e.offsetX||(e.clientX,this.viewer.container.getBoundingClientRect().left),e.offsetY||(e.clientY,this.viewer.container.getBoundingClientRect().top),e.srcElement&&e.srcElement!==this&&(e.clientX,this.viewer.container.getBoundingClientRect().left,e.clientY,this.viewer.container.getBoundingClientRect().top),null==e.srcElement&&e.target&&e.target!==this&&(e.clientX,this.viewer.container.getBoundingClientRect().left,e.clientY,this.viewer.container.getBoundingClientRect().top),void 0===c.object)||!0===n||void 0!==e.button&&0!==e.button||(0!==(t=e.changedTouches?e.changedTouches[0]:e).button&&void 0!==t.button||(i=null,"both"!=r?(i=H(t,o[r].pickers.children))&&(c.pickType=r):(i=H(t,o[r]._rotatePickers.children))?c.pickType="rotate":(i=H(t,o[r]._translatePickers.children))&&(c.pickType="translate"),i?(e.preventDefault(),e.stopPropagation(),c.dispatchEvent(k),c.axis=i.object.name,c.down=!0,c.update(),f.copy(K).sub(R).normalize(),o[r].setActivePlane(c.axis,f),(e=H(t,[o[r].activePlane]))&&(S.copy(c.object.position),Q.copy(c.object.position),B.copy(c.object.scale),q.extractRotation(c.object.matrix),O.extractRotation(c.object.matrixWorld),c.object.parent&&(P.extractRotation(c.object.parent.matrixWorld),C.setFromMatrixScale(m.getInverse(c.object.parent.matrixWorld))),a.copy(e.point))):(c.axis=null,c.update(),c.down=!1,c.pickType="default",c.dispatchEvent(s))),n=!0)}function ee(){"translate"===r||"translate"==c.pickType?(i.sub(a),"local"===c.space&&(c.piovtDir?i.projectOnVector(c.piovtDir):(-1===c.axis.search("X")&&(i.x=0),-1===c.axis.search("Y")&&(i.y=0),-1===c.axis.search("Z")&&(i.z=0)),c.object.position.copy(S),c.object.position.add(i),(Y=c.object.position.clone()).sub(Q),c.newPosition=c.object.position.clone(),Q.copy(c.newPosition)),"world"!==c.space&&-1===c.axis.search("XYZ")||(-1===c.axis.search("X")&&(i.x=0),-1===c.axis.search("Y")&&(i.y=0),-1===c.axis.search("Z")&&(i.z=0),i.applyMatrix4(m.getInverse(P)),c.object.position.copy(S),c.object.position.add(i)),null!==c.translationSnap&&("local"===c.space&&c.object.position.applyMatrix4(m.getInverse(O)),-1!==c.axis.search("X")&&(c.object.position.x=Math.round(c.object.position.x/c.translationSnap)*c.translationSnap),-1!==c.axis.search("Y")&&(c.object.position.y=Math.round(c.object.position.y/c.translationSnap)*c.translationSnap),-1!==c.axis.search("Z")&&(c.object.position.z=Math.round(c.object.position.z/c.translationSnap)*c.translationSnap),"local"===c.space)&&c.object.position.applyMatrix4(O)):"scale"===r?(i.sub(a),i.multiply(C),"local"===c.space&&("XYZ"===c.axis?(p=1+i.y/Math.max(B.x,B.y,B.z),c.object.scale.x=B.x*p,c.object.scale.y=B.y*p,c.object.scale.z=B.z*p):(i.applyMatrix4(m.getInverse(O)),"X"===c.axis&&(c.object.scale.x=B.x*(1+i.x/B.x)),"Y"===c.axis&&(c.object.scale.y=B.y*(1+i.y/B.y)),"Z"===c.axis&&(c.object.scale.z=B.z*(1+i.z/B.z))))):"rotate"!==r&&"rotate"!=c.pickType||(i.sub(R),i.multiply(C),g.copy(a).sub(R),g.multiply(C),"E"===c.axis?(i.applyMatrix4(m.getInverse(X)),g.applyMatrix4(m.getInverse(X)),e.set(Math.atan2(i.z,i.y),Math.atan2(i.x,i.z),Math.atan2(i.y,i.x)),t.set(Math.atan2(g.z,g.y),Math.atan2(g.x,g.z),Math.atan2(g.y,g.x)),v.setFromRotationMatrix(m.getInverse(P)),b.setFromAxisAngle(f,e.z-t.z),M.setFromRotationMatrix(O),v.multiplyQuaternions(v,b),v.multiplyQuaternions(v,M),c.object.quaternion.copy(v)):"XYZE"===c.axis?(b.setFromEuler(i.clone().cross(g).normalize()),v.setFromRotationMatrix(m.getInverse(P)),w.setFromAxisAngle(b,-i.clone().angleTo(g)),M.setFromRotationMatrix(O),v.multiplyQuaternions(v,w),v.multiplyQuaternions(v,M),c.object.quaternion.copy(v)):"local"===c.space?(i.applyMatrix4(m.getInverse(O)),g.applyMatrix4(m.getInverse(O)),e.set(Math.atan2(i.z,i.y),Math.atan2(i.x,i.z),Math.atan2(i.y,i.x)),t.set(Math.atan2(g.z,g.y),Math.atan2(g.x,g.z),Math.atan2(g.y,g.x)),M.setFromRotationMatrix(q),null!==c.rotationSnap?(w.setFromAxisAngle(A,Math.round((e.x-t.x)/c.rotationSnap)*c.rotationSnap),x.setFromAxisAngle(y,Math.round((e.y-t.y)/c.rotationSnap)*c.rotationSnap),I.setFromAxisAngle(E,Math.round((e.z-t.z)/c.rotationSnap)*c.rotationSnap)):(w.setFromAxisAngle(A,e.x-t.x),x.setFromAxisAngle(y,e.y-t.y),I.setFromAxisAngle(E,e.z-t.z)),"X"===c.axis&&M.multiplyQuaternions(M,w),"Y"===c.axis&&M.multiplyQuaternions(M,x),"Z"===c.axis&&M.multiplyQuaternions(M,I),c.object.quaternion.copy(M)):"world"===c.space&&(e.set(Math.atan2(i.z,i.y),Math.atan2(i.x,i.z),Math.atan2(i.y,i.x)),t.set(Math.atan2(g.z,g.y),Math.atan2(g.x,g.z),Math.atan2(g.y,g.x)),v.setFromRotationMatrix(m.getInverse(P)),null!==c.rotationSnap?(w.setFromAxisAngle(A,Math.round((e.x-t.x)/c.rotationSnap)*c.rotationSnap),x.setFromAxisAngle(y,Math.round((e.y-t.y)/c.rotationSnap)*c.rotationSnap),I.setFromAxisAngle(E,Math.round((e.z-t.z)/c.rotationSnap)*c.rotationSnap)):(w.setFromAxisAngle(A,e.x-t.x),x.setFromAxisAngle(y,e.y-t.y),I.setFromAxisAngle(E,e.z-t.z)),M.setFromRotationMatrix(O),"X"===c.axis&&v.multiplyQuaternions(v,w),"Y"===c.axis&&v.multiplyQuaternions(v,x),"Z"===c.axis&&v.multiplyQuaternions(v,I),v.multiplyQuaternions(v,M),c.object.quaternion.copy(v))),c.update(),c.dispatchEvent(s),c.dispatchEvent(G)}function te(e){var t;Re.enableBroadcast&&!Re.broadcastMajor||void 0===c.object||null===c.axis||!1===n||void 0!==e.button&&0!==e.button||!1!==(t=H(e.changedTouches?e.changedTouches[0]:e,[o[r].activePlane]))&&(e.preventDefault(),e.stopPropagation(),i.copy(t.point),ee())}function D(e){Re.enableBroadcast&&!Re.broadcastMajor||(e.preventDefault(),void 0!==e.button&&0!==e.button)||(n&&null!==c.axis&&(_.mode=r,c.dispatchEvent(_)),n=!1,c.down=!1,"TouchEvent"in window&&e instanceof TouchEvent?(c.axis=null,c.update(),c.dispatchEvent(s)):L(e))}function H(e,t){var i=d.getBoundingClientRect(),n=i.width,r=i.height,n=(null!=d.clientWidth&&null!=d.clientHeight&&(10t.x||e.y>t.y||e.z>t.z||(h.viewer.controls.setBoundingBox(e,t),h.viewer.switchRotateCenterBySelection()))},this.onOpBall=function(){if(h.clipTransRotControl){var e=h.viewer.selectionManager.getSelectedleafObjects(!0),t=h.clipTransRotControl.getOffset(),i=h.clipTransRotControl.getRotateOffset(),n=(h.rotateAngle=h.clipTransRotControl.getRotateAngle(),t.clone());if(t.set(0,0,0),null==h.viewer.draggedObjects&&(h.viewer.draggedObjects=new Array),"translate"==h.clipTransRotControl.pickType){if(h.viewer.ndsModel)for(var r=0;r=e.x/2&&e.y>=-e.x/2?(this.OpMeasure.unsteadyTextBox.childNodes[1].style.left="calc(50% - 6px)",this.OpMeasure.unsteadyTextBox.childNodes[1].style.top="-5.5px",this.OpMeasure.unsteadyTextBox.setAttribute("mobile","down")):e.y>e.x/2&&e.y<-e.x/2?(this.OpMeasure.unsteadyTextBox.childNodes[1].style.left="calc(100% - 4px)",this.OpMeasure.unsteadyTextBox.childNodes[1].style.top="calc(50% - 5.5px)",this.OpMeasure.unsteadyTextBox.setAttribute("mobile","right")):e.y-e.x/2&&(this.OpMeasure.unsteadyTextBox.childNodes[1].style.left="-5.5px",this.OpMeasure.unsteadyTextBox.childNodes[1].style.top="calc(50% - 5.5px)",this.OpMeasure.unsteadyTextBox.setAttribute("mobile","left"));for(var o=0;oe;){var t=this.boxInfos[0].textBox.children[1];"sectionCross"==t.className&&this.MeasureOper.sectionCrossend.apply(t,[])}},be.prototype.setMeasureVisible=function(e){this.rootObject&&(this.rootObject.visible=e);for(var t=e?"block":"none",i=0,n=this.boxInfos.length;i
"+Se.translateString("MEASURE_APP_AXISNOPARALLELLINE_2")+"
",this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.NOBREPNOPLNE:i=Se.translateString("MEASURE_APP_NOBREPNOPLNE");break;case Ae.INFOTYPE.BREPDATAERROR:i=Se.translateString("MEASURE_BREPDATAERROR")}else switch(e){case Ae.INFOTYPE.POINT:i=Se.translateString("MEASURE_POINT");break;case Ae.INFOTYPE.COORDINATEPOINT:i=Se.translateString("MEASURE_COORDINATEPOINT");break;case Ae.INFOTYPE.SECONDPOINT:i=Re.inBIMContext?Se.translateString("MEASURE_BIM_SECONDPOINT"):Se.translateString("MEASURE_SECONDPOINT");break;case Ae.INFOTYPE.THIRDPOINT:i=Re.inBIMContext?Se.translateString("MEASURE_BIM_THIRDPOINT"):Se.translateString("MEASURE_THIRDPOINT");break;case Ae.INFOTYPE.POINTLINE:i=Se.translateString("MEASURE_POINTLINE");break;case Ae.INFOTYPE.LINE:i=Se.translateString("MEASURE_LINE");break;case Ae.INFOTYPE.LINEANDCIRCLE:i=Se.translateString("MEASURE_LINEANDCIRCLE");break;case Ae.INFOTYPE.POINTPLANE:i=Se.translateString("MEASURE_POINTPLANE");break;case Ae.INFOTYPE.PLANE:i=Se.translateString("MEASURE_PLANE");break;case Ae.INFOTYPE.FIRSTLINE:i=Se.translateString("MEASURE_FIRSTLINE");break;case Ae.INFOTYPE.SECONDLINE:i=Se.translateString("MEASURE_SECONDLINE");break;case Ae.INFOTYPE.LINEPLANE:i=Se.translateString("MEASURE_LINEPLANE");break;case Ae.INFOTYPE.PARALLELLINE:i=Se.translateString("MEASURE_PARALLELLINE");break;case Ae.INFOTYPE.FIRSTPARALLELPLANE:i=Se.translateString("MEASURE_FIRSTPARALLELPLANE");break;case Ae.INFOTYPE.PARALLELPLANE:i=Se.translateString("MEASURE_PARALLELPLANE");break;case Ae.INFOTYPE.CIRCLE:i=this.viewer.is2DModel?Se.translateString("MEASURE_2D_CIRCLE"):Se.translateString("MEASURE_CIRCLE");break;case Ae.INFOTYPE.CIRCLEA:i=this.viewer.is2DModel?Se.translateString("MEASURE_2D_CIRCLEA"):Se.translateString("MEASURE_CIRCLEA");break;case Ae.INFOTYPE.SECONDCIRCLE:i=this.viewer.is2DModel?Se.translateString("MEASURE_2D_SECONDCIRCLE"):Se.translateString("MEASURE_SECONDCIRCLE");break;case Ae.INFOTYPE.SECONDPLANE:i=Se.translateString("MEASURE_SECONDPLANE");break;case Ae.INFOTYPE.FIRSTPLANE:i=Se.translateString("MEASURE_FIRSTPLANE");break;case Ae.INFOTYPE.AXISLINE:i=this.viewer.is2DModel?Se.translateString("MEASURE_2D_AXISLINE"):Se.translateString("MEASURE_AXISLINE");break;case Ae.INFOTYPE.AXISPOINT:i=this.viewer.is2DModel?Se.translateString("MEASURE_2D_AXISPOINT"):Se.translateString("MEASURE_AXISPOINT");break;case Ae.INFOTYPE.AXIS:i=Se.translateString("MEASURE_AXIS");break;case Ae.INFOTYPE.AXISPLANE:i=Se.translateString("MEASURE_AXISPLANE");break;case Ae.INFOTYPE.FACE:i=Se.translateString("MEASURE_FACE");break;case Ae.INFOTYPE.CIRCLEANDLINE:i="
"+Se.translateString("MEASURE_CIRCLEANDLINE_1")+"
"+Se.translateString("MEASURE_CIRCLEANDLINE_2")+"
",this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.FIRSTPOINT:i=Re.inBIMContext?Se.translateString("MEASURE_FIRSTPOINT_BIM"):Se.translateString("MEASURE_FIRSTPOINT");break;case Ae.INFOTYPE.BODY:i=Se.translateString("MEASURE_BODY");break;case Ae.INFOTYPE.LINEPOSITION:i=Se.translateString("MEASURE_LINEPOSITION");break;case Ae.INFOTYPE.ENDMEASURE:i=Se.translateString("MEASURE_ENDMEASURE");break;case Ae.INFOTYPE.CANCELLINE:i="
"+Se.translateString("MEASURE_CANCELLINE_1")+"
"+Se.translateString("MEASURE_CANCELLINE_2")+"
",this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.LINENOPARALLEL:i="
"+Se.translateString("MEASURE_LINENOPARALLEL_1")+"
"+Se.translateString("MEASURE_LINENOPARALLEL_2")+"
",this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.PLANENOPARALLEL:i="
"+Se.translateString("MEASURE_PLANENOPARALLEL_1")+"
"+Se.translateString("MEASURE_PLANENOPARALLEL_2")+"
",this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.NOTFACE:i="
"+Se.translateString("MEASURE_NOTFACE_1")+"
"+Se.translateString("MEASURE_NOTFACE_2")+"
",this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.NOTFACESECOND:i="
"+Se.translateString("MEASURE_NOTFACESECOND_1")+"
"+Se.translateString("MEASURE_NOTFACESECOND_2")+"
",this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.NOTFACEPARALLEL:i="
"+Se.translateString("MEASURE_NOTFACEPARALLEL_1")+"
"+Se.translateString("MEASURE_NOTFACEPARALLEL_2")+"
",this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.AXISNOPARALLEL:i="
"+Se.translateString("MEASURE_AXISNOPARALLEL_1")+"
"+Se.translateString("MEASURE_AXISNOPARALLEL_2")+"
",this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.MOUSEENTER:i=Se.translateString("MEASURE_MOUSEENTER");break;case Ae.INFOTYPE.CROSSENTER:i=Se.translateString("MEASURE_CROSSENTER");break;case Ae.INFOTYPE.NOBREP:i=Se.translateString("MEASURE_NOBREP");break;case Ae.INFOTYPE.NOPARALLEL:i=Se.translateString("MEASURE_NOPARALLEL");break;case Ae.INFOTYPE.INTERSECT:i="
"+Se.translateString("MEASURE_INTERSECT_1")+"
"+Se.translateString("MEASURE_INTERSECT_2")+"
",this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.LINEPARALLEL:i="
"+Se.translateString("MEASURE_LINEPARALLEL_1")+"
"+Se.translateString("MEASURE_LINEPARALLEL_2")+"
",this.viewer.is2DModel&&(i="
"+Se.translateString("MEASURE_LINEPARALLEL_2D_1")+"
"+Se.translateString("MEASURE_LINEPARALLEL_2D_2")+"
"),this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.PLANEPARALLELLINE:i="
"+Se.translateString("MEASURE_PLANEPARALLELLINE_1")+"
"+Se.translateString("MEASURE_PLANEPARALLELLINE_2")+"
",this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.LINEPARALLELPLANE:i="
"+Se.translateString("MEASURE_LINEPARALLELPLANE_1")+"
"+Se.translateString("MEASURE_LINEPARALLELPLANE_2")+"
",this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.PLANEPARALLEL:i="
"+Se.translateString("MEASURE_PLANEPARALLEL_1")+"
"+Se.translateString("MEASURE_PLANEPARALLEL_2")+"
",this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.TWOAXISNOPARALLEL:var r=this.viewer.is2DModel?Se.translateString("MEASURE_TWOAXISNOPARALLEL_2D_2"):Se.translateString("MEASURE_TWOAXISNOPARALLEL_2"),i="
"+Se.translateString("MEASURE_TWOAXISNOPARALLEL_1")+"
"+r+"
";this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.NOCONJOINT:i="
"+Se.translateString("MEASURE_NOCONJOINT_1")+"
"+Se.translateString("MEASURE_NOCONJOINT_2")+"
"+Se.translateString("MEASURE_NOCONJOINT_3")+"
",this.prompt.style.height=3*n+"px";break;case Ae.INFOTYPE.NOCLOSE:i="
"+Se.translateString("MEASURE_NOCLOSE_1")+"
"+Se.translateString("MEASURE_NOCLOSE_2")+"
"+Se.translateString("MEASURE_NOCLOSE_3")+"
",this.prompt.style.height=3*n+"px";break;case Ae.INFOTYPE.FIRMEASUREBODY:i=Se.translateString("MEASURE_FIRMEASUREBODY");break;case Ae.INFOTYPE.SECMEASUREBODY:i=Se.translateString("MEASURE_SECMEASUREBODY");break;case Ae.INFOTYPE.MEASUREBODY:i=Se.translateString("MEASURE_MEASUREBODY");break;case Ae.INFOTYPE.TWOBODYPARALLEL:i="
"+Se.translateString("MEASURE_TWOBODYPARALLEL_1")+"
"+Se.translateString("MEASURE_TWOBODYPARALLEL_2")+"
",this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.TWOBODYNOTPARALLEL:i="
"+Se.translateString("MEASURE_TWOBODYNOTPARALLEL_1")+"
"+Se.translateString("MEASURE_TWOBODYNOTPARALLEL_2")+"
",this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.LOADDATE:i=Se.translateString("MEASURE_LOADDATE");break;case Ae.INFOTYPE.CLICKFIRSTPOINT:i=Se.translateString("MEASURE_CLICKFIRSTPOINT");break;case Ae.INFOTYPE.CLICKSECONDPOINT:i=Se.translateString("MEASURE_CLICKSECONDPOINT");break;case Ae.INFOTYPE.PROJECTPLANE:i=Se.translateString("MEASURE_PROJECTPLANE");break;case Ae.INFOTYPE.SELECTPROJECTPLANE:i=Se.translateString("MEASURE_SELECTPROJECTPLANE");break;case Ae.INFOTYPE.PLACELINELOCATION:i=Se.translateString("MEASURE_PLACELINELOCATION");break;case Ae.INFOTYPE.SELECTPLACELINELOCATION:i=Se.translateString("MEASURE_SELECTPLACELINELOCATION");break;case Ae.INFOTYPE.FIRSTMESH:i=Se.translateString("MEASURE_FIRSTMESH");break;case Ae.INFOTYPE.SECONDMESH:i=Se.translateString("MEASURE_SECONDMESH");break;case Ae.INFOTYPE.MESHVERTICAL:i=Se.translateString("MEASURE_MESHVERTICAL");break;case Ae.INFOTYPE.AXISNOPARALLELLINE:i="
"+Se.translateString("MEASURE_AXISNOPARALLELLINE_1")+"
"+Se.translateString("MEASURE_AXISNOPARALLELLINE_2")+"
",this.prompt.style.height=2*n+"px";break;case Ae.INFOTYPE.NOBREPNOPLNE:i=Se.translateString("MEASURE_NOBREPNOPLNE");break;case Ae.INFOTYPE.BREPDATAERROR:i=Se.translateString("MEASURE_BREPDATAERROR")}""==i||!Re.broadcastMajor&&Re.enableBroadcast?(this.prompt.style.display="none",this.prompt.innerHTML=i):(this.prompt.innerHTML=i,this.prompt.style.display="block",Se.isMobileDevice()&&(e=this.viewer.renderer.getSize().height/2-21+"px",this.prompt.style.top=e),this.InfoType>Ae.INFOTYPE.MEASURENOTICEBEGIN?this.prompt.style.color="#ff7d2c":Se.isMobileDevice()?this.prompt.style.color="rgba(27,27,27,1)":this.prompt.style.color="rgba(51,51,51,1)",e=2e3,(t=this).InfoType>Ae.INFOTYPE.MEASURENOTICEBEGIN&&(e=3e3),Se.isMobileDevice()&&(this.Popup=setTimeout(function(){t.prompt.style.display="none"},e)))}},be.prototype.setMeasureType=function(e){switch(""!=e&&this.viewer.hasBrepFile()?this.showMouseZoomArea=!0:this.showMouseZoomArea=!1,this.measureType=e,this.viewer.brepInfo.BfacePerimeter||"facePerimeter"!=this.measureType||(this.measureType="Base"),Re.enableBroadcast&&!Re.broadcastMajor&&this.viewer.dispatchEvent({type:"FaceSelectionChangeEvent"}),this.viewer.selectionManager.clearSelection(),this.viewer.onOpChanged({id:"MeasureType"}),this.MeasureOper.OperatorEnd(),this.measureType){case"bodyDistance":case"PointToLine":case"PointToFace":case"AxisToPoint":case"LineToLine":case"LineToFace":case"faceDist":case"AxisToLine":case"AxisToFace":case"holeDist":case"pt2pt":case"pt2ptbim":"Distance"!=this.MeasureOper.measureClass&&(this.MeasureOper=new ai(this));break;case"radius":"Hole"!=this.MeasureOper.measureClass&&(this.MeasureOper=new li(this));break;case"measureEdges":case"bodyEdgeLength":"Edge"!=this.MeasureOper.measureClass&&(this.MeasureOper=new di(this));break;case"facePerimeter":case"faceArea":"Face"!=this.MeasureOper.measureClass&&(this.MeasureOper=new ci(this));break;case"bodyAngle":case"LineAngle":case"LineFaceAngle":case"faceAngle":case"angle":"Angle"!=this.MeasureOper.measureClass&&(this.MeasureOper=new o(this));break;case"BodyArea":case"BodyVolume":case"bodyBoundingBox":case"TotalArea":case"TotalVolume":case"BoundingBox":"BodyAndTotal"!=this.MeasureOper.measureClass&&(this.MeasureOper=new hi(this));break;case"coordinate":"Coordinate"!=this.MeasureOper.measureClass&&(this.MeasureOper=new ui(this));break;case"Lineargauge":"Lineargauge"!=this.MeasureOper.measureClass&&(this.MeasureOper=new pi(this));break;case"LmPt2Pt":case"LmPt2Line":case"LmLine2Line":case"LmHole2Hole":case"LmAxis2Pt":case"LmAxis2Line":"Lineargauge3D"!=this.MeasureOper.measureClass&&(this.MeasureOper=new s(this)),this.MeasureOper.OperatorClear(this.measureType);break;case"contour":case"contourarea":"Contour"!=this.MeasureOper.measureClass&&(this.MeasureOper=new Ai(this));break;case"WallThickness":"WallThickness"!=this.MeasureOper.measureClass&&(this.MeasureOper=new a(this));break;case"ellipse":"Ellipse"!=this.MeasureOper.measureClass&&(this.MeasureOper=new yi(this));break;default:"Base"!=this.MeasureOper.measureClass&&(this.MeasureOper=new Me(this))}"Base"!=this.MeasureOper.measureClass&&!this.viewer.hasBrepInfo()&&this.viewer.hasBrepFile()?this.PostInfo(Ae.INFOTYPE.LOADDATE):!this.viewer.hasBrepFile()&&this.measureType&&"pt2pt"!=this.measureType&&"pt2ptbim"!=this.measureType&&"angle"!=this.measureType&&"LmPt2Pt"!=this.measureType&&"BoundingBox"!=this.measureType&&"bodyBoundingBox"!=this.measureType||"facePerimeter"==e&&this.viewer.brepInfo&&!this.viewer.brepInfo.BfacePerimeter||"BodyArea"==e&&this.viewer.brepInfo&&!this.viewer.brepInfo.BbodyArea||("BodyVolume"==e||"TotalVolume"==e)&&this.viewer.brepInfo&&!this.viewer.brepInfo.BbodyVolume||"faceArea"==e&&this.viewer.brepInfo&&!this.viewer.brepInfo.BfaceArea||"TotalArea"==e&&this.viewer.brepInfo&&!this.viewer.brepInfo.BtotalArea?this.PostInfo(Ae.INFOTYPE.NOBREP):this.MeasureOper.OperatorStart(this.measureType),this.prompt&&!Se.isMobileDevice()&&(this.prompt.style.display="none"),Se.isMobileDevice()&&(this.hasMouseZoomArea?this.createMouseZoomArea():this.createZoomArea()),this.render(!1,!1)},be.prototype.setPointScale=function(e,t){t=this.getScale(e,t);e.scale.x=t,e.scale.y=t,e.scale.z=t,e.updateMatrixWorld()},be.prototype.setCylinderScale=function(e,t){Se.isMobileDevice()&&(t*=1.5);t=this.getScale(e,t);e.scale.x=t,e.scale.y=t,e.scale.z=t,e.oldPosition&&e.offsetPos&&e.position.addVectors(e.oldPosition,e.offsetPos.clone().multiplyScalar(t)),e.updateMatrixWorld()},be.prototype.setResolution=function(e){var t=this.viewer.renderer.getPixelRatio(),i=this.viewer.renderer.domElement.width/t,t=this.viewer.renderer.domElement.height/t;e.material.resolution.set(i,t)},be.prototype.getScale=function(e,t){var i=5,t=(null!=t&&(i=t),this.viewer.camera.getCameraTarget()),n=this.viewer.camera.position,r=new THREE.Vector3,t=(r.subVectors(t,n),e.position.clone()),e=this.viewer.camera.isPerspective?t.sub(n).dot(r.normalize()):r.length(),t=this.viewer.camera.fov,n=2*e*Math.tan(THREE.Math.degToRad(.5*t)),r=this.viewer.renderer.domElement.height;return i*n*this.viewer.renderer.getPixelRatio()/r},be.prototype.renderScale=function(e){for(var t=0;t=i.x/2&&i.y>=-i.x/2?(o.childNodes[1].style.left="calc(50% - 6px)",o.childNodes[1].style.top="-5.5px",o.setAttribute("mobile","down")):i.y>i.x/2&&i.y<-i.x/2?(o.childNodes[1].style.left="calc(100% - 4px)",o.childNodes[1].style.top="calc(50% - 5.5px)",o.setAttribute("mobile","right")):i.y-i.x/2&&(o.childNodes[1].style.left="-5.5px",o.childNodes[1].style.top="calc(50% - 5.5px)",o.setAttribute("mobile","left")),o.setAttribute("group",e.groupUuid),o.setAttribute("lineInfo",e.lineInfoIndex)):(o.setAttribute("group",e.groupUuid),o.childNodes[1].style.left="calc(50% - 6px)",o.childNodes[1].style.top="calc(100% - 5.5px)",o.setAttribute("mobile","up")),n.textBox=o,n},n=i(e),i=(n&&("ellipse"==e.unsteadyData.measureType&&n.textBox.setAttribute("radiusType","X"),this.boxInfos.push(n)),"ellipse"==e.unsteadyData.measureType&&(n=i({textPos:e.textPos1,dimString:e.dimString1,textBoxInnerHTML:e.textBoxInnerHTML1,type:e.type,lineInfo:e.lineInfo1,dimStringPrefix:e.dimStringPrefix,unit:e.unit,groupUuid:e.groupUuid,lineInfoIndex:e.lineInfoIndex}))&&(n.textBox.setAttribute("radiusType","Y"),this.boxInfos.push(n)),{}),n={},r=(e.lineInfo&&e.lineInfo.start&&(i.start=new THREE.Vector3(e.lineInfo.start.x,e.lineInfo.start.y,e.lineInfo.start.z),i.end=new THREE.Vector3(e.lineInfo.end.x,e.lineInfo.end.y,e.lineInfo.end.z),i.uuid=e.lineInfo.uuid,this.textLines.push(i)),e.lineInfo1&&e.lineInfo1.start&&(n.start=new THREE.Vector3(e.lineInfo1.start.x,e.lineInfo1.start.y,e.lineInfo1.start.z),n.end=new THREE.Vector3(e.lineInfo1.end.x,e.lineInfo1.end.y,e.lineInfo1.end.z),n.uuid=e.lineInfo1.uuid,this.textLines.push(n)),e.unsteadyData&&(this.CreateVector3(e.unsteadyData),this.unsteadyData[e.groupUuid]=e.unsteadyData),this.CreateVector3(e.measureObject),null),o=0;o=i.x/2&&i.y>=-i.x/2?(l.childNodes[1].style.left="calc(50% - 6px)",l.childNodes[1].style.top="-5.5px",l.setAttribute("mobile","down")):i.y>i.x/2&&i.y<-i.x/2?(l.childNodes[1].style.left="calc(100% - 4px)",l.childNodes[1].style.top="calc(50% - 5.5px)",l.setAttribute("mobile","right")):i.y-i.x/2&&(l.childNodes[1].style.left="-5.5px",l.childNodes[1].style.top="calc(50% - 5.5px)",l.setAttribute("mobile","left")),l.setAttribute("group",t[e[2]].uuid),l.setAttribute("lineInfo",e[2])):(l.childNodes[1].style.left="calc(50% - 6px)",l.childNodes[1].style.top="calc(100% - 5.5px)",l.setAttribute("mobile","up"),l.setAttribute("group",e[2]))),o.textBox=l}return o}var h=this,u=[];if(e){var i=0;for(i=0;ie.far||t.push({distance:v,point:l.clone().applyMatrix4(this.matrixWorld),index:p,face:null,faceIndex:null,object:this})}else for(p=0,f=h.length/3-1;pe.far||t.push({distance:v,point:l.clone().applyMatrix4(this.matrixWorld),index:p,face:null,faceIndex:null,object:this})}else if(r.isGeometry)for(var v,A=r.vertices,y=A.length,p=0;pe.far||t.push({distance:v,point:l.clone().applyMatrix4(this.matrixWorld),index:p,face:null,faceIndex:null,object:this})}}),THREE.Box3.prototype.intersectsPlane=function(e){return Xi=0=-e.constant},Je.prototype.raycast=(Qi=new THREE.Matrix4,qi=new THREE.Ray,new THREE.Sphere,Zi=new THREE.Box3,function(e,t){if(0!=this.visible){var i=e.linePrecision,n=i*i,r=this.geometry,o=this.matrixWorld;if(null===r.boundingBox&&r.computeBoundingBox(),Zi.copy(r.boundingBox),Zi.applyMatrix4(o),Zi.max.x+=i,Zi.max.y+=i,Zi.max.z+=i,Zi.min.x-=i,Zi.min.y-=i,Zi.min.z-=i,!1!==e.ray.intersectsBox(Zi)&&r.attributes.position){Qi.getInverse(o),qi.copy(e.ray).applyMatrix4(Qi);var s=new THREE.Vector3,a=new THREE.Vector3,l=new THREE.Vector3,d=new THREE.Vector3;if(r.isBufferGeometry&&r.attributes&&r.attributes.instanceStart)for(var c,h=r.attributes.instanceStart.data.array,u=0,p=h.length/3-1;ue.far||t.push({distance:c,point:l.clone().applyMatrix4(this.matrixWorld),index:0,face:null,faceIndex:null,object:this})}}}),Ae.INTERSECTSTATE={INTERSECTED:0,CONTAINED:1,NOTINTERSECTED:2},(we.prototype=Object.create(g.prototype)).initPixelInfo=function(){for(var e=0;en.end.y,o=0,s=t.length;oa.end.y;this.pointRayCrossesLine(e,a,r,l)&&i++,r=l}return i},we.prototype.lineCrossesLine=function(e,t){function i(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}var n=e.start,e=e.end,r=t.start,t=t.end;return i(n,r,t)!==i(e,r,t)&&i(n,e,r)!==i(n,e,t)},we.prototype.intersectsBounds=function(e,t){for(var i=new Array(8).fill().map(function(){return new THREE.Vector3}),n=0,r=1/0,o=-1/0,s=1/0,a=0;a<=1;a++)for(var l=0;l<=1;l++)for(var d=0;d<=1;d++){var c=i[n],h=(c.x=(0===a?e:t).x,c.y=(0===l?e:t).y,c.z=(0===d?e:t).z,c.w=1,[]),h=(h[0]=c.x,h[1]=c.y,h[2]=c.z,this.viewer.modelCoordToClientCoord(h));c.x=h[0]/window.innerWidth*2-1,c.y=1-h[1]/window.innerHeight*2,c.z=0,n++,c.yo&&(o=c.y),c.xi&&(i=this.lMouseUp.x),this.lMouseUp.yr&&(r=this.lMouseUp.y),this.selectRect(e,n,i,r),this.viewer.logOperatorTime&&this.viewer.logOperatorTimeShow("[框选-高亮]",t)},tn.prototype.onTouchSingleStart=function(e){e.preventDefault(),g.prototype.onTouchSingleStart.call(this,e)},tn.prototype.onTouchSingleMove=function(e){e.preventDefault();e=this.viewer.renderer.getPixelRatio();this.drawRectangle(this.singleTouchStartPos.x*e,this.singleTouchStartPos.y*e,this.pointer.x*e,this.pointer.y*e)},tn.prototype.onTouchSingleEnd=function(e){var t=Date.now(),e=(e.preventDefault(),g.prototype.onTouchSingleEnd.call(this,e),this.clearCanvas2D(),this.singleTouchStartPos.x),i=this.singleTouchStartPos.x,n=this.singleTouchStartPos.y,r=this.singleTouchStartPos.y;this.singleTouchEndPos.xi&&(i=this.singleTouchEndPos.x),this.singleTouchEndPos.yr&&(r=this.singleTouchEndPos.y),this.selectRect(e,n,i,r),this.viewer.logOperatorTime&&this.viewer.logOperatorTimeShow("[框选-高亮]",t)},function(e){var n=e.viewer,r=e.objects,o=e.domElement,i=e.group,s=null,a=(new THREE.Plane,new THREE.Raycaster),l=new THREE.Vector2,d=new THREE.Vector2,c=(new THREE.Vector3,null),h=!1,u=!0,p=!1,f=!1,m=!(this._enabled=!0),g=1,v=this;function t(e,t){if(e)switch(e){case"translate":v.setTransformEnable();break;case"rotate":v.setRotateEnable();break;case"both":v.setTransRotEnable()}Se.isMobileDevice()?(o.addEventListener("touchstart",y,!1),o.addEventListener("touchmove",E,!1),o.addEventListener("touchend",M,!1)):(o.addEventListener("mousemove",E,!1),o.addEventListener("mousedown",y,!1),o.addEventListener("mouseup",M,!1)),u?((s=new V(n,o,t)).setMode("translate"),s.setSpace("local"),i.add(s)):p?((s=new V(n,o,t)).setMode("rotate"),s.setSpace("local"),i.add(s)):f&&((s=new V(n,o,t)).setMode("both"),s.setSpace("local"),i.add(s)),v.setSize(g),m=!0}function A(){null!=s&&s.detach(s.object),Se.isMobileDevice()?(o.removeEventListener("touchstart",y,!1),o.removeEventListener("touchmove",E,!1),o.removeEventListener("touchend",M,!1)):(o.removeEventListener("mousemove",E,!1),o.removeEventListener("mousedown",y,!1),o.removeEventListener("mouseup",M,!1))}function y(e){h=!1,e.preventDefault(),e.stopPropagation();var t=e,e=(Se.isMobileDevice()&&0 0","#if ! defined( PHYSICAL ) && ! defined( PHONG )","vViewPosition = - mvPosition.xyz;","#endif","vec4 tempWorldPosition = modelMatrix * vec4( position, 1.0 );","vClippingWorldPosition = tempWorldPosition.xyz;","#endif"].join("\n"),["#if NUM_CLIPPING_PLANES > 0","#if ! defined( PHYSICAL ) && ! defined( PHONG )","varying vec3 vViewPosition;","#endif","varying vec3 vClippingWorldPosition;","#endif"].join("\n"),["#if NUM_CLIPPING_PLANES > 0 ","uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];","varying vec3 vClipPosition;","bvec2 checkClippingPlanes() {","bool isCut = false;","bool isCutEdge = false;","#if defined( STANDARD )","for (int i=0; i 0.0 );","if (!isCut) {","isCutEdge = isCutEdge || (abs(dotPlane) < abs(0.0012 * length(vViewPosition)));","}","}","#else","vec4 plane;","#pragma unroll_loop_start","for (int i=0; i plane.w ) isCut = true;","}","#pragma unroll_loop_end","#endif","return bvec2(isCut,isCutEdge);","}","#endif"].join("\n")),on=["#if NUM_CLIPPING_PLANES > 0 && !defined( NOCLIPPING )","bvec2 clipRetVec2NDS = checkClippingPlanes();","if (clipRetVec2NDS.x) discard;","#endif"].join("\n"),e=["#if NUM_CLIPPING_PLANES > 0","if(clipRetVec2NDS.y) gl_FragColor = vec4(0.8, 0.4, 0.298, 1.0);","#endif","}"].join("\n"),sn=(an=THREE.ShaderChunk.meshphong_frag).lastIndexOf("}"),an=an.substr(0,sn)+e,sn=(ln=THREE.ShaderChunk.meshphysical_frag).lastIndexOf("}"),ln=ln.substr(0,sn)+e,dn=(["#if NUM_CLIPPING_PLANES > 0","for ( int i = 0; i < NUM_CLIPPING_PLANES; ++ i ) {","vec4 plane = clippingPlanes[ i ];","if ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;","}","if (!gl_FrontFacing) {","gl_FragColor = vec4(0.8, 0.4, 0.298, 1.0);","return;","}","#endif"].join("\n"),{defines:{NUM_CLIPPING_PLANES_NDS:1},uniforms:{clipping:{color:{type:"c",value:new THREE.Color(16711680)},clippingPlaneNDS:{type:"v4v",value:[0,0,-1,0]}},caps:{color:{type:"c",value:new THREE.Color(.8,.4,.298)}}},vertex:["void main() {","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),vertexClipping:["varying vec4 worldPosition;","varying vec3 camPosition;","void main() {","worldPosition = modelMatrix * vec4( position, 1.0 );","camPosition = cameraPosition;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragment:["uniform vec3 color;","void main( void ) {","gl_FragColor = vec4( color , 1.0 );","}"].join("\n"),fragmentClippingFront:["uniform vec3 color;","uniform vec4 clippingPlaneNDS[NUM_CLIPPING_PLANES_NDS];","varying vec4 worldPosition;","varying vec3 camPosition;","void main() {","#if NUM_CLIPPING_PLANES_NDS > 0","for ( int i = 0; i < NUM_CLIPPING_PLANES_NDS; ++ i ) {","vec4 plane = clippingPlaneNDS[i];","if ( -dot( worldPosition.xyz, plane.xyz ) > plane.w && -dot( camPosition, plane.xyz ) > plane.w) discard;","else {","gl_FragColor = vec4( color , 1.0 );","}","}","#endif","}"].join("\n")}),cn={vertex:["void main() {","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragment:["uniform vec3 color;","uniform vec2 hatchParams;","uniform vec3 hatchTintColor;","uniform float hatchTintIntensity;","vec4 calculateHatchPattern(vec2 hatchParams, vec2 coord, vec4 fragColor, vec3 hatchTintColor, float hatchTintIntensity ) {","float hatchSlope = hatchParams.x;","float hatchPeriod = hatchParams.y;","if (abs(hatchSlope) <= 1.0) {","float hatchPhase = coord.y - hatchSlope * coord.x;","float dist = abs(mod((hatchPhase), (hatchPeriod)));","if (dist < 2.0) {","fragColor = vec4(0.0,0.0,0.0,1.0);","} else {","fragColor.xyz = mix(fragColor.xyz, hatchTintColor, hatchTintIntensity);","}","} else {","float hatchPhase = - coord.y / hatchSlope + coord.x;","float dist = abs(mod((hatchPhase), (hatchPeriod)));","if (dist < 1.0) {","fragColor = vec4(0.0,0.0,0.0,1.0);","} else {","fragColor.xyz = mix(fragColor.xyz, hatchTintColor, hatchTintIntensity);","}","}","return fragColor;","}","void main( void ) {","gl_FragColor = vec4( color , 1.0 );","gl_FragColor = calculateHatchPattern(hatchParams, gl_FragCoord.xy, gl_FragColor, hatchTintColor, hatchTintIntensity);","}"].join("\n")},hn=function(e,t,i){THREE.Mesh.call(this,e,t,!1),this.tempVector3=new THREE.Vector3,this.plane=i,this.planeVec=new THREE.Vector4(i.normal.x,i.normal.y,i.normal.z,i.constant),this.connectivity=[],this.outlines=[]},un=(hn.prototype=Object.create(THREE.Mesh.prototype),(hn.prototype.constructor=hn).prototype.update=function(){this.plane.normal.set(0,0,-1),this.plane.normal.applyQuaternion(this.quaternion);var e=this.plane.normal,t=-1*this.getWorldPosition(this.tempVector3).dot(e);this.planeVec.set(e.x,e.y,e.z,t),this.plane.constant=t},function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager}),pn=(un.prototype={constructor:un,load:function(e,t,i,n,r,o){var s=this,a="?time=",l=(0s.width/120?s.width/120:h<4?4:h,c=[0,0],s=O.clientCoordToModelCoord(c),h=new THREE.Vector3(s[0],s[1],s[2]),d=[d,0],u=O.clientCoordToModelCoord(d),p=new THREE.Vector3(u[0],u[1],u[2]),f=(o.linePrecision=h.distanceTo(p),O.camera.setCastRay(o,l,a),new THREE.Matrix4),m=new THREE.Ray,g=new THREE.Vector3,v=new THREE.Vector3,A=new THREE.Vector3,y=1/0,E=o.intersectObjects(O.leafPMIObjects,!0),M=null,w=0;w=t.width-15&&n<=15,s=i<=15&&n>=t.height-15,i=i>=t.width-15&&n>=t.height-15;if((r||o||s||i)&&c.enableMove)c._isResizing=!0,c.onLMouseDown(e),c.startWidth=e.target.parentNode.children[0].offsetWidth,c.startHeight=e.target.parentNode.children[0].offsetHeight,c.stratLeft=parseInt(e.target.parentNode.style.left),c.startTop=parseInt(e.target.parentNode.style.top),c.startX=e.clientX,c.startY=e.clientY,c._currentTarget=e.target,r&&(c.cornerStyle=0),o&&(c.cornerStyle=1),s&&(c.cornerStyle=2),i&&(c.cornerStyle=3),r||i?d.style.cursor="nwse-resize":(o||s)&&(d.style.cursor="nesw-resize");else{c.enableMove&&(c._isDragging=!0);for(var a=0;a=r.width-15&&e<=15,n=t<=15&&e>=r.height-15,r=t>=r.width-15&&e>=r.height-15,d.style.cursor=t<=15&&e<=15||r?"nwse-resize":i||n?"nesw-resize":"default"),c.viewer.render()}),i.addEventListener("click",function(e){for(var t=0;ti.width?(i.style.height="160px",i.style.width=160*i.width/i.height+"px"):(i.style.height=160*i.height/i.width+"px",i.style.width="160px"),d.aspect=i.width/i.height,i.style.display="block",d.style.top="19px",d.style.left="56px",c.viewer.dispatchEvent({type:"PicAdd",data:r}),c.viewer.dispatchEvent({type:"PicSelect",data:[]}),c.picSelectIDs=[],c.setMode("normal"),c.viewer.setOperatorByID("OpOrbit"))},i.onerror=function(){c.deleteNoteAnnotation(n)};for(var o=0;od.width?(d.style.height=t+"px",d.style.width=t*d.width/d.height+"px"):(d.style.height=t*d.height/d.width+"px",d.style.width=t+"px"),s.aspect=d.width/d.height,c.setPicTextVisible(i,!0)},d.addEventListener("mousemove",function(e){var t,i,n,r,o={clientX:e.clientX,clientY:e.clientY};c._isResizing&&c.state==Ae.MOUSE.LEFT?(c.reSize(e),c.viewer.render()):(c._isDragging&&c.state==Ae.MOUSE.LEFT?c.onLMouseMove(o):c.state==Ae.MOUSE.LEFT?(o=e.clientX-c.viewer.container.getBoundingClientRect().left,r=e.clientY-c.viewer.container.getBoundingClientRect().top,c.pointer.set(o,r),g.prototype.onLMouseMove.call(c,e),c.pointerOld.set(o,r)):c.state==Ae.MOUSE.MIDDLE?c.onMMouseMove(e):(o=s.getBoundingClientRect(),r=e.clientX-o.left,t=e.clientY-o.top,i=r>=o.width-20&&t<=20,n=r<=20&&t>=o.height-20,o=r>=o.width-20&&t>=o.height-20,s.style.cursor!=(r=r<=20&&t<=20||o?"nwse-resize":i||n?"nesw-resize":"default")&&(s.style.cursor=r,d.style.cursor=s.style.cursor)),Math.abs(c.startX-e.clientX)<3&&Math.abs(c.startY-e.clientY)<3||(c.update2DScene(),c.viewer.render()))}),d.addEventListener("mousewheel",function(e){c.onMouseWheel(e),c.viewer.render()}),d.addEventListener("mousedown",function(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),c.startX=e.clientX,c.startY=e.clientY,c.onLMouseDown(e),c.selectID!=e.target.parentNode.id&&-1==c.selectIDs.indexOf(e.target.parentNode.id)||"NoteEdit"==c.mode||!c.enableMove||(c.oldmode=c.mode,c.mode="NoteMove",c.MoveTarget=e.target.parentNode);var t,i=e.target.parentNode,n=e.target.parentNode.getBoundingClientRect(),r=Math.abs(e.clientX-n.left),o=Math.abs(e.clientY-n.top),s=r<=20&&o<=20,a=r>=n.width-20&&o<=20,l=r<=20&&o>=n.height-20,r=r>=n.width-20&&o>=n.height-20;(s||a||l||r)&&c.enableMove?(c._isResizing=!0,c.onLMouseDown(e),c.startWidth=e.target.parentNode.children[0].offsetWidth,c.startHeight=e.target.parentNode.children[0].offsetHeight,c.stratLeft=parseInt(e.target.parentNode.style.left),c.startTop=parseInt(e.target.parentNode.style.top),c.startX=e.clientX,c.startY=e.clientY,c._currentTarget=e.target,s&&(c.cornerStyle=0),a&&(c.cornerStyle=1),l&&(c.cornerStyle=2),r&&(c.cornerStyle=3),s||r?t="nwse-resize":(a||l)&&(t="nesw-resize"),c.setMode("picNote")):(c._isDragging=!0,e.target.parentNode.style.zIndex=21,c._currentTarget=e.target,c.startX=e.clientX-e.target.parentNode.offsetLeft,c.startY=e.clientY-e.target.parentNode.offsetTop,t="default"),i.style.cursor!=t&&(i.style.cursor=t,d.style.cursor=i.style.cursor),i.readOnly=!1,i.focus(),i.blur()}),d.addEventListener("mouseup",function(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),"NoteMove"==c.mode&&(c.mode=c.oldmode,"NoteMove"==c.mode&&(c.mode="normal"),e.target.readOnly=!1),c.onLMouseUp(e)}),d.addEventListener("click",function(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();for(var t,i,n=0;n=2*e.x&&e.y>=2*-e.x?(i.setAttribute("mobile","down"),i.style.left=parseInt((t.x-parseInt(i.childNodes[0].style.width)*this.dpr/2)/this.dpr)+"px",i.style.top=parseInt(t.y/this.dpr)+"px"):e.y>2*e.x&&e.y<2*-e.x?(i.setAttribute("mobile","right"),i.style.left=parseInt((t.x-parseInt(i.childNodes[0].style.width)*this.dpr)/this.dpr)+"px",i.style.top=parseInt((t.y-parseInt(i.childNodes[0].style.height)*this.dpr/2)/this.dpr)+"px"):e.y<2*e.x&&e.y<2*-e.x?(i.setAttribute("mobile","up"),i.style.left=parseInt((t.x-parseInt(i.childNodes[0].style.width)/2)/this.dpr)+"px",i.style.top=parseInt((t.y-parseInt(i.childNodes[0].style.height))/this.dpr)+"px"):e.y<2*e.x&&e.y>2*-e.x&&(i.setAttribute("mobile","left"),i.style.left=parseInt(t.x/this.dpr)+"px",i.style.top=parseInt((t.y-parseInt(i.childNodes[0].style.height)/2)/this.dpr)+"px")},xe.prototype.clientCoordToModelCoordOnPlane=function(e,t,i){e=[e,t,.99],t=this.viewer.clientCoordToModelCoord(e),t=new THREE.Vector3(t[0],t[1],t[2]),e[2]=-.99,e=this.viewer.clientCoordToModelCoord(e),e=new THREE.Vector3(e[0],e[1],e[2]);return this.intersectLine(t,e,i)},xe.prototype.intersectLine=function(e,t,i){var n,r;return!(e&&t&&i)||(n=e.clone(),(e=(new THREE.Vector3).subVectors(t,e)).normalize(),r=e.dot(i.normal),Math.abs(r)<=1e-8)?null:(t=i.coplanarPoint(t.clone()),t=(new THREE.Vector3).subVectors(t,n).dot(i.normal)/r,n.add(e.multiplyScalar(t)))},xe.prototype.update2DScene=function(){var e,t,i=this.viewer.renderer.getPixelRatio(),n=this.viewer.canvas2D.getContext("2d");if(this.rootObject.visible){this.Textbox&&this.intersectPnt&&(this.viewer.is2DModel?n.strokeStyle="#00FF00":n.strokeStyle="#FF6302",n.lineWidth=i,n.beginPath(),"up"==(e=this.Textbox.getAttribute("mobile"))||"down"==e?(s=this.get2dPoint(this.intersectPnt.clone()),a=this.get2dPoint(this.Textbox.pos.clone()),n.moveTo(s.x,s.y),n.lineTo(a.x,a.y)):"left"!=e&&"right"!=e||(e=this.get2dPoint(this.intersectPnt.clone()),t=this.get2dPoint(this.Textbox.pos.clone()),n.moveTo(e.x,e.y),n.lineTo(Math.round((e.x+t.x)/2),t.y),n.lineTo(t.x,t.y)),n.stroke());for(var r=0;rMath.PI/4?-1:1)*r.length(),r.y=0,r.z=0),this.viewer.dispatchEvent({type:"OpBallModel",position:{x:a(this.position.x)?0:this.position.x,y:a(this.position.y)?0:this.position.y,z:a(this.position.z)?0:this.position.z},angle:{x:a(this.angle.x)?0:this.angle.x,y:a(this.angle.y)?0:this.angle.y,z:a(this.angle.z)?0:this.angle.z},deltaAngle:{x:1!=o.length||this.piovtRotateDir?this.angle.x:180*n.x/Math.PI,y:1!=o.length||this.piovtRotateDir?this.angle.y:180*n.y/Math.PI,z:1!=o.length||this.piovtRotateDir?this.angle.z:180*n.z/Math.PI},deltaPosition:{x:r.x,y:r.y,z:r.z}}))},Ie.prototype.addDraggedObject=function(e){for(var t=0;t=e.length?{done:!0}:{done:!1,value:e[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function vn(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);it.x?t:e).x,this.pdfInfo.xSelMax=(e.xt.y?t:e).y,this.pdfInfo.ySelMax=(e.yt.x?t:e).x,this.pdfInfo.xSelMax=(e.xt.y?t:e).y,this.pdfInfo.ySelMax=(e.yr.x&&(r.x=n[2]),n[3]>r.y&&(r.y=n[3]))),this.pdfInfo.xSelMin=i.x-.001,this.pdfInfo.ySelMin=i.y-.001,this.pdfInfo.xSelMax=r.x+.001,this.pdfInfo.ySelMax=r.y+.001),this.setPaperSize(this.pdfInfo.size,this.pdfInfo.orientation),this.setAlign(),this.drawPDFInfo())},this.getBoundingBox=function(e,t,F){this.viewer.ndsModel.setDirty();for(var i=0,N=this.viewer.ndsModel.meshManager.getNumInstancedMeshes();it.x&&(t.x=A.x),A.y>t.y&&(t.y=A.y))}else{f.copy(u.matrixWorld),m.makeTranslation(-this.transPosition.x,-this.transPosition.y,-this.transPosition.z),f.premultiply(m),f.premultiply(this.matrixWorld),m.makeTranslation(this.transPosition.x,this.transPosition.y,this.transPosition.z),f.premultiply(m);var y=p.boundingBox.min.clone().applyMatrix4(f),E=p.boundingBox.max.clone().applyMatrix4(f);this.textflag?(this.textflag=!1,e.x=y.x,e.y=y.y,t.x=E.x,t.y=E.y):(y.xt.x&&(t.x=E.x),E.y>t.y&&(t.y=E.y))}}}}for(var M=0,U=c.getNumTexts();Mt.x&&(t.x=s[2]),s[3]>t.y&&(t.y=s[3])));for(var G=this.viewer.ndsModel.getLineSegmentsSet(),C=0,z=G.getNumLineSegments();Ct.x&&(t.x=D.x),D.y>t.y&&(t.y=D.y)),H.lineStyle&&(O=H.lineStyle.textMesh)&&(O.geometry.computeBoundingBox(),L=O.geometry.boundingBox.min.clone().applyMatrix4(R),D=O.geometry.boundingBox.max.clone().applyMatrix4(R),this.textflag?(this.textflag=!1,e.x=L.x,e.y=L.y,t.x=D.x,t.y=D.y):(L.xt.x&&(t.x=D.x),D.y>t.y&&(t.y=D.y)))))}},this.setPaperSize=function(e,t){switch(e){case"A5":var i=[210,148];this.pdfInfo.width=i[0],this.pdfInfo.height=i[1];break;case"A4":i=[297,210];this.pdfInfo.width=i[0],this.pdfInfo.height=i[1];break;case"A3":i=[420,297];this.pdfInfo.width=i[0],this.pdfInfo.height=i[1];break;case"A2":i=[594,420];this.pdfInfo.width=i[0],this.pdfInfo.height=i[1];break;case"A1":i=[841,594];this.pdfInfo.width=i[0],this.pdfInfo.height=i[1];break;case"A0":i=[1189,841];this.pdfInfo.width=i[0],this.pdfInfo.height=i[1];break;default:i=[297,210];this.pdfInfo.width=i[0],this.pdfInfo.height=i[1]}"l"!=t&&(e=this.pdfInfo.width,this.pdfInfo.width=this.pdfInfo.height,this.pdfInfo.height=e)},this.getPaperSize=function(){return["A5","A4","A3","A2","A1","A0"]},this.setAlign=function(){this.pdfInfo.xLen=this.pdfInfo.xSelMax-this.pdfInfo.xSelMin,this.pdfInfo.yLen=this.pdfInfo.ySelMax-this.pdfInfo.ySelMin;var e=this.pdfInfo.xLen/this.pdfInfo.yLen;this.pdfInfo.height,this.pdfInfo.width;e>this.pdfInfo.width/this.pdfInfo.height?(this.pdfInfo.xAlign=0,this.pdfInfo.yAlign=(this.pdfInfo.height-this.pdfInfo.width/e)/2,this.pdfInfo.scale=(this.pdfInfo.height-2*this.pdfInfo.yAlign)/this.pdfInfo.yLen):(this.pdfInfo.xAlign=(this.pdfInfo.width-this.pdfInfo.height*e)/2,this.pdfInfo.yAlign=0,this.pdfInfo.scale=(this.pdfInfo.width-2*this.pdfInfo.xAlign)/this.pdfInfo.xLen)},this.normalize=function(e){e.x=(e.x-this.pdfInfo.xSelMin)/this.pdfInfo.xLen,e.y=(e.y-this.pdfInfo.ySelMin)/this.pdfInfo.yLen},this.convertToPDFCood=function(e,t,i){var n,r,o=this.pdfInfo.width-2*this.pdfInfo.xAlign,s=this.pdfInfo.height-2*this.pdfInfo.yAlign,a=e.x*o+this.pdfInfo.xAlign,e=(1-e.y)*s+this.pdfInfo.yAlign;return t&&(n=t.x*o+this.pdfInfo.xAlign,r=(1-t.y)*s+this.pdfInfo.yAlign),i?[a,e,n,r,i.x*o+this.pdfInfo.xAlign,(1-i.y)*s+this.pdfInfo.yAlign]:t?[a,e,n,r]:[a,e]},this.colorTest=function(e){16777215==e.getHex()&&e.setHex(16777215-e.getHex())},this.getFontSaveTableId=function(e){for(var t,i=0;is&&(r[0]=s),r[1]>t&&(r[1]=t),r[2]=n.tEnd?(n.tCur=Math.abs(i/n.tEnd),n.updateModel(n.tCur),n.clipTransRotControl.update(),n.clipTransRotControl.updateMatrixWorld(!0),n.updateTransContorlOnce=!0):0Math.abs(n.tEnd)&&(n.tCur=1,n.updateModel(n.tCur),e=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(1,0,0),n.lineNormal),t=(new THREE.Matrix4).makeRotationFromQuaternion(e),i=(new THREE.Matrix4).makeTranslation(n.endPoint.x,n.endPoint.y,n.endPoint.z),n.objectBox.matrix.identity(),n.objectBox.matrixAutoUpdate=!1,n.objectBox.applyMatrix(t),n.objectBox.applyMatrix(i),n.objectBox.updateMatrixWorld(!0),n.objectBox.matrixAutoUpdate=!0,n.updateTransContorlOnce)&&(n.clipTransRotControl.position.copy(n.endPoint),n.clipTransRotControl.update(),n.clipTransRotControl.updateMatrixWorld(!0))}}function Pe(e){g.call(this,e),this.type="OpPiovt",this.tempCenterBox=new THREE.Vector3,this.OpUtils=new i(e),this.selectedObjectUUID=[],!this.viewer.hasBrepInfo()&&this.viewer.hasBrepFile()?this.viewer.loadBrepInfo(!1):this.viewer.dispatchEvent({type:"BrepInfoEvent"}),this.piovtPrompt=document.createElement("div"),Se.isMobileDevice()?this.piovtPrompt.className="app-alert":this.piovtPrompt.className="pc-alert",this.viewer.container.appendChild(this.piovtPrompt),this.piovtType="",this.PointSize=4,this.allowType=[],this.preSelectInfo=null,this.preSelectObj=null,this.piovtScene=new THREE.Group,this.piovtScene.name="OpPiovt",this.init()}(An.prototype=Object.create(g.prototype)).changeSelobject=function(){var e=this.viewer.getExplodeMode();if(this.updateNodeMatrix(),this.TransRotControl){this.MoveObjects=this.viewer.selectionManager.getSelectedleafObjects();for(var t,i,n=new THREE.Box3,r=0;rthis.drawCount&&this.drawArray.pop(),2<=this.drawArray.length?this.addSpline(1,!0):this.clearUnCompleteMesh(),this.drawArray=[],this.drawCount=0)},Te.prototype.cricle3=function(e,t,i,n){var r=(new THREE.Vector3).subVectors(t,e).normalize(),o=(new THREE.Vector3).subVectors(i,t).normalize(),s=(new THREE.Vector3).crossVectors(r,o);if(Math.abs(s.x)<1e-7&&Math.abs(s.y)<1e-7&&Math.abs(s.z)<1e-7)return l=new THREE.LineCurve3(e,t).getPoints(this.ARC_SEGMENTS/2),d=new THREE.LineCurve3(t,i).getPoints(this.ARC_SEGMENTS/2),l.concat(d);for(var a=[n],l=this.projectPlane.normal.clone(),d=l.angleTo(s)<1e-4,c=(new THREE.Vector3).crossVectors(r,s),o=(new THREE.Vector3).crossVectors(o,s),s=(new THREE.Vector3).addVectors(e,t).divideScalar(2),i=(new THREE.Vector3).addVectors(t,i).divideScalar(2),i=(new THREE.Vector3).subVectors(i,s).cross(o),o=(new THREE.Vector3).crossVectors(c,o),i=i.dot(o)/o.dot(o),h=(new THREE.Vector3).copy(s).addScaledVector(c,i),u=h.distanceTo(e),p=(new THREE.Vector3).subVectors(e,h).normalize(),o=(new THREE.Vector3).subVectors(t,h).normalize(),s=(new THREE.Vector3).subVectors(h,t).normalize(),c=(new THREE.Vector3).crossVectors(r,s).normalize(),f=p.angleTo(o),m=(d==l.angleTo(c)<1e-4&&(f=2*Math.PI-f),new THREE.Vector3),g=(new THREE.Vector3).copy(l),v=d?-1:1,A=0;A=Math.PI/2&&t.negate(),this.projectPlane=(new THREE.Plane).setFromNormalAndCoplanarPoint(t,e),this.viewer.cameraControl.rotateToPlane(this.projectPlane),this.isDrawType()?this.viewer.onChangeCursor("OpDrawGeom"):this.viewer.onChangeCursor("OpOrbit")},Te.prototype.createPlaneFace=function(e,t){e=this.OpUtils.createFace(e,t);return e.updateMatrixWorld(!0),e},Te.prototype.clearParams=function(){this.drawArray=[],this.drawCount=0,this.needAddScene=!1,this.needSelectPlane=!1},Te.prototype.clearUnCompleteMesh=function(){this.currentMesh&&(this.needAddScene||(this.drawScene.remove(this.currentMesh),this.currentMesh.geometry.dispose()),this.clearParams(),this.currentMesh=null)},Te.prototype.clearPreSelectPlane=function(){this.preSelectPlaneInfo=null,this.preSelectPlaneObj&&(this.drawScene.remove(this.preSelectPlaneObj),this.preSelectPlaneObj=null,this.viewer.render())},Te.prototype.clearSelectPlane=function(){this.selectPlaneObj&&(this.drawScene.remove(this.selectPlaneObj),this.selectPlaneObj=null,this.viewer.render())},Te.prototype.notifyCreateMesh=function(e){this.viewer.dispatchEvent({type:"drawGeom",uuid:e.uuid,name:e.name,id:e.objectType}),this.viewer.render()},Te.prototype.removeMesh=function(e,t){for(var i=!1,n=0;n=t.value)return this.search_node_=t}else for(;t=t.next;)if(e=e.basin.bottom_node.next.point.y;)e.basin.bottom_node=e.basin.bottom_node.next;if(e.basin.bottom_node!==e.basin.left_node){for(e.basin.right_node=e.basin.bottom_node;e.basin.right_node.next&&e.basin.right_node.point.ye.basin.right_node.point.y,function e(t,i){if(kn(t,i))return;Vn(t,i);{if(i.prev===t.basin.left_node&&i.next===t.basin.right_node)return;if(i.prev===t.basin.left_node){if(v(i.point,i.next.point,i.next.next.point)===f.CW)return;i=i.next}else if(i.next===t.basin.right_node){if(v(i.point,i.prev.point,i.prev.prev.point)===f.CCW)return;i=i.prev}else i=i.prev.point.yt.q.x,!Nn(i.triangle,t.p,t.q)){!function(e,t,i){(e.edge_event.right?function(e,t,i){for(;i.next.point.xt.p.x;)v(t.q,i.prev.point,t.p)===f.CW?function e(t,i,n){n.point.x>i.p.x&&(v(n.point,n.prev.point,n.prev.prev.point)===f.CW?Wn:(zn(t,i,n),e))(t,i,n)}(e,t,i):i=i.prev})(e,t,i)}(e,t,i);try{Fn(e,t.p,t.q,i.triangle,t.q)}catch(e){}}}(e,o[s],r)}(e),function(e){var t=e.front().head().next.triangle,i=e.front().head().next.point;for(;!t.getConstrainedEdgeCW(i);)t=t.neighborCCW(i);e.meshClean(t)}(e)}});function Fn(e,t,i,n,r){if(!Nn(n,t,i)){var o=n.pointCCW(r),s=v(i,o,t);if(s===f.COLLINEAR)throw new Bn("poly2tri EdgeEvent: Collinear not supported!",[i,o,t]);var o=n.pointCW(r),a=v(i,o,t);if(a===f.COLLINEAR)throw new Bn("poly2tri EdgeEvent: Collinear not supported!",[i,o,t]);s===a?Fn(e,t,i,n=s===f.CW?n.neighborCCW(r):n.neighborCW(r),r):Yn(e,t,i,n,r)}}function Nn(e,t,i){var n=e.edgeIndex(t,i);if(-1!==n)return e.markConstrainedEdgeByIndex(n),(e=e.getNeighbor(n))&&e.markConstrainedEdgeByPoints(t,i),1}function Vn(e,t){var i=new l(t.prev.point,t.point,t.next.point);i.markNeighbor(t.prev.triangle),i.markNeighbor(t.triangle),e.addToMap(i),t.prev.next=t.next,t.next.prev=t.prev,jn(e,i)||e.mapTriangleToNodes(i)}function jn(e,t){for(var i=0;i<3;++i)if(!t.delaunay_edge[i]){var n=t.getNeighbor(i);if(n){var r=t.getPoint(i),o=n.oppositePoint(t,r),s=n.index(o);if(n.constrained_edge[s]||n.delaunay_edge[s])t.constrained_edge[i]=n.constrained_edge[s];else if(function(e,t,i,n){var r=e.x-n.x,e=e.y-n.y,o=t.x-n.x,t=t.y-n.y,s=r*t-o*e;if(s<=0)return!1;var a=i.x-n.x,i=i.y-n.y,n=a*e-r*i;if(n<=0)return!1;return 0<(r*r+e*e)*(o*i-a*t)+(o*o+t*t)*n+(a*a+i*i)*s}(r,t.pointCCW(r),t.pointCW(r),o))return t.delaunay_edge[i]=!0,n.delaunay_edge[s]=!0,Un(t,r,n,o),!jn(e,t)&&e.mapTriangleToNodes(t),!jn(e,n)&&e.mapTriangleToNodes(n),t.delaunay_edge[i]=!1,n.delaunay_edge[s]=!1,1}}}function Un(e,t,i,n){var r=e.neighborCCW(t),o=e.neighborCW(t),s=i.neighborCCW(n),a=i.neighborCW(n),l=e.getConstrainedEdgeCCW(t),d=e.getConstrainedEdgeCW(t),c=i.getConstrainedEdgeCCW(n),h=i.getConstrainedEdgeCW(n),u=e.getDelaunayEdgeCCW(t),p=e.getDelaunayEdgeCW(t),f=i.getDelaunayEdgeCCW(n),m=i.getDelaunayEdgeCW(n);e.legalize(t,n),i.legalize(n,t),i.setDelaunayEdgeCCW(t,u),e.setDelaunayEdgeCW(t,p),e.setDelaunayEdgeCCW(n,f),i.setDelaunayEdgeCW(n,m),i.setConstrainedEdgeCCW(t,l),e.setConstrainedEdgeCW(t,d),e.setConstrainedEdgeCCW(n,c),i.setConstrainedEdgeCW(n,h),e.clearNeighbors(),i.clearNeighbors(),r&&i.markNeighbor(r),o&&e.markNeighbor(o),s&&e.markNeighbor(s),a&&i.markNeighbor(a),e.markNeighbor(i)}function kn(e,t){t=e.basin.left_highest?e.basin.left_node.point.y-t.point.y:e.basin.right_node.point.y-t.point.y;return e.basin.width>t}function _n(e,t,i){Vn(e,i.next),i.next.point!==t.p&&v(t.q,i.next.point,t.p)===f.CCW&&v(i.point,i.next.point,i.next.next.point)===f.CCW&&_n(e,t,i)}function Gn(e,t,i){v(i.next.point,i.next.next.point,i.next.next.next.point)===f.CCW?_n(e,t,i.next):v(t.q,i.next.next.point,t.p)===f.CCW&&Gn(e,t,i.next)}function zn(e,t,i){v(i.prev.point,i.prev.prev.point,i.prev.prev.prev.point)===f.CW?Wn(e,t,i.prev):v(t.q,i.prev.prev.point,t.p)===f.CW&&zn(e,t,i.prev)}function Wn(e,t,i){Vn(e,i.prev),i.prev.point!==t.p&&v(t.q,i.prev.point,t.p)===f.CW&&v(i.point,i.prev.point,i.prev.prev.point)===f.CW&&Wn(e,t,i)}function Yn(e,t,i,n,r){var o,s,a,l,d,c,h,u=n.neighborAcross(r),p=(Rn(u,"FLIP failed due to missing triangle!"),u.oppositePoint(n,r));if(n.getConstrainedEdgeAcross(r))throw o=n.index(r),new Bn("poly2tri Intersecting Constraints",[r,p,n.getPoint((o+1)%3),n.getPoint((o+2)%3)]);Cn(r,n.pointCCW(r),n.pointCW(r),p)?(Un(n,r,u,p),e.mapTriangleToNodes(n),e.mapTriangleToNodes(u),r===i&&p===t?i===e.edge_event.constrained_edge.q&&t===e.edge_event.constrained_edge.p&&(n.markConstrainedEdgeByPoints(t,i),u.markConstrainedEdgeByPoints(t,i),jn(e,n),jn(e,u)):(o=v(i,p,t),a=n,l=u,d=r,c=p,Yn(s=e,t,i,n=o!==f.CCW?(h=a.edgeIndex(d,c),a.delaunay_edge[h]=!0,jn(s,a),a.clearDelaunayEdges(),l):(h=l.edgeIndex(d,c),l.delaunay_edge[h]=!0,jn(s,l),l.clearDelaunayEdges(),a),r))):(function e(t,i,n,r,o,s){var a=o.neighborAcross(s);Rn(a,"FLIP failed due to missing triangle");o=a.oppositePoint(o,s);Cn(n,r.pointCCW(n),r.pointCW(n),o)?Yn(t,n,o,a,o):(s=Xn(i,n,a,o),e(t,i,n,r,a,s))}(e,t,i,n,u,Xn(t,i,u,p)),Fn(e,t,i,n,r))}function Xn(e,t,i,n){var r=v(t,n,e);if(r===f.CW)return i.pointCCW(n);if(r===f.CCW)return i.pointCW(n);throw new Bn("poly2tri [Unsupported] nextFlipPoint: opposing point on constrained edge!",[t,n,e])}function Qn(e,t){if(this.p=e,this.q=t,e.y>t.y)this.q=e,this.p=t;else if(e.y===t.y)if(e.x>t.x)this.q=e,this.p=t;else if(e.x===t.x)throw new Bn("poly2tri Invalid Edge constructor: repeated points!",[e]);this.q._p2t_edge_list||(this.q._p2t_edge_list=[]),this.q._p2t_edge_list.push(this)}function qn(){this.left_node=null,this.bottom_node=null,this.right_node=null,this.width=0,this.left_highest=!1}function Zn(){this.constrained_edge=null,this.right=!1}function p(e,t){t=t||{},this.triangles_=[],this.map_=[],this.points_=t.cloneArrays?e.slice(0):e,this.edge_list=[],this.pmin_=this.pmax_=null,this.front_=null,this.head_=null,this.tail_=null,this.af_head_=null,this.af_middle_=null,this.af_tail_=null,this.basin=new qn,this.edge_event=new Zn,this.initEdges(this.points_)}function Kn(e,t,i){var r,n,o,s,a,l,d,c,h,u,p,f,m=e,g=t,v=!1,A=new THREE.Color,y=this,E={texSize:64,pixScale:1,blurRadius:7,debug:!1};function M(e){return new THREE.ShaderMaterial({uniforms:THREE.UniformsUtils.clone(e.uniforms),vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,defines:THREE.UniformsUtils.clone(e.defines)})}if(this.setTransform=function(e,t,i,n){r.left=-t.z/2,r.right=t.z/2,r.top=t.x/2,r.bottom=-t.x/2,r.near=1,r.far=t.y+r.near,r.updateProjectionMatrix(),r.position.addVectors(e,i.clone().multiplyScalar(-t.y/2-r.near)),n&&r.up.set(n.x,n.y,n.z),r.lookAt(e),o.position.set(e.x,e.y,e.z),o.rotation.set(r.rotation.x,r.rotation.y,r.rotation.z),o.scale.set(t.z,t.x,t.y),E.debug&&(f.position.set(e.x,e.y,e.z),f.rotation.set(r.rotation.x,r.rotation.y,r.rotation.z),f.scale.set(t.z,t.x,t.y)),p.uniforms.worldSize.value.copy(t)},this.renderIntoShadow=function(e){var t,i;!this.enabled||e.overrideMaterial&&e.overrideMaterial.transparent||(t=e.overrideMaterial,e.overrideMaterial=l,(i=e.getObjectByName("GridHelper"))&&(e.gridvisible=i.visible,i.visible=!1),m.ndsModel&&(m.ndsModel.backupDirty(),m.ndsModel.setDirty(),m.ndsModel.setDrawMode(m.ndsModel.SHADED),m.scene.children.push(m.ndsModel),m.ndsModel.setOverrideMaterial(l,d,!1)),g.render(e,r,s,!1),e.overrideMaterial=t,m.ndsModel&&(m.ndsModel.setOverrideMaterial(null,null,!1),m.ndsModel.resetDirty()),i&&(i.visible=e.gridvisible))},this.renderShadow=function(e,t){this.enabled&&v&&(t?g.render(n,e,t,!1):g.render(n,e))},this.postprocess=function(){this.enabled&&(u.render(g,a,s),h.render(g,s,a),v=!0)},this.clear=function(){var e,t,i;this.enabled&&(e=g.getClearColor(A),t=g.getClearAlpha(),i=g.getRenderTarget(),g.setClearColor(16777215,0),g.setRenderTarget(s),g.clear(!0,!0,!1),g.setClearColor(e,t),v=!1,g.setRenderTarget(i))},this.getRenderTarget=function(){return s},this.setColor=function(e){c.uniforms.uShadowColor.value.x=e.r,c.uniforms.uShadowColor.value.y=e.g,c.uniforms.uShadowColor.value.z=e.b},this.getColor=function(){return new THREE.Color(c.uniforms.uShadowColor.value.x,c.uniforms.uShadowColor.value.y,c.uniforms.uShadowColor.value.z)},this.setAlpha=function(e){c.uniforms.uShadowColor.value.w=e},this.getAlpha=function(){return c.uniforms.uShadowColor.value.w},this.isValid=function(){return v},this.getDepthMaterial=function(){return l},this.updateGroundTransform=function(e,t,i){var n,r,o;y.enabled&&t&&(y.needClear=!0,t=t.clone(),n=new THREE.Vector3(1,0,0),r=t.getCenter(new THREE.Vector3),o=t.getSize(new THREE.Vector3),e.worldUpTransform&&(n.applyMatrix4(e.worldUpTransform),t.applyMatrix4(e.worldUpTransform),o=t.size()),t=o.x>o.z?o.x/o.z:o.z/o.x,o.multiply(new THREE.Vector3(1.25,1.01,1.25)),o.x=o.z=Math.max(o.x,o.z),i?y.setTransform(r,o,i,n):y.setTransform(r,o,e.up,n),--t<5&&(t/=500),0<(t=2/Math.PI*Math.atan(t)))&&(c.defines.DARKNESS_SCALE=1.00001+t)},i)for(var w in E)E[w]=i[w]||E[w];n=new THREE.Scene,r=new THREE.OrthographicCamera,(s=new THREE.WebGLRenderTarget(E.texSize,E.texSize,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat,stencilBuffer:!1})).texture.generateMipmaps=!1,(a=new THREE.WebGLRenderTarget(E.texSize,E.texSize,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat,stencilBuffer:!1})).texture.generateMipmaps=!1,(l=M($n)).defines.NUM_CUTPLANES=0,l.side=THREE.DoubleSide,l.blending=THREE.NoBlending,d=(new l.constructor).copy(l),h=new Wt(tr,"tDepth"),u=new Wt(tr,"tDepth"),p=new Wt(er,"tDepth"),h.material.defines.KERNEL_SCALE=u.material.defines.KERNEL_SCALE=(E.pixScale/E.texSize).toFixed(4),h.material.defines.KERNEL_RADIUS=u.material.defines.KERNEL_RADIUS=E.blurRadius.toFixed(2),p.material.blending=h.material.blending=u.material.blending=THREE.NoBlending,p.material.depthWrite=h.material.depthWrite=u.material.depthWrite=!1,p.material.depthTest=h.material.depthTest=u.material.depthTest=!1,h.material.defines.HORIZONTAL=1,(c=M(ir)).uniforms.tDepth.value=s.texture,c.depthWrite=!1,c.transparent=!0,c.defines.NUM_CUTPLANES=0,(e=new THREE.BufferGeometry).addAttribute("position",new THREE.BufferAttribute(new Float32Array([-.5,-.5,.5,-.5,.5,.5,.5,.5,.5,.5,-.5,.5]),3)),e.addAttribute("uv",new THREE.BufferAttribute(new Float32Array([0,0,0,1,1,1,1,0]),2)),e.setIndex(new THREE.BufferAttribute(new Uint16Array([0,1,2,2,3,0]),1)),o=new THREE.Mesh(e,c),n.add(o),E.debug&&(f=new THREE.Mesh(new THREE.BoxGeometry(1,1,1),new THREE.MeshBasicMaterial({color:65280,wireframe:!0})),n.add(f)),this.setTransform(new THREE.Vector3(0,0,0),new THREE.Vector3(1,1,1),new THREE.Vector3(0,1,0))}var l=function(e,t,i){this.points_=[e,t,i],this.neighbors_=[null,null,null],this.interior_=!1,this.constrained_edge=[!1,!1,!1],this.delaunay_edge=[!1,!1,!1]},Jn=Pn.toString,e=(l.prototype.toString=function(){return"["+Jn(this.points_[0])+Jn(this.points_[1])+Jn(this.points_[2])+"]"},l.prototype.getPoint=function(e){return this.points_[e]},l.prototype.GetPoint=l.prototype.getPoint,l.prototype.getPoints=function(){return this.points_},l.prototype.getNeighbor=function(e){return this.neighbors_[e]},l.prototype.containsPoint=function(e){var t=this.points_;return e===t[0]||e===t[1]||e===t[2]},l.prototype.containsEdge=function(e){return this.containsPoint(e.p)&&this.containsPoint(e.q)},l.prototype.containsPoints=function(e,t){return this.containsPoint(e)&&this.containsPoint(t)},l.prototype.isInterior=function(){return this.interior_},l.prototype.setInterior=function(e){return this.interior_=e,this},l.prototype.markNeighborPointers=function(e,t,i){var n=this.points_;if(e===n[2]&&t===n[1]||e===n[1]&&t===n[2])this.neighbors_[0]=i;else if(e===n[0]&&t===n[2]||e===n[2]&&t===n[0])this.neighbors_[1]=i;else{if(!(e===n[0]&&t===n[1]||e===n[1]&&t===n[0]))throw new Error("poly2tri Invalid Triangle.markNeighborPointers() call");this.neighbors_[2]=i}},l.prototype.markNeighbor=function(e){var t=this.points_;e.containsPoints(t[1],t[2])?(this.neighbors_[0]=e).markNeighborPointers(t[1],t[2],this):e.containsPoints(t[0],t[2])?(this.neighbors_[1]=e).markNeighborPointers(t[0],t[2],this):e.containsPoints(t[0],t[1])&&(this.neighbors_[2]=e).markNeighborPointers(t[0],t[1],this)},l.prototype.clearNeighbors=function(){this.neighbors_[0]=null,this.neighbors_[1]=null,this.neighbors_[2]=null},l.prototype.clearDelaunayEdges=function(){this.delaunay_edge[0]=!1,this.delaunay_edge[1]=!1,this.delaunay_edge[2]=!1},l.prototype.pointCW=function(e){var t=this.points_;return e===t[0]?t[2]:e===t[1]?t[0]:e===t[2]?t[1]:null},l.prototype.pointCCW=function(e){var t=this.points_;return e===t[0]?t[1]:e===t[1]?t[2]:e===t[2]?t[0]:null},l.prototype.neighborCW=function(e){return e===this.points_[0]?this.neighbors_[1]:e===this.points_[1]?this.neighbors_[2]:this.neighbors_[0]},l.prototype.neighborCCW=function(e){return e===this.points_[0]?this.neighbors_[2]:e===this.points_[1]?this.neighbors_[0]:this.neighbors_[1]},l.prototype.getConstrainedEdgeCW=function(e){return e===this.points_[0]?this.constrained_edge[1]:e===this.points_[1]?this.constrained_edge[2]:this.constrained_edge[0]},l.prototype.getConstrainedEdgeCCW=function(e){return e===this.points_[0]?this.constrained_edge[2]:e===this.points_[1]?this.constrained_edge[0]:this.constrained_edge[1]},l.prototype.getConstrainedEdgeAcross=function(e){return e===this.points_[0]?this.constrained_edge[0]:e===this.points_[1]?this.constrained_edge[1]:this.constrained_edge[2]},l.prototype.setConstrainedEdgeCW=function(e,t){e===this.points_[0]?this.constrained_edge[1]=t:e===this.points_[1]?this.constrained_edge[2]=t:this.constrained_edge[0]=t},l.prototype.setConstrainedEdgeCCW=function(e,t){e===this.points_[0]?this.constrained_edge[2]=t:e===this.points_[1]?this.constrained_edge[0]=t:this.constrained_edge[1]=t},l.prototype.getDelaunayEdgeCW=function(e){return e===this.points_[0]?this.delaunay_edge[1]:e===this.points_[1]?this.delaunay_edge[2]:this.delaunay_edge[0]},l.prototype.getDelaunayEdgeCCW=function(e){return e===this.points_[0]?this.delaunay_edge[2]:e===this.points_[1]?this.delaunay_edge[0]:this.delaunay_edge[1]},l.prototype.setDelaunayEdgeCW=function(e,t){e===this.points_[0]?this.delaunay_edge[1]=t:e===this.points_[1]?this.delaunay_edge[2]=t:this.delaunay_edge[0]=t},l.prototype.setDelaunayEdgeCCW=function(e,t){e===this.points_[0]?this.delaunay_edge[2]=t:e===this.points_[1]?this.delaunay_edge[0]=t:this.delaunay_edge[1]=t},l.prototype.neighborAcross=function(e){return e===this.points_[0]?this.neighbors_[0]:e===this.points_[1]?this.neighbors_[1]:this.neighbors_[2]},l.prototype.oppositePoint=function(e,t){e=e.pointCW(t);return this.pointCW(e)},l.prototype.legalize=function(e,t){var i=this.points_;if(e===i[0])i[1]=i[0],i[0]=i[2],i[2]=t;else if(e===i[1])i[2]=i[1],i[1]=i[0],i[0]=t;else{if(e!==i[2])throw new Error("poly2tri Invalid Triangle.legalize() call");i[0]=i[2],i[2]=i[1],i[1]=t}},l.prototype.index=function(e){var t=this.points_;if(e===t[0])return 0;if(e===t[1])return 1;if(e===t[2])return 2;throw new Error("poly2tri Invalid Triangle.index() call")},l.prototype.edgeIndex=function(e,t){var i=this.points_;if(e===i[0]){if(t===i[1])return 2;if(t===i[2])return 1}else if(e===i[1]){if(t===i[2])return 0;if(t===i[0])return 2}else if(e===i[2]){if(t===i[0])return 1;if(t===i[1])return 0}return-1},l.prototype.markConstrainedEdgeByIndex=function(e){this.constrained_edge[e]=!0},l.prototype.markConstrainedEdgeByEdge=function(e){this.markConstrainedEdgeByPoints(e.p,e.q)},l.prototype.markConstrainedEdgeByPoints=function(e,t){var i=this.points_;t===i[0]&&e===i[1]||t===i[1]&&e===i[0]?this.constrained_edge[2]=!0:t===i[0]&&e===i[2]||t===i[2]&&e===i[0]?this.constrained_edge[1]=!0:(t===i[1]&&e===i[2]||t===i[2]&&e===i[1])&&(this.constrained_edge[0]=!0)},qn.prototype.clear=function(){this.left_node=null,this.bottom_node=null,this.right_node=null,this.width=0,this.left_highest=!1},p.prototype.AddHole=p.prototype.addHole=function(e){this.initEdges(e);for(var t=e.length,i=0;ie&&(e=s.x),s.xi&&(i=s.y),s.y=e.bbox.max.y||e.node_edges.length<3)){for(var t=.5*(e.bbox.min.y+e.bbox.max.y),i=(e.left=new h,e.right=new h,this.pts),n=e.node_edges,r=[],o=new THREE.Vector2,s=0;s=i)for(var n=this.pts,r=e.node_edges,o=0,s=r.length;o=i&&this.pointInPolygonRec(u,t,i),e.right);u&&u.bbox.min.y<=i&&u.bbox.max.y>=i&&this.pointInPolygonRec(u,t,i)},u.prototype.pointInPolygon=function(e,t){return this.pipResult=!1,this.pointInPolygonRec(this.root,e,t),this.pipResult};var i=new THREE.Vector3;function e(e,t){this.edges=e,this.bbox=t,this.pts=[],this.idmap={},this.xymap={},this.contours=[],this.scale=1e6/this.bbox.getSize(i).length()}function t(e){this.indices=[],this.cset=e;var t=this.pts=e.pts;this.intervalTree=new u(e.pts,e.edges,e.bbox),this.intervalTree.build();for(var i=0;iS&&(g=r,v=o,u=y.clone()):(p=r,f=o,h=y)),0==A&&0==c?a.push(new B(i.clone(),n.clone(),o,o,s,s,l)):(M*e<0&&(m=1/(e-M),g=o,v=s,y=i.clone().multiplyScalar(e*m).sub(n.clone().multiplyScalar(M*m)),h?y.distanceTo(h)>S&&(g=o,v=s,u=y.clone()):(p=o,f=s,h=y.clone())),0==d&&0==c?a.push(new B(n.clone(),t.clone(),s,s,r,r,l)):(e*E<0&&(A=1/(E-e),y=n.clone().multiplyScalar(E*A).sub(t.clone().multiplyScalar(e*A)),h?y.distanceTo(h)>S&&(g=s,v=r,u=y.clone()):(p=s,f=r,h=y.clone())),h&&u&&a.push(new B(h,u,p,f,g,v,l)))))))},this.intersectBoxPlane=function(e,t){var i=new THREE.Vector3,n=(i.set(t.min.x,t.min.y,t.min.z),e.distanceToPoint(i)),n=Math.sign(n),r=(i.set(t.min.x,t.min.y,t.max.z),e.distanceToPoint(i));return Math.sign(r)!==n||(i.set(t.min.x,t.max.y,t.min.z),r=e.distanceToPoint(i),Math.sign(r)!==n)||(i.set(t.min.x,t.max.y,t.max.z),r=e.distanceToPoint(i),Math.sign(r)!==n)||(i.set(t.max.x,t.min.y,t.min.z),r=e.distanceToPoint(i),Math.sign(r)!==n)||(i.set(t.max.x,t.min.y,t.max.z),r=e.distanceToPoint(i),Math.sign(r)!==n)||(i.set(t.max.x,t.max.y,t.min.z),r=e.distanceToPoint(i),Math.sign(r)!==n)||(i.set(t.max.x,t.max.y,t.max.z),r=e.distanceToPoint(i),Math.sign(r)!==n)},this.intersectMeshPlane=(w=new THREE.Vector3,x=new THREE.Vector3,I=new THREE.Vector3,b=new THREE.Matrix4,T=new THREE.Plane,function(e,t,i,n,r){var o,s,a,l=r.length,d=t.attributes,c=i;if(b.getInverse(c),T.copy(e).applyMatrix4(b),void 0!==d.index||null!=t.index){var h=(d.index?d:t).index.array,u=t.vb||d.position.array,p=t.vb?t.vbstride:3,f=(d.position&&d.position instanceof THREE.InterleavedBufferAttribute&&(u=d.position.data.array,p=d.position.data.stride),t.groups);f&&0!==f.length||(f=[{start:0,count:h.length,index:0}],t.drawRange&&t.drawRange.count!=1/0&&(f[0].start=t.drawRange.start,f[0].count=t.drawRange.count));for(var m=0,g=f.length;m 0","uniform vec4 cutplanes[NUM_CUTPLANES];","#ifdef CUTPLANES_LINE","uniform vec3 cutplanesOutlineColor;","uniform float cutplanesOutlineThickness;","#endif","bool checkCutPlanes() {","bool isCut = false;","#ifdef CUTPLANES_LINE","bool isCutEdge = false;","float eyeDist = length(vViewPosition);","#endif","for (int i=0; i 0.0);","#ifdef CUTPLANES_LINE","isCutEdge = isCutEdge || (dotPlane > -cutplanesOutlineThickness*eyeDist);","#endif","}","if (isCut) {","discard;","return true;","}","#ifdef CUTPLANES_LINE","else if (isCutEdge) {","gl_FragColor = vec4(cutplanesOutlineColor, 1.0);","return true;","}","#endif","return false;","}","#endif"].join("\n")),t=["vec4 packDepth( const in float depth ) {","vec4 enc = vec4(1.0, 255.0, 65025.0, 160581375.0) * depth;","enc = fract(enc);","enc -= enc.yzww * vec4(1.0/255.0,1.0/255.0,1.0/255.0,0.0);","return enc;","}","float unpackDepth( const in vec4 rgba_depth ) {","return dot( rgba_depth, vec4(1.0, 1.0/255.0, 1.0/65025.0, 1.0/160581375.0) );","}"].join("\n"),$n={uniforms:{cutplanes:{type:"v4v",value:[]}},vertexShader:["#ifdef USE_LOGDEPTHBUF"," #ifdef USE_LOGDEPTHBUF_EXT"," varying float vFragDepth;"," #endif"," uniform float logDepthBufFC;","#endif","#if NUM_CUTPLANES > 0","varying vec3 vWorldPosition;","#endif","void main() {","#ifdef USE_MODELMATRIXATTRIB"," mat4 ndsModelViewMatrix = viewMatrix * modelMatrixAttrib;"," gl_Position = projectionMatrix * ndsModelViewMatrix * vec4( position, 1.0 );","#else"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );;","#endif","#if NUM_CUTPLANES > 0"," vec4 worldPosition = modelMatrix * vec4( position, 1.0 );"," vWorldPosition = worldPosition.xyz;","#endif","#ifdef USE_LOGDEPTHBUF"," gl_Position.z = log2(max(1e-6, gl_Position.w + 1.0)) * logDepthBufFC;"," #ifdef USE_LOGDEPTHBUF_EXT"," vFragDepth = 1.0 + gl_Position.w;"," #else"," gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;"," #endif","#endif","}"].join("\n"),fragmentShader:["#ifdef USE_LOGDEPTHBUF"," uniform float logDepthBufFC;"," #ifdef USE_LOGDEPTHBUF_EXT"," #extension GL_EXT_frag_depth : enable"," varying float vFragDepth;"," #endif","#endif",t,"#if NUM_CUTPLANES > 0","varying vec3 vWorldPosition;","#endif",e,"void main() {","#if NUM_CUTPLANES > 0","if (checkCutPlanes()) return;","#endif","#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)","gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;","#endif","#ifdef USE_LOGDEPTHBUF_EXT","float depth = gl_FragDepthEXT / gl_FragCoord.w;","#else","float depth = gl_FragCoord.z / gl_FragCoord.w;","#endif","depth = 1.0 - depth;","gl_FragColor = packDepth(depth);","}"].join("\n")},er={uniforms:{tDepth:{type:"t",value:null},worldSize:{type:"v3",value:new THREE.Vector3(1,1,1)}},defines:{},vertexShader:["varying vec2 vUv;","void main() {","vUv = vec2(uv.x, uv.y);","gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["#define NUM_SAMPLES 29.0","#define NUM_SPIRAL_TURNS 7.0","uniform sampler2D tDepth;","uniform vec3 worldSize;","varying vec2 vUv;","#ifdef PRESET_2","#define SAMPLE_RADIUS 0.3","#define AO_GAMMA 1.0","#define AO_INTENSITY 1.0","#else","#define SAMPLE_RADIUS 0.2","#define AO_GAMMA 3.0","#define AO_INTENSITY 0.8","#endif",t,"#define PI 3.14159265358979","float rand(vec2 co) {","return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);","}","float getRandomAngle(vec2 pos) {","return rand(pos) * (2.0 * PI);","}","vec2 tapLocation(float sampleNumber, float spinAngle, out float ssR){","float alpha = float(sampleNumber + 0.5) * (1.0 / NUM_SAMPLES);","float angle = alpha * (NUM_SPIRAL_TURNS * PI * 2.0) + spinAngle;","ssR = alpha;","return vec2(cos(angle), sin(angle));","}","vec2 sampleAO(vec2 unitDirection, float radius) {","vec2 sampleOffset = unitDirection * radius;","float idepth = unpackDepth(texture2D(tDepth, vUv + sampleOffset));","float depth = 1.0 - idepth;","if (depth < 1e-6) {","if (radius == 0.0)","return vec2(1.0, 1.0);","else","return vec2(0.0, 1.0);","}","vec3 dir = vec3(sampleOffset.x, depth, sampleOffset.y) * worldSize;","float distance2 = dot(dir,dir);","float idistance = 1.0 / sqrt(distance2);","vec3 ndir = dir * idistance;","#ifdef PRESET_2","float importance = ndir.y * idistance;","#else","float importance = ndir.y / distance2;","#endif","vec2 ret;","ret.x = (idepth == 0.0) ? 0.0 : importance;","ret.y = importance;","return ret;","}","void main() {","vec2 sum = vec2(0.0);","float angle = getRandomAngle(vUv);","for (float i = 0.0; ir.maxX?r.maxX:i)r.maxY?r.maxY:n)i.col?i.row:i.col;return t.x=e.x/n,t.y=(1==i.row?e.y:e.height-e.y)/n,t.width=e.width/n,t.height=e.height/n,2==i.row&&1==i.col?(t.width=t.width/i.row,t.x+=t.width/2):1==i.row&&2==i.col&&(t.height=t.height/i.col,t.y+=t.height/2),t},this.setConnectView=function(e){e&&o.toOrthographicCamera(),l.setConnectView(e)},this.updateViewConnectByOperator=function(e){o.getActiveView().is2DView&&"OpPan"!=e&&(l.bConnectView=!0,l.updateOperatorByViewState())},this.resetCamera=function(){l.resetCamera()},this.getOrginalCameraInfo=function(){return e},this.updateActiveViewCameraInfo=function(){o.setConnectView(!1),o.viewer.look({smoothTranslation:!1,useOrginal:!0})},this.init=function(){o.bInited=!0,e=o.viewer.camera.getOrginalCameraInfo(),o.viewer.renderer.getClearColor(t),o.viewer.ndsModel.models.forEach(function(e){e.sketchFileUrl&&(n=20)}),l.setConnectView(!0)},this.initViewBoxForAllViews=function(){o.bInitViewBox||(o.bInitViewBox=!0,l.initViewBox(),o.getActiveView().enableViewBox(!0))},this.removeViewBoxes=function(){var e=o.viewer.container,t=document.getElementById("viewboxMain");t&&e.removeChild(t),l.removeViewBoxesForAllViews(),o.bInitViewBox=!1},this.displayViewBox=function(e){l.displayViewBox(e)},this.refreshViewBox=function(){l.refreshViewBox()},void 0);this.notifyCameraMove=function(t){var e,i=o.getActiveView();i.defaultCameraInfo&&null==d&&(e=function(){i.notifyConnectView({originalEventViewId:i.viewId,eventType:t.eventType,activeViewDir:i.defaultViewDir,cameraInfo:i.getCameraInfo(),defaultCameraInfo:i.defaultCameraInfo});var e=l.getIndirectConnectedView(i);null!=e&&"cameraZoom"==t.eventType&&e.notifyConnectView({originalEventViewId:i.viewId,eventType:t.eventType,activeViewDir:e.defaultViewDir,cameraInfo:e.getCameraInfo(),defaultCameraInfo:e.defaultCameraInfo})},t.immediateUpdate?e():d=setInterval(function(){e(),clearInterval(d),d=void 0},n))},this.notifyConnectCameraMove=function(){l.bConnectView&&o.getActiveView().is2DView&&(o.notifyCameraMove({eventType:"cameraPan",immediateUpdate:!0}),o.notifyCameraMove({eventType:"cameraZoom",immediateUpdate:!0}))},this.toPerspectiveCamera=function(){var e=o.getActiveView();if(e&&!e.camera.IsPerspective()){l.setConnectView(!1);for(var t=o.getView(),i=0;ic.x&&ec.y&&tthis.m_value[0]&&(e=1),e=this.m_value[2]>this.m_value[e]?2:e},t.DistanceToPoint=function(e){return Math.sqrt(Math.pow(this.m_value[0]-e.m_value[0],2)+Math.pow(this.m_value[1]-e.m_value[1],2)+Math.pow(this.m_value[2]-e.m_value[2],2))},t.GetValue=function(e){return this.m_value[e]},e}(),Y=function(){function i(){this.m_value=[],this.m_value[0]=this.m_value[1]=this.m_value[2]=1/0,this.m_value[3]=this.m_value[4]=this.m_value[5]=-1/0}var e=i.prototype;return e.Init=function(){this.m_value[0]=this.m_value[1]=this.m_value[2]=1/0,this.m_value[3]=this.m_value[4]=this.m_value[5]=-1/0},e.GetCentriod=function(){return new gr(.5*(this.m_value[0]+this.m_value[3]),.5*(this.m_value[1]+this.m_value[4]),.5*(this.m_value[2]+this.m_value[5]))},e.GetMinMaxPoint=function(e,t){new gr(this.m_value[0],this.m_value[1],this.m_value[2]),new gr(this.m_value[3],this.m_value[4],this.m_value[5])},e.SetMinMaxPoint=function(e,t){this.m_value[0]=e.m_value[0],this.m_value[1]=e.m_value[1],this.m_value[2]=e.m_value[2],this.m_value[3]=t.m_value[0],this.m_value[4]=t.m_value[1],this.m_value[5]=t.m_value[2]},e.SetMinMaxPointFromArray=function(e){this.m_value[0]=e[0],this.m_value[1]=e[1],this.m_value[2]=e[2],this.m_value[3]=e[3],this.m_value[4]=e[4],this.m_value[5]=e[5]},e.GetSize=function(){return new gr(this.m_value[3]-this.m_value[0],this.m_value[4]-this.m_value[1],this.m_value[5]-this.m_value[2])},e.Area=function(){var e=this.m_value[3]-this.m_value[0],t=this.m_value[4]-this.m_value[1],i=this.m_value[5]-this.m_value[2];return e<0||t<0||i<0?0:2*(e*t+t*i+e*i)},e.DiagonalLength=function(){return Math.sqrt(Math.pow(this.m_value[0]-this.m_value[3],2)+Math.pow(this.m_value[1]-this.m_value[4],2)+Math.pow(this.m_value[2]-this.m_value[5],2))},e.AddPoint=function(e){e.m_value[0]this.m_value[3]&&(this.m_value[3]=e.m_value[0]),e.m_value[1]this.m_value[4]&&(this.m_value[4]=e.m_value[1]),e.m_value[2]this.m_value[5]&&(this.m_value[5]=e.m_value[2])},e.AddVector=function(e){this.m_value[0]=Math.min(e.x,this.m_value[0]),this.m_value[1]=Math.min(e.y,this.m_value[1]),this.m_value[2]=Math.min(e.z,this.m_value[2]),this.m_value[3]=Math.max(e.x,this.m_value[3]),this.m_value[4]=Math.max(e.y,this.m_value[4]),this.m_value[5]=Math.max(e.z,this.m_value[5])},e.AddBox=function(e){e.m_value[0]this.m_value[3]&&(this.m_value[3]=e.m_value[3]),e.m_value[1]this.m_value[4]&&(this.m_value[4]=e.m_value[4]),e.m_value[2]this.m_value[5]&&(this.m_value[5]=e.m_value[5])},e.IsIntersectBox=function(e){return!(e.m_value[3]this.m_value[3]||e.m_value[4]this.m_value[4]||e.m_value[5]this.m_value[5])},e.GetValue=function(e){return this.m_value[e]},e.SetFromBox=function(e){this.m_value[0]=e.m_value[0],this.m_value[1]=e.m_value[1],this.m_value[2]=e.m_value[2],this.m_value[3]=e.m_value[3],this.m_value[4]=e.m_value[4],this.m_value[5]=e.m_value[5]},e.MultiplyMatrix=function(e){i.points[0].set(this.m_value[0],this.m_value[1],this.m_value[2]).applyMatrix4(e),i.points[1].set(this.m_value[3],this.m_value[1],this.m_value[2]).applyMatrix4(e),i.points[2].set(this.m_value[3],this.m_value[1],this.m_value[5]).applyMatrix4(e),i.points[3].set(this.m_value[0],this.m_value[1],this.m_value[5]).applyMatrix4(e),i.points[4].set(this.m_value[0],this.m_value[4],this.m_value[2]).applyMatrix4(e),i.points[5].set(this.m_value[3],this.m_value[4],this.m_value[2]).applyMatrix4(e),i.points[6].set(this.m_value[3],this.m_value[4],this.m_value[5]).applyMatrix4(e),i.points[7].set(this.m_value[0],this.m_value[4],this.m_value[5]).applyMatrix4(e),this.Init();for(var t=0;t<8;++t)this.AddVector(i.points[t])},e.toArray=function(){return this.m_value},i}(),Ar=(Y.points=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3],function(){function e(){this.m_size=0,this.m_nodes=[],this.m_primIds=[]}var t=e.prototype;return t.Reset=function(){this.m_nodes=[],this.m_primIds=[],this.m_size=0},t.SetNumEstimateNodes=function(e){for(var t=0;tt){var i=t/4;(i=i<16?16:i)=this.m_maxLevel||f.m_value[m]P&&(n[z+W]=O[H-r],++W);return N.SetFromBox(m[P]),V.SetFromBox(w[P+1]),j.SetFromBox(g[P]),U.SetFromBox(x[P+1]),z},t.getMatrixId=function(e){for(var t=0,i=this.matrixs.length;t=b.maxFPS+5)M=b.maxFPS;else{1<=e-E&&(E=e);var n=0===e?100:M/b.minFPS*b.maxFrameTime;if((_b.minFPS&&s>b.renderer.maxPrimitivesPerFrame&&(b.renderer.maxPrimitivesPerFrame=s)}T.length=w.length=0}e={timeStamp:e,fps:M,needsRedraw:!1};if(v.ndsModel&&!v.ndsModel.isEmpty()&&v.ndsModel.update(e),v.modelRequestor&&v.modelRequestor.request(),Ce.update(e),t){if(v.enableProgressiveRender||(n=1e4),null!=A)for(var a=0,l=A.length;a=b.renderer.maxPrimitivesPerFrame&&w.push(u)):(b.showLineObjects(b.scene,!1),b.positionMaterial.uniforms.cameraNear.value=b.camera.near,b.positionMaterial.uniforms.cameraFar.value=b.camera.far,b.scene.overrideMaterial=b.positionMaterial,b.renderer.render(b.scene,b.camera,b.positionTarget,!0),b.scene.overrideMaterial=b.normalMaterial,b.renderer.render(b.scene,b.camera,b.normalTarget,!0),b.scene.overrideMaterial=null,b.showLineObjects(b.scene,!0),b.renderer.render(b.scene,b.camera,b.normalRenderTarget,!0)),b.ssaoComposer.render();else if(b.ndsModel){if(b.renderStates.forceClear&&(b.renderer.clearTarget(b.renderer.colorTarget,!0,!0,!1),b.ndsModel.setDirty()),void 0!==b.backGroundScene&&!y&&b.renderStates.forceClear&&b.renderer.render(b.backGroundScene,b.backGroundCamera,b.renderer.colorTarget),b.envMapScene&&!L&&b.renderStates.forceClear&&(H?(b.renderer.render(b.envMapScene,b.envMapCamera,b.envMapBlurTargetH),b.envMapBlurPassV.render(b.renderer,b.envMapBlurTargetV,b.envMapBlurTargetH),b.envMapBlurPassH.render(b.renderer,b.renderer.colorTarget,b.envMapBlurTargetV)):b.renderer.render(b.envMapScene,b.envMapCamera,b.renderer.colorTarget)),N&&b.groundShadow.needClear&&(b.groundShadow.clear(),b.groundShadow.needClear=!1),N&&!b.groundShadow.isValid()&&j&&(b.groundShadow.renderIntoShadow(b.scene),b.groundShadow.postprocess(),b.ndsModel.setDirty()),j||y){b.clipPlaneManager&&(b.clipPlaneManager.renderClipPlane(),b.renderer.clippingPlanes=c);for(var h,u=0,p=b.ndsModel.SHADED_WITH_EDGES,f=(4===R?p=b.ndsModel.SHADED_WITH_EDGES:5===R?p=b.ndsModel.SHADED:2===R?p=b.ndsModel.WIREFRAME:6===R?p=b.ndsModel.HIDDEN_LINE_REMOVE:7===R?p=b.ndsModel.HIDDEN_LINE_VISIBLE:8===R&&(p=b.ndsModel.TRANSPARENT),p!==b.ndsModel.SHADED_WITH_EDGES||b.bLinesVisibility||(p=b.ndsModel.SHADED),b.ndsModel.setDrawMode(p),b.scene.children.push(b.ndsModel),b.renderer.render(b.scene,b.camera,b.renderer.colorTarget,!1,!1,!1,n),u+=b.renderer.info.render.triangles+b.renderer.info.render.lines,Re.enableOutlineEffect&&b.renderStates.forceClear?v.outlinePass.render(b.renderer,null,b.renderer.colorTarget):v.selectionOutlinePass&&(b.renderStates.forceClear&&(v.selectionOutlinePass.shouldRenderOutline=!0),b.selectionManager.shouldApplySelectedMaterial)&&!v.isNdsModelInWireframeMode(R)&&v.selectionOutlinePass.shouldRenderOutline&&!b.renderer.stopRenderingEarly&&(p=v.renderer.getClearColor(v.oldClearColor).clone(),h=v.renderer.getClearAlpha(),v.renderer.setClearColor(p,0),v.selectionOutlinePass.render(b.renderer,null,b.renderer.colorTarget),v.renderer.setClearColor(p,h)),b.pmiVisible&&b.pmiObject&&(b.scene.getObjectByName("pmiobject")||b.scene.add(b.pmiObject),b.renderer.render(b.scene,b.camera,b.renderer.colorTarget,!1,!1,!1,n),b.scene.remove(b.pmiObject)),ee&&v.isNdsModelInWireframeMode(R)&&!b.is2DModel&&(b.composer.colorTarget.uuid!=b.renderer.colorTarget.uuid&&b.composer.setColorTarget(b.renderer.colorTarget),b.composer.render()),b.renderer.clippingPlanes=[],b.renderer.colorTarget&&b.renderStates.forceClear&&N&&b.groundShadow.isValid()&&b.groundShadow.renderShadow(b.camera,b.renderer.colorTarget),b.renderStates.forceClear&&(b.renderStates.shouldRenderClipbox=!0,b.renderStates.shouldRenderClipScene=!0,b.selectionManager.renderSelectionScene(b.renderer.colorTarget),b.additionalObjectsScene)&&(b.renderer.render(b.additionalObjectsScene,b.camera,b.renderer.colorTarget),u+=b.renderer.info.render.triangles+b.renderer.info.render.lines),b.clipBoxManager&&b.clipBoxManager.active&&b.renderStates.shouldRenderClipbox&&b.clipBoxManager.renderClipBox(b.renderer.colorTarget),b.clipPlaneManager&&b.renderStates.shouldRenderClipScene&&!b.renderer.stopRenderingEarly&&b.clipPlaneManager.renderClipScene(b.renderer.colorTarget),b.ndsModel.referenceEntityDirty&&0=b.renderer.maxPrimitivesPerFrame&&w.push(u),b.renderer.colorTarget&&(b.renderStates.forceClear||j)&&$.render(b.renderer,null,b.renderer.colorTarget.texture),b.renderStates.forceClear=!1,b.controls.staticDrawGeomOp&&b.controls.staticDrawGeomOp.renderGeomScene(),v.renderWaterMark(v.waterInfo),i&&i.applyViewScissorToRenderer(),b.controls.staticmeasureOp&&b.isViewActive(i)&&b.controls.staticmeasureOp.renderMeasureScene(),b.controls.staticAnnotation&&b.isViewActive(i)&&b.controls.staticAnnotation.renderAnnotation(),i&&i.revertViewScissorToRenderer(),b.ndsModel.getMeshSets()),m=0,g=0,l=f.length;gb.camera.far&&(b.camera.far=s),b.viewBox&&b.cameraControl.updateViewBoxCamDir(),b.camera.updateProjectionMatrix(),b.camera.updateMatrixWorld(!0),b.ScenarioEditorInfo.EulerAngle.set(THREE.Math.degToRad(e.x),THREE.Math.degToRad(e.y),THREE.Math.degToRad(e.z))}t&&(n=b.camera.getOrginalCameraInfo(),i=new THREE.Vector3(n.position.x-n.center.x,n.position.y-n.center.y,n.position.z-n.center.z).length(),r=b.getCameraInfo(),o=new THREE.Vector3(r.target.x,r.target.y,r.target.z),a=new THREE.Vector3(r.position.x,r.position.y,r.position.z).sub(o).normalize().multiplyScalar(i/20*t),b.camera.position.copy(a.add(o)),(s=b.cameraControl.calFarthestDistToCamera())>b.camera.far&&(b.camera.far=s),b.camera.updateProjectionMatrix(),b.camera.updateMatrixWorld(!0)),b.groundShadowChange(),b.render()},v.getScreenCapture=function(e,t,i){return this.getScreenCapture2(e,!1,!1,t,i),"111"},v.getScreenCapture2=function(a,l,e,d,c,t,h,i,u){var p,f,m,g,v,A,y,E,M,w;function x(e,t,i,n){t&&t(e),i&&b.dispatchEvent({type:"snapEvent",cameraInfo:b.getCameraInfo(),imgData:e}),n&&(t="
",(i=window.open()).document.open(),i.document.write(t),i.document.close())}function I(e){var t,i,n,r,o,e=e.userData.precent,s=b.ndsModel.getLineSegmentsSet();e<.99||4===R&&s.visualStates.dirty||(t=document.createElement("canvas"),i=t.getContext("2d"),e=b.renderer.domElement.toDataURL(),n=b.canvas2D.toDataURL(),t.width=b.renderer.domElement.width,t.height=b.renderer.domElement.height,i.fillStyle=b.container.style.backgroundColor,i.fillRect(0,0,t.width,t.height),r=new Image,u&&b.viewManager?(s=document.getElementById("t_container"),(o=b.viewManager.getActiveView()).displayViewBox(!1),html2canvas(s,{useCORS:!0,allowTaint:!0,ignoreMouse:!0,ignoreAnimation:!0}).then(function(e){e=e.toDataURL();r.onload=function(){var e=b.viewManager.getActiveViewCanvasSizeForScreenCapture();i.drawImage(r,e.x,e.y,e.width,e.height,0,0,t.width,t.height),x(t.toDataURL(),a,l,d)},r.src=e}),o.displayViewBox(!0)):(r.onload=function(){var e;i.globalAlpha=1,i.drawImage(r,0,0),f||p?((e=new Image).onload=function(){h||i.drawImage(e,0,0),x(t.toDataURL(),a,l,d)},e.src=n):x(t.toDataURL(),a,l,d)},r.src=e),b.removeEventListener("updateProgress",I),b.isSectionViewEnabled()&&(g&&b.clipPlaneManager&&b.clipPlaneManager.hideShowClipPlane(!0),v)&&b.clipPlaneManager&&b.clipPlaneManager.onOpenClipControl(),b.clipBoxManager&&A&&b.isSectionBoxViewEnabled()&&b.clipBoxManager.displaySectionBox(!0),y&&b.controls.staticmeasureOp&&b.controls.staticmeasureOp.setMeasureVisible(!0),M&&b.controls.staticAnnotation&&(b.controls.staticAnnotation.rootObject.visible=!0),E&&b.ndsModel.explodeObject&&b.explodeAxis&&this.setExplodeAxisVisible(!0,b.explodeAxis),null!=c&&c||m&&b.lightControls.setVisible(!0),null!=w?(b.viewManager=w,b.renderAllViews()):b.render())}void 0===h&&(h=!1),void 0===i&&(i=!1),void 0===u&&(u=!1),b.GeomEmpty||(p=!0===t,f=e&&(b.watermark||b.waterInfo.text||b.waterInfo.imageSrc)&&b.excalibur,b.lightControls.getVisible()&&(m=!0),null!=c&&c||m&&b.lightControls.setVisible(!1),M=E=y=A=v=g=!1,w=void 0,h||i||!this.isSectionViewEnabled()||(this.clipPlaneManager.getClipPlaneVisible()&&(this.clipPlaneManager.hideShowClipPlane(!1),g=!0),this.clipPlaneManager.getClipControlVisible()&&(this.clipPlaneManager.onCloseClipControl(),v=!0)),!h&&this.isSectionBoxViewEnabled()&&this.clipBoxManager.getSectionBoxVisible()&&(this.clipBoxManager.displaySectionBox(!1),A=!0),!h&&b.controls.staticmeasureOp&&(!p&&b.controls.staticmeasureOp.getMeasureVisible()&&(b.controls.staticmeasureOp.setMeasureVisible(!1),y=!0),b.controls.staticmeasureOp.MeasureOper)&&b.controls.staticmeasureOp.MeasureOper.OperatorEnd(),!h&&b.controls.staticAnnotation&&(b.controls.staticAnnotation.rootObject.visible=!1,M=!0),!h&&this.ndsModel.explodeObject&&this.ndsModel.explodeObject.visible&&this.explodeAxis&&this.ndsModel.explodeObject.getAxisVisible(this.explodeAxis)&&(this.setExplodeAxisVisible(!1),E=!0),!this.viewManager||h||u||(this.viewManager.restoreRenderTargetToSingleView(),w=this.viewManager,this.viewManager=void 0,this.render()),b.render(),b.addEventListener("updateProgress",I,!1))},v.getImagePortion=function(e,t,i,n,r,o){var s=document.createElement("canvas"),a=s.getContext("2d"),l=(s.width=t,s.height=i,document.createElement("canvas")),d=l.getContext("2d");return l.width=e.width,l.height=e.height,d.drawImage(e,0,0),a.drawImage(l,n,r,t*o,i*o,0,0,t,i),s.toDataURL()},v.getScreenCapturethumbnailByData=function(s,e){var a,l=1280,d=768,c=(e&&(l=e.width||l,d=e.height||d,a=e.backgroundColor,t=e.opacity,f=e.cameraPosition,m=e.cameraTarget),this.getBackgroundstate()),h=(c.alpha=this.renderer.getClearAlpha(),c.alpha),e=(void 0!==a&&a&&("envmap"==c.backgroundtype?(c.envmapUrls=this.envmapUrls,c.envmapUrlsindex=this.envmapUrlsindex,c.envMapCamera=this.envMapCamera,c.envMapScene=this.envMapScene,this.envMapTexture&&(c.envMapTexture=this.envMapTexture.clone()),this.envMapMaterial&&(c.envMapMaterial=this.envMapMaterial.clone()),c.exchangeBackImage=this.exchangeBackImage):"Image"==c.backgroundtype&&(c.backGroundScene=this.backGroundScene,c.backGroundCamera=this.backGroundCamera,c.backGroundMesh=this.backGroundMesh,this.backGroundMesh)&&this.backGroundMesh.material&&this.backGroundMesh.material.map&&(c.backGroundMesh.material.map=this.backGroundMesh.material.map.clone()),(e=new THREE.Color).set(a),this.setBackGroundColor(e.getHex())),void 0!==t&&(h=t,this.bBackGroundTransparent?this.renderer.setClearAlpha(0):this.renderer.setClearAlpha(t)),this.onWindowResize(null,2*l,2*d),new THREE.Vector3),t=new THREE.Vector3,i={flag:!0},n=(this.is2DModel?(p=this.modelRootObject.boundingBox.clone(),this.computeVisibleBoundingBox(this.scene,e,t,i,void 0,!0),n=p.max.x-p.min.x,o=p.max.y-p.min.y,r=this.modelRootObject.boundingBox.max.x-this.modelRootObject.boundingBox.min.x,u=this.modelRootObject.boundingBox.max.y-this.modelRootObject.boundingBox.min.y,(n.25*r.length()&&(this.camera.near=.25*r.length()),this.camera.perpNear>.25*r.length()&&(this.camera.perpNear=.25*r.length()),new THREE.Vector3(0,0,0).sub(new THREE.Vector3(1,1,1))),t=(this.camera.getOrginalCameraInfo()&&(p=new THREE.Vector3,i=new THREE.Vector3,p.copy(this.camera.getOrginalCameraInfo().center),i.copy(this.camera.getOrginalCameraInfo().position),p.sub(i),p.normalize(),u.copy(p)),u.normalize(),u.multiplyScalar(o),n.clone().sub(u)),e=(this.groundShadow.updateGroundTransform(this.camera,this.modelRootObject.boundingBox),this.camera.setOrthoNear(this.modelRootObject.boundingBox),f?this.camera.position.set(f.x,f.y,f.z):this.camera.position.copy(t),m?this.camera.setCameraTarget(new THREE.Vector3(m.x,m.y,m.z)):this.camera.setCameraTarget(n),this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(!0),this.render(),this.modelRootObject.boundingBox),r=[],i=(r[0]=e.max.x,r[1]=e.max.y,r[2]=e.max.z,this.modelCoordToClientCoord(r)),p=((r=[])[0]=e.min.x,r[1]=e.max.y,r[2]=e.min.z,this.modelCoordToClientCoord(r)),o=((r=[])[0]=e.min.x,r[1]=e.max.y,r[2]=e.max.z,this.modelCoordToClientCoord(r)),u=((r=[])[0]=e.max.x,r[1]=e.max.y,r[2]=e.min.z,this.modelCoordToClientCoord(r)),f=((r=[])[0]=e.min.x,r[1]=e.min.y,r[2]=e.min.z,this.modelCoordToClientCoord(r)),t=((r=[])[0]=e.min.x,r[1]=e.min.y,r[2]=e.max.z,this.modelCoordToClientCoord(r)),m=((r=[])[0]=e.max.x,r[1]=e.min.y,r[2]=e.min.z,this.modelCoordToClientCoord(r)),n=((r=[])[0]=e.max.x,r[1]=e.min.y,r[2]=e.max.z,this.modelCoordToClientCoord(r)),e=Math.max(i[0],p[0],o[0],u[0],f[0],t[0],m[0],n[0]),r=Math.min(i[0],p[0],o[0],u[0],f[0],t[0],m[0],n[0]),g=Math.max(i[1],p[1],o[1],u[1],f[1],t[1],m[1],n[1]),i=Math.min(i[1],p[1],o[1],u[1],f[1],t[1],m[1],n[1]),v=(e*=this.renderer.getPixelRatio(),r*=this.renderer.getPixelRatio(),g*=this.renderer.getPixelRatio(),i*=this.renderer.getPixelRatio(),e-r),A=g-i,y=0,E=0,M=(dmodify the model and try again":"当前模型暂不支持插入",e.style.height="84px",e.style.display="block",Se.isMobileDevice()||(e.innerHTML=n?"Entity already exist please modify the model and try again":"当前模型暂不支持插入",e.style.height="42px"),setTimeout(function(){b.container.removeChild(e)},3e3),b.dispatchEvent({type:"loadBegin"}),b.dispatchEvent({type:"BrepInfoEvent",faceArea:!1,bodyVolume:!1,totalVolume:!1,bodyArea:!1,totalArea:!1,boundingbox:!1,facePerimeter:!1}),b.dispatchEvent({type:"BVHInfoEvent",hasbvh:!1}),b.dispatchEvent({type:"PMIInfoEvent",PMI:!1}),b.dispatchAsyncEvent({type:"geometryAllLoadedEvent",modelLoadedTime:-1,wholeModelLoadedTime:-1,modelInfo:{}}),b.dispatchEvent({type:"insertfailed",ModelLength:b.ndsModel.models.length}),j=!0,void(b.sceneInfo=null);b.sceneInfo.setScene=!0,b.sceneInfo.ScenarioEditorid=Re.ScenarioEditorid}if(b.sceneInfo)for(var r=0;rt.x||e.y>t.y||e.z>t.z||(this.controls.setBoundingBox(e,t),this.cameraControl.adjustNearAndFar(),this.emptyCenter.set(0,0,0),e=this.controls.getBoundingBox().getCenter(this.emptyCenter),this.cameraControl.setRotateCenter(e),(t=b.controls.getOperator())&&t.updateRotateCenterHelper(),this.render()))},v.getModelCount=function(){return b.ndsModel.models.length},v.getModelTree=function(e,t,i){if(void 0===i&&(i=!1),b.ndsModel.newrootBodyNode&&!Re.ScenarioEditor&&!Re.AnimationEdit)return b.ndsModel.newrootBodyNode;var n,r,o=null;if(-1!=(t=void 0===t?-1:t))return this.loadrelease&&-1!=t&&0==i&&(t+=this.loadreleasecount-1),b.ndsModel&&(b.ndsModel instanceof Ut&&b.ndsModel.setActiveModel(t),o=Re.ScenarioEditor||Re.AnimationEdit?b.ndsModel.rootBodyNode:b.ndsModel.rootBodyNode.clone()),o?(n=function e(t,i){if((b.bodyUuid2ClonedNodeMap[t.uuid]=t).persistentId&&b.PersistentId2uuid.set(t.persistentId,t.uuid),t.fullpath=""!=i?i+"/"+t.name:t.name,0=Math.abs(l.y)*Math.PI/180,e=0=Math.abs(l.x)*Math.PI/180,t||e)&&(this.scene.updateMatrixWorld(!0),this.controls.SetBoundingBoxUpdated(!1),this.scene.traverse(function(e){e.hasOwnProperty("geometry")&&"lightctrls"!=e.name&&(e.matrixWorldTransOrginal&&(e.matrixWorldTransOrginal=void 0),e.matrixWorldTransOrginalDrag)&&(e.matrixWorldTransOrginalDrag=void 0)}),null!=b.modelSceneOrgin&&b.modelSceneOrgin!=this.scene&&(b.modelSceneOrgin.updateMatrixWorld(!0),b.modelSceneOrgin.traverse(function(e){e.hasOwnProperty("geometry")&&"lightctrls"!=e.name&&(e.matrixWorldTransOrginal&&(e.matrixWorldTransOrginal=void 0),e.matrixWorldTransOrginalDrag)&&(e.matrixWorldTransOrginalDrag=void 0)})),this.camera.setOrginalCameraInfo(void 0),this.camera.up.set(0,1,0),t=new THREE.Matrix4,Math.abs(l.y)<4.5?t.lookAt(new THREE.Vector3(1,0,1),new THREE.Vector3,this.camera.up):t.lookAt(new THREE.Vector3(1,.1,1),new THREE.Vector3,this.camera.up),this.camera.quaternion.setFromRotationMatrix(t),this.resetCamera({useOrginal:!0}))},v.getModelOperationVerticalRotationRange=function(){return l},v.isLineExisted=function(){var t=!1;return this.scene.traverse(function(e){(e instanceof THREE.Line||e instanceof THREE.LineSegments)&&e.hasOwnProperty("geometry")&&e.hasOwnProperty("material")&&(b.materialsSetting&&b.materialsSetting.getMaterialsMarkersMat()==e.material||(t=!0))}),t},v.isModelExplosionAbled=function(){void 0===THREE.Object3D.prototype.tranverseWithCondition&&(THREE.Object3D.prototype.tranverseWithCondition=function(e){if(!e(this))for(var t=this.children,i=0,n=t.length;ithis.countermandarray.length-2||!e&&this.countermandflag<1||this.countermandarray.length<2)){e?this.countermandflag++:this.countermandflag--;var t=this.countermandarray[this.countermandflag];if(t.meshVisible&&b.ndsModel){b.ndsModel.hideBody(b.ndsModel.rootBodyNode);for(var i=0;ithis.countermandarray.length-2||!e&&this.countermandflag<1||this.countermandarray.length<2)},v.getObjectProByName=function(e,o){var t,s=new Array(o.length);return"string"!=typeof e&&(e=e.toString()),b.bodyUuid2ClonedNodeMap[e]&&b.bodyUuid2ClonedNodeMap[e].propertyfile&&b.bodyUuid2ClonedNodeMap[e].propertyList?(b.bodyUuid2ClonedNodeMap[e].propertyList.forEach(function(e){for(var t in e)for(var i=e[t],n=0;n