!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=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;t0;){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 ")),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;r0;)if(h=I.pop(),l=O[h]){var H={},T=l.hot._disposeHandlers;for(s=0;s=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=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>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;tf&&(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;t0&&(v=t,C=i)}let x=e[2*v],P=e[2*v+1],E=1/0;for(let t=0;tr&&(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;t0&&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);e0?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=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);if(s=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{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({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.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{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{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{t.push([e.x,e.y])}),t.push(t[0]),t}_interpolationInPolygon(e,t,i){for(var r=[],n=t.minx;n{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