数字孪生Web 后台dt( digital twin)2.0版本 统一命名格式
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
12 KiB

!function(e){var t=window.webpackHotUpdate;window.webpackHotUpdate=function(e,r){!function(e,t){if(!w[e]||!b[e])return;for(var r in b[e]=!1,t)Object.prototype.hasOwnProperty.call(t,r)&&(m[r]=t[r]);0==--y&&0===_&&x()}(e,r),t&&t(e,r)};var r,n=!0,i="30aee07b03ee2ec2f922",o=1e4,s={},a=[],c=[];function d(e){var t=O[e];if(!t)return D;var n=function(n){return t.hot.active?(O[n]?-1===O[n].parents.indexOf(e)&&O[n].parents.push(e):(a=[e],r=n),-1===t.children.indexOf(n)&&t.children.push(n)):(console.warn("[HMR] unexpected require("+n+") from disposed module "+e),a=[]),D(n)},i=function(e){return{configurable:!0,enumerable:!0,get:function(){return D[e]},set:function(t){D[e]=t}}};for(var o in D)Object.prototype.hasOwnProperty.call(D,o)&&"e"!==o&&"t"!==o&&Object.defineProperty(n,o,i(o));return n.e=function(e){return"ready"===p&&f("prepare"),_++,D.e(e).then(t,(function(e){throw t(),e}));function t(){_--,"prepare"===p&&(g[e]||C(e),0===_&&0===y&&x())}},n.t=function(e,t){return 1&t&&(e=n(e)),D.t(e,-2&t)},n}function u(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 n=0;n<e.length;n++)t._acceptedDependencies[e[n]]=r||function(){};else t._acceptedDependencies[e]=r||function(){}},decline:function(e){if(void 0===e)t._selfDeclined=!0;else if("object"==typeof e)for(var r=0;r<e.length;r++)t._declinedDependencies[e[r]]=!0;else t._declinedDependencies[e]=!0},dispose:function(e){t._disposeHandlers.push(e)},addDisposeHandler:function(e){t._disposeHandlers.push(e)},removeDisposeHandler:function(e){var r=t._disposeHandlers.indexOf(e);r>=0&&t._disposeHandlers.splice(r,1)},check:P,apply:j,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:s[e]};return r=void 0,t}var l=[],p="idle";function f(e){p=e;for(var t=0;t<l.length;t++)l[t].call(null,e)}var h,m,v,y=0,_=0,g={},b={},w={};function E(e){return+e+""===e?+e:e}function P(e){if("idle"!==p)throw new Error("check() is only allowed in idle status");return n=e,f("check"),(t=o,t=t||1e4,new Promise((function(e,r){if("undefined"==typeof XMLHttpRequest)return r(new Error("No browser support"));try{var n=new XMLHttpRequest,o=D.p+""+i+".hot-update.json";n.open("GET",o,!0),n.timeout=t,n.send(null)}catch(e){return r(e)}n.onreadystatechange=function(){if(4===n.readyState)if(0===n.status)r(new Error("Manifest request to "+o+" timed out."));else if(404===n.status)e();else if(200!==n.status&&304!==n.status)r(new Error("Manifest request to "+o+" failed."));else{try{var t=JSON.parse(n.responseText)}catch(e){return void r(e)}e(t)}}}))).then((function(e){if(!e)return f("idle"),null;b={},g={},w=e.c,v=e.h,f("prepare");var t=new Promise((function(e,t){h={resolve:e,reject:t}}));m={};return C(0),"prepare"===p&&0===_&&0===y&&x(),t}));var t}function C(e){w[e]?(b[e]=!0,y++,function(e){var t=document.createElement("script");t.charset="utf-8",t.src=D.p+""+e+"."+i+".hot-update.js",document.head.appendChild(t)}(e)):g[e]=!0}function x(){f("ready");var e=h;if(h=null,e)if(n)Promise.resolve().then((function(){return j(n)})).then((function(t){e.resolve(t)}),(function(t){e.reject(t)}));else{var t=[];for(var r in m)Object.prototype.hasOwnProperty.call(m,r)&&t.push(E(r));e.resolve(t)}}function j(t){if("ready"!==p)throw new Error("apply() is only allowed in ready status");var r,n,o,c,d;function u(e){for(var t=[e],r={},n=t.map((function(e){return{chain:[e],id:e}}));n.length>0;){var i=n.pop(),o=i.id,s=i.chain;if((c=O[o])&&!c.hot._selfAccepted){if(c.hot._selfDeclined)return{type:"self-declined",chain:s,moduleId:o};if(c.hot._main)return{type:"unaccepted",chain:s,moduleId:o};for(var a=0;a<c.parents.length;a++){var d=c.parents[a],u=O[d];if(u){if(u.hot._declinedDependencies[o])return{type:"declined",chain:s.concat([d]),moduleId:o,parentId:d};-1===t.indexOf(d)&&(u.hot._acceptedDependencies[o]?(r[d]||(r[d]=[]),l(r[d],[o])):(delete r[d],t.push(d),n.push({chain:s.concat([d]),id:d})))}}}}return{type:"accepted",moduleId:e,outdatedModules:t,outdatedDependencies:r}}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];-1===e.indexOf(n)&&e.push(n)}}t=t||{};var h={},y=[],_={},g=function(){console.warn("[HMR] unexpected require("+P.moduleId+") to disposed module")};for(var b in m)if(Object.prototype.hasOwnProperty.call(m,b)){var P;d=E(b);var C=!1,x=!1,j=!1,I="";switch((P=m[b]?u(d):{type:"disposed",moduleId:b}).chain&&(I="\nUpdate propagation: "+P.chain.join(" -> ")),P.type){case"self-declined":t.onDeclined&&t.onDeclined(P),t.ignoreDeclined||(C=new Error("Aborted because of self decline: "+P.moduleId+I));break;case"declined":t.onDeclined&&t.onDeclined(P),t.ignoreDeclined||(C=new Error("Aborted because of declined dependency: "+P.moduleId+" in "+P.parentId+I));break;case"unaccepted":t.onUnaccepted&&t.onUnaccepted(P),t.ignoreUnaccepted||(C=new Error("Aborted because "+d+" is not accepted"+I));break;case"accepted":t.onAccepted&&t.onAccepted(P),x=!0;break;case"disposed":t.onDisposed&&t.onDisposed(P),j=!0;break;default:throw new Error("Unexception type "+P.type)}if(C)return f("abort"),Promise.reject(C);if(x)for(d in _[d]=m[d],l(y,P.outdatedModules),P.outdatedDependencies)Object.prototype.hasOwnProperty.call(P.outdatedDependencies,d)&&(h[d]||(h[d]=[]),l(h[d],P.outdatedDependencies[d]));j&&(l(y,[P.moduleId]),_[d]=g)}var z,M=[];for(n=0;n<y.length;n++)d=y[n],O[d]&&O[d].hot._selfAccepted&&_[d]!==g&&M.push({module:d,errorHandler:O[d].hot._selfAccepted});f("dispose"),Object.keys(w).forEach((function(e){!1===w[e]&&function(e){delete installedChunks[e]}(e)}));for(var A,H,S=y.slice();S.length>0;)if(d=S.pop(),c=O[d]){var X={},k=c.hot._disposeHandlers;for(o=0;o<k.length;o++)(r=k[o])(X);for(s[d]=X,c.hot.active=!1,delete O[d],delete h[d],o=0;o<c.children.length;o++){var R=O[c.children[o]];R&&((z=R.parents.indexOf(d))>=0&&R.parents.splice(z,1))}}for(d in h)if(Object.prototype.hasOwnProperty.call(h,d)&&(c=O[d]))for(H=h[d],o=0;o<H.length;o++)A=H[o],(z=c.children.indexOf(A))>=0&&c.children.splice(z,1);for(d in f("apply"),i=v,_)Object.prototype.hasOwnProperty.call(_,d)&&(e[d]=_[d]);var T=null;for(d in h)if(Object.prototype.hasOwnProperty.call(h,d)&&(c=O[d])){H=h[d];var U=[];for(n=0;n<H.length;n++)if(A=H[n],r=c.hot._acceptedDependencies[A]){if(-1!==U.indexOf(r))continue;U.push(r)}for(n=0;n<U.length;n++){r=U[n];try{r(H)}catch(e){t.onErrored&&t.onErrored({type:"accept-errored",moduleId:d,dependencyId:H[n],error:e}),t.ignoreErrored||T||(T=e)}}}for(n=0;n<M.length;n++){var q=M[n];d=q.module,a=[d];try{D(d)}catch(e){if("function"==typeof q.errorHandler)try{q.errorHandler(e)}catch(r){t.onErrored&&t.onErrored({type:"self-accept-error-handler-errored",moduleId:d,error:r,originalError:e}),t.ignoreErrored||T||(T=r),T||(T=e)}else t.onErrored&&t.onErrored({type:"self-accept-errored",moduleId:d,error:e}),t.ignoreErrored||T||(T=e)}}return T?(f("fail"),Promise.reject(T)):(f("idle"),new Promise((function(e){e(y)})))}var O={};function D(t){if(O[t])return O[t].exports;var r=O[t]={i:t,l:!1,exports:{},hot:u(t),parents:(c=a,a=[],c),children:[]};return e[t].call(r.exports,r,r.exports,d(t)),r.l=!0,r.exports}D.m=e,D.c=O,D.d=function(e,t,r){D.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},D.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},D.t=function(e,t){if(1&t&&(e=D(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(D.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)D.d(r,n,function(t){return e[t]}.bind(null,n));return r},D.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return D.d(t,"a",t),t},D.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},D.p="",D.h=function(){return i},d(0)(D.s=0)}([function(e,t,r){"use strict";r.r(t);class n extends XE.Core.XbsjCzmObj{constructor(e,t){super(e,t),this._createCustomPrimitive(e),e.terrainEffect.depthTest=!0;const r=()=>{let e=this._getCone(),t=[this.width,this.width,this.height],r=e.positions.map((e,r)=>e*t[r%3]);this._customPrimitive.position=this.xbsjPosition,this._customPrimitive.positions=r,this._customPrimitive.normals=void 0,this._customPrimitive.indices=e.indices};r(),this.disposers.push(XE.MVVM.watch(()=>({position:[...this.xbsjPosition],rotation:[...this.xbsjRotation],width:this.width,height:this.height}),r));const n=()=>{this._customPrimitive.show=this.show};n(),this.disposers.push(XE.MVVM.watch(()=>({show:this.show}),n)),this._registerEditing(),this.disposers.push(XE.MVVM.bind(this,"enabled",this,"show")),XE.Earth.Interaction.Picking.registerPickingParent(this._customPrimitive,this)}_getCone(){var e={};if(!e.positions){let t={positions:[],normals:[],uvs:[],indices:[]},r={radius:128,dircetion:3},n=new Cesium.Cartesian3(1e-6,0,0),i=new Array(r.radius).fill(0).map((e,t)=>{let n=2*Math.PI*t/r.radius;return new Array(r.dircetion).fill(0).map((e,t)=>{let i=.5*(t+1)/r.dircetion;return new Cesium.Cartesian3(i*Math.cos(n),i*Math.sin(n),.8660254037844386*(t+1)/r.dircetion*-1)})}),o=i[r.radius-1];i.forEach((e,r)=>{e.forEach((r,i)=>{0==i?this._triangle(r,n,o[i],t):this._face(r,e[i-1],o[i-1],o[i],t)}),o=e}),e.positions=new Float64Array(t.positions),e.normals=new Float64Array(t.normals),e.indices=new Uint16Array(t.indices),e.uvs=new Float32Array(t.uvs)}return e}_face(e,t,r,n,i){let o=this._getNormal(e,t,r),s=i.positions.length/3;i.indices.push(s,s+1,s+2,s,s+2,s+3),i.positions.push(e.x,e.y,e.z,t.x,t.y,t.z,r.x,r.y,r.z,n.x,n.y,n.z),i.normals.push(o.x,o.y,o.z,o.x,o.y,o.z,o.x,o.y,o.z,o.x,o.y,o.z);let a=new Cesium.Cartesian3(0,.5,.5);this._moveAndScale([e,t,r,n],a,i)}_triangle(e,t,r,n){let i=n.positions.length/3;n.indices.push(i,i+1,i+2);let o=this._getNormal(e,t,r);n.positions.push(e.x,e.y,e.z,t.x,t.y,t.z,r.x,r.y,r.z),n.normals.push(o.x,o.y,o.z,o.x,o.y,o.z,o.x,o.y,o.z);let s=new Cesium.Cartesian3(0,.5,.5);this._moveAndScale([e,t,r],s,n)}_getNormal(e,t,r){let n=new Cesium.Cartesian3,i=new Cesium.Cartesian3;Cesium.Cartesian3.subtract(e,t,n),Cesium.Cartesian3.subtract(t,r,i),Cesium.Cartesian3.normalize(n,n),Cesium.Cartesian3.normalize(i,i);let o=Cesium.Cartesian3.cross(n,i,new Cesium.Cartesian3);return Cesium.Cartesian3.normalize(o,o),o}_moveAndScale(e,t,r){e.forEach(e=>{let n=Cesium.Cartesian3.add(e,t,new Cesium.Cartesian3);r.uvs.push(n.y,n.z)})}_createCustomPrimitive(e){const t=XE.Obj.CustomPrimitive.getRenderState(!0,!0);t.cull.enabled=!1;const r={color:[0,.5,.5,.5],renderState:t,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(r),this.disposers.push(()=>{this._customPrimitive=this._customPrimitive&&this._customPrimitive.destroy()})}flyTo(){this._customPrimitive.flyTo()}_registerEditing(){this.disposers.push(XE.Earth.Interaction.InteractionProperty.registerPositionEditing(this._earth,this,{positionProperty:"xbsjPosition"})),this.disposers.push(XE.Earth.Interaction.InteractionProperty.registerPositionPicking(this._earth,this,{positionPickingProperty:"creating",positionProperty:"xbsjPosition"})),this.disposers.push(XE.Earth.Interaction.InteractionProperty.registerRotationEditing(this._earth,this,{positionProperty:"xbsjPosition",rotationProperty:"xbsjRotation"}))}}n.defaultOptions={width:1e4,height:1e4,show:!0,xbsjPosition:[0,0,0],xbsjRotation:[0,0,0],xbsjScale:[1,1,1]},XE.Core.XbsjCzmObj.registerType(n,"CustomPrimitiveExt_Cone");var i=n;XE.Obj.CustomPrimitiveExt=XE.Obj.CustomPrimitiveExt||{},XE.Obj.CustomPrimitiveExt.Cone=i}]);
//# sourceMappingURL=customPrimitiveCone.js.map