@kq_npm/client3d_webgl_vue
Version:
KQGIS Client3D for Vue.js
1 lines • 16.4 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("vue"),require("@kq_npm/client_common_vue/init.js"),require("@kq_npm/client_common_vue/_utils/gis-utils"),require("@kq_npm/client_common_vue/_utils/util")):"function"==typeof define&&define.amd?define("@kq_npm/client3d_webgl_vue",["vue","@kq_npm/client_common_vue/init.js","@kq_npm/client_common_vue/_utils/gis-utils","@kq_npm/client_common_vue/_utils/util"],t):"object"==typeof exports?exports["@kq_npm/client3d_webgl_vue"]=t(require("vue"),require("@kq_npm/client_common_vue/init.js"),require("@kq_npm/client_common_vue/_utils/gis-utils"),require("@kq_npm/client_common_vue/_utils/util")):e["@kq_npm/client3d_webgl_vue"]=t(e.Vue,e["@kq_npm/client_common_vue/init.js"],e["@kq_npm/client_common_vue/_utils/gis-utils"],e["@kq_npm/client_common_vue/_utils/util"])}(this,(function(e,t,n,i){return function(){"use strict";var o={1705:function(e,t,n){var i=n(9389),o=n(7997),l=n.n(o);i.ElMessage.install=(e,t)=>{l()(e,t),e.component("KqMessage",i.ElMessage)},t.Z=i.ElMessage},8434:function(e,t,n){n.d(t,{Z:function(){return i}});class i{_animationPath=null;stopEvent=null;constructor(e){this._animationPath=new Cesium.Kq3dAnimationPath(e),this.stopEvent=this._animationPath.stoped}play(){this._animationPath.play()}pause(){this._animationPath.pause()}stop(){this._animationPath.stop()}getAutoRepeat(){return this._animationPath.getAutoRepeat()}setAutoRepeat(e){this._animationPath.setAutoRepeat(e)}addKeyPointByCurrentView(e){this._animationPath.addKeyPointByCurrentView(e)}modifyKeyPointByCurrentView(e,t){this._animationPath.modifyKeyPointByCurrentView(e,t)}getKeyPoint(e){return this._animationPath.getKeyPoint(e)}getKeyPointDur(e){return this._animationPath.getKeyPointDur(e)}modifyKeyPoint(e,t,n,i){this._animationPath.modifyKeyPoint(e,t,n,i)}deleteKeyPoint(e){this._animationPath.deleteKeyPoint(e)}getAllKeyPoints(){return this._animationPath.getAllKeyPoints()}clearKeyPoints(){this._animationPath.clearKeyPoints()}fromXmlString(e){this._animationPath.fromXmlString(e)}asXmlString(){return this._animationPath.asXmlString()}fromXmlFile(e){return this._animationPath.fromXmlFile(e)}asXmlFile(e){this._animationPath.asXmlFile(e)}destroy(){this._animationPath=null}}},8422:function(e){e.exports=require("@element-plus/icons-vue")},348:function(e){e.exports=require("@kq_npm/client_icons_vue")},9389:function(e){e.exports=require("element-plus/dist/index.full.js")},7080:function(e){e.exports=require("vue-i18n/dist/vue-i18n.cjs.js")},7135:function(e){e.exports=n},3458:function(e){e.exports=i},7997:function(e){e.exports=t},1895:function(t){t.exports=e}},l={};function a(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}};return o[e](n,n.exports,a),n.exports}a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return function(){a.r(r),a.d(r,{FlightViewModel:function(){return l.Z},default:function(){return x}});var e=a(1895),t=a(1705),n=a(8422),i=a(348),o=a(7135),l=a(8434),u=a(3458),c=a(7080);const s={class:"kq-flight3d-box"},d={key:0},f={class:"kq-flight3d-btns"},p={class:"kq-flight3d-list-title"},m={key:1},h={class:"kq-flight3d-add-title"},g={key:0},v={key:1},y={style:{"text-align":"right"}},_={name:"Kq3dFlight"};var x=Object.assign(_,{props:{showShadow:{type:Boolean,default:!0},loadFlightPath:{type:Function},saveFlightPath:{type:Function},deleteFlightPath:{type:Function},position:[String,Object],showHeaderTemp:{type:Boolean,default:!1},isCollapseHeaderTemp:{type:Boolean,default:!1},headerTempTitle:{type:String},headerTempIcon:{type:[Object,String],default:i.IconFlight},isRight:{type:Boolean,default:!0}},setup(a,{expose:r}){const _=a,{proxy:x}=(0,e.getCurrentInstance)();let k=(0,e.ref)(x.$i18n.global.messages[x.$i18n.global.locale].webgl),P=(0,e.ref)(!1),C=(0,e.ref)(!1),V=(0,e.reactive)([]),w=(0,e.ref)(!1),N=(0,e.ref)(null),q=(0,e.ref)(""),S=(0,e.reactive)([]),b=(0,e.ref)(!1),F=null,K=-1,B=null,E=(0,e.ref)(),D=null,j=e=>({"background-color":"var(--kq-fill-color-light)",color:"var(--kq-color-info)","font-size":"14px"}),z=(0,e.ref)(null),R=(0,e.ref)(),I=(0,e.ref)(),{locale:M,messages:T}=(0,c.useI18n)(),X=(0,e.ref)(null);X.value=k.value.flight,(0,e.watch)((()=>M.value),((e,t)=>{k.value=T.value[e].webgl,X.value=k.value.flight})),(0,e.onMounted)((()=>{(0,u.updatePosition)(z.value,_),(0,e.watch)((()=>_.position),((e,t)=>{(0,u.updatePosition)(z.value,_)})),A(),(0,e.watch)((()=>_.showHeaderTemp),((t,n)=>{(0,e.nextTick)((()=>{A()}))})),o.utils.getWebMap(null,(e=>{e&&(F=e._viewer,D=new l.Z(F),D.stopEvent.addEventListener((function(){b.value=!1,V.forEach((e=>{e.isPlaying=!1}))})),_.loadFlightPath&&_.loadFlightPath((e=>{(e=JSON.parse(JSON.stringify(e))).forEach((e=>{e.isPlaying=!1,e.isRepeat=!1,V.push(e)}))})))}))})),(0,e.onBeforeUnmount)((()=>{D.stop(),document.removeEventListener("click",Y)}));const A=()=>{_.showHeaderTemp&&(R.value=(0,u.createHeaderTemp)(z.value,(0,e.toRefs)(_),I,X))};function O(){V.forEach((e=>{e.isPlaying&&G(e)})),D.clearKeyPoints(),P.value=!0,K=-1}function L(){B&&(O(),C.value=!0,q.value=B.name,D.fromXmlString(B.xmlString),$())}function $(){D.getAllKeyPoints().forEach((e=>{var t=Cesium.Cartographic.fromCartesian(e.destination),n=[1*Cesium.Math.toDegrees(t.longitude).toFixed(4),1*Cesium.Math.toDegrees(t.latitude).toFixed(4),1*t.height.toFixed(2)],i={position:n.join(", "),interval:e.duration,positionArr:n};S.push(i)}))}function H(){B&&(B.index===K&&(K=-1),V.splice(B.index,1),_.deleteFlightPath&&_.deleteFlightPath(B.guid))}function U(e,t){t!==K&&(D.fromXmlString(e.xmlString),K=t),D.play(),e.isPlaying=!0,D.setAutoRepeat(e.isRepeat)}function Z(e){e.isPlaying=!1,D.pause()}function G(e){e.isPlaying=!1,D.stop()}function J(e){e.isRepeat=!e.isRepeat,e.isPlaying&&D.setAutoRepeat(e.isRepeat)}function W(e,t){if(!0===w.value&&t===B.index)return w.value=!1,void document.addEventListener("click",Y);w.value=!0;let n=N.value.$el;n.style.left=window.event.clientX-70+"px",n.style.top=window.event.clientY+15+"px",B={index:t,...e},document.addEventListener("click",Y)}function Y(){if(N.value){let e=N.value.$el.querySelector(".is-active");e&&e.classList.remove("is-active")}document.removeEventListener("click",Y),w.value=!1}function Q(){var t=F.getCurrentView(),n=[1*t.longitude.toFixed(4),1*t.latitude.toFixed(4),1*t.height.toFixed(2)],i={position:n.join(", "),interval:5,positionArr:n};S.push(i),(0,e.nextTick)((()=>{E.value.$refs.child.setScrollTop(1e4)})),D.addKeyPointByCurrentView(5)}function ee(e,t){var n=F.getCurrentView(),i=[1*n.longitude.toFixed(4),1*n.latitude.toFixed(4),1*n.height.toFixed(2)],o=i.join(", ");t.position=o,t.positionArr=i,D.modifyKeyPointByCurrentView(e,t.interval)}function te(e){D.deleteKeyPoint(e),S.splice(e,1)}function ne(){for(let n=0;n<S.length;n++){var e=S[n].interval,t=D.getKeyPoint(n);D.getKeyPointDur(n)!==e&&D.modifyKeyPoint(n,t.position,t.orientation,e)}b.value=!0,D.play()}function ie(){b.value=!1,D.pause()}function oe(){b.value=!1,D.stop()}function le(){if(""===q.value)(0,t.Z)({message:k.value.enterPathName+"!",type:"warning"});else{for(let t=0;t<S.length;t++){var e=S[t].interval,n=D.getKeyPoint(t);D.getKeyPointDur(t)!==e&&D.modifyKeyPoint(t,n.position,n.orientation,e)}var i=D.asXmlString();if(C.value){if(B){var o=V[B.index];o.name=q.value,o.xmlString=i,_.saveFlightPath&&_.saveFlightPath({guid:o.guid,name:o.name,xmlString:o.xmlString})}}else{var l={guid:Cesium.createGuid(),name:q.value,xmlString:i,isPlaying:!1};V.push(l),_.saveFlightPath&&_.saveFlightPath({guid:l.guid,name:l.name,xmlString:l.xmlString})}ae()}}function ae(){oe(),D.clearKeyPoints(),S.length=0,P.value=!1,q.value="",C.value=!1}function re(e){var t=e.name.split(".")[0];D.fromXmlFile(e.raw).then((()=>{var e=D.asXmlString(),n={guid:Cesium.createGuid(),name:t,xmlString:e,isPlaying:!1};V.push(n),_.saveFlightPath&&_.saveFlightPath({guid:n.guid,name:n.name,xmlString:n.xmlString})}))}function ue(){B&&(D.fromXmlString(B.xmlString),D.asXmlFile(B.name))}return r({convertAnimationPathKeys:$,showDropDownMenu:W,hideDropDownMenu:Y,save:le,cancel:ae,addPath:O,editPath:L,deletePath:H,play:U,pause:Z,stop:G,repeat:J,addKey:Q,replaceKey:ee,deleteKey:te,prePlay:ne,prePause:ie,preStop:oe,importFile:re,exportFile:ue}),(t,o)=>{const l=(0,e.resolveComponent)("kq-icon"),r=(0,e.resolveComponent)("kq-button"),u=(0,e.resolveComponent)("kq-upload"),c=(0,e.resolveComponent)("kq-menu-item"),_=(0,e.resolveComponent)("kq-menu"),x=(0,e.resolveComponent)("kq-input"),F=(0,e.resolveComponent)("kq-form-item"),K=(0,e.resolveComponent)("kq-table-column"),B=(0,e.resolveComponent)("kq-input-number"),D=(0,e.resolveComponent)("kq-table"),M=(0,e.resolveComponent)("kq-divider");return(0,e.openBlock)(),(0,e.createElementBlock)("section",{class:(0,e.normalizeClass)(["kq-flight3d",{"kq-box-shadow":a.showShadow}]),ref_key:"boxRef",ref:z},[a.showHeaderTemp?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)((0,e.unref)(R)),{key:0,ref_key:"headerTempRef",ref:I},null,512)):(0,e.createCommentVNode)("v-if",!0),(0,e.createElementVNode)("div",s,[(0,e.unref)(P)?((0,e.openBlock)(),(0,e.createElementBlock)("div",m,[(0,e.createElementVNode)("div",h,[(0,e.createVNode)(r,{text:"",onClick:ae},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(l,{size:16},{default:(0,e.withCtx)((()=>[(0,e.createVNode)((0,e.unref)(n.ArrowLeft))])),_:1})])),_:1}),(0,e.unref)(C)?((0,e.openBlock)(),(0,e.createElementBlock)("span",v,(0,e.toDisplayString)((0,e.unref)(k).editPath),1)):((0,e.openBlock)(),(0,e.createElementBlock)("span",g,(0,e.toDisplayString)((0,e.unref)(k).addPath),1))]),(0,e.createVNode)(F,{class:"kq-flight3d-item-name",label:(0,e.unref)(k).pathName},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(x,{placeholder:(0,e.unref)(k).enterPathName,modelValue:(0,e.unref)(q),"onUpdate:modelValue":o[0]||(o[0]=t=>(0,e.isRef)(q)?q.value=t:q=t)},null,8,["placeholder","modelValue"])])),_:1},8,["label"]),(0,e.createVNode)(D,{ref_key:"tableRef",ref:E,border:"",data:(0,e.unref)(S),"header-cell-style":(0,e.unref)(j),style:{height:"200px"}},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(K,{label:(0,e.unref)(k).order,width:"50",type:"index",align:"center"},null,8,["label"]),(0,e.createVNode)(K,{label:(0,e.unref)(k).position,prop:"position",align:"center"},null,8,["label"]),(0,e.createVNode)(K,{label:(0,e.unref)(k).interval,width:"100",align:"center"},{default:(0,e.withCtx)((t=>[(0,e.createVNode)(B,{modelValue:t.row.interval,"onUpdate:modelValue":e=>t.row.interval=e,min:1,"controls-position":"right",style:{width:"83px"}},null,8,["modelValue","onUpdate:modelValue"])])),_:1},8,["label"]),(0,e.createVNode)(K,{label:(0,e.unref)(k).operation,width:"90",align:"center"},{default:(0,e.withCtx)((t=>[(0,e.createVNode)(r,{onClick:e=>ee(t.$index,t.row),title:(0,e.unref)(k).replaceKeyframe},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(l,{size:16},{default:(0,e.withCtx)((()=>[(0,e.createVNode)((0,e.unref)(i.IconReplace))])),_:1})])),_:2},1032,["onClick","title"]),(0,e.createVNode)(r,{onClick:e=>te(t.$index),title:(0,e.unref)(k).delete},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(l,{size:16},{default:(0,e.withCtx)((()=>[(0,e.createVNode)((0,e.unref)(n.Delete))])),_:1})])),_:2},1032,["onClick","title"])])),_:1},8,["label"])])),_:1},8,["data","header-cell-style"]),(0,e.createVNode)(r,{class:"kq-flight3d-btn-add",onClick:Q},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(l,{size:16},{default:(0,e.withCtx)((()=>[(0,e.createVNode)((0,e.unref)(n.Plus))])),_:1}),(0,e.createTextVNode)((0,e.toDisplayString)((0,e.unref)(k).addkeyframe),1)])),_:1}),(0,e.createVNode)(F,{class:"kq-flight3d-ybf",label:(0,e.unref)(k).prePlay},{default:(0,e.withCtx)((()=>[(0,e.createElementVNode)("div",null,[(0,e.unref)(b)?((0,e.openBlock)(),(0,e.createBlock)(l,{key:1,size:32,onClick:ie,title:(0,e.unref)(k).pause},{default:(0,e.withCtx)((()=>[(0,e.createVNode)((0,e.unref)(i.IconVideoPause))])),_:1},8,["title"])):((0,e.openBlock)(),(0,e.createBlock)(l,{key:0,size:32,onClick:ne,title:(0,e.unref)(k).play},{default:(0,e.withCtx)((()=>[(0,e.createVNode)((0,e.unref)(i.IconVideoPlay))])),_:1},8,["title"])),(0,e.createVNode)(l,{size:32,onClick:oe,title:(0,e.unref)(k).stop},{default:(0,e.withCtx)((()=>[(0,e.createVNode)((0,e.unref)(i.IconVideoStop))])),_:1},8,["title"])])])),_:1},8,["label"]),(0,e.createVNode)(M),(0,e.createElementVNode)("div",y,[(0,e.createVNode)(r,{type:"primary",onClick:le},{default:(0,e.withCtx)((()=>[(0,e.createTextVNode)((0,e.toDisplayString)((0,e.unref)(k).save),1)])),_:1}),(0,e.createVNode)(r,{onClick:ae},{default:(0,e.withCtx)((()=>[(0,e.createTextVNode)((0,e.toDisplayString)((0,e.unref)(k).cancel),1)])),_:1})])])):((0,e.openBlock)(),(0,e.createElementBlock)("div",d,[(0,e.createElementVNode)("div",f,[(0,e.createVNode)(r,{onClick:O,title:(0,e.unref)(k).addPath},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(l,{size:24},{default:(0,e.withCtx)((()=>[(0,e.createVNode)((0,e.unref)(n.Plus))])),_:1})])),_:1},8,["title"]),(0,e.createVNode)(u,{style:{"margin-left":"4px"},"on-change":re,"auto-upload":!1,"show-file-list":!1,accept:"text/xml"},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(r,{title:(0,e.unref)(k).importXML},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(l,{size:24},{default:(0,e.withCtx)((()=>[(0,e.createVNode)((0,e.unref)(i.IconUploadCloud))])),_:1})])),_:1},8,["title"])])),_:1})]),(0,e.createElementVNode)("div",p,(0,e.toDisplayString)((0,e.unref)(k).pathName),1),(0,e.createVNode)(_,{class:"pathlist-ul"},{default:(0,e.withCtx)((()=>[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)((0,e.unref)(V),((t,o)=>((0,e.openBlock)(),(0,e.createBlock)(c,{index:o,key:o},{title:(0,e.withCtx)((()=>[(0,e.createElementVNode)("span",null,(0,e.toDisplayString)(t.name),1),t.isPlaying?((0,e.openBlock)(),(0,e.createBlock)(l,{key:0,size:16,class:"menuIcon",onClick:e=>Z(t),title:(0,e.unref)(k).pause},{default:(0,e.withCtx)((()=>[(0,e.createVNode)((0,e.unref)(i.IconVideoPause))])),_:2},1032,["onClick","title"])):((0,e.openBlock)(),(0,e.createBlock)(l,{key:1,size:16,class:"menuIcon",onClick:e=>U(t,o),title:(0,e.unref)(k).play},{default:(0,e.withCtx)((()=>[(0,e.createVNode)((0,e.unref)(i.IconVideoPlay))])),_:2},1032,["onClick","title"])),(0,e.createVNode)(l,{size:16,class:"menuIcon",onClick:e=>G(t),title:(0,e.unref)(k).stop},{default:(0,e.withCtx)((()=>[(0,e.createVNode)((0,e.unref)(i.IconVideoStop))])),_:2},1032,["onClick","title"]),(0,e.createVNode)(l,{size:16,class:(0,e.normalizeClass)(t.isRepeat?"kq-icon-light":""),onClick:e=>J(t),title:(0,e.unref)(k).repeat},{default:(0,e.withCtx)((()=>[(0,e.createVNode)((0,e.unref)(i.IconVideoRepeat))])),_:2},1032,["class","onClick","title"]),(0,e.createVNode)(l,{size:16,class:"menuIcon",onClick:(0,e.withModifiers)((e=>W(t,o)),["prevent","stop"]),title:(0,e.unref)(k).more},{default:(0,e.withCtx)((()=>[(0,e.createVNode)((0,e.unref)(n.More))])),_:2},1032,["onClick","title"])])),_:2},1032,["index"])))),128))])),_:1}),(0,e.withDirectives)((0,e.createElementVNode)("div",null,[(0,e.createVNode)(_,{class:"dropdown-ul",ref_key:"dropDownMenu",ref:N},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(c,{index:"1",onClick:L},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(l,{size:16},{default:(0,e.withCtx)((()=>[(0,e.createVNode)((0,e.unref)(n.Edit))])),_:1}),(0,e.createElementVNode)("span",null,(0,e.toDisplayString)((0,e.unref)(k).edit),1)])),_:1}),(0,e.createVNode)(c,{index:"2",onClick:ue},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(l,{size:14},{default:(0,e.withCtx)((()=>[(0,e.createVNode)((0,e.unref)(i.IconExport))])),_:1}),(0,e.createElementVNode)("span",null,(0,e.toDisplayString)((0,e.unref)(k).export),1)])),_:1}),(0,e.createVNode)(c,{index:"3",onClick:H},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(l,{size:16},{default:(0,e.withCtx)((()=>[(0,e.createVNode)((0,e.unref)(n.Delete))])),_:1}),(0,e.createElementVNode)("span",null,(0,e.toDisplayString)((0,e.unref)(k).delete),1)])),_:1})])),_:1},512)],512),[[e.vShow,(0,e.unref)(w)]])]))])],2)}}}),k=a(7997),P=a.n(k);x.install=(e,t)=>{P()(e,t),e.component(x.name,x)}}(),r}()}));