!function(e){var t=window.webpackHotUpdate;window.webpackHotUpdate=function(e,r){!function(e,t){if(!C[e]||!P[e])return;for(var r in P[e]=!1,t)Object.prototype.hasOwnProperty.call(t,r)&&(m[r]=t[r]);0==--y&&0===g&&x()}(e,r),t&&t(e,r)};var r,i=!0,n="2e26d545062ed4cdf574",s=1e4,o={},c=[],a=[];function u(e){var t=j[e];if(!t)return D;var i=function(i){return t.hot.active?(j[i]?-1===j[i].parents.indexOf(e)&&j[i].parents.push(e):(c=[e],r=i),-1===t.children.indexOf(i)&&t.children.push(i)):(console.warn("[HMR] unexpected require("+i+") from disposed module "+e),c=[]),D(i)},n=function(e){return{configurable:!0,enumerable:!0,get:function(){return D[e]},set:function(t){D[e]=t}}};for(var s in D)Object.prototype.hasOwnProperty.call(D,s)&&"e"!==s&&"t"!==s&&Object.defineProperty(i,s,n(s));return i.e=function(e){return"ready"===p&&h("prepare"),g++,D.e(e).then(t,(function(e){throw t(),e}));function t(){g--,"prepare"===p&&(_[e]||w(e),0===g&&0===y&&x())}},i.t=function(e,t){return 1&t&&(e=i(e)),D.t(e,-2&t)},i}function d(e){var t={_acceptedDependencies:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_disposeHandlers:[],_main:r!==e,active:!0,accept:function(e,r){if(void 0===e)t._selfAccepted=!0;else if("function"==typeof e)t._selfAccepted=e;else if("object"==typeof e)for(var i=0;i=0&&t._disposeHandlers.splice(r,1)},check:b,apply:O,status:function(e){if(!e)return p;l.push(e)},addStatusHandler:function(e){l.push(e)},removeStatusHandler:function(e){var t=l.indexOf(e);t>=0&&l.splice(t,1)},data:o[e]};return r=void 0,t}var l=[],p="idle";function h(e){p=e;for(var t=0;t0;){var n=i.pop(),s=n.id,o=n.chain;if((a=j[s])&&!a.hot._selfAccepted){if(a.hot._selfDeclined)return{type:"self-declined",chain:o,moduleId:s};if(a.hot._main)return{type:"unaccepted",chain:o,moduleId:s};for(var c=0;c ")),b.type){case"self-declined":t.onDeclined&&t.onDeclined(b),t.ignoreDeclined||(w=new Error("Aborted because of self decline: "+b.moduleId+M));break;case"declined":t.onDeclined&&t.onDeclined(b),t.ignoreDeclined||(w=new Error("Aborted because of declined dependency: "+b.moduleId+" in "+b.parentId+M));break;case"unaccepted":t.onUnaccepted&&t.onUnaccepted(b),t.ignoreUnaccepted||(w=new Error("Aborted because "+u+" is not accepted"+M));break;case"accepted":t.onAccepted&&t.onAccepted(b),x=!0;break;case"disposed":t.onDisposed&&t.onDisposed(b),O=!0;break;default:throw new Error("Unexception type "+b.type)}if(w)return h("abort"),Promise.reject(w);if(x)for(u in g[u]=m[u],l(y,b.outdatedModules),b.outdatedDependencies)Object.prototype.hasOwnProperty.call(b.outdatedDependencies,u)&&(f[u]||(f[u]=[]),l(f[u],b.outdatedDependencies[u]));O&&(l(y,[b.moduleId]),g[u]=_)}var S,I=[];for(i=0;i0;)if(u=T.pop(),a=j[u]){var z={},k=a.hot._disposeHandlers;for(s=0;s=0&&A.parents.splice(S,1))}}for(u in f)if(Object.prototype.hasOwnProperty.call(f,u)&&(a=j[u]))for(X=f[u],s=0;s=0&&a.children.splice(S,1);for(u in h("apply"),n=v,g)Object.prototype.hasOwnProperty.call(g,u)&&(e[u]=g[u]);var U=null;for(u in f)if(Object.prototype.hasOwnProperty.call(f,u)&&(a=j[u])){X=f[u];var V=[];for(i=0;i{s=s||new Cesium.Cartesian3,o=o||new Cesium.Cartesian3,c=c||new Cesium.Cartesian3,a=a||new Cesium.Cartesian3,u=u||new Cesium.Quaternion;const n=s,d=o,l=c,p=a,h=Cesium.Cartesian3.fromElements(e[0],e[1],e[2],n),f=Cesium.Cartesian3.fromElements(t[0],t[1],t[2],d);let m=Cesium.Cartesian3.subtract(f,h,l),v=Cesium.Cartesian3.magnitude(m);if(v>0){v=v>0?v:.001,m=Cesium.Cartesian3.normalize(m,m);const e=Cesium.Cartesian3.angleBetween(m,Cesium.Cartesian3.UNIT_Z),t=Cesium.Cartesian3.cross(Cesium.Cartesian3.UNIT_Z,m,p),n=Cesium.Cartesian3.fromElements(r,r,v,d),s=Cesium.Quaternion.fromAxisAngle(t,e,u);return i=i||new Cesium.Matrix4,Cesium.Matrix4.fromTranslationQuaternionRotationScale(h,s,n,i),i}};class p extends XE.Core.XbsjCzmObj{constructor(e,t){super(e,t),this._createCustomPrimitive(e);const r=()=>{if(this.positions.length>1)if(this.isCurve)try{const{center:e,positions:t,sts:r,normals:i,indices:n,totalDistance:s}=function(e,t,r,i,n){if(!e||e.length<=1)throw new Error("rawPositions error!");let s,o,c=0;{const t=[],r=e.length;for(let i=0;i{const t=a.vertices[e.a],r=a.vertices[e.b],i=a.vertices[e.c];return[t.x,t.y,t.z,r.x,r.y,r.z,i.x,i.y,i.z]}),d=a.faceVertexUvs[0].flatMap(e=>[e[0].x,e[0].y,e[1].x,e[1].y,e[2].x,e[2].y]),l=a.faces.flatMap(e=>{const t=e.vertexNormals[0],r=e.vertexNormals[1],i=e.vertexNormals[2];return[t.x,t.y,t.z,r.x,r.y,r.z,i.x,i.y,i.z]}),p=[];{const e=a.faces.length;for(let t=0;th.push(e)),y.forEach(e=>f.push(e)),g.forEach(e=>m.push(e))}return{center:c,positions:h,sts:f,indices:m,totalDistance:l}}(this.positions,this.radius,this.radialSegments);this._customPrimitive.position=e,this._customPrimitive.positions=t,this._customPrimitive.sts=r,this._customPrimitive.normals=void 0,this._customPrimitive.indices=i,this._totalDistance=n}};r(),this.disposers.push(XE.MVVM.watch(()=>({positions:[...this.positions],tubularSegments:this.tubularSegments,radius:this.radius,radialSegments:this.radialSegments,closed:this.closed,isCurve:this.isCurve}),r));const i=()=>{this._customPrimitive.color=this.color,this._customPrimitive.show=this.show};i(),this.disposers.push(XE.MVVM.watch(()=>({color:[...this.color],show:this.show}),i));const n=()=>{const e=this._totalDistance||0;this._customPrimitive.customParams[0]=this.speed[0]/e,this._customPrimitive.customParams[1]=this.speed[1]/(this.radius*Math.PI*2),this._customPrimitive.customParams[2]=e/this.textureSize[0],this._customPrimitive.customParams[3]=this.radius*Math.PI*2/this.textureSize[1]};n(),this.disposers.push(XE.MVVM.watch(()=>({speed:[...this.speed],textureSize:[...this.textureSize],radius:this.radius,positions:[...this.positions]}),n)),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)}_createCustomPrimitive(e){const t={customParams:[1,1,1,1],renderState:XE.Obj.CustomPrimitive.getRenderState(!0,!1),fragmentShaderSource:"\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 uniform vec4 u_customParams;\n void main()\n {\n float time = czm_frameNumber / 60.0;\n float s = fract(u_customParams.z*(u_customParams.x * time + v_st.s));\n float t = fract(u_customParams.w*(u_customParams.y * time + v_st.t));\n vec4 imageColor = texture2D(u_image, vec2(s, t));\n gl_FragColor = imageColor * u_color;\n }\n ",pass:Cesium.Pass.TRANSLUCENT};this._customPrimitive=new XE.Obj.CustomPrimitive(e),this._customPrimitive.xbsjFromJSON(t),this.disposers.push(()=>{this._customPrimitive=this._customPrimitive&&this._customPrimitive.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"}))}}p.defaultOptions={positions:[],tubularSegments:12,radius:20,radialSegments:5,closed:!1,speed:[10,5],textureSize:[100,10],imageUrl:"",color:[1,1,1,1],isCurve:!0,show:!0},XE.Core.XbsjCzmObj.registerType(p,"CustomPrimitiveExt_Tube");var h=p;XE.Obj.CustomPrimitiveExt=XE.Obj.CustomPrimitiveExt||{},XE.Obj.CustomPrimitiveExt.Tube=h}]); //# sourceMappingURL=customPrimitive.js.map