UNPKG

@kq_npm/client3d_webgl_vue

Version:

KQGIS Client3D for Vue.js

1 lines 16.1 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,a,o){return function(){"use strict";var l={1705:function(e,t,a){var o=a(9389),l=a(7997),i=a.n(l);o.ElMessage.install=(e,t)=>{i()(e,t),e.component("KqMessage",o.ElMessage)},t.Z=o.ElMessage},8422:function(e){e.exports=require("@element-plus/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")},6869:function(e){e.exports=require("xe-utils")},7135:function(e){e.exports=t},3458:function(e){e.exports=o},7997:function(e){e.exports=a},1895:function(t){t.exports=e}},i={};function n(e){var t=i[e];if(void 0!==t)return t.exports;var a=i[e]={exports:{}};return l[e](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.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(){n.r(r),n.d(r,{GPUSpatialQueryViewModel:function(){return s},default:function(){return g}});var e=n(1895),t=n(8422),a=n(7135),o=n(6869),l=n.n(o),i=n(1705);class s{_gpuSpatialQuery=null;_drawManager=null;_geometry=null;_center=null;_options=null;finishedQuery=null;_language={};constructor(e,t){this._language=e._language,t.viewer=e._viewer,t.viewer.scene.globe.depthTestAgainstTerrain=!0,t.viewer.scene.logarithmicDepthBuffer=!0,t.viewer.scene.globe.enableLighting=!0,this._options=t,this._gpuSpatialQuery=new Cesium.Kq3dSpatialQuery({viewer:t.viewer}),this.finishedQuery=this._gpuSpatialQuery.finishSQ,this._drawManager=e._drawManager;var a=this;this._gpuSpatialQuery.finishSQ.addEventListener((function(){for(let e=0;e<a._gpuSpatialQuery._layers.length;e++){const t=a._gpuSpatialQuery._layers[e].layer,o=a._gpuSpatialQuery._layers[e].sqResult;for(let e=0;e<t._selectedTiles.length;e++){const a=t._selectedTiles[e].content;if(a)for(let e=0;e<a.featuresLength;e++){const t=a.getFeature(e);let l=!1;if(t.pickId){const e=t.pickId.key;for(let t=0;t<o.length;t++)o[t]==e&&(l=!0)}t.color=l?Cesium.Color.AQUA:Cesium.Color.WHITE}}t.makeStyleDirty()}}))}start(){var e=this,t=!1,a=this._options.viewer.scene.primitives._primitives;for(let e=0;e<a.length;e++)a[e]._url&&(t=!0);t?(this.clear(),this.findLayers(),this._drawManager.startDraw("marker",{image:null},((t,{shape:a})=>{a.groupName&&"GPUSpatialQueryDraw"===a.groupName&&(a&&(e._center=a.position,setTimeout((()=>{e.startQuery()}),10)),e._drawManager&&e._drawManager.clearDrawGroup("GPUSpatialQueryDraw"))}),"GPUSpatialQueryDraw",!0)):(0,i.Z)({message:this._language.addModelAnalysisTips,type:"warning"})}startQuery(){this.createGeometry(),this._gpuSpatialQuery.setGeom(this._geometry),this._gpuSpatialQuery.setSpaceTopology(this._options.positionMode),this._gpuSpatialQuery.setLayers(this._options.layers),this._gpuSpatialQuery.start()}clear(){this._gpuSpatialQuery&&this._gpuSpatialQuery.clear(),this._drawManager.stopDraw()}destroy(){this.clear(),this._gpuSpatialQuery=null}findLayers(){this._options.layers=[];const e=this._options.viewer.scene.primitives._primitives;for(let t=0;t<e.length;t++)e[t]instanceof Cesium.Cesium3DTileset&&this._options.layers.push(new Cesium.Kq3dLayerQuery(e[t]))}createGeometry(){switch(this._options.volumeType){case 0:var e={length:260,width:260,height:260,position:this._center};this._geometry=new Cesium.Kq3dGeoBox(e);break;case 1:var t={position:this._center,radius:160};this._geometry=new Cesium.Kq3dGeoSphere(t);break;case 2:var a={position:this._center,height:300,topRadius:130,bottomRadius:130};this._geometry=new Cesium.Kq3dGeoCylinder(a);break;case 3:var o={position:this._center,xRadius:200,yRadius:120,zRadius:160};this._geometry=new Cesium.Kq3dGeoEllipsoid(o);break;case 4:var l={position:this._center,height:300,bottomRadius:160};this._geometry=new Cesium.Kq3dGeoCone(l)}this._geometry&&(this._geometry.scaleX=this._options.scale,this._geometry.scaleY=this._options.scale,this._geometry.scaleZ=this._options.scale,this._geometry.rotationX=this._options.xAngle,this._geometry.rotationY=this._options.yAngle,this._geometry.rotationZ=this._options.zAngle)}setType(e){this._options.volumeType=e,this.createGeometry(),this._gpuSpatialQuery&&(this._gpuSpatialQuery.setGeom(this._geometry),this._gpuSpatialQuery.start())}setMode(e){this._options.positionMode=e,this._gpuSpatialQuery&&(this._gpuSpatialQuery.setSpaceTopology(e),this._gpuSpatialQuery.start())}setScale(e){this._options.scale=e,this._geometry&&(this._geometry.scaleX=e,this._geometry.scaleY=e,this._geometry.scaleZ=e,this._gpuSpatialQuery&&this._gpuSpatialQuery.start())}setXangle(e){this._options.xAngle=e,this._geometry&&(this._geometry.rotationX=e,this._gpuSpatialQuery&&this._gpuSpatialQuery.start())}setYangle(e){this._options.yAngle=e,this._geometry&&(this._geometry.rotationY=e,this._gpuSpatialQuery&&this._gpuSpatialQuery.start())}setZangle(e){this._options.zAngle=e,this._geometry&&(this._geometry.rotationZ=e,this._gpuSpatialQuery&&this._gpuSpatialQuery.start())}}var u=n(3458),p=n(7080);const m={class:"kq3d-gpu-spatial-query-box"},c={class:"kq3d-gpu-spatial-query-footer"},d={name:"Kq3dGPUSpatialQuery"};var g=Object.assign(d,{props:{volumeType:{type:Number,default:0,validator(e){return l().includeArrays([0,1,2,3,4],e)}},positionMode:{type:Number,default:0,validator(e){return l().includeArrays([0,1,2],e)}},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:t.Search},isRight:{type:Boolean,default:!0}},setup(t,{expose:o}){const l=t,{proxy:i}=(0,e.getCurrentInstance)();let n=(0,e.ref)(i.$i18n.global.messages[i.$i18n.global.locale].webgl),r=(0,e.reactive)({collapseValue:l.settingParams&&l.settingParams.collapseValue||(""==(l.settingParams&&l.settingParams.collapseValue)?"":"setting"),volumeType:l.volumeType||0,positionMode:l.positionMode||0,scale:l.settingParams&&l.settingParams.scale||1,minScale:l.settingParams&&l.settingParams.minScale||.1,maxScale:l.settingParams&&l.settingParams.maxScale||10,xRotate:l.settingParams&&l.settingParams.xRotate||0,minXRotate:l.settingParams&&l.settingParams.minXRotate||0,maxXRotate:l.settingParams&&l.settingParams.maxXRotate||120,yRotate:l.settingParams&&l.settingParams.yRotate||0,minYRotate:l.settingParams&&l.settingParams.minYRotate||0,maxYRotate:l.settingParams&&l.settingParams.maxYRotate||90,zRotate:l.settingParams&&l.settingParams.zRotate||0,minZRotate:l.settingParams&&l.settingParams.minZRotate||0,maxZRotate:l.settingParams&&l.settingParams.maxZRotate||90}),d=null,g=(0,e.ref)(null),_=(0,e.ref)(),h=(0,e.ref)(),{locale:f,messages:y}=(0,p.useI18n)(),x=(0,e.ref)(null);x.value=n.value.spatialQuery,(0,e.watch)((()=>f.value),((e,t)=>{n.value=y.value[e].webgl,x.value=n.value.spatialQuery})),(0,e.onMounted)((()=>{(0,u.updatePosition)(g.value,l),(0,e.watch)((()=>l.position),((e,t)=>{(0,u.updatePosition)(g.value,l)})),v(),(0,e.watch)((()=>l.showHeaderTemp),((t,a)=>{(0,e.nextTick)((()=>{v()}))})),a.utils.getWebMap(null,(e=>{e&&(d=new s(e,{volumeType:r.volumeType,positionMode:r.positionMode,scale:r.scale,xAngle:r.xRotate,yAngle:r.yRotate,zAngle:r.zRotate}))}))}));const v=()=>{l.showHeaderTemp&&(_.value=(0,u.createHeaderTemp)(g.value,(0,e.toRefs)(l),h,x))};function w(e){switch(e){case"type":d.setType(r.volumeType);break;case"mode":d.setMode(r.positionMode);break;case"scale":d.setScale(r.scale);break;case"xRotate":d.setXangle(r.xRotate);break;case"yRotate":d.setYangle(r.yRotate);break;case"zRotate":d.setZangle(r.zRotate)}}function V(){d&&d.start()}function b(){d&&d.clear()}return(0,e.onBeforeUnmount)((()=>{d&&d.destroy()})),o({paramsChanged:w,query:V,reset:b}),(a,o)=>{const l=(0,e.resolveComponent)("kq-option"),i=(0,e.resolveComponent)("kq-select"),s=(0,e.resolveComponent)("kq-form-item"),u=(0,e.resolveComponent)("kq-row"),p=(0,e.resolveComponent)("kq-form"),d=(0,e.resolveComponent)("kq-slider"),f=(0,e.resolveComponent)("kq-col"),y=(0,e.resolveComponent)("kq-input-number"),x=(0,e.resolveComponent)("kq-collapse-item"),v=(0,e.resolveComponent)("kq-collapse"),C=(0,e.resolveComponent)("kq-button");return(0,e.openBlock)(),(0,e.createElementBlock)("section",{class:(0,e.normalizeClass)(["kq3d-gpu-spatial-query",{"kq-box-shadow":t.showShadow}]),ref_key:"boxRef",ref:g},[t.showHeaderTemp?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)((0,e.unref)(_)),{key:0,ref_key:"headerTempRef",ref:h},null,512)):(0,e.createCommentVNode)("v-if",!0),(0,e.createElementVNode)("div",m,[(0,e.createVNode)(p,{"label-width":"100px","label-position":"left"},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(u,null,{default:(0,e.withCtx)((()=>[(0,e.createVNode)(s,{label:(0,e.unref)(n).queryShape},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(i,{modelValue:(0,e.unref)(r).volumeType,"onUpdate:modelValue":o[0]||(o[0]=t=>(0,e.unref)(r).volumeType=t),onChange:o[1]||(o[1]=e=>w("type"))},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(l,{label:(0,e.unref)(n).cube,value:0},null,8,["label"]),(0,e.createVNode)(l,{label:(0,e.unref)(n).sphere,value:1},null,8,["label"]),(0,e.createVNode)(l,{label:(0,e.unref)(n).cylinder,value:2},null,8,["label"]),(0,e.createVNode)(l,{label:(0,e.unref)(n).ellipsoid,value:3},null,8,["label"]),(0,e.createVNode)(l,{label:(0,e.unref)(n).cone,value:4},null,8,["label"])])),_:1},8,["modelValue"])])),_:1},8,["label"])])),_:1}),(0,e.createVNode)(u,null,{default:(0,e.withCtx)((()=>[(0,e.createVNode)(s,{label:(0,e.unref)(n).locaLMode},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(i,{modelValue:(0,e.unref)(r).positionMode,"onUpdate:modelValue":o[2]||(o[2]=t=>(0,e.unref)(r).positionMode=t),onChange:o[3]||(o[3]=e=>w("mode"))},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(l,{label:(0,e.unref)(n).intersect,value:0},null,8,["label"]),(0,e.createVNode)(l,{label:(0,e.unref)(n).disjoint,value:1},null,8,["label"]),(0,e.createVNode)(l,{label:(0,e.unref)(n).contain,value:2},null,8,["label"])])),_:1},8,["modelValue"])])),_:1},8,["label"])])),_:1})])),_:1}),(0,e.createVNode)(u,{class:"kq3d-gpu-spatial-query-tip"},{default:(0,e.withCtx)((()=>[(0,e.createElementVNode)("p",null,(0,e.toDisplayString)((0,e.unref)(n).queryTips),1)])),_:1}),(0,e.createVNode)(v,{"model-value":(0,e.unref)(r).collapseValue,class:"kq3d-gpu-spatial-query-set-title"},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(x,{title:(0,e.unref)(n).analysisSettings,name:"setting"},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(p,{"label-width":"100px","label-position":"left"},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(u,null,{default:(0,e.withCtx)((()=>[(0,e.createVNode)(s,{label:(0,e.unref)(n).zoom},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(u,{style:{display:"flex"}},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(f,{span:16},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(d,{modelValue:(0,e.unref)(r).scale,"onUpdate:modelValue":o[4]||(o[4]=t=>(0,e.unref)(r).scale=t),step:.1,min:(0,e.unref)(r).minScale,max:(0,e.unref)(r).maxScale,onChange:o[5]||(o[5]=e=>w("scale"))},null,8,["modelValue","step","min","max"])])),_:1}),(0,e.createVNode)(f,{span:8},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(y,{modelValue:(0,e.unref)(r).scale,"onUpdate:modelValue":o[6]||(o[6]=t=>(0,e.unref)(r).scale=t),min:(0,e.unref)(r).minScale,max:(0,e.unref)(r).maxScale,step:.1,"controls-position":"right",onChange:o[7]||(o[7]=e=>w("scale"))},null,8,["modelValue","min","max","step"])])),_:1})])),_:1})])),_:1},8,["label"])])),_:1}),(0,e.createVNode)(u,null,{default:(0,e.withCtx)((()=>[(0,e.createVNode)(s,{label:(0,e.unref)(n).xRotate},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(u,{style:{display:"flex"}},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(f,{span:16},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(d,{modelValue:(0,e.unref)(r).xRotate,"onUpdate:modelValue":o[8]||(o[8]=t=>(0,e.unref)(r).xRotate=t),step:1,min:(0,e.unref)(r).minXRotate,max:(0,e.unref)(r).maxXRotate,onChange:o[9]||(o[9]=e=>w("xRotate"))},null,8,["modelValue","min","max"])])),_:1}),(0,e.createVNode)(f,{span:8},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(y,{modelValue:(0,e.unref)(r).xRotate,"onUpdate:modelValue":o[10]||(o[10]=t=>(0,e.unref)(r).xRotate=t),min:(0,e.unref)(r).minXRotate,max:(0,e.unref)(r).maxXRotate,step:1,"controls-position":"right",onChange:o[11]||(o[11]=e=>w("xRotate"))},null,8,["modelValue","min","max"])])),_:1})])),_:1})])),_:1},8,["label"])])),_:1}),(0,e.createVNode)(u,null,{default:(0,e.withCtx)((()=>[(0,e.createVNode)(s,{label:(0,e.unref)(n).yRotate},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(u,{style:{display:"flex"}},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(f,{span:16},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(d,{modelValue:(0,e.unref)(r).yRotate,"onUpdate:modelValue":o[12]||(o[12]=t=>(0,e.unref)(r).yRotate=t),step:1,min:(0,e.unref)(r).minXRotate,max:(0,e.unref)(r).maxXRotate,onChange:o[13]||(o[13]=e=>w("yRotate"))},null,8,["modelValue","min","max"])])),_:1}),(0,e.createVNode)(f,{span:8},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(y,{modelValue:(0,e.unref)(r).yRotate,"onUpdate:modelValue":o[14]||(o[14]=t=>(0,e.unref)(r).yRotate=t),min:(0,e.unref)(r).minXRotate,max:(0,e.unref)(r).maxXRotate,step:1,"controls-position":"right",onChange:o[15]||(o[15]=e=>w("yRotate"))},null,8,["modelValue","min","max"])])),_:1})])),_:1})])),_:1},8,["label"])])),_:1}),(0,e.createVNode)(u,null,{default:(0,e.withCtx)((()=>[(0,e.createVNode)(s,{label:(0,e.unref)(n).zRotate},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(u,{style:{display:"flex"}},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(f,{span:16},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(d,{modelValue:(0,e.unref)(r).zRotate,"onUpdate:modelValue":o[16]||(o[16]=t=>(0,e.unref)(r).zRotate=t),step:1,min:(0,e.unref)(r).minZRotate,max:(0,e.unref)(r).maxZRotate,onChange:o[17]||(o[17]=e=>w("zRotate"))},null,8,["modelValue","min","max"])])),_:1}),(0,e.createVNode)(f,{span:8},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(y,{modelValue:(0,e.unref)(r).zRotate,"onUpdate:modelValue":o[18]||(o[18]=t=>(0,e.unref)(r).zRotate=t),min:(0,e.unref)(r).minZRotate,max:(0,e.unref)(r).maxZRotate,step:1,"controls-position":"right",onChange:o[19]||(o[19]=e=>w("zRotate"))},null,8,["modelValue","min","max"])])),_:1})])),_:1})])),_:1},8,["label"])])),_:1})])),_:1})])),_:1},8,["title"])])),_:1},8,["model-value"]),(0,e.createElementVNode)("div",c,[(0,e.createVNode)(C,{onClick:o[20]||(o[20]=(0,e.withModifiers)((e=>V()),["stop"])),title:(0,e.unref)(n).gpuQuery,type:"primary"},{default:(0,e.withCtx)((()=>[(0,e.createTextVNode)((0,e.toDisplayString)((0,e.unref)(n).gpuQuery),1)])),_:1},8,["title"]),(0,e.createVNode)(C,{onClick:o[21]||(o[21]=(0,e.withModifiers)((e=>b()),["stop"])),title:(0,e.unref)(n).clear},{default:(0,e.withCtx)((()=>[(0,e.createTextVNode)((0,e.toDisplayString)((0,e.unref)(n).clear),1)])),_:1},8,["title"])])])],2)}}}),_=n(7997),h=n.n(_);g.install=(e,t)=>{h()(e,t),e.component(g.name,g)}}(),r}()}));