@kq_npm/client3d_webgl_vue
Version:
KQGIS Client3D for Vue.js
1 lines • 17.7 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("vue"),require("@kq_npm/client_common_vue/_utils/gis-utils"),require("@kq_npm/client_common_vue/init.js"),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/_utils/gis-utils","@kq_npm/client_common_vue/init.js","@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/_utils/gis-utils"),require("@kq_npm/client_common_vue/init.js"),require("@kq_npm/client_common_vue/_utils/util")):e["@kq_npm/client3d_webgl_vue"]=t(e.Vue,e["@kq_npm/client_common_vue/_utils/gis-utils"],e["@kq_npm/client_common_vue/init.js"],e["@kq_npm/client_common_vue/_utils/util"])}(this,(function(e,t,i,a){return function(){"use strict";var n={1705:function(e,t,i){var a=i(9389),n=i(7997),s=i.n(n);a.ElMessage.install=(e,t)=>{s()(e,t),e.component("KqMessage",a.ElMessage)},t.Z=a.ElMessage},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=t},3458:function(e){e.exports=a},7997:function(e){e.exports=i},1895:function(t){t.exports=e}},s={};function l(e){var t=s[e];if(void 0!==t)return t.exports;var i=s[e]={exports:{}};return n[e](i,i.exports,l),i.exports}l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,{a:t}),t},l.d=function(e,t){for(var i in t)l.o(t,i)&&!l.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return function(){l.r(o),l.d(o,{ModelProfileAnalysisViewModel:function(){return u},default:function(){return v}});var e=l(1895),t=l(7135),i=l(1705);let a,n=[],s=[],r=[];class u{_profileAnalysis=null;_ProfileAnalysisChart=null;_ProfileAnalysisChartVis=null;_language=null;_globaOptions={width:360,height:360};constructor(e,t,i){this._language=e._language,this._globaOptions.viewModel={angle:t.perspectiveAngle||90,frustumH:t.targetAreaHeight||200,extendWidth:t.targetAreaWidth||1,isPerspective:t.enablePerspective||!0,cameraHeight:t.cameraHeight||0},this._globaOptions.viewer=e._viewer,this._globaOptions.viewer.scene.postProcessStages._fxaa.enabled=!0,this._globaOptions.viewer.scene.globe.depthTestAgainstTerrain=!0,this._ProfileAnalysisChart=i,this._ProfileAnalysisChartVis=i||{},this._profileAnalysis=new window.Cesium.Kq3dProfileAnalysis({viewer:this._globaOptions.viewer,width:this._globaOptions.width,height:this._globaOptions.height,angle:this._globaOptions.viewModel.angle,frustumH:this._globaOptions.viewModel.frustumH,extendWidth:this._globaOptions.viewModel.extendWidth,isPerspective:this._globaOptions.viewModel.isPerspective,cameraHeight:this._globaOptions.viewModel.cameraHeight,isShowDown:!1,debugCamera:{show:!0,color:window.Cesium.Color.fromBytes(0,255,255,200)}}),this._globaOptions._handler=new window.Cesium.ScreenSpaceEventHandler(this._globaOptions.viewer.canvas),this._globaOptions.canvas=document.createElement("canvas"),this._globaOptions.canvas.id="pro",this._globaOptions.ctx=this._globaOptions.canvas.getContext("2d"),this._ProfileAnalysisChart.appendChild(this._globaOptions.canvas)}start(){var e=!1,t=this._globaOptions.viewer.scene.primitives._primitives;for(let i=0;i<t.length;i++)t[i]instanceof Cesium.Cesium3DTileset&&t[i]._url&&(e=!0);if(e){this.remove();let e=this;this._globaOptions._handler.removeInputAction(window.Cesium.ScreenSpaceEventType.LEFT_CLICK),this._globaOptions._handler.setInputAction((function(t){var i=e._globaOptions.viewer.scene.pickPosition(t.position);if(window.Cesium.defined(i)){a=e.createPoint(i),n.push(a),s.push(i);let t=window.Cesium.Cartographic.fromCartesian(i);if(r.push(t),2==s.length){var l=[];s.forEach((e=>{var t=window.Cesium.Cartographic.fromCartesian(e);l.push(t)})),e._profileAnalysis.elevation=l,setTimeout((()=>{e.updatePorfileAnalysis()}),200),n.forEach((function(t){e._globaOptions.viewer.entities.remove(t)})),n=[],s=[]}}}),window.Cesium.ScreenSpaceEventType.LEFT_CLICK)}else(0,i.Z)({message:this._language.addModelTips,type:"warning"})}createPoint(e){return this._globaOptions.viewer.entities.add({position:e,point:{color:window.Cesium.Color.YELLOW,pixelSize:5}})}updatePorfileAnalysis(){if(this._profileAnalysis&&(this._profileAnalysis.frustumH=this._globaOptions.viewModel.frustumH,this._profileAnalysis.angle=this._globaOptions.viewModel.angle,this._profileAnalysis.extendWidth=this._globaOptions.viewModel.extendWidth,this._profileAnalysis.cameraHeight=this._globaOptions.viewModel.cameraHeight,this._profileAnalysis.isPerspective=this._globaOptions.viewModel.isPerspective,this._globaOptions._handler)){let e=this._profileAnalysis.updateBuffer();this._ProfileAnalysisChartVis.value=!0,setTimeout((()=>{this.getPorfileAnalysisTexture(e),this._globaOptions._handler.removeInputAction(window.Cesium.ScreenSpaceEventType.LEFT_CLICK)}),500)}}getPorfileAnalysisTexture(e){if(e){this._globaOptions.canvas.height=this._globaOptions.height,this._globaOptions.canvas.width=this._globaOptions.width;let i=this._globaOptions.ctx.createImageData(this._globaOptions.width,this._globaOptions.height);var t=4*this._globaOptions.width;for(let a=0;a<this._globaOptions.height;a++)for(let n=0;n<this._globaOptions.width;n++)for(let s=0;s<4;s++)i.data[(this._globaOptions.height-1-a)*t+4*n+s]=e[a*t+4*n+s];this._globaOptions.ctx.putImageData(i,0,0),this._globaOptions.ctx.setLineDash([20,5]),this._globaOptions.ctx.lineWidth=1,this._globaOptions.ctx.strokeStyle="#ff2";let a=360*(1-this._profileAnalysis._frustumH/this._profileAnalysis._maxH),n=(1-this._profileAnalysis._frustumW/this._profileAnalysis._maxW)/2*360;this._globaOptions.ctx.moveTo(n,360),this._globaOptions.ctx.lineTo(n,a),this._globaOptions.ctx.lineTo(360-n,a),this._globaOptions.ctx.lineTo(360-n,360),this._globaOptions.ctx.stroke();let s=String(this._profileAnalysis._frustumW.toFixed(2)),l=this._language.profileLength+" : "+s+"m";s=String(this._profileAnalysis._maxW.toFixed(2));let o=this._language.totalLength+" : "+s+"m";s=String(this._profileAnalysis._frustumH.toFixed(2));let r=this._language.profileHeight+" : "+s+"m";s=String(this._profileAnalysis._maxH.toFixed(2));let u=this._language.totalHeight+" : "+s+"m";this._globaOptions.ctx.font="bold 15px Arial",this._globaOptions.ctx.textAlign="left",this._globaOptions.ctx.textBaseline="bottom",this._globaOptions.ctx.fillStyle="#ccc",this._globaOptions.ctx.fillText(l,10,20),this._globaOptions.ctx.fillText(o,10,40),this._globaOptions.ctx.fillText(r,10,60),this._globaOptions.ctx.fillText(u,10,80)}}setEnablePerspective(e){this._globaOptions.viewModel.isPerspective=e,this._ProfileAnalysisChartVis.value&&this.updatePorfileAnalysis()}setPerspectiveAngle(e){this._globaOptions.viewModel.angle=e,this._ProfileAnalysisChartVis.value&&this.updatePorfileAnalysis()}setTargetAreaWidth(e){this._globaOptions.viewModel.extendWidth=e,this._ProfileAnalysisChartVis.value&&this.updatePorfileAnalysis()}setTargetAreaHeight(e){this._globaOptions.viewModel.frustumH=e,this._ProfileAnalysisChartVis.value&&this.updatePorfileAnalysis()}setCameraHeight(e){this._globaOptions.viewModel.cameraHeight=e,this._ProfileAnalysisChartVis.value&&this.updatePorfileAnalysis()}changeLanguage(e){this._language=e,this._ProfileAnalysisChartVis.value&&this.updatePorfileAnalysis()}remove(){this._ProfileAnalysisChartVis.value=!1,this._profileAnalysis&&this._profileAnalysis.clearPrimitives()}clear(){this.remove(),this._globaOptions._handler.removeInputAction(window.Cesium.ScreenSpaceEventType.LEFT_CLICK)}destroy(){this.remove(),this._globaOptions._handler.removeInputAction(window.Cesium.ScreenSpaceEventType.LEFT_CLICK),this._globaOptions._handler=null,this._ProfileAnalysisChartVis.value=!1,this._profileAnalysis&&this._profileAnalysis.destroy(),this._profileAnalysis=null}}var p=l(348),h=l(3458),g=l(7080);const m={class:"kq3d-model-profile-analysis-box"},d={class:"kq3d-model-profile-analysis-footer"},c={class:"kq3d-model-profile-analysis-result"},f={id:"resultCahrt",class:"resultCahrt"},_={name:"Kq3dModelProfileAnalysis"};var v=Object.assign(_,{props:{settingParams:{type:Object},showShadow:{type:Boolean,default:!0},position:[String,Object],showHeaderTemp:{type:Boolean,default:!1},isCollapseHeaderTemp:{type:Boolean,default:!1},headerTempTitle:{type:String},headerTempIcon:{type:[Object,String],default:p.IconProfileAnalysis},isRight:{type:Boolean,default:!0}},setup(i,{expose:a}){const n=i,{proxy:s}=(0,e.getCurrentInstance)();let l=(0,e.ref)(s.$i18n.global.messages[s.$i18n.global.locale].webgl),o=null,r=(0,e.ref)(!0),p=(0,e.reactive)({collapseValue:n.settingParams&&n.settingParams.collapseValue||(""==(n.settingParams&&n.settingParams.collapseValue)?"":"setting"),perspectiveAngle:n.settingParams&&n.settingParams.perspectiveAngle||90,minPerspectiveAngle:n.settingParams&&n.settingParams.minPerspectiveAngle||0,maxPerspectiveAngle:n.settingParams&&n.settingParams.maxPerspectiveAngle||90,targetAreaWidth:n.settingParams&&n.settingParams.targetAreaWidth||1,minTargetAreaWidth:n.settingParams&&n.settingParams.minTargetAreaWidth||0,maxTargetAreaWidth:n.settingParams&&n.settingParams.maxTargetAreaWidth||500,targetAreaHeight:n.settingParams&&n.settingParams.targetAreaHeight||200,minTargetAreaHeight:n.settingParams&&n.settingParams.minTargetAreaHeight||0,maxTargetAreaHeight:n.settingParams&&n.settingParams.maxTargetAreaHeight||500,cameraHeight:n.settingParams&&n.settingParams.cameraHeight||0,minCameraHeight:n.settingParams&&n.settingParams.minCameraHeight||0,maxCameraHeight:n.settingParams&&n.settingParams.maxCameraHeight||500,enablePerspective:n.settingParams&&void 0!==n.settingParams.isLabel||!0}),_=(0,e.ref)(null),v=(0,e.ref)(),x=(0,e.ref)(),{locale:A,messages:b}=(0,g.useI18n)(),w=(0,e.ref)(null);w.value=l.value.modelProfileAnalysis,(0,e.watch)((()=>A.value),((e,t)=>{l.value=b.value[e].webgl,w.value=l.value.modelProfileAnalysis,o&&o.changeLanguage(l.value)})),(0,e.onMounted)((()=>{(0,h.updatePosition)(_.value,n),(0,e.watch)((()=>n.position),((e,t)=>{(0,h.updatePosition)(_.value,n)})),y(),(0,e.watch)((()=>n.showHeaderTemp),((t,i)=>{(0,e.nextTick)((()=>{y()}))})),t.utils.getWebMap(null,(e=>{e&&(o=new u(e,{perspectiveAngle:p.perspectiveAngle,targetAreaWidth:p.targetAreaWidth,targetAreaHeight:p.targetAreaHeight,cameraHeight:p.cameraHeight,enablePerspective:p.enablePerspective},document.getElementById("resultCahrt")),o._ProfileAnalysisChartVis=r,r.value=!1)}))}));const y=()=>{n.showHeaderTemp&&(v.value=(0,h.createHeaderTemp)(_.value,(0,e.toRefs)(n),x,w))};function C(){o&&o.start()}function P(){o&&o.clear()}function V(){o&&o.setEnablePerspective(p.enablePerspective)}function O(){o&&o.setPerspectiveAngle(p.perspectiveAngle)}function H(){o&&o.setTargetAreaWidth(p.targetAreaWidth)}function T(){o&&o.setTargetAreaHeight(p.targetAreaHeight)}function k(){o&&o.setCameraHeight(p.cameraHeight)}return(0,e.onBeforeUnmount)((()=>{o&&o.destroy()})),a({startAnalysis:C,clearResult:P,onChangeEnablePerspective:V,onChangePerspectiveAngle:O,onChangeTargetAreaWidth:H,onChangeTargetAreaHeight:T,onChangeCameraHeight:k}),(t,a)=>{const n=(0,e.resolveComponent)("kq-row"),s=(0,e.resolveComponent)("kq-slider"),o=(0,e.resolveComponent)("kq-col"),u=(0,e.resolveComponent)("kq-input-number"),h=(0,e.resolveComponent)("kq-form-item"),g=(0,e.resolveComponent)("kq-checkbox"),A=(0,e.resolveComponent)("kq-form"),b=(0,e.resolveComponent)("kq-collapse-item"),w=(0,e.resolveComponent)("kq-collapse"),y=(0,e.resolveComponent)("kq-button");return(0,e.openBlock)(),(0,e.createElementBlock)("section",{class:(0,e.normalizeClass)(["kq3d-model-profile-analysis",{"kq-box-shadow":i.showShadow}]),ref_key:"boxRef",ref:_},[i.showHeaderTemp?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)((0,e.unref)(v)),{key:0,ref_key:"headerTempRef",ref:x},null,512)):(0,e.createCommentVNode)("v-if",!0),(0,e.createElementVNode)("div",m,[(0,e.createVNode)(n,{class:"kq3d-model-profile-analysis-tip"},{default:(0,e.withCtx)((()=>[(0,e.createElementVNode)("p",null,(0,e.toDisplayString)((0,e.unref)(l).profileTips),1)])),_:1}),(0,e.createVNode)(w,{"model-value":(0,e.unref)(p).collapseValue},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(b,{title:(0,e.unref)(l).analysisSettings,name:"setting"},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(A,{"label-width":"135px","label-position":"left"},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(n,null,{default:(0,e.withCtx)((()=>[(0,e.createVNode)(h,{label:(0,e.unref)(l).perspectiveAngle},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(n,{style:{display:"flex"}},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(o,{span:16},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(s,{modelValue:(0,e.unref)(p).perspectiveAngle,"onUpdate:modelValue":a[0]||(a[0]=t=>(0,e.unref)(p).perspectiveAngle=t),step:1,min:(0,e.unref)(p).minPerspectiveAngle,max:(0,e.unref)(p).maxPerspectiveAngle,onInput:O},null,8,["modelValue","min","max"])])),_:1}),(0,e.createVNode)(o,{span:8},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(u,{modelValue:(0,e.unref)(p).perspectiveAngle,"onUpdate:modelValue":a[1]||(a[1]=t=>(0,e.unref)(p).perspectiveAngle=t),min:(0,e.unref)(p).minPerspectiveAngle,max:(0,e.unref)(p).maxPerspectiveAngle,step:1,"controls-position":"right"},null,8,["modelValue","min","max"])])),_:1})])),_:1})])),_:1},8,["label"])])),_:1}),(0,e.createVNode)(n,null,{default:(0,e.withCtx)((()=>[(0,e.createVNode)(h,{label:(0,e.unref)(l).targetAreaWidth},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(n,{style:{display:"flex"}},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(o,{span:16},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(s,{modelValue:(0,e.unref)(p).targetAreaWidth,"onUpdate:modelValue":a[2]||(a[2]=t=>(0,e.unref)(p).targetAreaWidth=t),step:1,min:(0,e.unref)(p).minTargetAreaWidth,max:(0,e.unref)(p).maxTargetAreaWidth,onInput:H},null,8,["modelValue","min","max"])])),_:1}),(0,e.createVNode)(o,{span:8},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(u,{modelValue:(0,e.unref)(p).targetAreaWidth,"onUpdate:modelValue":a[3]||(a[3]=t=>(0,e.unref)(p).targetAreaWidth=t),min:(0,e.unref)(p).minTargetAreaWidth,step:1,max:(0,e.unref)(p).maxTargetAreaWidth,"controls-position":"right"},null,8,["modelValue","min","max"])])),_:1})])),_:1})])),_:1},8,["label"])])),_:1}),(0,e.createVNode)(n,null,{default:(0,e.withCtx)((()=>[(0,e.createVNode)(h,{label:(0,e.unref)(l).targetAreaHeight},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(n,{style:{display:"flex"}},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(o,{span:16},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(s,{modelValue:(0,e.unref)(p).targetAreaHeight,"onUpdate:modelValue":a[4]||(a[4]=t=>(0,e.unref)(p).targetAreaHeight=t),step:1,min:(0,e.unref)(p).minTargetAreaHeight,max:(0,e.unref)(p).maxTargetAreaHeight,onInput:T},null,8,["modelValue","min","max"])])),_:1}),(0,e.createVNode)(o,{span:8},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(u,{modelValue:(0,e.unref)(p).targetAreaHeight,"onUpdate:modelValue":a[5]||(a[5]=t=>(0,e.unref)(p).targetAreaHeight=t),min:(0,e.unref)(p).minTargetAreaHeight,step:1,max:(0,e.unref)(p).maxTargetAreaHeight,"controls-position":"right"},null,8,["modelValue","min","max"])])),_:1})])),_:1})])),_:1},8,["label"])])),_:1}),(0,e.createVNode)(n,null,{default:(0,e.withCtx)((()=>[(0,e.createVNode)(h,{label:(0,e.unref)(l).cameraHeight},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(n,{style:{display:"flex"}},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(o,{span:16},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(s,{modelValue:(0,e.unref)(p).cameraHeight,"onUpdate:modelValue":a[6]||(a[6]=t=>(0,e.unref)(p).cameraHeight=t),step:1,min:(0,e.unref)(p).minCameraHeight,max:(0,e.unref)(p).maxCameraHeight,onInput:k},null,8,["modelValue","min","max"])])),_:1}),(0,e.createVNode)(o,{span:8},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(u,{modelValue:(0,e.unref)(p).cameraHeight,"onUpdate:modelValue":a[7]||(a[7]=t=>(0,e.unref)(p).cameraHeight=t),min:(0,e.unref)(p).minCameraHeight,step:1,max:(0,e.unref)(p).maxCameraHeight,"controls-position":"right"},null,8,["modelValue","min","max"])])),_:1})])),_:1})])),_:1},8,["label"])])),_:1}),(0,e.createVNode)(n,null,{default:(0,e.withCtx)((()=>[(0,e.createVNode)(g,{modelValue:(0,e.unref)(p).enablePerspective,"onUpdate:modelValue":a[8]||(a[8]=t=>(0,e.unref)(p).enablePerspective=t),onChange:V},{default:(0,e.withCtx)((()=>[(0,e.createTextVNode)((0,e.toDisplayString)((0,e.unref)(l).enablePerspective),1)])),_:1},8,["modelValue"])])),_:1})])),_:1})])),_:1},8,["title"])])),_:1},8,["model-value"]),(0,e.createElementVNode)("div",d,[(0,e.createVNode)(y,{onClick:a[9]||(a[9]=(0,e.withModifiers)((e=>C()),["stop"])),title:(0,e.unref)(l).startAnalysis,type:"primary"},{default:(0,e.withCtx)((()=>[(0,e.createTextVNode)((0,e.toDisplayString)((0,e.unref)(l).startAnalysis),1)])),_:1},8,["title"]),(0,e.createVNode)(y,{onClick:a[10]||(a[10]=(0,e.withModifiers)((e=>P()),["stop"])),title:(0,e.unref)(l).clearResult},{default:(0,e.withCtx)((()=>[(0,e.createTextVNode)((0,e.toDisplayString)((0,e.unref)(l).clearResult),1)])),_:1},8,["title"])]),(0,e.createElementVNode)("div",c,[(0,e.withDirectives)((0,e.createElementVNode)("div",f,null,512),[[e.vShow,(0,e.unref)(r)]])])])],2)}}}),x=l(7997),A=l.n(x);v.install=(e,t)=>{A()(e,t),e.component(v.name,v)}}(),o}()}));