1129 lines
30 KiB
Vue
1129 lines
30 KiB
Vue
<template>
|
|
<div class="leftSideSecond">
|
|
<svg
|
|
class="leftSideSecond_bg"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
width="244"
|
|
height="310.1533203125"
|
|
viewBox="0 0 244 310.1533203125"
|
|
fill="none"
|
|
preserveAspectRatio="none"
|
|
>
|
|
<foreignObject x="-5" y="-4.8466796875" width="254" height="320">
|
|
<div
|
|
xmlns="http://www.w3.org/1999/xhtml"
|
|
style="
|
|
backdrop-filter: blur(5px);
|
|
clip-path: url(#bgblur_244_310_10_clip_path);
|
|
height: 100%;
|
|
width: 100%;
|
|
"
|
|
></div>
|
|
</foreignObject>
|
|
<path
|
|
fill="#000000"
|
|
fill-opacity="0.5"
|
|
d="M232.01 310.153L244 297.278L244 0.15332L0 0.15332L0 310.153L232.01 310.153Z"
|
|
/>
|
|
<path
|
|
fill="url(#linear_fill_730_213_1)"
|
|
d="M232.01 310.153L244 297.278L244 0.15332L0 0.15332L0 310.153L232.01 310.153Z"
|
|
/>
|
|
<foreignObject x="-5" y="-5" width="32" height="32">
|
|
<div
|
|
xmlns="http://www.w3.org/1999/xhtml"
|
|
style="
|
|
backdrop-filter: blur(5px);
|
|
clip-path: url(#bgblur_22_22_10_clip_path);
|
|
height: 100%;
|
|
width: 100%;
|
|
"
|
|
></div>
|
|
</foreignObject>
|
|
<foreignObject x="202" y="271.1533203125" width="47" height="43.99951171875">
|
|
<div
|
|
xmlns="http://www.w3.org/1999/xhtml"
|
|
style="
|
|
backdrop-filter: blur(5px);
|
|
clip-path: url(#bgblur_37_33.99951171875_10_clip_path);
|
|
height: 100%;
|
|
width: 100%;
|
|
"
|
|
></div>
|
|
</foreignObject>
|
|
<path
|
|
fill-rule="evenodd"
|
|
fill="url(#linear_border_2035_2214_0)"
|
|
d="M232.01 310.153L0 310.153L0 0.15332L244 0.15332L244 297.278L232.01 310.153ZM242.5 296.688L242.5 1.65332L1.5 1.65332L1.5 308.653L231.357 308.653L242.5 296.688Z"
|
|
/>
|
|
<path d="M0 0L0 22L22 0L0 0Z" fill="rgb(var(--color-base1))" fill-opacity="0.2" />
|
|
<defs>
|
|
<clipPath id="bgblur_22_22_10_clip_path" transform="translate(5 5)">
|
|
<path d="M0 0L0 22L22 0L0 0Z" />
|
|
</clipPath>
|
|
</defs>
|
|
<path
|
|
d="M244 276.153L244 297.304L232 310.153L207 310.153L244 276.153Z"
|
|
fill="rgb(var(--color-base1))"
|
|
fill-opacity="0.2"
|
|
/>
|
|
<defs>
|
|
<clipPath
|
|
id="bgblur_37_33.99951171875_10_clip_path"
|
|
transform="translate(-202 -271.1533203125)"
|
|
>
|
|
<path d="M244 276.153L244 297.304L232 310.153L207 310.153L244 276.153Z" />
|
|
</clipPath>
|
|
</defs>
|
|
<path d="M12 3L3 3L3 12L12 3Z" stroke="rgba(var(--color-base2), 1)" stroke-width="1" />
|
|
<defs>
|
|
<linearGradient
|
|
id="linear_fill_730_213_1"
|
|
x1="127.20458984375"
|
|
y1="310.1533203125"
|
|
x2="127.203857421875"
|
|
y2="0.1533203125"
|
|
gradientUnits="userSpaceOnUse"
|
|
>
|
|
<stop offset="0" stop-color="rgb(var(--color-base1))" stop-opacity="0.3" />
|
|
<stop offset="1" stop-color="rgb(var(--color-base2))" stop-opacity="0" />
|
|
</linearGradient>
|
|
<linearGradient
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
id="linear_border_2035_2214_0"
|
|
x1="0"
|
|
y1="-10.0346360206604"
|
|
x2="211.1868896484375"
|
|
y2="231.8046417236328"
|
|
gradientUnits="userSpaceOnUse"
|
|
>
|
|
<stop offset="0.0625" stop-color="rgb(var(--color-base1))" />
|
|
<stop offset="1" stop-color="var(--color-border1)" />
|
|
</linearGradient>
|
|
</defs>
|
|
</svg>
|
|
<div class="leftSideSecondBox">
|
|
<template v-if="obj">
|
|
<div class="menuItem" v-for="value in obj.children" @click="handleClick(value)">
|
|
<!-- <img :src="'http://localhost:' + `${availablePort}` + '/icon/' + `${value}` + '.png'"
|
|
style="color: rgb(255, 0, 0)" alt="" /> -->
|
|
<svg-icon :name="value" :size="20" color="rgba(var(--color-base2), 1)"></svg-icon>
|
|
<span :style="{ color: !clickChange[value] ? 'var(--color-text)' : 'rgb(255,0,0)' }">{{
|
|
t(`${obj.key}.${value}`)
|
|
}}</span>
|
|
</div>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script setup lang="ts">
|
|
import { useI18n } from 'vue-i18n'
|
|
import { ref, reactive, getCurrentInstance } from 'vue'
|
|
import { initMapData } from '../../../common/initMapData'
|
|
import { useTreeNode } from '../tree/hooks/treeNode'
|
|
import { TreeApi } from '@/api/tree'
|
|
import { gdbApi } from '@/api/gdb'
|
|
import { renderMethods } from '../tree/hooks/renderTreeNode'
|
|
import { addMapSource } from '../../../common/addMapSource'
|
|
import { processBase64Images, combineBase64Images } from '@/utils/HighDefinitionScreenshot'
|
|
import {
|
|
$sendElectronChanel,
|
|
$recvElectronChanel,
|
|
$changeComponentShow
|
|
} from '@/utils/communication'
|
|
import { ElMessage, ElLoading } from 'element-plus'
|
|
import dayjs from 'dayjs'
|
|
import { renderVector } from '../tree/components/hooks/renderVector'
|
|
const { ipcRenderer } = require('electron')
|
|
const { t } = useI18n()
|
|
const { findParentId, findTreeIndex, cusAddNodes } = useTreeNode()
|
|
const fs = require('fs')
|
|
const availablePort = ref(55110)
|
|
ipcRenderer.invoke('get-available-port').then((port) => {
|
|
availablePort.value = port
|
|
})
|
|
const obj: any = ref(null)
|
|
const isclick = ref(false)
|
|
const eventBus: any = inject('bus')
|
|
const initList = (value) => {
|
|
obj.value = value
|
|
}
|
|
var clickChange = reactive({
|
|
mouseLocation: false,
|
|
splitScreen: false,
|
|
annotationAggregation: false,
|
|
videoRecord: false,
|
|
nightVision: false
|
|
})
|
|
var graffitiObjArr = reactive([])
|
|
eventBus.on('graffitiObj', (data: never) => {
|
|
graffitiObjArr.push(data)
|
|
})
|
|
|
|
function openLoading(
|
|
text = '拼命加载中...',
|
|
option: any = {
|
|
fullscreen: true,
|
|
background: 'rgba(0,0,0,0.63)',
|
|
lock: true
|
|
// spinner: 'el-icon-loading'
|
|
}
|
|
) {
|
|
option.text = text
|
|
let loadingInstance = ElLoading.service(option)
|
|
return loadingInstance
|
|
}
|
|
// 监听键盘esc键,移出鼠标定位
|
|
|
|
const handleKeyDown = (e) => {
|
|
if (e.key === 'Escape') {
|
|
if (clickChange.mouseLocation) {
|
|
//鼠标定位
|
|
clickChange.mouseLocation = false
|
|
new YJ.Global.MouseCoordinate(window.earth, clickChange.mouseLocation)
|
|
// window.removeEventListener('keydown', handleKeyDown)
|
|
let dom = document.getElementById('earthContainer')
|
|
dom?.classList.remove('custom-cursor')
|
|
dom?.classList.add('default-cursor')
|
|
}
|
|
|
|
//视频录制
|
|
if (clickChange.videoRecord) {
|
|
methodMap['videoRecord']()
|
|
}
|
|
}
|
|
}
|
|
window.addEventListener('keydown', handleKeyDown)
|
|
|
|
eventBus.on('closeSplitScreen', (data: never) => {
|
|
clickChange.splitScreen = !clickChange.splitScreen
|
|
YJ.Global.splitScreen.off()
|
|
})
|
|
|
|
const methodMap = {
|
|
// 轨迹运动
|
|
path: async () => {
|
|
eventBus.emit(
|
|
'openModel',
|
|
true,
|
|
(url) => {
|
|
let draw = new YJ.Draw.DrawPolyline(window.earth)
|
|
draw.start(async (err, positions) => {
|
|
if (positions && positions.length > 1) {
|
|
let id = new YJ.Tools().randomString()
|
|
let name = t(`effect.path`)
|
|
await addMapSource({
|
|
type: 'path',
|
|
id: id,
|
|
sourceName: name,
|
|
opt: {
|
|
id: id,
|
|
name: name,
|
|
model: {
|
|
show: true,
|
|
url: url
|
|
},
|
|
line: {
|
|
show: true,
|
|
positions: positions
|
|
}
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
'trajectoryMotion'
|
|
)
|
|
},
|
|
// 电子围墙
|
|
wallStereoscopic: () => {
|
|
let draw = new YJ.Draw.DrawPolyline(window.earth)
|
|
draw.start((err, positions) => {
|
|
if (positions.length > 1) {
|
|
let id = new YJ.Tools().randomString()
|
|
let name = t(`effect.wallStereoscopic`)
|
|
addMapSource({
|
|
type: 'wallStereoscopic',
|
|
id: id,
|
|
sourceName: name,
|
|
opt: {
|
|
id: id,
|
|
name: name,
|
|
positions: positions
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// 实体墙
|
|
entityWall: () => {
|
|
let draw = new YJ.Draw.DrawPolyline(window.earth)
|
|
draw.start((err, positions) => {
|
|
if (positions.length > 1) {
|
|
let id = new YJ.Tools().randomString()
|
|
let name = t(`effect.entityWall`)
|
|
addMapSource({
|
|
type: 'entityWall',
|
|
id: id,
|
|
sourceName: name,
|
|
opt: {
|
|
id: id,
|
|
name: name,
|
|
positions: positions
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// 扩散光波
|
|
diffuseScan: () => {
|
|
let draw = new YJ.Draw.DrawCircle(window.earth)
|
|
draw.start((err, options) => {
|
|
if (options) {
|
|
let id = new YJ.Tools().randomString()
|
|
let name = t(`effect.diffuseScan`)
|
|
addMapSource({
|
|
type: 'diffuseScan',
|
|
id: id,
|
|
sourceName: name,
|
|
opt: {
|
|
id: id,
|
|
name: name,
|
|
lng: options.center.lng,
|
|
lat: options.center.lat,
|
|
circle: [
|
|
{
|
|
radius: options.radius,
|
|
color: '#ff0000'
|
|
}
|
|
]
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// 雷达光波
|
|
radarScan: () => {
|
|
let draw = new YJ.Draw.DrawCircle(window.earth)
|
|
draw.start((err, options) => {
|
|
if (options) {
|
|
let id = new YJ.Tools().randomString()
|
|
let name = t(`effect.radarScan`)
|
|
addMapSource({
|
|
type: 'radarScan',
|
|
id: id,
|
|
sourceName: name,
|
|
opt: {
|
|
id: id,
|
|
name: name,
|
|
lng: options.center.lng,
|
|
lat: options.center.lat,
|
|
radius: options.radius
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// 立体雷达扫描
|
|
scanStereoscopic: () => {
|
|
let draw = new YJ.Draw.DrawCircle(window.earth)
|
|
draw.start((err, options) => {
|
|
if (options) {
|
|
let id = new YJ.Tools().randomString()
|
|
let name = t(`effect.scanStereoscopic`)
|
|
addMapSource({
|
|
type: 'scanStereoscopic',
|
|
id: id,
|
|
sourceName: name,
|
|
opt: {
|
|
id: id,
|
|
name: name,
|
|
lng: options.center.lng,
|
|
lat: options.center.lat,
|
|
alt: options.center.alt,
|
|
radius: options.radius
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// 多面体
|
|
polyhedronObject: () => {
|
|
let draw = new YJ.Draw.DrawPolygon(window.earth)
|
|
draw.start((err, positions) => {
|
|
if (!positions || positions.length < 3) {
|
|
ElMessage({
|
|
message: '至少需要绘制三个坐标!',
|
|
type: 'warning'
|
|
})
|
|
return
|
|
}
|
|
let id = new YJ.Tools().randomString()
|
|
let name = t(`effect.polyhedronObject`)
|
|
addMapSource({
|
|
type: 'polyhedronObject',
|
|
id: id,
|
|
sourceName: name,
|
|
opt: {
|
|
id: id,
|
|
name: name,
|
|
positions: positions
|
|
}
|
|
})
|
|
})
|
|
},
|
|
// 水面
|
|
water: () => {
|
|
let draw = new YJ.Draw.DrawPolygon(window.earth)
|
|
draw.start((err, positions) => {
|
|
if (!positions || positions.length < 3) {
|
|
ElMessage({
|
|
message: '至少需要绘制三个坐标!',
|
|
type: 'warning'
|
|
})
|
|
return
|
|
}
|
|
let id = new YJ.Tools().randomString()
|
|
let name = t(`effect.water`)
|
|
addMapSource({
|
|
type: 'water',
|
|
id: id,
|
|
sourceName: name,
|
|
opt: {
|
|
id: id,
|
|
name: name,
|
|
positions: positions
|
|
}
|
|
})
|
|
})
|
|
},
|
|
// 喷泉
|
|
fountain: () => {
|
|
let draw = new YJ.Draw.DrawPoint(window.earth)
|
|
draw.start(async (a, position) => {
|
|
if (!position) {
|
|
return
|
|
}
|
|
let id = new YJ.Tools().randomString()
|
|
let name = t(`effect.fountain`)
|
|
await addMapSource({
|
|
type: 'fountain',
|
|
id: id,
|
|
sourceName: name,
|
|
opt: {
|
|
id: id,
|
|
name: name,
|
|
lng: position.lng,
|
|
lat: position.lat,
|
|
alt: position.alt
|
|
}
|
|
})
|
|
})
|
|
},
|
|
// 火焰
|
|
fire: () => {
|
|
let draw = new YJ.Draw.DrawPoint(window.earth)
|
|
draw.start(async (a, position) => {
|
|
if (!position) {
|
|
return
|
|
}
|
|
let id = new YJ.Tools().randomString()
|
|
let name = t(`effect.fire`)
|
|
await addMapSource({
|
|
type: 'fire',
|
|
id: id,
|
|
sourceName: name,
|
|
opt: {
|
|
id: id,
|
|
name: name,
|
|
lng: position.lng,
|
|
lat: position.lat,
|
|
alt: position.alt
|
|
}
|
|
})
|
|
})
|
|
},
|
|
// 烟雾
|
|
smoke: () => {
|
|
let draw = new YJ.Draw.DrawPoint(window.earth)
|
|
draw.start(async (a, position) => {
|
|
if (!position) {
|
|
return
|
|
}
|
|
let id = new YJ.Tools().randomString()
|
|
let name = t(`effect.smoke`)
|
|
await addMapSource({
|
|
type: 'smoke',
|
|
id: id,
|
|
sourceName: name,
|
|
opt: {
|
|
id: id,
|
|
name: name,
|
|
lng: position.lng,
|
|
lat: position.lat,
|
|
alt: position.alt
|
|
}
|
|
})
|
|
})
|
|
},
|
|
// 喷射水柱
|
|
waterL: () => {
|
|
let draw = new YJ.Draw.DrawPolyline(window.earth, { number: 2 })
|
|
draw.start(async (a, positions) => {
|
|
if (!positions || positions.length < 2) {
|
|
ElMessage({
|
|
message: '至少需要绘制两个坐标!',
|
|
type: 'warning'
|
|
})
|
|
return
|
|
}
|
|
let id = new YJ.Tools().randomString()
|
|
let name = t(`effect.waterL`)
|
|
await addMapSource({
|
|
type: 'waterL',
|
|
id: id,
|
|
sourceName: name,
|
|
opt: {
|
|
id: id,
|
|
name: name,
|
|
start: {
|
|
...positions[0]
|
|
},
|
|
end: {
|
|
...positions[1]
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
// 飞线
|
|
flyLine: () => {
|
|
let draw = new YJ.Draw.DrawPolygon(window.earth)
|
|
draw.start((err, positions) => {
|
|
if (!positions || positions.length < 3) {
|
|
ElMessage({
|
|
message: '至少需要绘制三个坐标!',
|
|
type: 'warning'
|
|
})
|
|
return
|
|
}
|
|
let id = new YJ.Tools().randomString()
|
|
let name = t(`effect.flyLine`)
|
|
addMapSource({
|
|
type: 'flyLine',
|
|
id: id,
|
|
sourceName: name,
|
|
opt: {
|
|
id: id,
|
|
name: name,
|
|
positions: positions
|
|
}
|
|
})
|
|
})
|
|
},
|
|
// 爆炸
|
|
explosion: () => {
|
|
let draw = new YJ.Draw.DrawPoint(window.earth)
|
|
draw.start(async (a, position) => {
|
|
if (!position) {
|
|
return
|
|
}
|
|
let id = new YJ.Tools().randomString()
|
|
let name = t(`effect.explosion`)
|
|
await addMapSource({
|
|
type: 'explosion',
|
|
id: id,
|
|
sourceName: name,
|
|
opt: {
|
|
id: id,
|
|
name: name,
|
|
position: position
|
|
}
|
|
})
|
|
})
|
|
},
|
|
// 夜视
|
|
nightVision: () => {
|
|
clickChange.nightVision = !clickChange.nightVision
|
|
YJ.Global.efflect.nightVision(window.earth, clickChange.nightVision)
|
|
},
|
|
//投影面积
|
|
projectionArea: () => {
|
|
new YJ.Measure.MeasureTyArea(window.earth).start()
|
|
},
|
|
//投影距离测量
|
|
projectionDistanceMeasure: () => {
|
|
new YJ.Measure.MeasureProjectionDistance(window.earth).start()
|
|
},
|
|
areaMeasure: () => {
|
|
new YJ.Measure.MeasureTdArea(window.earth).start()
|
|
},
|
|
//距离测量
|
|
distanceMeasure: () => {
|
|
new YJ.Measure.MeasureDistance(window.earth).start()
|
|
},
|
|
//高度测量
|
|
heightMeasure: () => {
|
|
new YJ.Measure.MeasureHeight(window.earth).start()
|
|
},
|
|
//三角测量
|
|
triangleMeasure: () => {
|
|
new YJ.Measure.MeasureTriangle(window.earth).start()
|
|
},
|
|
// 方位角
|
|
MeasureAzimuth() {
|
|
new YJ.Measure.MeasureAzimuth(window.earth).start()
|
|
},
|
|
//夹角测量
|
|
MeasureAngle() {
|
|
new YJ.Measure.MeasureAngle(window.earth).start()
|
|
},
|
|
// 坡度测量
|
|
lopeDistanceMeasures() {
|
|
new YJ.Measure.MeasureSlopeDistance(window.earth).start()
|
|
},
|
|
//坐标测量
|
|
coorMeasure() {
|
|
new YJ.Measure.MeasureLocation(window.earth).start()
|
|
},
|
|
//清除测量
|
|
clear() {
|
|
YJ.Measure.Clear()
|
|
},
|
|
//淹没分析
|
|
inundationAnalysis() {
|
|
// eventBus.emit('submergeDialog')
|
|
eventBus.emit('openDialog', 'submergeDialog')
|
|
},
|
|
//剖面分析
|
|
profileAnalysis() {
|
|
// eventBus.emit('profileDialog')
|
|
eventBus.emit('openDialog', 'profileDialog')
|
|
},
|
|
// 视线分析
|
|
sightAnalysis() {
|
|
// eventBus.emit('analysisDialog')
|
|
eventBus.emit('openDialog', 'analysisDialog')
|
|
},
|
|
//视域分析
|
|
kenAnalysis() {
|
|
// eventBus.emit('viewShedDialog')
|
|
eventBus.emit('openDialog', 'viewShedDialog')
|
|
},
|
|
//圆形视域分析
|
|
circleKen() {
|
|
// eventBus.emit('circleViewShedDialog')
|
|
eventBus.emit('openDialog', 'circleViewShedDialog')
|
|
},
|
|
//坡向分析
|
|
slopeDirection() {
|
|
new YJ.Analysis.SlopeAspect(window.earth)
|
|
},
|
|
// 填挖方分析
|
|
cutFill() {
|
|
// eventBus.emit('cutFillDialog')
|
|
eventBus.emit('openDialog', 'cutFillDialog')
|
|
},
|
|
//全局等高线分析
|
|
globalContour() {
|
|
// eventBus.emit('contourDialog')
|
|
eventBus.emit('openDialog', 'contourDialog')
|
|
},
|
|
//等高线分析
|
|
contour() {
|
|
let Draw = new YJ.Draw.DrawRect(window.earth)
|
|
Draw.start((a, positions) => {
|
|
// 等高线
|
|
new YJ.Analysis.Contour(window.earth, { positions: positions })
|
|
// YJ.Analysis.Clear();
|
|
})
|
|
},
|
|
//分析清除
|
|
clearAnalysis() {
|
|
YJ.Analysis.Clear()
|
|
},
|
|
//----------------工具------------------
|
|
//路径规划
|
|
routePlan() {
|
|
// eventBus.emit('routePlanningDialog')
|
|
eventBus.emit('openDialog', 'routePlanningDialog')
|
|
},
|
|
//路径清除
|
|
clearRoute() {
|
|
new YJ.ClearAllRoutePlanning()
|
|
},
|
|
//涂鸦
|
|
graffiti() {
|
|
// eventBus.emit('graffitiDialog')
|
|
eventBus.emit('openDialog', 'graffitiDialog')
|
|
},
|
|
//涂鸦清除
|
|
clearGraffiti() {
|
|
graffitiObjArr.forEach((item: any) => {
|
|
item.remove()
|
|
})
|
|
},
|
|
//漫游
|
|
roam() {
|
|
// eventBus.emit('flyRoamDialog')
|
|
eventBus.emit('openDialog', 'flyRoamDialog')
|
|
},
|
|
//坐标定位
|
|
coorLocation() {
|
|
// eventBus.emit('coorLocationDialog')
|
|
eventBus.emit('openDialog', 'coorLocationDialog')
|
|
},
|
|
//鼠标定位
|
|
mouseLocation() {
|
|
clickChange.mouseLocation = !clickChange.mouseLocation
|
|
|
|
new YJ.Global.MouseCoordinate(window.earth, clickChange.mouseLocation)
|
|
let dom = document.getElementById('earthContainer')
|
|
if (clickChange.mouseLocation) {
|
|
ElMessage({
|
|
message: '按下键盘ESC键可快速退出',
|
|
type: 'warning'
|
|
})
|
|
dom?.classList.remove('default-cursor')
|
|
dom?.classList.add('custom-cursor')
|
|
} else {
|
|
dom?.classList.remove('custom-cursor')
|
|
dom?.classList.add('default-cursor')
|
|
}
|
|
|
|
// if (clickChange.mouseLocation) {
|
|
// window.addEventListener('keydown', handleKeyDown)
|
|
// } else {
|
|
// window.removeEventListener('keydown', handleKeyDown)
|
|
// }
|
|
},
|
|
//聚合标注
|
|
annotationAggregation() {
|
|
clickChange.annotationAggregation = !clickChange.annotationAggregation
|
|
|
|
YJ.Global.switchCluster(window.earth, clickChange.annotationAggregation)
|
|
},
|
|
//卷帘对比
|
|
splitScreen() {
|
|
clickChange.splitScreen = !clickChange.splitScreen
|
|
if (clickChange.splitScreen) {
|
|
YJ.Global.splitScreen.on(window.earth)
|
|
} else {
|
|
YJ.Global.splitScreen.off()
|
|
}
|
|
},
|
|
//屏幕截图
|
|
async screenShot() {
|
|
function downloadScreen(res) {
|
|
let base64 = res.replace(/^data:image\/\w+;base64,/, '')
|
|
let dataBuffer = new Buffer(base64, 'base64')
|
|
$sendElectronChanel('saveFile', {
|
|
title: '保存图片',
|
|
filename: dayjs().format('YYYYMMDDHHmmss') + '截图',
|
|
filters: [{ name: '保存图片', extensions: ['jpg'] }]
|
|
})
|
|
$recvElectronChanel('selectedFileItem', (e, path) => {
|
|
fs.writeFile(path, dataBuffer, (res) => {})
|
|
})
|
|
}
|
|
|
|
if ((window as any).splitScreen || (window as any).multiViewportMode) {
|
|
let res = ''
|
|
let res2 = ''
|
|
let sdk
|
|
if ((window as any).splitScreen) {
|
|
sdk = YJ.Global.splitScreen.getSdk()
|
|
} else {
|
|
sdk = YJ.Global.multiViewportMode.getSdk()
|
|
}
|
|
await new YJ.Global.ScreenShot(sdk.sdkD, (data) => {
|
|
res = data
|
|
})
|
|
await new YJ.Global.ScreenShot(sdk.sdkP, (data) => {
|
|
res2 = data
|
|
})
|
|
if ((window as any).multiViewportMode) {
|
|
processBase64Images(res, res2, (mergedBase64) => {
|
|
downloadScreen(mergedBase64)
|
|
// window.multiViewportMode = false;
|
|
})
|
|
} else {
|
|
let doms: any = document.querySelectorAll('.cesium-widget')
|
|
let leftWidth = doms[0].offsetWidth
|
|
let rightWidth = doms[1].offsetWidth
|
|
combineBase64Images(res2, leftWidth, res, rightWidth)
|
|
.then((result) => {
|
|
downloadScreen(result)
|
|
// window.splitScreen = false;
|
|
})
|
|
.catch((err) => console.error('拼接失败:', err))
|
|
}
|
|
} else {
|
|
let res = ''
|
|
await new YJ.Global.ScreenShot(window.earth, (data) => {
|
|
res = data
|
|
})
|
|
downloadScreen(res)
|
|
}
|
|
},
|
|
//高清出图
|
|
highQuality() {
|
|
// eventBus.emit('screenShotDialog')
|
|
// YJ.Global.ScreenShotHD(window.earth)
|
|
eventBus.emit('openDialog', 'screenShotDialog')
|
|
},
|
|
//视频录制
|
|
videoRecord() {
|
|
clickChange.videoRecord = !clickChange.videoRecord
|
|
|
|
let time: any = 3
|
|
$changeComponentShow('#secondMenu', false)
|
|
if (clickChange.videoRecord) {
|
|
// document.addEventListener("keydown", onKeyDown);
|
|
let loading: any = openLoading(time, {
|
|
background: 'rgba(0,0,0,0)',
|
|
fullscreen: false,
|
|
customClass: 'timer'
|
|
})
|
|
let timer: any = ''
|
|
const p = document.createElement('p')
|
|
p.style.color = '#fff'
|
|
p.innerHTML = '再次点击录制结束'
|
|
document.getElementsByClassName('el-loading-spinner')[0].appendChild(p)
|
|
let func = () => {
|
|
loading.setText(time--)
|
|
if (time == -1) {
|
|
clearInterval(timer)
|
|
loading.close()
|
|
p.remove()
|
|
$sendElectronChanel('startRecoder')
|
|
}
|
|
}
|
|
func()
|
|
timer = setInterval(func, 1000)
|
|
} else {
|
|
$sendElectronChanel('endRecoder')
|
|
// document.removeEventListener("keydown", onKeyDown);
|
|
}
|
|
},
|
|
//模型压平
|
|
pressModel() {
|
|
if ((window as any).checkAuthIsValid) {
|
|
let selectedNode = window.treeObj.getSelectedNodes()[0]
|
|
if (selectedNode) {
|
|
let isTileset = ['bim', 'tileset'].includes(selectedNode.sourceType)
|
|
if (!isTileset) {
|
|
ElMessage({
|
|
message: '请在图层指挥舱选中对应模型进行操作',
|
|
type: 'warning'
|
|
})
|
|
return
|
|
}
|
|
// let source_id = this.$md5(new Date().getTime() + '压平面')
|
|
|
|
let draw = new YJ.Draw.DrawPolygon(window.earth)
|
|
draw.start((err, params) => {
|
|
if (params.length > 2) {
|
|
if (err) throw err
|
|
let alt = params[0].alt
|
|
params.forEach((item) => {
|
|
if (item.alt < alt) alt = item.alt
|
|
})
|
|
|
|
//获取节点树对象
|
|
|
|
let entity = window.earth.entityMap.get(selectedNode.id).entity
|
|
|
|
let flat = new YJ.Analysis.Flat(window.earth, entity, {
|
|
positions: params
|
|
})
|
|
let detailOption = {
|
|
// modleId: selectedNode.id,
|
|
modelId: selectedNode.id,
|
|
positions: params,
|
|
height: flat.height
|
|
}
|
|
let id = new YJ.Tools().randomString()
|
|
let paramsData: any = {
|
|
params: detailOption,
|
|
id,
|
|
sourceName: '压平面',
|
|
sourceType: 'pressModel',
|
|
// parentId:
|
|
// selectedNode.sourceType == 'directory' ? selectedNode.id : selectedNode.parentId
|
|
parentId: selectedNode.id
|
|
}
|
|
|
|
TreeApi.addOtherSource(paramsData)
|
|
paramsData.isShow = true
|
|
paramsData.params = JSON.stringify(paramsData.params)
|
|
;(window as any).pressModelMap.set(id + '_' + selectedNode.id, paramsData)
|
|
;(window as any).pressModelEntities.set(id, flat)
|
|
cusAddNodes(window.treeObj, paramsData.parentId, [paramsData])
|
|
// //鼠标右键点击事件
|
|
flat.onRightClick = () => {}
|
|
// _entityMap.set(node.source_id, flat)
|
|
} else {
|
|
// this.$message.warning('至少三个点')
|
|
}
|
|
})
|
|
} else {
|
|
ElMessage({
|
|
message: '请在图层指挥舱选中对应模型进行操作',
|
|
type: 'warning'
|
|
})
|
|
}
|
|
} else {
|
|
ElMessage({
|
|
message: '您没有该功能的权限',
|
|
type: 'warning'
|
|
})
|
|
}
|
|
},
|
|
//地形开挖
|
|
terrainDig() {
|
|
if ((window as any).checkAuthIsValid) {
|
|
// new YJ.Analysis.TerrainExcavation(window.Earth1);
|
|
// eventBus.emit('terrainExcavationDialog')
|
|
eventBus.emit('openDialog', 'terrainExcavationDialog')
|
|
} else {
|
|
ElMessage({
|
|
message: '您没有该功能的权限',
|
|
type: 'warning'
|
|
})
|
|
}
|
|
},
|
|
//剖切
|
|
tilesetClipping() {
|
|
if ((window as any).checkAuthIsValid) {
|
|
let selectedNode = window.treeObj.getSelectedNodes()
|
|
if (selectedNode.length < 1) {
|
|
ElMessage({
|
|
message: '请在图层指挥舱选中对应模型进行操作',
|
|
type: 'warning'
|
|
})
|
|
return
|
|
}
|
|
if (!(selectedNode[0].sourceType === 'tileset' || selectedNode[0].sourceType === 'bim')) {
|
|
ElMessage({
|
|
message: '选中的节点不能进行剖切',
|
|
type: 'warning'
|
|
})
|
|
return
|
|
}
|
|
let tileset = window.earth.entityMap.get(selectedNode[0].id)
|
|
let draw = new YJ.Draw.DrawPolygon(window.earth)
|
|
draw.start((err, pos) => {
|
|
let section = new YJ.Analysis.Section(window.earth, tileset.entity, {
|
|
positions: pos
|
|
})
|
|
// _entityMap.set(selectedNode.source_id + 'pouqie', section)
|
|
})
|
|
} else {
|
|
ElMessage({
|
|
message: '您没有该功能的权限',
|
|
type: 'warning'
|
|
})
|
|
}
|
|
},
|
|
//删除剖切
|
|
clearTilesetClipping() {
|
|
YJ.Analysis.ClearSection()
|
|
},
|
|
//度分秒
|
|
projConvert() {
|
|
// eventBus.emit('projConvertDialog')
|
|
eventBus.emit('openDialog', 'projConvertDialog')
|
|
},
|
|
//投影转换
|
|
projectionConvert() {
|
|
// eventBus.emit('ProjectionConvertDialog')
|
|
eventBus.emit('openDialog', 'ProjectionConvertDialog')
|
|
},
|
|
//GDB导入
|
|
gdbImport() {
|
|
let option = {
|
|
properties: ['openDirectory'],
|
|
filters: []
|
|
}
|
|
$sendElectronChanel('open-directory-dialog', option)
|
|
$recvElectronChanel('selectedItem', (e, path) => {
|
|
if (path.length) {
|
|
// let formData = new FormData()
|
|
// formData.append('path', path[0])
|
|
// gdbApi.importGdb(formData).then((res) => {
|
|
// console.log(res, 'resresres')
|
|
// if (res.status === 200) {
|
|
// ElMessage({
|
|
// message: '导入成功',
|
|
// type: 'success'
|
|
// })
|
|
|
|
// let path = path[0]
|
|
let arr = path[0].split('/')
|
|
let name = arr[arr.length - 1]
|
|
|
|
let id = new YJ.Tools().randomString()
|
|
let selectedNode = window.treeObj.getSelectedNodes()[0]
|
|
let DbOption: any = {
|
|
params: {
|
|
id: id,
|
|
path: path[0],
|
|
field: 'id',
|
|
name: name,
|
|
headTables: [],
|
|
opacity: 1,
|
|
color: 'rgba(0,255,184,0.5)',
|
|
show: true
|
|
},
|
|
id,
|
|
sourceName: name,
|
|
sourceType: 'vector',
|
|
// isShow: true,
|
|
// sourcePath: path[0],
|
|
parentId: selectedNode
|
|
? selectedNode.sourceType == 'directory'
|
|
? selectedNode.id
|
|
: selectedNode.parentId
|
|
: undefined
|
|
}
|
|
TreeApi.addOtherSource(DbOption)
|
|
DbOption.isShow = true
|
|
DbOption.params = JSON.stringify(DbOption.params)
|
|
cusAddNodes(window.treeObj, DbOption.parentId, [DbOption])
|
|
let entityObject = renderVector(DbOption, true)
|
|
;(window as any)._entityMap.set(id, entityObject)
|
|
// }
|
|
// })
|
|
}
|
|
})
|
|
},
|
|
//圆形统计
|
|
circleStatistics() {
|
|
if ((window as any).checkAuthIsValid) {
|
|
// eventBus.emit('goodsSearchCircleDialog')
|
|
eventBus.emit('openDialog', 'goodsSearchCircleDialog')
|
|
} else {
|
|
ElMessage({
|
|
message: '您没有该功能的权限',
|
|
type: 'warning'
|
|
})
|
|
}
|
|
},
|
|
//多边形统计
|
|
polygonStatistics() {
|
|
if ((window as any).checkAuthIsValid) {
|
|
// eventBus.emit('goodsSearchPolgonDialog')
|
|
eventBus.emit('openDialog', 'goodsSearchPolgonDialog')
|
|
} else {
|
|
ElMessage({
|
|
message: '您没有该功能的权限',
|
|
type: 'warning'
|
|
})
|
|
}
|
|
}
|
|
}
|
|
|
|
const handleClick = (value = 'projectionDistanceMeasure') => {
|
|
methodMap[value]()
|
|
}
|
|
defineExpose({
|
|
initList
|
|
})
|
|
</script>
|
|
<style>
|
|
@keyframes rotate-bg {
|
|
0% {
|
|
transform: rotate(0deg);
|
|
}
|
|
100% {
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
.custom-cursor {
|
|
cursor:
|
|
url('@/assets/img/mouse.png') 16 16,
|
|
auto;
|
|
}
|
|
.default-cursor {
|
|
cursor: default;
|
|
}
|
|
/* .el-loading-parent--relative {
|
|
position: unset !important;
|
|
} */
|
|
.timer .el-loading-spinner .el-loading-text {
|
|
width: 166px !important;
|
|
height: 166px !important;
|
|
position: relative;
|
|
background: unset !important;
|
|
z-index: 2;
|
|
/* background: url('@/assets/img/timerBg.png') !important;
|
|
animation: rotate-bg 5s infinite linear; */
|
|
|
|
/* 旋转动画 */
|
|
/* animation: rotateBackground 10s linear infinite; */
|
|
}
|
|
.timer .el-loading-spinner .el-loading-text::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background-image: url('@/assets/img/timerBg.png');
|
|
background-size: cover;
|
|
background-position: center;
|
|
animation: rotate-bg 10s linear infinite;
|
|
z-index: -1;
|
|
}
|
|
</style>
|
|
<style lang="scss" scoped>
|
|
.leftSideSecond {
|
|
display: none;
|
|
// height: 365px;
|
|
width: 240px;
|
|
// background: url('@/assets/images/secondBj.png') no-repeat;
|
|
// background-size: 100% 100%;
|
|
padding: 13px 6px 13px 6px;
|
|
|
|
> .leftSideSecond_bg {
|
|
width: 100%;
|
|
height: 100%;
|
|
position: absolute;
|
|
z-index: -1;
|
|
left: 0;
|
|
top: 0;
|
|
}
|
|
|
|
.leftSideSecondBox {
|
|
// border: 1px solid red;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
max-height: 100%;
|
|
overflow-y: auto;
|
|
|
|
.menuItem {
|
|
width: 25%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
margin: 5px 0;
|
|
|
|
img {
|
|
width: 20px;
|
|
height: 20px;
|
|
}
|
|
|
|
span {
|
|
font-size: 12px;
|
|
text-align: center;
|
|
height: 30px;
|
|
line-height: 14px;
|
|
margin-top: 6px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|