UNPKG

@kq_npm/client3d_webgl_vue

Version:

KQGIS Client3D for Vue.js

1 lines 12.8 kB
!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,n){return function(){"use strict";var a={1705:function(e,t,i){var n=i(9389),a=i(7997),o=i.n(a);n.ElMessage.install=(e,t)=>{o()(e,t),e.component("KqMessage",n.ElMessage)},t.Z=n.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=n},7997:function(e){e.exports=i},1895:function(t){t.exports=e}},o={};function r(e){var t=o[e];if(void 0!==t)return t.exports;var i=o[e]={exports:{}};return a[e](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return function(){r.r(s),r.d(s,{TerrainOperationViewModel:function(){return n},default:function(){return h}});var e=r(1895),t=r(7135),i=r(1705);class n{_terrainexcavationext=null;_terrainmodification=null;_drawManager=null;_globaOptions={};_positions=[];_terrainStyle=null;_height=0;_smoothHeight=2e3;_language={};constructor(e,t){this._language=e._language,this._globaOptions.viewer=e._viewer,this._globaOptions.viewer.scene.logarithmicDepthBuffer=!1,this._globaOptions.viewer.scene.globe.depthTestAgainstTerrain=!0,this._drawManager=e._drawManager,this._terrainStyle=t.terrainStyle,this._height=t.excavationDepth,this._smoothHeight=t.modificationHeight}createTerrainExcavation(e){var t=this;this._globaOptions.viewer.terrainProvider.readyPromise.then((function(){setTimeout((()=>{t._terrainexcavationext=new window.Cesium.Kq3dTerrainExcavationExt({viewer:t._globaOptions.viewer}),e&&e()}),500)}))}createTerrainModification(e){var t=this;this._globaOptions.viewer.terrainProvider.readyPromise.then((function(){setTimeout((()=>{let i=[],n=[];t._globaOptions.positions.forEach(((e,t)=>{let a=window.Cesium.Cartographic.fromCartesian(e);n.push(a),i.push(a.height)})),t._terrainmodification?(t._terrainmodification.heights=i,t._terrainmodification.positions=n):t._terrainmodification=new window.Cesium.Kq3dTerrainModification({viewer:t._globaOptions.viewer,positions:n,height:Number(t._smoothHeight)||2e3,heights:i}),t._terrainmodification._clippingPlanesEnabled=!0,e&&e()}),500)}))}setTerrainExcavationAddPolygon(){this._terrainexcavationext.addPolygon({polygonArray:this._globaOptions.positions,height:Number(this._height)})}setTerrainModification(){let e=[],t=[];this._globaOptions.positions.forEach(((i,n)=>{let a=window.Cesium.Cartographic.fromCartesian(i);t.push(a),e.push(a.height)})),this._terrainmodification.heights=e,this._terrainmodification.positions=t}start(){var e=this;this._globaOptions.viewer.terrainProvider.availability?this._globaOptions.viewer.terrainProvider&&!this._globaOptions.viewer.terrainProvider._heightmapStructure?(this.clear(),this._drawManager.startDraw("polygon",{clampToGround:!0},((t,{shape:i})=>{i.groupName&&"TerrainOperationDraw"===i.groupName&&(i&&(e._globaOptions.positions=i._controlPoints,1===e._terrainStyle?(e._positions.push(i._controlPoints),e._terrainexcavationext?e.setTerrainExcavationAddPolygon():e.createTerrainExcavation((()=>{e.setTerrainExcavationAddPolygon()}))):2===e._terrainStyle&&(e._terrainmodification?e.setTerrainModification():e.createTerrainModification())),e._drawManager&&e._drawManager.clearDrawGroup("TerrainOperationDraw"))}),"TerrainOperationDraw")):(0,i.Z)({message:this._language.stkTerrainAnalysisTips,type:"warning"}):(0,i.Z)({message:this._language.terrainAnalysisTips,type:"warning"})}setTerrainStyle(e){this._terrainStyle=e,this.clear()}setHeight(e){let t=this;this._height=e,0===this._terrainStyle&&this._terrainexcavationext&&(this._terrainexcavationext&&this._terrainexcavationext.destroy(),this._terrainexcavationext=new window.Cesium.Kq3dTerrainExcavationExt({viewer:this._globaOptions.viewer}),this._positions.forEach((e=>{t._terrainexcavationext&&t._terrainexcavationext.addPolygon({polygonArray:e,height:Number(t._height)})})))}setModificationHeight(e){this._smoothHeight=Number(e),this._terrainmodification&&(this._terrainmodification._height=this._smoothHeight)}clear(){this._drawManager.stopDraw(),this._terrainexcavationext&&(this._terrainexcavationext.destroy(),this._terrainexcavationext=null,this._positions=[]),this._terrainmodification&&(this._terrainmodification&&this._terrainmodification.remove(),this._terrainmodification=null)}destroy(){this.clear()}}var a=r(348),o=r(3458),l=r(7080);const c={class:"kq3d-terrain-operation-analysis-box"},u={class:"kq3d-terrain-operation-analysis-span"},p={class:"kq3d-terrain-operation-analysis-span"},d={class:"kq3d-terrain-operation-analysis-footer"},m={name:"Kq3dTerrainOperation"};var h=Object.assign(m,{props:{settingParams:{type:Object},operationMode:{type:Number,default:0},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:a.IconTerrainOperation},isRight:{type:Boolean,default:!0}},setup(i,{expose:a}){const r=i,{proxy:s}=(0,e.getCurrentInstance)();let m=(0,e.ref)(""),h=(0,e.ref)(s.$i18n.global.messages[s.$i18n.global.locale].webgl),f=(0,e.reactive)({terrainStyle:r.settingParams&&r.settingParams.terrainStyle||1,excavationDepth:r.settingParams&&r.settingParams.excavationDepth||500,minExcavationDepth:r.settingParams&&r.settingParams.minExcavationDepth||100,maxExcavationDepth:r.settingParams&&r.settingParams.maxExcavationDepth||5e3,modificationHeight:r.settingParams&&r.settingParams.modificationHeight||2e3,minModificationHeight:r.settingParams&&r.settingParams.minModificationHeight||100,maxModificationHeight:r.settingParams&&r.settingParams.maxModificationHeight||8e3}),g=null,_=(0,e.ref)(null),v=(0,e.ref)(),x=(0,e.ref)(),{locale:y,messages:w}=(0,l.useI18n)(),b=(0,e.ref)(null);b.value=h.value.terrainOperation,(0,e.watch)((()=>y.value),((e,t)=>{h.value=w.value[e].webgl,b.value=h.value.terrainOperation})),(0,e.onMounted)((()=>{(0,o.updatePosition)(_.value,r),(0,e.watch)((()=>r.position),((e,t)=>{(0,o.updatePosition)(_.value,r)})),k(),(0,e.watch)((()=>r.showHeaderTemp),((t,i)=>{(0,e.nextTick)((()=>{k()}))})),m.value=s.$i18n.locale,t.utils.getWebMap(null,(e=>{e&&(0!==r.operationMode&&(f.terrainStyle=r.operationMode),g=new n(e,{terrainStyle:f.terrainStyle,excavationDepth:f.excavationDepth,modificationHeight:f.modificationHeight}))}))}));const k=()=>{r.showHeaderTemp&&(v.value=(0,o.createHeaderTemp)(_.value,(0,e.toRefs)(r),x,b))};function V(){g&&g.setTerrainStyle(f.terrainStyle)}function T(){g&&g.setHeight(f.excavationDepth)}function C(){g&&g.setModificationHeight(f.modificationHeight)}function q(){g&&g.start()}function S(){g&&g.clear()}return(0,e.onBeforeUnmount)((()=>{g&&g.destroy()})),a({changeStyle:V,changeHeight:T,changeModificationHeight:C,startOperation:q,clear:S}),(t,n)=>{const a=(0,e.resolveComponent)("kq-radio"),o=(0,e.resolveComponent)("kq-row"),r=(0,e.resolveComponent)("kq-col"),s=(0,e.resolveComponent)("kq-slider"),l=(0,e.resolveComponent)("kq-input-number"),g=(0,e.resolveComponent)("kq-button");return(0,e.openBlock)(),(0,e.createElementBlock)("section",{class:(0,e.normalizeClass)(["kq3d-terrain-operation-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",c,[0===i.operationMode?((0,e.openBlock)(),(0,e.createBlock)(o,{key:0},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(a,{modelValue:(0,e.unref)(f).terrainStyle,"onUpdate:modelValue":n[0]||(n[0]=t=>(0,e.unref)(f).terrainStyle=t),label:1,onChange:V},{default:(0,e.withCtx)((()=>[(0,e.createTextVNode)((0,e.toDisplayString)((0,e.unref)(h).terrainExcavation),1)])),_:1},8,["modelValue"]),(0,e.createVNode)(a,{modelValue:(0,e.unref)(f).terrainStyle,"onUpdate:modelValue":n[1]||(n[1]=t=>(0,e.unref)(f).terrainStyle=t),label:2,onChange:V},{default:(0,e.withCtx)((()=>[(0,e.createTextVNode)((0,e.toDisplayString)((0,e.unref)(h).TerrainModification),1)])),_:1},8,["modelValue"])])),_:1})):(0,e.createCommentVNode)("v-if",!0),1===(0,e.unref)(f).terrainStyle?((0,e.openBlock)(),(0,e.createBlock)(o,{key:1,gutter:10},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(r,{span:"zh"===(0,e.unref)(m)?7:10},{default:(0,e.withCtx)((()=>[(0,e.createElementVNode)("span",u,(0,e.toDisplayString)((0,e.unref)(h).excavationDepth),1)])),_:1},8,["span"]),(0,e.createVNode)(r,{span:"zh"===(0,e.unref)(m)?11:8},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(s,{modelValue:(0,e.unref)(f).excavationDepth,"onUpdate:modelValue":n[2]||(n[2]=t=>(0,e.unref)(f).excavationDepth=t),step:100,min:(0,e.unref)(f).minExcavationDepth,max:(0,e.unref)(f).maxExcavationDepth,onChange:n[3]||(n[3]=e=>T()),onClick:n[4]||(n[4]=e=>T())},null,8,["modelValue","min","max"])])),_:1},8,["span"]),(0,e.createVNode)(r,{span:6,style:{"text-align":"end"}},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(l,{modelValue:(0,e.unref)(f).excavationDepth,"onUpdate:modelValue":n[5]||(n[5]=t=>(0,e.unref)(f).excavationDepth=t),min:(0,e.unref)(f).minExcavationDepth,step:100,max:(0,e.unref)(f).maxExcavationDepth,"controls-position":"right",onInput:n[6]||(n[6]=e=>T())},null,8,["modelValue","min","max"])])),_:1})])),_:1})):(0,e.createCommentVNode)("v-if",!0),2===(0,e.unref)(f).terrainStyle?((0,e.openBlock)(),(0,e.createBlock)(o,{key:2,gutter:10},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(r,{span:"zh"===(0,e.unref)(m)?7:10},{default:(0,e.withCtx)((()=>[(0,e.createElementVNode)("span",p,(0,e.toDisplayString)((0,e.unref)(h).modificationHeight),1)])),_:1},8,["span"]),(0,e.createVNode)(r,{span:"zh"===(0,e.unref)(m)?11:8},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(s,{modelValue:(0,e.unref)(f).modificationHeight,"onUpdate:modelValue":n[7]||(n[7]=t=>(0,e.unref)(f).modificationHeight=t),step:100,min:(0,e.unref)(f).minModificationHeight,max:(0,e.unref)(f).maxModificationHeight,onChange:n[8]||(n[8]=e=>C()),onClick:n[9]||(n[9]=e=>C())},null,8,["modelValue","min","max"])])),_:1},8,["span"]),(0,e.createVNode)(r,{span:6,style:{"text-align":"end"}},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(l,{modelValue:(0,e.unref)(f).modificationHeight,"onUpdate:modelValue":n[10]||(n[10]=t=>(0,e.unref)(f).modificationHeight=t),min:(0,e.unref)(f).minModificationHeight,step:100,max:(0,e.unref)(f).maxModificationHeight,"controls-position":"right",onInput:n[11]||(n[11]=e=>C())},null,8,["modelValue","min","max"])])),_:1})])),_:1})):(0,e.createCommentVNode)("v-if",!0),(0,e.createVNode)(o,{class:"kq3d-terrain-operation-analysis-tip"},{default:(0,e.withCtx)((()=>[(0,e.createElementVNode)("p",null,(0,e.toDisplayString)((0,e.unref)(h).skylineTips),1),(0,e.createCommentVNode)(' <p v-if="formItem.terrainStyle === 2">{{ "(" + language.reverseDrawPolygon + ")" }}</p> ')])),_:1}),(0,e.createElementVNode)("div",d,[(0,e.createVNode)(g,{onClick:n[12]||(n[12]=(0,e.withModifiers)((e=>q()),["stop"])),title:(0,e.unref)(h).startOperation,type:"primary"},{default:(0,e.withCtx)((()=>[(0,e.createTextVNode)((0,e.toDisplayString)((0,e.unref)(h).startOperation),1)])),_:1},8,["title"]),(0,e.createVNode)(g,{onClick:n[13]||(n[13]=(0,e.withModifiers)((e=>S()),["stop"])),title:(0,e.unref)(h).clear},{default:(0,e.withCtx)((()=>[(0,e.createTextVNode)((0,e.toDisplayString)((0,e.unref)(h).clear),1)])),_:1},8,["title"])])])],2)}}}),f=r(7997),g=r.n(f);h.install=(e,t)=>{g()(e,t),e.component(h.name,h)}}(),s}()}));