You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
22 KiB
2 lines
22 KiB
!function(e){var t=window.webpackHotUpdate;window.webpackHotUpdate=function(e,i){!function(e,t){if(!w[e]||!C[e])return;for(var i in C[e]=!1,t)Object.prototype.hasOwnProperty.call(t,i)&&(m[i]=t[i]);0==--g&&0===v&&E()}(e,i),t&&t(e,i)};var i,r=!0,n="a2f03efb7e3f48fe4e22",s=1e4,o={},a=[],l=[];function h(e){var t=O[e];if(!t)return j;var r=function(r){return t.hot.active?(O[r]?-1===O[r].parents.indexOf(e)&&O[r].parents.push(e):(a=[e],i=r),-1===t.children.indexOf(r)&&t.children.push(r)):(console.warn("[HMR] unexpected require("+r+") from disposed module "+e),a=[]),j(r)},n=function(e){return{configurable:!0,enumerable:!0,get:function(){return j[e]},set:function(t){j[e]=t}}};for(var s in j)Object.prototype.hasOwnProperty.call(j,s)&&"e"!==s&&"t"!==s&&Object.defineProperty(r,s,n(s));return r.e=function(e){return"ready"===d&&f("prepare"),v++,j.e(e).then(t,(function(e){throw t(),e}));function t(){v--,"prepare"===d&&(y[e]||P(e),0===v&&0===g&&E())}},r.t=function(e,t){return 1&t&&(e=r(e)),j.t(e,-2&t)},r}function c(e){var t={_acceptedDependencies:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_disposeHandlers:[],_main:i!==e,active:!0,accept:function(e,i){if(void 0===e)t._selfAccepted=!0;else if("function"==typeof e)t._selfAccepted=e;else if("object"==typeof e)for(var r=0;r<e.length;r++)t._acceptedDependencies[e[r]]=i||function(){};else t._acceptedDependencies[e]=i||function(){}},decline:function(e){if(void 0===e)t._selfDeclined=!0;else if("object"==typeof e)for(var i=0;i<e.length;i++)t._declinedDependencies[e[i]]=!0;else t._declinedDependencies[e]=!0},dispose:function(e){t._disposeHandlers.push(e)},addDisposeHandler:function(e){t._disposeHandlers.push(e)},removeDisposeHandler:function(e){var i=t._disposeHandlers.indexOf(e);i>=0&&t._disposeHandlers.splice(i,1)},check:x,apply:M,status:function(e){if(!e)return d;u.push(e)},addStatusHandler:function(e){u.push(e)},removeStatusHandler:function(e){var t=u.indexOf(e);t>=0&&u.splice(t,1)},data:o[e]};return i=void 0,t}var u=[],d="idle";function f(e){d=e;for(var t=0;t<u.length;t++)u[t].call(null,e)}var p,m,_,g=0,v=0,y={},C={},w={};function b(e){return+e+""===e?+e:e}function x(e){if("idle"!==d)throw new Error("check() is only allowed in idle status");return r=e,f("check"),(t=s,t=t||1e4,new Promise((function(e,i){if("undefined"==typeof XMLHttpRequest)return i(new Error("No browser support"));try{var r=new XMLHttpRequest,s=j.p+""+n+".hot-update.json";r.open("GET",s,!0),r.timeout=t,r.send(null)}catch(e){return i(e)}r.onreadystatechange=function(){if(4===r.readyState)if(0===r.status)i(new Error("Manifest request to "+s+" timed out."));else if(404===r.status)e();else if(200!==r.status&&304!==r.status)i(new Error("Manifest request to "+s+" failed."));else{try{var t=JSON.parse(r.responseText)}catch(e){return void i(e)}e(t)}}}))).then((function(e){if(!e)return f("idle"),null;C={},y={},w=e.c,_=e.h,f("prepare");var t=new Promise((function(e,t){p={resolve:e,reject:t}}));m={};return P(0),"prepare"===d&&0===v&&0===g&&E(),t}));var t}function P(e){w[e]?(C[e]=!0,g++,function(e){var t=document.createElement("script");t.charset="utf-8",t.src=j.p+""+e+"."+n+".hot-update.js",document.head.appendChild(t)}(e)):y[e]=!0}function E(){f("ready");var e=p;if(p=null,e)if(r)Promise.resolve().then((function(){return M(r)})).then((function(t){e.resolve(t)}),(function(t){e.reject(t)}));else{var t=[];for(var i in m)Object.prototype.hasOwnProperty.call(m,i)&&t.push(b(i));e.resolve(t)}}function M(t){if("ready"!==d)throw new Error("apply() is only allowed in ready status");var i,r,s,l,h;function c(e){for(var t=[e],i={},r=t.map((function(e){return{chain:[e],id:e}}));r.length>0;){var n=r.pop(),s=n.id,o=n.chain;if((l=O[s])&&!l.hot._selfAccepted){if(l.hot._selfDeclined)return{type:"self-declined",chain:o,moduleId:s};if(l.hot._main)return{type:"unaccepted",chain:o,moduleId:s};for(var a=0;a<l.parents.length;a++){var h=l.parents[a],c=O[h];if(c){if(c.hot._declinedDependencies[s])return{type:"declined",chain:o.concat([h]),moduleId:s,parentId:h};-1===t.indexOf(h)&&(c.hot._acceptedDependencies[s]?(i[h]||(i[h]=[]),u(i[h],[s])):(delete i[h],t.push(h),r.push({chain:o.concat([h]),id:h})))}}}}return{type:"accepted",moduleId:e,outdatedModules:t,outdatedDependencies:i}}function u(e,t){for(var i=0;i<t.length;i++){var r=t[i];-1===e.indexOf(r)&&e.push(r)}}t=t||{};var p={},g=[],v={},y=function(){console.warn("[HMR] unexpected require("+x.moduleId+") to disposed module")};for(var C in m)if(Object.prototype.hasOwnProperty.call(m,C)){var x;h=b(C);var P=!1,E=!1,M=!1,A="";switch((x=m[C]?c(h):{type:"disposed",moduleId:C}).chain&&(A="\nUpdate propagation: "+x.chain.join(" -> ")),x.type){case"self-declined":t.onDeclined&&t.onDeclined(x),t.ignoreDeclined||(P=new Error("Aborted because of self decline: "+x.moduleId+A));break;case"declined":t.onDeclined&&t.onDeclined(x),t.ignoreDeclined||(P=new Error("Aborted because of declined dependency: "+x.moduleId+" in "+x.parentId+A));break;case"unaccepted":t.onUnaccepted&&t.onUnaccepted(x),t.ignoreUnaccepted||(P=new Error("Aborted because "+h+" is not accepted"+A));break;case"accepted":t.onAccepted&&t.onAccepted(x),E=!0;break;case"disposed":t.onDisposed&&t.onDisposed(x),M=!0;break;default:throw new Error("Unexception type "+x.type)}if(P)return f("abort"),Promise.reject(P);if(E)for(h in v[h]=m[h],u(g,x.outdatedModules),x.outdatedDependencies)Object.prototype.hasOwnProperty.call(x.outdatedDependencies,h)&&(p[h]||(p[h]=[]),u(p[h],x.outdatedDependencies[h]));M&&(u(g,[x.moduleId]),v[h]=y)}var D,z=[];for(r=0;r<g.length;r++)h=g[r],O[h]&&O[h].hot._selfAccepted&&v[h]!==y&&z.push({module:h,errorHandler:O[h].hot._selfAccepted});f("dispose"),Object.keys(w).forEach((function(e){!1===w[e]&&function(e){delete installedChunks[e]}(e)}));for(var S,k,I=g.slice();I.length>0;)if(h=I.pop(),l=O[h]){var H={},T=l.hot._disposeHandlers;for(s=0;s<T.length;s++)(i=T[s])(H);for(o[h]=H,l.hot.active=!1,delete O[h],delete p[h],s=0;s<l.children.length;s++){var U=O[l.children[s]];U&&((D=U.parents.indexOf(h))>=0&&U.parents.splice(D,1))}}for(h in p)if(Object.prototype.hasOwnProperty.call(p,h)&&(l=O[h]))for(k=p[h],s=0;s<k.length;s++)S=k[s],(D=l.children.indexOf(S))>=0&&l.children.splice(D,1);for(h in f("apply"),n=_,v)Object.prototype.hasOwnProperty.call(v,h)&&(e[h]=v[h]);var X=null;for(h in p)if(Object.prototype.hasOwnProperty.call(p,h)&&(l=O[h])){k=p[h];var F=[];for(r=0;r<k.length;r++)if(S=k[r],i=l.hot._acceptedDependencies[S]){if(-1!==F.indexOf(i))continue;F.push(i)}for(r=0;r<F.length;r++){i=F[r];try{i(k)}catch(e){t.onErrored&&t.onErrored({type:"accept-errored",moduleId:h,dependencyId:k[r],error:e}),t.ignoreErrored||X||(X=e)}}}for(r=0;r<z.length;r++){var R=z[r];h=R.module,a=[h];try{j(h)}catch(e){if("function"==typeof R.errorHandler)try{R.errorHandler(e)}catch(i){t.onErrored&&t.onErrored({type:"self-accept-error-handler-errored",moduleId:h,error:i,originalError:e}),t.ignoreErrored||X||(X=i),X||(X=e)}else t.onErrored&&t.onErrored({type:"self-accept-errored",moduleId:h,error:e}),t.ignoreErrored||X||(X=e)}}return X?(f("fail"),Promise.reject(X)):(f("idle"),new Promise((function(e){e(g)})))}var O={};function j(t){if(O[t])return O[t].exports;var i=O[t]={i:t,l:!1,exports:{},hot:c(t),parents:(l=a,a=[],l),children:[]};return e[t].call(i.exports,i,i.exports,h(t)),i.l=!0,i.exports}j.m=e,j.c=O,j.d=function(e,t,i){j.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},j.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},j.t=function(e,t){if(1&t&&(e=j(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(j.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)j.d(i,r,function(t){return e[t]}.bind(null,r));return i},j.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return j.d(t,"a",t),t},j.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},j.p="",j.h=function(){return n},h(0)(j.s=0)}([function(e,t,i){"use strict";i.r(t);const r=Math.pow(2,-52),n=new Uint32Array(512);class s{static from(e,t=f,i=p){const r=e.length,n=new Float64Array(2*r);for(let s=0;s<r;s++){const r=e[s];n[2*s]=t(r),n[2*s+1]=i(r)}return new s(n)}constructor(e){const t=e.length>>1;if(t>0&&"number"!=typeof e[0])throw new Error("Expected coords to contain numbers.");this.coords=e;const i=Math.max(2*t-5,0);this._triangles=new Uint32Array(3*i),this._halfedges=new Int32Array(3*i),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:i,_hullTri:n,_hullHash:s}=this,a=e.length>>1;let h=1/0,d=1/0,f=-1/0,p=-1/0;for(let t=0;t<a;t++){const i=e[2*t],r=e[2*t+1];i<h&&(h=i),r<d&&(d=r),i>f&&(f=i),r>p&&(p=r),this._ids[t]=t}const m=(h+f)/2,_=(d+p)/2;let g,v,y,C=1/0;for(let t=0;t<a;t++){const i=o(m,_,e[2*t],e[2*t+1]);i<C&&(g=t,C=i)}const w=e[2*g],b=e[2*g+1];C=1/0;for(let t=0;t<a;t++){if(t===g)continue;const i=o(w,b,e[2*t],e[2*t+1]);i<C&&i>0&&(v=t,C=i)}let x=e[2*v],P=e[2*v+1],E=1/0;for(let t=0;t<a;t++){if(t===g||t===v)continue;const i=c(w,b,x,P,e[2*t],e[2*t+1]);i<E&&(y=t,E=i)}let M=e[2*y],O=e[2*y+1];if(E===1/0){for(let t=0;t<a;t++)this._dists[t]=e[2*t]-e[0]||e[2*t+1]-e[1];u(this._ids,this._dists,0,a-1);const t=new Uint32Array(a);let i=0;for(let e=0,r=-1/0;e<a;e++){const n=this._ids[e];this._dists[n]>r&&(t[i++]=n,r=this._dists[n])}return this.hull=t.subarray(0,i),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(l(w,b,x,P,M,O)){const e=v,t=x,i=P;v=y,x=M,P=O,y=e,M=t,O=i}const j=function(e,t,i,r,n,s){const o=i-e,a=r-t,l=n-e,h=s-t,c=o*o+a*a,u=l*l+h*h,d=.5/(o*h-a*l);return{x:e+(h*c-a*u)*d,y:t+(o*u-l*c)*d}}(w,b,x,P,M,O);this._cx=j.x,this._cy=j.y;for(let t=0;t<a;t++)this._dists[t]=o(e[2*t],e[2*t+1],j.x,j.y);u(this._ids,this._dists,0,a-1),this._hullStart=g;let A=3;i[g]=t[y]=v,i[v]=t[g]=y,i[y]=t[v]=g,n[g]=0,n[v]=1,n[y]=2,s.fill(-1),s[this._hashKey(w,b)]=g,s[this._hashKey(x,P)]=v,s[this._hashKey(M,O)]=y,this.trianglesLen=0,this._addTriangle(g,v,y,-1,-1,-1);for(let o,a,h=0;h<this._ids.length;h++){const c=this._ids[h],u=e[2*c],d=e[2*c+1];if(h>0&&Math.abs(u-o)<=r&&Math.abs(d-a)<=r)continue;if(o=u,a=d,c===g||c===v||c===y)continue;let f=0;for(let e=0,t=this._hashKey(u,d);e<this._hashSize&&(-1===(f=s[(t+e)%this._hashSize])||f===i[f]);e++);let p,m=f=t[f];for(;p=i[m],!l(u,d,e[2*m],e[2*m+1],e[2*p],e[2*p+1]);)if((m=p)===f){m=-1;break}if(-1===m)continue;let _=this._addTriangle(m,c,i[m],-1,-1,n[m]);n[c]=this._legalize(_+2),n[m]=_,A++;let C=i[m];for(;p=i[C],l(u,d,e[2*C],e[2*C+1],e[2*p],e[2*p+1]);)_=this._addTriangle(C,c,p,n[c],-1,n[C]),n[c]=this._legalize(_+2),i[C]=C,A--,C=p;if(m===f)for(;l(u,d,e[2*(p=t[m])],e[2*p+1],e[2*m],e[2*m+1]);)_=this._addTriangle(p,c,m,-1,n[m],n[p]),this._legalize(_+2),n[p]=_,i[m]=m,A--,m=p;this._hullStart=t[c]=m,i[m]=t[C]=c,i[c]=C,s[this._hashKey(u,d)]=c,s[this._hashKey(e[2*m],e[2*m+1])]=m}this.hull=new Uint32Array(A);for(let e=0,t=this._hullStart;e<A;e++)this.hull[e]=t,t=i[t];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(function(e,t){const i=e/(Math.abs(e)+Math.abs(t));return(t>0?3-i:1+i)/4}(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:i,coords:r}=this;let s=0,o=0;for(;;){const a=i[e],l=e-e%3;if(o=l+(e+2)%3,-1===a){if(0===s)break;e=n[--s];continue}const c=a-a%3,u=l+(e+1)%3,d=c+(a+2)%3,f=t[o],p=t[e],m=t[u],_=t[d];if(h(r[2*f],r[2*f+1],r[2*p],r[2*p+1],r[2*m],r[2*m+1],r[2*_],r[2*_+1])){t[e]=_,t[a]=f;const r=i[d];if(-1===r){let t=this._hullStart;do{if(this._hullTri[t]===d){this._hullTri[t]=e;break}t=this._hullPrev[t]}while(t!==this._hullStart)}this._link(e,r),this._link(a,i[o]),this._link(o,d);const l=c+(a+1)%3;s<n.length&&(n[s++]=l)}else{if(0===s)break;e=n[--s]}}return o}_link(e,t){this._halfedges[e]=t,-1!==t&&(this._halfedges[t]=e)}_addTriangle(e,t,i,r,n,s){const o=this.trianglesLen;return this._triangles[o]=e,this._triangles[o+1]=t,this._triangles[o+2]=i,this._link(o,r),this._link(o+1,n),this._link(o+2,s),this.trianglesLen+=3,o}}function o(e,t,i,r){const n=e-i,s=t-r;return n*n+s*s}function a(e,t,i,r,n,s){const o=(r-t)*(n-e),a=(i-e)*(s-t);return Math.abs(o-a)>=33306690738754716e-32*Math.abs(o+a)?o-a:0}function l(e,t,i,r,n,s){return(a(n,s,e,t,i,r)||a(e,t,i,r,n,s)||a(i,r,n,s,e,t))<0}function h(e,t,i,r,n,s,o,a){const l=e-o,h=t-a,c=i-o,u=r-a,d=n-o,f=s-a,p=c*c+u*u,m=d*d+f*f;return l*(u*m-p*f)-h*(c*m-p*d)+(l*l+h*h)*(c*f-u*d)<0}function c(e,t,i,r,n,s){const o=i-e,a=r-t,l=n-e,h=s-t,c=o*o+a*a,u=l*l+h*h,d=.5/(o*h-a*l),f=(h*c-a*u)*d,p=(o*u-l*c)*d;return f*f+p*p}function u(e,t,i,r){if(r-i<=20)for(let n=i+1;n<=r;n++){const r=e[n],s=t[r];let o=n-1;for(;o>=i&&t[e[o]]>s;)e[o+1]=e[o--];e[o+1]=r}else{let n=i+1,s=r;d(e,i+r>>1,n),t[e[i]]>t[e[r]]&&d(e,i,r),t[e[n]]>t[e[r]]&&d(e,n,r),t[e[i]]>t[e[n]]&&d(e,i,n);const o=e[n],a=t[o];for(;;){do{n++}while(t[e[n]]<a);do{s--}while(t[e[s]]>a);if(s<n)break;d(e,n,s)}e[i+1]=e[s],e[s]=o,r-n+1>=s-i?(u(e,t,n,r),u(e,t,i,s-1)):(u(e,t,i,s-1),u(e,t,n,r))}}function d(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function f(e){return e[0]}function p(e){return e[1]}class m extends XE.Core.XbsjCzmObj{constructor(e,t){super(e,t),this._createCustomPrimitive(e),this._xbsjCutFillComputing=new Cesium.XbsjCutFillComputing,e.terrainEffect.depthTest=!0;const i=()=>{if(this._line.positions=[...this.positions],this.positions.length<4)return void(this._customPrimitive.show=!1);this._customPrimitive.show=!0;const e=[];for(let t=0;t<this.positions.length;++t)e.push(Cesium.Cartesian3.fromRadians(this.positions[t][0],this.positions[t][1],this.positions[t][2]));e[e.length-1].equals(e[e.length-2])&&e.pop();var t,i,r,n=this._getApproximateNormal(e),s=this._getCenter(e),o=Cesium.Cartesian3.normalize(s,new Cesium.Cartesian3),a=Cesium.Cartesian3.dot(o,n);if(a<0&&(n=this._getCartesian3Inserve(n),e.reverse()),Math.abs(a)<.999){t=this._getRotationMatrixByNormalAndCenter(n,o);var l=this._getCartesian3Inserve(s),h=Cesium.Matrix4.fromTranslation(l,new Cesium.Matrix4);r=Cesium.Matrix4.multiply(t,h,h),i=Cesium.Matrix4.inverse(r,new Cesium.Matrix4)}else i=Cesium.Transforms.eastNorthUpToFixedFrame(s),r=Cesium.Matrix4.inverseTransformation(i,new Cesium.Matrix4);var c=this._transformCartesians(e,r),u=[],d=[],f=[];if(this.interpolation){var p=this._getBounds2D(c),m=this._getTurfPoints(c),_=this._interpolationInPolygon(m,p,this.interpolationDistance);_=this._pickFromScene(_,i,r,n,this._earth.czm.viewer.scene,this.offsetHeight,this.drillDepth);var g=this._interpolationAlongPolygon(c,this.interpolationDistance);g=this._pickFromScene(g,i,r,n,this._earth.czm.viewer.scene,this.offsetHeight,this.drillDepth),f.push(..._.world_cartesian),u.push(..._.local),d.push(..._.world),f.push(...g.world_cartesian),u.push(...g.local),d.push(...g.world),c.forEach(e=>{var t=this._pickFromScene([e],i,r,n,this._earth.czm.viewer.scene,this.offsetHeight,this.drillDepth);if(t.local.length>0)u.push(...t.local),d.push(...t.world),f.push(...t.world_cartesian);else{u.push(e);var s=this._transformCartesians([e],i);for(let e=0;e<s.length;++e){f.push(s[e]);var o=Cesium.Cartographic.fromCartesian(s[e]);d.push([o.longitude,o.latitude,o.height+this.offsetHeight])}}})}else{u=c,f=this._transformCartesians(c,i);for(let e=0;e<f.length;++e){var v=Cesium.Cartographic.fromCartesian(f[e]);d.push([v.longitude,v.latitude,v.height+this.offsetHeight])}}var y=this._getSTS(u,this.textureSize),C=this._getIndices(u);const[w,b]=XE.Obj.CustomPrimitive.Geometry.getLocalPositions(d);this._customPrimitive.position=b,this._customPrimitive.positions=w,this._customPrimitive.sts=y,this._customPrimitive.normals=void 0,this._customPrimitive.indices=C;for(var x=[],P=0;P<4*w.length;P++)x.push(1);this._createCustomPrimitive.colors=x,this.totalArea=this._getMeshArea(f,C)};i(),this.disposers.push(XE.MVVM.watch(()=>({imageUrl:this.imageUrl,positions:[...this.positions],interpolation:this.interpolation,interpolationDistance:this.interpolationDistance,textureSize:this.textureSize,offsetHeight:this.offsetHeight}),i));const r=()=>{this._customPrimitive.show=this.show,this._line.show=this.show};r(),this.disposers.push(XE.MVVM.watch(()=>({show:this.show}),r)),this.disposers.push(XE.MVVM.track(this._customPrimitive,"imageUrl",this,"imageUrl")),this._registerEditing(),this.disposers.push(XE.MVVM.bind(this,"enabled",this,"show")),XE.Earth.Interaction.Picking.registerPickingParent(this._customPrimitive,this)}_getMeshArea(e,t){for(var i=0,r=0;r<t.length;r+=3)i+=this._getTriangleArea(e[t[r]],e[t[r+1]],e[t[r+2]]);return i}_getTriangleArea(e,t,i){var r=Cesium.Cartesian3.distance(e,t),n=Cesium.Cartesian3.distance(t,i),s=Cesium.Cartesian3.distance(i,e),o=(r+n+s)/2;return Math.sqrt(o*(o-r)*(o-n)*(o-s))}_getHeadingPitchRollFromRotation(e,t){var i=Cesium.Transforms.eastNorthUpToFixedFrame(e),r=Cesium.Matrix4.inverse(i,i),n=Cesium.Matrix4.multiply(r,t,i),s=Cesium.Matrix4.getRotation(n,new Cesium.Matrix3),o=Cesium.Quaternion.fromRotationMatrix(s);return Cesium.HeadingPitchRoll.fromQuaternion(o)}_getIndices(e){var t=[];return e.forEach(e=>{t.push([e.x,e.y])}),s.from(t).triangles.reverse()}_getSTS(e,t){var i=[];return e.forEach(e=>{var r=e.x/t,n=e.y/t;i.push(r),i.push(n)}),i}_getBounds2D(e){var t=e[0].x,i=e[0].y,r=e[0].x,n=e[0].y;return e.forEach(e=>{t=Math.min(t,e.x),i=Math.min(i,e.y),r=Math.max(r,e.x),n=Math.max(n,e.y)}),{minx:t,miny:i,maxx:r,maxy:n}}_transformCartesians(e,t){var i=[];for(let s=0;s<e.length;++s){var r=e[s],n=Cesium.Matrix4.multiplyByPoint(t,r,new Cesium.Cartesian3);i.push(n)}return i}_pickFromScene(e,t,i,r,n,s,o){var a=[];e.forEach(e=>{var t=e.clone();t.z=1e5,a.push(t)});var l=this._transformCartesians(a,t),h=new Cesium.Cartesian3(-1*r.x,-1*r.y,-1*r.z),c=[],u=[],d=[];for(let a=0;a<l.length;++a){var f=l[a],p=new Cesium.Ray(f,h),m=[];try{m=n.drillPickFromRay(p,o)}catch{}if(0===m.length){p=new Cesium.Ray(f,r);try{m=n.drillPickFromRay(p,o)}catch{}}if(0!==m.length){for(var _,g=0;g<m.length;g++){var v=m[g];if((!v.object||v.object.content)&&v.position){_=v.position;break}}if(_&&_.x&&!isNaN(_.x)){var y=this._transformCartesians([_],i);y.forEach(e=>{e.z+=s}),_=this._transformCartesians(y,t)[0],d.push(_),_=Cesium.Cartographic.fromCartesian(_),c.push([_.longitude,_.latitude,_.height]),u.push(e[a])}}}return{local:u,world:c,world_cartesian:d}}_getRotationMatrixByNormalAndCenter(e,t){var i=Cesium.Cartesian3.cross(e,t,new Cesium.Cartesian3);i=Cesium.Cartesian3.normalize(i,i);var r=Cesium.Cartesian3.cross(e,i,new Cesium.Cartesian3);r=Cesium.Cartesian3.normalize(r,r);var n=e;return new Cesium.Matrix4(i.x,i.y,i.z,0,r.x,r.y,r.z,0,n.x,n.y,n.z,0,0,0,0,1)}_getApproximateNormal(e){var t=new Cesium.Cartesian3(0,0,0),i=new Cesium.Cartesian3(0,0,0),r=new Cesium.Cartesian3(0,0,0),n=new Cesium.Cartesian3(0,0,0),s=e.length;for(let h=0;h<s;++h){var o,a,l=e[h];o=0==h?e[e.length-1]:e[h-1],a=h==e.length-1?e[0]:e[h+1],t=Cesium.Cartesian3.subtract(l,o,t),i=Cesium.Cartesian3.subtract(l,a,i),r=Cesium.Cartesian3.cross(t,i,r),r=Cesium.Cartesian3.normalize(r,r),n=Cesium.Cartesian3.add(n,r,n)}return r.x=n.x/s,r.y=n.y/s,r.z=n.z/s,r}_getCenter(e){var t=new Cesium.Cartesian3(0,0,0),i=e.length;for(let n=0;n<i;++n){var r=e[n];t=Cesium.Cartesian3.add(t,r,t)}return t.x=t.x/i,t.y=t.y/i,t.z=t.z/i,t}_getCartesian3Inserve(e){return new Cesium.Cartesian3(-1*e.x,-1*e.y,-1*e.z)}_getTurfPoints(e){var t=[];return e.forEach(e=>{t.push([e.x,e.y])}),t.push(t[0]),t}_interpolationInPolygon(e,t,i){for(var r=[],n=t.minx;n<t.maxx;n+=i)for(var s=t.miny;s<t.maxy;s+=i)this._pointInPolygon([n,s],e)&&r.push(new Cesium.Cartesian3(n,s,0));return r}_interpolationAlongPolygon(e,t){var i=[];for(let o=0;o<e.length;++o){var r,n=e[o];r=o==e.length-1?e[0]:e[o+1];var s=this._interpolationAlongLine(n,r,t);i.push(...s)}return i}_interpolationAlongLine(e,t,i){var r=[],n=Cesium.Cartesian3.distance(e,t),s=Cesium.Cartesian3.subtract(t,e,new Cesium.Cartesian3);s=Cesium.Cartesian3.normalize(s,s);for(var o=i;o<n;){var a=new Cesium.Cartesian3(s.x*o,s.y*o,s.z*o),l=Cesium.Cartesian3.add(e,a,new Cesium.Cartesian3);r.push(l),o+=i}return r}_pointInPolygon(e,t){var i=turf.point(e);if(!turf.booleanEqual(turf.point(t[0]),turf.point(t[t.length-1])))return!1;var r=[];r.push(t);var n=turf.polygon(r);return turf.booleanPointInPolygon(i,n)}_createCustomPrimitive(e){const t={color:[1,1,1,1],renderState:XE.Obj.CustomPrimitive.getRenderState(!1,!1),fragmentShaderSource:"\n\n\n varying vec3 v_positionEC;\n varying vec3 v_normalEC;\n varying vec2 v_st;\n varying vec4 v_color;\n uniform sampler2D u_image;\n uniform vec4 u_color;\n void main()\n {\n vec3 positionToEyeEC = -v_positionEC;\n vec3 normalEC = normalize(v_normalEC);\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n vec4 imageColor = texture2D(u_image, fract(v_st));\n\n vec3 diffuse = imageColor.rgb;\n float alpha = imageColor.a;\n\n diffuse *= v_color.rgb;\n alpha *= v_color.a;\n\n diffuse *= u_color.rgb;\n alpha *= u_color.a;\n\n gl_FragColor = vec4(diffuse, alpha);\n }\n ",translucent:!1};this._customPrimitive=new XE.Obj.CustomPrimitive(e),this._customPrimitive.xbsjFromJSON(t),this._line=new XE.Obj.Polyline(e),this._line.loop=!0,this._line.material.XbsjColorMaterial.color=[1,1,0,.9],this.disposers.push(()=>{this._customPrimitive=this._customPrimitive&&this._customPrimitive.destroy(),this._line=this._line&&this._line.destroy()})}flyTo(){this._customPrimitive.flyTo()}_registerEditing(){this.disposers.push(XE.Earth.Interaction.InteractionProperty.registerPolylineCreating(this._earth,this,{polylineCreatingProperty:"creating"})),this.disposers.push(XE.Earth.Interaction.InteractionProperty.registerPolylineEditing(this._earth,this,{polylineEditingProperty:"editing"}))}}m.defaultOptions={positions:[],imageUrl:"",totalArea:0,interpolationDistance:50,interpolation:!1,textureSize:10,offsetHeight:1,show:!0,drillDepth:3},XE.Core.XbsjCzmObj.registerType(m,"CustomPrimitiveExt_Image");var _=m;XE.Obj.CustomPrimitiveExt=XE.Obj.CustomPrimitiveExt||{},XE.Obj.CustomPrimitiveExt.Image=_}]);
|
|
//# sourceMappingURL=customPrimitiveImage.js.map
|