Browse Source

1、添加多种数据类型的船型,并实现船只和轨迹的切换

2、添加光电追踪窗口,视频监控依赖在电子地图中无法引入,后续抽离出单独项目后补充
master
Fuyuu 8 months ago
parent
commit
5b1eb38ee5
  1. 2
      .env.development
  2. 16
      build/vite/plugin/index.ts
  3. 93
      electron/electron.js
  4. 2
      electron/preload.js
  5. 1
      index.html
  6. BIN
      src/assets/images/ship.png
  7. BIN
      src/assets/images/ship_a.png
  8. 136
      src/components/earthMap/AISInfoWindow.vue
  9. 253
      src/components/earthMap/ShowHideControl.vue
  10. 81
      src/components/earthMap/TailAfterWindow.vue
  11. 6
      src/store/modules/earthMap.ts
  12. 121
      src/utils/earthMap/earthObj.ts
  13. 11
      src/utils/earthMap/getCameraInfo.ts
  14. 9
      src/utils/earthMap/listenMouseHandler.ts
  15. 196
      src/utils/earthMap/shipDraw.ts
  16. 29
      src/views/earthMap/edit/EarthComp.vue
  17. 531
      src/views/earthMap/edit/EarthCompTest.vue
  18. 1683
      src/views/earthMap/show/EarthComp.vue
  19. 8
      src/views/military/modules/earthMap/camera/MsCameraSiteList.vue

2
.env.development

@ -2,7 +2,7 @@
# @Author: Fuyuu 1805498209@qq.com
# @Date: 2023-11-24 10:15:22
# @LastEditors: Fuyuu 1805498209@qq.com
# @LastEditTime: 2023-11-24 18:10:19
# @LastEditTime: 2024-01-19 10:20:30
# @FilePath: \dt-admin-pc\.env.development
# @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
###

16
build/vite/plugin/index.ts

@ -1,3 +1,11 @@
/*
* @Author: Fuyuu 1805498209@qq.com
* @Date: 2023-11-30 10:37:07
* @LastEditors: Fuyuu 1805498209@qq.com
* @LastEditTime: 2024-01-20 10:31:38
* @FilePath: \dt-admin-pc-v2\build\vite\plugin\index.ts
* @Description: ,`customMade`, koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { PluginOption } from 'vite';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
@ -6,6 +14,7 @@ import purgeIcons from 'vite-plugin-purge-icons';
import windiCSS from 'vite-plugin-windicss';
import VitePluginCertificate from 'vite-plugin-mkcert';
import vueSetupExtend from 'vite-plugin-vue-setup-extend';
// import requireTransform from 'vite-plugin-require-transform';
import { configHtmlPlugin } from './html';
import { configPwaConfig } from './pwa';
import { configMockPlugin } from './mock';
@ -15,8 +24,8 @@ import { configVisualizerConfig } from './visualizer';
import { configThemePlugin } from './theme';
import { configImageminPlugin } from './imagemin';
import { configSvgIconsPlugin } from './svgSprite';
import OptimizationPersist from 'vite-plugin-optimize-persist'
import PkgConfig from 'vite-plugin-package-config'
import OptimizationPersist from 'vite-plugin-optimize-persist';
import PkgConfig from 'vite-plugin-package-config';
export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
const { VITE_USE_IMAGEMIN, VITE_USE_MOCK, VITE_LEGACY, VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE } = viteEnv;
@ -32,6 +41,9 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
VitePluginCertificate({
source: 'coding',
}),
// requireTransform({
// fileRegex: /.js$|.vue$/,
// }),
];
// vite-plugin-windicss

93
electron/electron.js

@ -2,10 +2,10 @@
const path = require('path');
const { app, BrowserWindow, ipcMain } = require('electron');
const isDev = process.env.IS_DEV == "true" ? true : false;
const isDev = process.env.IS_DEV == 'true' ? true : false;
// rtsp相关,ffmpeg-static会自动下载对应平台windos,linux,mac(intle),mac(M1版本)的ffmpeg二进制文件
const ffmpegPath = require('ffmpeg-static')
const ffmpegPath = require('ffmpeg-static');
/**
stream相关配置及方法
name = options.name
@ -18,8 +18,8 @@ const ffmpegPath = require('ffmpeg-static')
ffmpegPath = options?.ffmpegPath ?? ffmpeg
stop()
*/
const Stream = require('node-rtsp-stream')
/**
const Stream = require('node-rtsp-stream');
/**
* rtsp列表
* interface {
* rtspUrl: {
@ -28,25 +28,24 @@ const ffmpegPath = require('ffmpeg-static')
* }
* }
*/
const rtspOpenders = {}
let addPort = 9000
const rtspOpenders = {};
let addPort = 9000;
/**
* 开启rtsp
* @param rtsp {String} rtsp流地址
*/
ipcMain.on('openRtsp', (event, rtsp) => {
/** 判断是否已开启,若已开启,直接返回ws地址, 未开启则先开启再返回 */
if (rtspOpenders[rtsp]) {
event.returnValue = {
code: 200,
msg: '开启成功',
ws: rtspOpenders[rtsp].ws
}
ws: rtspOpenders[rtsp].ws,
};
} else {
addPort++
addPort++;
const stream = new Stream({
name: `socket-${addPort}`,
streamUrl: rtsp,
@ -54,27 +53,27 @@ ipcMain.on('openRtsp', (event, rtsp) => {
ffmpegPath: app.isPackaged ? ffmpegPath.replace('app.asar', 'app.asar.unpacked') : ffmpegPath,
ffmpegOptions: {
'-stats': '',
'-r': 30
}
'-r': 30,
},
}).on('exitWithError', () => {
stream.stop()
delete rtspOpenders[rtsp]
stream.stop();
delete rtspOpenders[rtsp];
event.returnValue = {
code: 400,
msg: '开启失败'
}
})
msg: '开启失败',
};
});
rtspOpenders[rtsp] = {
ws: `ws://localhost:${addPort}`,
stream: stream
}
stream: stream,
};
event.returnValue = {
code: 200,
msg: '开启成功',
ws: rtspOpenders[rtsp].ws
}
ws: rtspOpenders[rtsp].ws,
};
}
})
});
/**
* 关闭rtsp
@ -82,22 +81,21 @@ ipcMain.on('openRtsp', (event, rtsp) => {
ipcMain.on('closeRtsp', (event, rtsp) => {
if (rtspOpenders[rtsp]) {
// 停止解析
rtspOpenders[rtsp].stream.stop()
rtspOpenders[rtsp].stream.stop();
// 删除该项
delete rtspOpenders[rtsp]
delete rtspOpenders[rtsp];
// 返回结果
event.returnValue = {
code: 200,
msg: '关闭成功'
}
msg: '关闭成功',
};
} else {
event.returnValue = {
code: 400,
msg: '未找到该rtsp'
msg: '未找到该rtsp',
};
}
}
})
});
///////////////////////////////////////////
@ -107,26 +105,19 @@ function createWindow() {
width: 800,
height: 600,
webPreferences: {
//preload: path.join(__dirname, 'preload.js'),
preload: path.join(__dirname, 'preload.js'),
javascript: true,
plugins: true,
allowRunningInsecureContent: true,
// 允许web断使用node
// 允许web端使用node
nodeIntegration: true,
contextIsolation: false,
// 同源策略关闭
webSecurity: false,
},
});
// and load the index.html of the app.
// win.loadFile("index.html");
mainWindow.loadURL(
isDev
? 'http://localhost:3200'
: `file://${path.join(__dirname, '../dist/index.html')}`
);
mainWindow.loadURL(isDev ? 'http://localhost:3200' : `file://${path.join(__dirname, '../dist/index.html')}`);
// mainWindow.loadURL('http://127.0.0.1:5500');
// Open the DevTools.
@ -139,12 +130,12 @@ function createWindow() {
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
createWindow()
createWindow();
app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});
// Quit when all windows are closed, except on macOS. There, it's common
@ -155,3 +146,19 @@ app.on('window-all-closed', () => {
app.quit();
}
});
// 在主进程中监听 webContents 的 did-create-window 事件
app.on('web-contents-created', (event, webContents) => {
// 监听新窗口创建事件
webContents.on('did-create-window', (Window, details) => {
console.log('Window---', Window);
// 在新窗口创建完成后重新加载预加载脚本
Window.webContents.on('dom-ready', () => {
Window.webContents.executeJavaScript(
`
console.log('window----',window)
`
);
});
});
});

2
electron/preload.js

@ -0,0 +1,2 @@
window.ipcRenderer = require('electron').ipcRenderer;
console.log('再次运行');

1
index.html

@ -16,6 +16,7 @@
<link rel="icon" href="/zgxlogo.png" />
<!-- 全局配置 -->
<script>
console.log('window', window);
window._CONFIG = {};
</script>
</head>

BIN
src/assets/images/ship.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
src/assets/images/ship_a.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

136
src/components/earthMap/AISInfoWindow.vue

@ -2,7 +2,7 @@
* @Author: Fuyuu 1805498209@qq.com
* @Date: 2024-01-05 14:18:33
* @LastEditors: Fuyuu 1805498209@qq.com
* @LastEditTime: 2024-01-12 17:55:17
* @LastEditTime: 2024-01-20 14:57:59
* @FilePath: \dt-admin-pc-v2\src\components\earthMap\AISInfoWindow.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
@ -12,7 +12,7 @@
:title="title"
:width="600"
:minWidth="600"
:height="380"
:height="420"
:left="80"
:top="70"
@cancel="cancel"
@ -25,11 +25,11 @@
<div class="ais_content">
<div class="content_item">
<div class="item_title">船名:</div>
<div class="item_content">顺宏海1026</div>
<div class="item_content">{{ AISInfo.name }}</div>
</div>
<div class="content_item">
<div class="item_title">MMSI:</div>
<div class="item_content">413495860</div>
<div class="item_content">{{ AISInfo.mmsi }}</div>
</div>
<div class="content_item">
<div class="item_title">船首向:</div>
@ -45,7 +45,7 @@
</div>
<div class="content_item">
<div class="item_title">IMO:</div>
<div class="item_content">458876</div>
<div class="item_content">{{ AISInfo.imo }}</div>
</div>
<div class="content_item">
<div class="item_title">航速:</div>
@ -53,11 +53,11 @@
</div>
<div class="content_item">
<div class="item_title">经度:</div>
<div class="item_content">113-26.578E</div>
<div class="item_content">{{ AISInfo.longitude }}</div>
</div>
<div class="content_item">
<div class="item_title">纬度:</div>
<div class="item_content">22-08.082N</div>
<div class="item_content">{{ AISInfo.latitude }}</div>
</div>
<div class="content_item">
<div class="item_title">状态:</div>
@ -96,6 +96,14 @@
<div class="item_title">航行轨迹:</div>
<a-switch v-model:checked="checked" @change="changeTrack" />
</div>
<!-- 跟踪船只 -->
<div class="content_item">
<div class="item_title">跟踪船只:</div>
<a-button size="small" type="primary" @click="tailAfter()">
跟踪
<EyeOutlined />
</a-button>
</div>
</div>
</Window>
</div>
@ -106,8 +114,9 @@
import Window from '@/components/earthMap/components/Window.vue';
import { useEarthMapStore } from '/@/store/modules/earthMap';
import $mitt from '@/utils/earthMap/mitt';
// store
const store = useEarthMapStore();
import { EyeOutlined } from '@ant-design/icons-vue';
import { defHttp } from '/@/utils/http/axios';
export default defineComponent({
name: 'AISInfoWindow',
props: {
@ -122,29 +131,47 @@
},
components: {
Window,
EyeOutlined,
},
setup() {
// store
const store = useEarthMapStore();
const { proxy }: any = getCurrentInstance();
//
const checked = ref(false);
// store
let foundData = store.shipDataList.filter((item) => item.guid === proxy.ship_guid);
// 线id
let track_guid = foundData ? foundData[0].track_guid : null;
// 线
let trackData = window.$earth.getObject(track_guid);
//
checked.value = trackData.show;
// guid
watch(
() => proxy.ship_guid,
(newVal, _oldVal) => {
console.log(newVal);
},
{ immediate: true }
);
// trackId
const trackId: any = ref('');
// id
const radarId: any = ref('');
// AIS
const AISInfo: any = ref({});
// 线
const trackData: any = ref({});
// ais线
function getShipAISInfo() {
// ship_guidtrack_idAIS
trackId.value = window.$earth.getObject(proxy.ship_guid).trackId;
// trackIdid
radarId.value = store.radarShipList.filter((item) => item.trackId === trackId.value)[0].radarId;
// storeais
AISInfo.value = store.aisShipList.filter((item) => item.trackId === trackId.value)[0];
// ship_guid线
let shipName = window.$earth.getObject(proxy.ship_guid).name;
// ais
if (shipName.includes('船_ais')) {
trackData.value = window.$earth.getObject(store.aisShipList.filter((item) => item.trackId === trackId.value)[0].track_guid);
} else if (shipName.includes('船_radar')) {
//
trackData.value = window.$earth.getObject(store.radarShipList.filter((item) => item.trackId === trackId.value)[0].track_guid);
} else if (shipName.includes('船_mix')) {
//
trackData.value = window.$earth.getObject(store.mixShipList.filter((item) => item.trackId === trackId.value)[0].track_guid);
} else {
console.log('未知船只');
}
checked.value = trackData.value.show;
}
//
function cancel() {
proxy.$parent.AISInfoWindowShow = false;
@ -153,27 +180,62 @@
function changeTrack(e) {
checked.value = e;
// 使show
trackData.show = e;
// 线
$mitt.emit('trackShowChange', e);
trackData.value.show = e;
}
//
function tailAfter() {
//
proxy.$parent.TailAfterWindowShow = true;
// idtrackIdidradarIdtracking0 1
// 使API
// defHttp
// .post(
// {
// url: '/military/tracking/target',
// params: {
// trackId: trackId.value,
// radarId: radarId.value,
// tracking: 1,
// },
// },
// { isTransformResponse: false }
// )
// .then((res) => {
// console.log('', res);
// //
$mitt.on('trackAllChange', (e: boolean) => {
// });
console.log('window', window);
}
// 线
$mitt.on('trackChange', (e: boolean) => {
// 线
checked.value = e;
if (trackData.value.name.includes(e)) {
checked.value = false;
}
});
$mitt.on('shipAllChange', (e: boolean) => {
//
if (!e) {
cancel()
//
$mitt.on('trackAllChange', (data: any) => {
if (trackData.value.name.includes(data.type)) {
checked.value = data.status;
}
})
});
// guid
watch(
() => proxy.ship_guid,
(_newVal, _oldVal) => {
// AIS
getShipAISInfo();
},
{ immediate: true }
);
return {
checked,
AISInfo,
cancel,
changeTrack,
tailAfter,
};
},
});

253
src/components/earthMap/ShowHideControl.vue

@ -1,47 +1,126 @@
<template>
<div class="showhideControl">
<a-dropdown :trigger="['click']">
<!-- <a-dropdown :trigger="['click']">
<template #overlay>
<a-menu>
<a-menu-item key="1">
<label for="ship-switch" style="margin-top: 2px">船只模型</label>
<a-switch id="ship-switch" v-model:checked="shipShow" @change="changeShipShow" checked-children="显示" un-checked-children="隐藏" />
</a-menu-item>
<a-menu-item key="1">
<a-menu-item key="2">
<label for="track-switch" style="margin-top: 2px">船只轨迹</label>
<a-switch id="track-switch" v-model:checked="trackShow" @change="changeTrackShow" checked-children="显示" un-checked-children="隐藏" />
</a-menu-item>
</a-menu>
</template>
<a-button> 地图元素显隐 <CaretUpOutlined /></a-button>
</a-dropdown>
</a-dropdown> -->
<!-- <div class="control_item">
<a-switch id="ship-switch" v-model:checked="shipShow" @change="changeShipShow" checked-children="显示船只" un-checked-children="隐藏船只" />
</div> -->
<!-- <div class="control_item">
<a-switch id="track-switch" v-model:checked="trackShow" @change="changeTrackShow" checked-children="显示轨迹" un-checked-children="隐藏轨迹" />
</div> -->
<div class="control_item">
<a-switch
id="ais-switch"
v-model:checked="aisTypeShow"
@change="changeAISType"
checked-children="AIS显示&nbsp;&nbsp;"
un-checked-children="AIS隐藏&nbsp;&nbsp;"
/>
</div>
<div class="control_item">
<a-switch
id="radar-switch"
v-model:checked="radarTypeShow"
@change="changeRadarType"
checked-children="雷达显示"
un-checked-children="雷达隐藏"
/>
</div>
<div class="control_item">
<a-switch id="mix-switch" v-model:checked="mixTypeShow" @change="changeMixType" checked-children="融合显示" un-checked-children="融合隐藏" />
</div>
<div class="control_item">
<a-button size="small" @click="changeTrackStatus(true)">打开轨迹</a-button>
<a-button size="small" @click="changeTrackStatus(false)">关闭轨迹</a-button>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent, ref, nextTick, watch } from 'vue';
import { defineComponent, ref, nextTick } from 'vue';
import { CaretUpOutlined } from '@ant-design/icons-vue';
import $mitt from '@/utils/earthMap/mitt';
export default defineComponent({
setup() {
//
const shipShow = ref<boolean>(true);
// const shipShow = ref<boolean>(true);
//
const trackShow = ref<boolean>(true);
// const trackShow = ref<boolean>(true);
//
const radarTypeShow = ref<boolean>(true);
//
const mixTypeShow = ref<boolean>(true);
// AIS
const aisTypeShow = ref<boolean>(true);
//
const shipList = ref([]);
// ais
const aisShipList = ref([]);
//
const radarShipList = ref([]);
//
const mixShipList = ref([]);
//
const trackList = ref([]);
//
const radarTrackList = ref([]);
// ais
const aisTrackList = ref([]);
//
const mixTrackList = ref([]);
//
function getShipInfo() {
//
let earthMapElements = window.$earth.getAllObjects();
//
let earthMapShips = earthMapElements.filter((item) => item.name && item.name.includes('船'));
// ais
let earthMapAisShips = earthMapElements.filter((item) => item.name && item.name.includes('船_ais'));
//
let earthMapRadarShips = earthMapElements.filter((item) => item.name && item.name.includes('船_radar'));
//
let earthMapMixShips = earthMapElements.filter((item) => item.name && item.name.includes('船_mix'));
if (earthMapShips.length > 0) {
//
shipShow.value = earthMapShips.every((item) => item.show === true);
// shipShow.value = earthMapShips.every((item) => item.show === true);
//
shipList.value = earthMapShips;
if (earthMapAisShips.length > 0) {
// ais
aisTypeShow.value = earthMapAisShips.every((item) => item.show === true);
// ais
aisShipList.value = earthMapAisShips;
} else {
console.log('当前场景没有ais船只');
}
if (earthMapRadarShips.length > 0) {
//
radarTypeShow.value = earthMapRadarShips.every((item) => item.show === true);
//
radarShipList.value = earthMapRadarShips;
} else {
console.log('当前场景没有雷达船只');
}
if (earthMapMixShips.length > 0) {
//
mixTypeShow.value = earthMapMixShips.every((item) => item.show === true);
//
mixShipList.value = earthMapMixShips;
} else {
console.log('当前场景没有融合船只');
}
} else {
console.log('当前场景没有船只');
}
@ -52,11 +131,29 @@
let earthMapElements = window.$earth.getAllObjects();
//
let earthMapTracks = earthMapElements.filter((item) => item.name && item.name.includes('轨迹线'));
let earthMapRadarTracks = earthMapElements.filter((item) => item.name && item.name.includes('轨迹线_radar'));
let earthMapAisTracks = earthMapElements.filter((item) => item.name && item.name.includes('轨迹线_ais'));
let earthMapMixTracks = earthMapElements.filter((item) => item.name && item.name.includes('轨迹线_mix'));
if (earthMapTracks.length > 0) {
//
trackShow.value = earthMapTracks.every((item) => item.show === true);
// trackShow.value = earthMapTracks.every((item) => item.show === true);
//
trackList.value = earthMapTracks;
if (earthMapRadarTracks.length > 0) {
radarTrackList.value = earthMapRadarTracks;
} else {
console.log('当前场景没有雷达轨迹线');
}
if (earthMapAisTracks.length > 0) {
aisTrackList.value = earthMapAisTracks;
} else {
console.log('当前场景没有ais轨迹线');
}
if (earthMapMixTracks.length > 0) {
mixTrackList.value = earthMapMixTracks;
} else {
console.log('当前场景没有融合轨迹线');
}
} else {
console.log('当前场景没有轨迹线');
}
@ -66,14 +163,14 @@
if (shipList.value.length > 0) {
if (!e) {
//
trackShow.value = false;
// trackShow.value = false;
//
trackList.value.forEach((item: any) => {
item.show = false;
});
}
//
shipShow.value = e;
// shipShow.value = e;
shipList.value.forEach((item: any) => {
//
item.show = e;
@ -85,34 +182,105 @@
// 线
function changeTrackShow(e) {
if (trackList.value.length > 0) {
if (shipShow.value) {
//
trackShow.value = e;
trackList.value.forEach((item: any) => {
// if (shipShow.value) {
// //
// trackShow.value = e;
// trackList.value.forEach((item: any) => {
// //
// item.show = e;
// });
// } else {
// trackShow.value = false;
// console.log('');
// }
} else {
console.log('当前场景没有轨迹线');
}
}
//
function changeRadarType(e) {
if (radarShipList.value.length > 0) {
if (!e) {
//
radarTrackList.value.forEach((item: any) => {
//
item.show = e;
});
$mitt.emit('trackChange', 'radar');
}
//
radarTypeShow.value = e;
radarShipList.value.forEach((item: any) => {
//
item.show = e;
});
} else {
trackShow.value = false;
console.log('请先打开显示船只模型');
console.log('当前场景没有雷达船只');
}
}
//
function changeMixType(e) {
if (mixShipList.value.length > 0) {
if (!e) {
//
mixTrackList.value.forEach((item: any) => {
//
item.show = e;
});
$mitt.emit('trackChange', 'mix');
}
//
mixTypeShow.value = e;
mixShipList.value.forEach((item: any) => {
//
item.show = e;
});
} else {
console.log('当前场景没有船只');
console.log('当前场景没有融合船只');
}
}
// 线
watch(trackShow, (newValue, _oldValue) => {
// 线
$mitt.emit('trackAllChange', newValue);
// AIS
function changeAISType(e) {
if (aisShipList.value.length > 0) {
if (!e) {
//
aisTrackList.value.forEach((item: any) => {
//
item.show = e;
});
//
watch(shipShow, (newValue, _oldValue) => {
// 线
$mitt.emit('shipAllChange', newValue);
$mitt.emit('trackChange', 'ais');
}
//
aisTypeShow.value = e;
aisShipList.value.forEach((item: any) => {
//
item.show = e;
});
} else {
console.log('当前场景没有AIS船只');
}
}
//
function changeTrackStatus(e) {
if (radarTypeShow.value) {
radarTrackList.value.forEach((item: any) => {
item.show = e;
});
$mitt.emit('trackAllChange', { status: e, type: 'radar' });
}
if (mixTypeShow.value) {
mixTrackList.value.forEach((item: any) => {
item.show = e;
});
$mitt.emit('trackAllChange', { status: e, type: 'mix' });
}
if (aisTypeShow.value) {
aisTrackList.value.forEach((item: any) => {
item.show = e;
});
$mitt.emit('trackAllChange', { status: e, type: 'ais' });
}
}
// mqtt
$mitt.on('deviceCmd', () => {
nextTick(() => {
@ -122,25 +290,19 @@
getTrackInfo();
});
});
// 线
$mitt.on('trackShowChange', (e: boolean) => {
if (!e) {
//
trackShow.value = e;
} else {
//
trackShow.value = window.$earth
.getAllObjects()
.filter((item) => item.name && item.name.includes('轨迹线'))
.every((item) => item.show === true);
}
});
return {
shipShow,
trackShow,
// shipShow,
// trackShow,
radarTypeShow,
mixTypeShow,
aisTypeShow,
changeShipShow,
changeTrackShow,
changeRadarType,
changeMixType,
changeAISType,
changeTrackStatus,
};
},
components: {
@ -151,8 +313,11 @@
<style lang="less" scoped>
.showhideControl {
position: absolute;
left: 0;
left: 10px;
bottom: 30px;
z-index: 99999;
.control_item {
margin: 8px 0;
}
}
</style>

81
src/components/earthMap/TailAfterWindow.vue

@ -0,0 +1,81 @@
<!--
* @Author: Fuyuu 1805498209@qq.com
* @Date: 2024-01-18 16:42:29
* @LastEditors: Fuyuu 1805498209@qq.com
* @LastEditTime: 2024-01-20 18:02:10
* @FilePath: \dt-admin-pc-v2\src\components\earthMap\TailAfterWindow.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="TailAfter">
<Window
:title="title"
:width="1280"
:minWidth="1280"
:height="720"
:left="100"
:top="100"
@cancel="cancel"
:floatright="false"
:showCancelButton="true"
:footervisible="false"
:showcloseButton="true"
id="tailAfterWindow"
>
<div class="mpegPlayer" ref="mpegPlayer"></div>
</Window>
</div>
</template>
<script lang="ts" setup>
import { getCurrentInstance, ref, onMounted, onBeforeUnmount } from 'vue';
import Window from '@/components/earthMap/components/Window.vue';
import MpegPlayer from 'jsmpeg-player';
const props = defineProps({
title: {
type: String,
default: '光电跟踪',
},
});
// ipcRenderer
// import { ipcRenderer } from 'electron';
const ipcRenderer: any = ref(null);
const { proxy }: any = getCurrentInstance();
// DOM
const mpegPlayer = ref();
// rtsp
const videoUrl = ref('rtsp://admin:123456@192.168.1.71:554/');
//
let player: any = ref(null);
//
const open = () => {
const res = ipcRenderer.sendSync('openRtsp', videoUrl.value);
if (res.code === 200) {
player.value = new MpegPlayer.VideoElement(mpegPlayer.value, res.ws);
}
};
//
const close = () => {
ipcRenderer.sendSync('closeRtsp', videoUrl.value);
};
//
function cancel() {
proxy.$parent.TailAfterWindowShow = false;
}
onMounted(() => {
open();
});
onBeforeUnmount(() => {
close();
});
</script>
<style lang="less" scoped>
#tailAfterWindow .xbsj-model-header .xbsj-model-arrow {
right: 25px;
}
.mpegPlayer {
width: 100%;
height: 720px;
background: #000;
}
</style>

6
src/store/modules/earthMap.ts

@ -2,7 +2,7 @@
* @Author: Fuyuu 1805498209@qq.com
* @Date: 2023-12-15 16:47:17
* @LastEditors: Fuyuu 1805498209@qq.com
* @LastEditTime: 2024-01-03 10:47:55
* @LastEditTime: 2024-01-16 09:16:16
* @FilePath: \dt-admin-pc-v2\src\store\modules\earthMap.ts
* @Description: ,`customMade`, koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
@ -19,7 +19,9 @@ export const useEarthMapStore = defineStore({
shapeList: <any>[], //绘画数组(区域)
shapeShowList: <any>[], //绘画存储(临时)
keyAreaPos: <number[][]>[], //记录创建防区的点位,重点管控区域
shipDataList: <any>[], //船只数据列表
aisShipList: <any>[], // ais船只数据列表
radarShipList: <any>[], // 雷达船只数据列表
mixShipList: <any>[], // 融合船只数据列表
xbsjEarthUI: <any>null, //XbsjEarthUI
///////////////////////
cameraData: <any>{},//请求的电线杆数据

121
src/utils/earthMap/earthObj.ts

@ -322,43 +322,101 @@ export const addCustomPrimitive = (
return cp;
};
// 创建船只贴地图片
export const addShipGroundImg = (lon: number, lat: number, height: number, imgUrl: string, imgUrl_a: string, rt: number, trackId: number) => {
const shipGroundImg = new window.XE.Obj.GroundImage(window.$earth);
// 创建船只三角模型
export const addShipTriangle = (options: any = {}) => {
const shipTriangle = new window.XE.Obj.GroundImage(window.$earth);
const objConfig = {
name: `${trackId}号船只`,
trackId,
position: [window.Cesium.Math.toRadians(lon), window.Cesium.Math.toRadians(lat), height],
loopPlay: false,
imageUrls: [imgUrl],
rotation: -(Math.PI / 180) * rt,
ground: false,
name: options.name, // 实例名称
imageUrls: [options.imageUrl], // 标识图片资源路径
trackId: options.id, // 船只trackid
position: options.position, // 位置数组 [经度、纬度、高度]
rotation: options.rotation, // 偏航角
loopPlay: false, // 是否轮播
ground: false, // 是否贴地
height: 80,
width: 60,
};
shipGroundImg.xbsjFromJSON(objConfig);
shipTriangle.xbsjFromJSON(objConfig);
//移入事件
shipGroundImg.onmouseover = (e: any) => {
e.id.imageUrls = [imgUrl_a];
shipTriangle.onmouseover = () => {
window.$earth.czm.viewer._container.style.cursor = 'pointer';
};
//移出事件
shipGroundImg.onmouseout = (e: any) => {
e.id.imageUrls = [imgUrl];
shipTriangle.onmouseout = () => {
window.$earth.czm.viewer._container.style.cursor = 'default';
};
return shipGroundImg;
return shipTriangle;
};
// 创建船只自定义图元
export const addShipPrimitive = (options: any = {}) => {
const shipCp = new window.XE.Obj.CustomPrimitive(window.$earth);
const objConfig = {
_name: options.name, // 实例名称
trackId: options.id, // 船只trackid
xbsjType: 'CustomPrimitive', // 图元类型
position: options.position, // 位置数组 [经度、纬度、高度]
rotation: options.rotation, // 姿态数组 [偏航角、俯仰角、翻转角]
imageUrl: options.imageUrl, // 标识图片资源路径
positions: [0, -1, 0, 0, 1, 0, 0, 1, 2, 0, -1, 2],
sts: [0, 0, 1, 0, 1, 1, 0, 1],
indices: [0, 1, 2, 0, 2, 3], // 索引数组
scale: [1, 5, 4],
renderState: {
cull: {
enabled: true,
},
polygonOffset: {},
scissorTest: {
rectangle: {},
},
depthRange: {},
depthTest: {
enabled: true,
},
colorMask: {},
depthMask: false,
blending: {
enabled: true,
color: {},
equationRgb: 32774,
equationAlpha: 32774,
functionSourceRgb: 770,
functionDestinationRgb: 771,
functionDestinationAlpha: 771,
},
stencilTest: {
frontOperation: {},
backOperation: {},
},
sampleCoverage: {},
},
color: [1, 1, 1, 1], // 颜色
canvasWidth: 500,
canvasHeight: 256,
autoRegisterEditing: true,
};
shipCp.xbsjFromJSON(objConfig);
return shipCp;
};
// 创建船只三维模型
export const addShipModel = (name: string, options: any = {}) => {
// 融合船只-船模型 ais船只-黄色三角 雷达船只-红色三角
export const addShipModel = (options: any = {}, dataType: number) => {
const tileset = new window.XE.Obj.Model(window.$earth);
// 创建一个Model对象
const objConfig = {
name: name,
url: options.url,
id: options.id,
name: options.name, // 实例名称
url: options.modelUrl, // 模型资源路径
trackId: options.id, // 船只trackid
xbsjPosition: options.position, // 位置数组 [经度、纬度、高度]
xbsjRotation: options.rotation, // 姿态数组 [偏航角、俯仰角、翻转角]
xbsjScale: [0.5, 0.5, 0.5], // 缩放比例
show: true,
xbsjScale: [1, 1, 1], // 缩放比例
show: true, // 显隐状态
distanceDisplayCondition: [1.0, 30000.0],
scale: 0.5,
minimumPixelSize: 80,
colorBlendAmount: dataType == 3 ? 0.0 : 1.0, // 1.0 模型颜色 0.0 设置纯色
color: dataType == 3 ? [1, 1, 1, 1] : dataType == 2 ? [1, 1, 0.03, 1] : [0.94, 0.13, 0.03, 1],
colorBlendMode: dataType == 3 ? 'ColorBlendMode.HIGHLIGHT' : 'ColorBlendMode.REPLACE',
};
tileset.xbsjFromJSON(objConfig);
//移入事件
@ -371,23 +429,22 @@ export const addShipModel = (name: string, options: any = {}) => {
};
return tileset;
};
// 创建船只轨迹
export const addShipTrack = (positions: number[][]) => {
export const addShipTrack = (positions: number[][], dataType: number) => {
const shipTrack = new window.XE.Obj.Polyline(window.$earth);
const objConfig = {
width: 3.0,
name: '轨迹线',
positions,
width: 2.0, // 线宽
name: `轨迹线_${dataType == 1 ? 'radar' : dataType == 2 ? 'ais' : 'mix'}`, // 实例名称
positions, // 点坐标经纬度数组 [经度、纬度、高度]
material: {
type: 'XbsjODLineMaterial',
type: 'XbsjODLineMaterial', // 材质类型
XbsjODLineMaterial: {
bgColor: [1, 1, 0.03, 1],
color: [1, 0, 1, 1],
glowPower: 0.6,
bgColor: dataType == 1 ? [0.94, 0.13, 0.03, 1] : dataType == 2 ? [1, 1, 0.03, 1] : [0.03, 0.32, 1, 0.85], // 背景颜色
color: dataType == 1 ? [1, 1, 0.03, 1] : dataType == 2 ? [0.94, 0.13, 0.03, 1] : [1, 1, 1, 1], // 颜色
glowPower: 0.6, // 发光程度
},
},
ground: true,
ground: true, // 是否贴地
};
shipTrack.xbsjFromJSON(objConfig);
return shipTrack;

11
src/utils/earthMap/getCameraInfo.ts

@ -6,14 +6,14 @@ import { defHttp } from '/@/utils/http/axios';
import { addPin } from '@/utils/earthMap/earthObj';
import { useUserStore } from '/@/store/modules/user';
import { useEarthMapStore } from '/@/store/modules/earthMap';
import { earthMapUrl } from '@/api/earth/earthMap'
import { earthMapUrl } from '@/api/earth/earthMap';
import { nextTick } from 'vue';
import $ from 'jquery';
let userStore = useUserStore();
let store = useEarthMapStore();
export default function getCameraInfo(models, type) {
console.log("加载站点");
console.log('加载站点');
return new Promise((resolve, reject) => {
//请求电线杆信息
defHttp.get({ url: earthMapUrl.queryCameraInfo }, { isTransformResponse: false }).then(async (res) => {
@ -107,6 +107,7 @@ async function setCamera(res, models, type) {
// gltfStr = window._CONFIG['domianURL'] + '/sys/common/static/' + newName + '.' + fileInfos[1];
gltfStr = '/dt/sys/common/static/' + newName + '.' + fileInfos[1];
}
const modelConfig = {
ref: data.id,
name: lineId,
@ -120,11 +121,7 @@ async function setCamera(res, models, type) {
scale: data.scale,
xbsjScale: data.xyzScale ? data.xyzScale.split(',') : [1, 1, 1],
xbsjPosition: [window.Cesium.Math.toRadians(data.longitude), window.Cesium.Math.toRadians(data.latitude), data.height],
xbsjRotation: [
window.Cesium.Math.toRadians(data.yaw),
window.Cesium.Math.toRadians(data.pitch),
window.Cesium.Math.toRadians(data.roll),
],
xbsjRotation: [window.Cesium.Math.toRadians(data.yaw), window.Cesium.Math.toRadians(data.pitch), window.Cesium.Math.toRadians(data.roll)],
viewDistance: 150,
distanceDisplayCondition: [1.0, 30000.0],
customProp: data.id,

9
src/utils/earthMap/listenMouseHandler.ts

@ -8,7 +8,7 @@ import { defHttp } from '/@/utils/http/axios';
import $ from 'jquery';
import { useUserStore } from '/@/store/modules/user';
import { useEarthMapStore } from '/@/store/modules/earthMap';
import { earthMapUrl } from '@/api/earth/earthMap'
import { earthMapUrl } from '@/api/earth/earthMap';
import { useMessage } from '/@/hooks/web/useMessage';
import { CircleScan } from '@/utils/earthMap/radarEntity';
import { radianToDegreeInLngLatHeight } from '@/utils/earthMap/earth';
@ -19,7 +19,6 @@ let store = useEarthMapStore();
const { createMessage } = useMessage();
export default function listenMouseHandler(that) {
const handler = new window.Cesium.ScreenSpaceEventHandler(window.$viewer.scene.canvas);
that._handler = handler;
//取消双击旋转事件
@ -87,7 +86,7 @@ export default function listenMouseHandler(that) {
'</div> </a></li>'
);
});
let cameraModal: any = document.getElementById('cameraModal')
let cameraModal: any = document.getElementById('cameraModal');
cameraModal.style.left = click.position.x + -45 + 'px';
cameraModal.style.top = click.position.y + -180 + 'px';
that.cameraModalShow = true;
@ -97,9 +96,9 @@ export default function listenMouseHandler(that) {
});
}
// 船只模型
if (pickedFeature.id.xbsjType && pickedFeature.id.name.includes('船') && pickedFeature.id.xbsjType === 'Model') {
if (pickedFeature.id.xbsjType && pickedFeature.id.name.includes('船')) {
that.AISInfoWindowShow = true;
// 赋值船只场景id
// 赋值船只场景id - 唯一标识 可通过该字段获取其余信息
that.ship_guid = pickedFeature.id.guid;
}
//雷达扫描范围

196
src/utils/earthMap/shipDraw.ts

@ -2,7 +2,7 @@
* @Author: Fuyuu 1805498209@qq.com
* @Date: 2024-01-03 17:42:49
* @LastEditors: Fuyuu 1805498209@qq.com
* @LastEditTime: 2024-01-09 10:35:50
* @LastEditTime: 2024-01-19 09:44:33
* @FilePath: \dt-admin-pc-v2\src\utils\earthMap\shipDraw.ts
* @Description: ,`customMade`, koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
@ -12,66 +12,186 @@
import { useEarthMapStore } from '/@/store/modules/earthMap';
import { addShipTrack, addShipModel } from '@/utils/earthMap/earthObj';
// 暂存store
const store = useEarthMapStore();
// 船只数据列表
let shipDataList: any = [];
// 雷达船只数据列表
let radarShipList: any = [];
// AIS船只数据列表
let aisShipList: any = [];
// 融合船只数据列表
let mixShipList: any = [];
// 绘制单个船只
const drawShips = function (shipItem) {
// 引入初始图片
// let imageUrl = new URL(`../../assets/images/ship.png`, import.meta.url).href;
// 引入高亮图片
// let imageUrl_a = new URL(`../../assets/images/ship_a.png`, import.meta.url).href;
// 角度转弧度
function toRadians(point) {
return window.Cesium.Math.toRadians(point);
}
// 绘制AIS船只
const drawAISShips = function (shipItem) {
// 模型配置参数
let options = {
id: shipItem.trackId,
name: `${shipItem.trackId}号船_ais`,
modelUrl: window._CONFIG['domianURL'] + '/sys/common/static/greenShip.gltf',
position: [toRadians(shipItem.longitude + 0.00005), toRadians(shipItem.latitude + 0.00005), 0],
rotation: [(Math.PI / 180) * (shipItem.course - 90), 0, 0],
};
// 绘制船只
let shipModel = addShipModel(options, 1);
// 返回船只绘制信息
return shipModel;
};
// 绘制雷达船只
const drawRadarShips = function (shipItem) {
// 模型配置参数
let options = {
id: shipItem.trackId,
url: window._CONFIG['domianURL'] + '/sys/common/static/tongyongchuan.gltf',
name: `${shipItem.trackId}号船_radar`,
modelUrl: window._CONFIG['domianURL'] + '/sys/common/static/yellowShip.gltf',
position: [toRadians(shipItem.longitude), toRadians(shipItem.latitude), 0],
rotation: [(Math.PI / 180) * (shipItem.course + 90), 0, 0],
rotation: [(Math.PI / 180) * (shipItem.course - 90), 0, 0],
};
// 绘制船只
let shipModel = addShipModel(`${shipItem.trackId}号船`, options);
let shipModel = addShipModel(options, 2);
// 返回船只绘制信息
return shipModel;
};
// 绘制融合船只
const drawMixShips = function (shipItem) {
// 模型配置参数
let options = {
id: shipItem.trackId,
name: `${shipItem.trackId}号船_mix`,
modelUrl: window._CONFIG['domianURL'] + '/sys/common/static/tongyongchuan.gltf',
position: [toRadians(shipItem.longitude + 0.0001), toRadians(shipItem.latitude + 0.0001), 0],
rotation: [(Math.PI / 180) * (shipItem.course - 90), 0, 0],
};
// 绘制船只
let shipModel = addShipModel(options, 3);
// 返回船只绘制信息
return shipModel;
};
// 角度转弧度
function toRadians(point) {
return window.Cesium.Math.toRadians(point);
}
// 绘制地球上所有雷达船只
export const drawRadarShipsList = function (radarItem) {
// 接收到的单个雷达船只信息
let radarData = radarItem.radarTrack;
// 获取store中的雷达船只数据列表
radarShipList = store.radarShipList;
// 是否已经存在
let existingShip = radarShipList.find((shipItem) => shipItem.trackId === radarData.trackId);
if (existingShip) {
// 添加新的轨迹点
window.$earth.getObject(existingShip.track_guid).positions.push([toRadians(radarData.longitude), toRadians(radarData.latitude), 0]);
// 获取场景中的船只信息
let shipData = window.$earth.getObject(existingShip.guid);
// 更新位置和航向
shipData.xbsjPosition = [toRadians(radarData.longitude), toRadians(radarData.latitude), 0];
// 航向需要后续调整。。。
shipData.xbsjRotation = [(Math.PI / 180) * (radarData.course - 90), 0, 0];
} else {
// 添加新的雷达船只
radarShipList.push({
name: `${radarData.trackId}号船_radar`, // 名称
trackId: radarData.trackId, // 船只id
guid: drawRadarShips(radarData).xbsjGuid, // 船只场景id
// 根据不同的数据类型绘制不同的轨迹线 轨迹线guid,用于轨迹显隐
track_guid: addShipTrack([[toRadians(radarData.longitude), toRadians(radarData.latitude), 0]], 1).xbsjGuid,
azimuth: radarData.azimuth, // 方位角
course: radarData.course, // 航向
latitude: radarData.latitude, // 纬度
longitude: radarData.longitude, // 经度
radarId: radarData.radarId, // 雷达id
});
// 更新store
store.radarShipList = radarShipList;
}
};
// 绘制地球上所有ais船只(暂无AIS数据,使用雷达数据进行模拟)
export const drawAISShipsList = function (aisItem) {
// 接收到的单个ais船只信息
let aisData = aisItem.radarTrack;
// 获取store中的ais船只数据列表
aisShipList = store.aisShipList;
// 是否已经存在
let existingShip = aisShipList.find((shipItem) => shipItem.trackId === aisData.trackId);
if (existingShip) {
// 添加新的轨迹点
window.$earth
.getObject(existingShip.track_guid)
.positions.push([toRadians(aisData.longitude + 0.00005), toRadians(aisData.latitude + 0.00005), 0]);
// 获取场景中的船只信息
let shipData = window.$earth.getObject(existingShip.guid);
// 更新位置和航向
shipData.xbsjPosition = [toRadians(aisData.longitude + 0.00005), toRadians(aisData.latitude + 0.00005), 0];
// 航向需要后续调整。。。
shipData.xbsjRotation = [(Math.PI / 180) * (aisData.course - 90), 0, 0];
} else {
// 添加新的ais船只
aisShipList.push({
name: `${aisData.trackId}号船_ais`, // 名称
mmsi: aisData.trackId * 66, // MMSI
call_sign: aisData.trackId * 6, // 呼号
imo: aisData.trackId * 5, // IMO
bow_direction: 511.0, // 船首向
track_direction: 342.0, // 航迹向
ship_status: '锚泊', // 状态
ship_length: 85.4, // 船长
ship_width: 19.0, // 船宽
draft: 0.0, // 吃水
ship_type: '货船', // 类型
ship_speed: '20m/s', // 航速
destination: 'JIANGMEN,CN', // 目的地
nationality: 'CN', // 国籍
pre_arrival_time: '2024-01-08 14:40:11', // 预到时间
trackId: aisData.trackId, // 船只id
guid: drawAISShips(aisData).xbsjGuid, // 船只场景id
// 根据不同的数据类型绘制不同的轨迹线 轨迹线guid,用于轨迹显隐
track_guid: addShipTrack([[toRadians(aisData.longitude + 0.00005), toRadians(aisData.latitude + 0.00005), 0]], 2).xbsjGuid,
azimuth: aisData.azimuth, // 方位角
course: aisData.course, // 航向
latitude: aisData.latitude + 0.00005, // 纬度
longitude: aisData.longitude + 0.00005, // 经度
radarId: aisData.radarId, // 雷达Id
});
// 更新store
store.aisShipList = aisShipList;
}
};
// 绘制地球上所有船只和轨迹
export const drawAllShips = function (message) {
// 接收到的单个船只信息
let messageData = JSON.parse(JSON.parse(message).radarTrack);
// 获取store中的船只数据列表
shipDataList = store.shipDataList;
// 绘制地球上所有融合船只(暂无融合数据,使用雷达数据进行模拟)
export const drawMixShipsList = function (mixItem) {
// 接收到的单个融合船只信息
let mixData = mixItem.radarTrack;
// 获取store中的融合船只数据列表
mixShipList = store.mixShipList;
// 是否已经存在
let existingShip = shipDataList.find((shipItem) => shipItem.trackId === messageData.trackId);
let existingShip = mixShipList.find((shipItem) => shipItem.trackId === mixData.trackId);
if (existingShip) {
// 添加新的轨迹点
window.$earth.getObject(existingShip.track_guid).positions.push([toRadians(messageData.longitude), toRadians(messageData.latitude), 0]);
window.$earth.getObject(existingShip.track_guid).positions.push([toRadians(mixData.longitude + 0.0001), toRadians(mixData.latitude + 0.0001), 0]);
// 获取场景中的船只信息
let shipData = window.$earth.getObject(existingShip.guid);
// 更新位置和航向
shipData.xbsjPosition = [toRadians(messageData.longitude), toRadians(messageData.latitude), 0];
shipData.xbsjPosition = [toRadians(mixData.longitude + 0.0001), toRadians(mixData.latitude + 0.0001), 0];
// 航向需要后续调整。。。
shipData.xbsjRotation = [(Math.PI / 180) * (messageData.course + 90), 0, 0];
shipData.xbsjRotation = [(Math.PI / 180) * (mixData.course - 90), 0, 0];
} else {
// 添加新的船只
shipDataList.push({
name: `${messageData.trackId}号船只`, // 名称
trackId: messageData.trackId, // 船只id
guid: drawShips(messageData).xbsjGuid, // 船只模型id
track_guid: addShipTrack([[toRadians(messageData.longitude), toRadians(messageData.latitude), 0]]).xbsjGuid, // 轨迹线guid,用于轨迹显隐
azimuth: messageData.azimuth, // 方位角
course: messageData.course, // 航向
latitude: messageData.latitude, // 纬度
longitude: messageData.longitude, // 经度
// 添加新的融合船只
mixShipList.push({
name: `${mixData.trackId}号船_mix`, // 名称
trackId: mixData.trackId, // 船只id
guid: drawMixShips(mixData).xbsjGuid, // 船只场景id
// 根据不同的数据类型绘制不同的轨迹线 轨迹线guid,用于轨迹显隐
track_guid: addShipTrack([[toRadians(mixData.longitude + 0.0001), toRadians(mixData.latitude + 0.0001), 0]], 3).xbsjGuid,
azimuth: mixData.azimuth, // 方位角
course: mixData.course, // 航向
latitude: mixData.latitude + 0.0001, // 纬度
longitude: mixData.longitude + 0.0001, // 经度
radarId: mixData.radarId, // 雷达Id
});
// 更新store
store.shipDataList = shipDataList;
store.mixShipList = mixShipList;
}
};

29
src/views/earthMap/edit/EarthComp.vue

@ -86,7 +86,9 @@
></AddModelWin>
<AddRoamVideo v-if="addRoamVideoShow"></AddRoamVideo>
<!-- AIS信息显示窗口 -->
<AISInfoWindow v-if="AISInfoWindowShow" :ship_guid="ship_guid" :ship_aisData="ship_aisData"></AISInfoWindow>
<AISInfoWindow v-if="AISInfoWindowShow" :ship_guid="ship_guid"></AISInfoWindow>
<!-- 跟踪船只窗口 -->
<TailAfterWindow v-if="TailAfterWindowShow"></TailAfterWindow>
</div>
</template>
@ -108,6 +110,8 @@
import WarnInfoList from '@/components/earthMap/WarnInfoList.vue';
import AISInfoDetail from '@/components/earthMap/AISInfoDetail.vue';
import AISInfoWindow from '@/components/earthMap/AISInfoWindow.vue';
import TailAfterWindow from '@/components/earthMap/TailAfterWindow.vue';
import { getRealTime } from '@/utils/date';
import $mitt from '@/utils/earthMap/mitt';
import guid from '@/utils/earthMap/guid';
@ -115,8 +119,8 @@
import { handleNodeType } from '@/utils/earthMap/handleNodeType';
import { getRandomArr, getHeigthByLonLat } from '@/utils/earthMap/earth';
import redFlag from '@/assets/earthMap/redFlag.png';
import { addModel, addPin, addViewShedRadar, addShipGroundImg, addShipTrack } from '@/utils/earthMap/earthObj';
import { drawAllShips } from '@/utils/earthMap/shipDraw';
import { addModel, addPin, addViewShedRadar, addShipTrack } from '@/utils/earthMap/earthObj';
import { drawAISShipsList, drawMixShipsList, drawRadarShipsList } from '@/utils/earthMap/shipDraw';
import hidePng from '@/assets/earthMap/hide.png';
import alarmImg from '@/assets/earthMap/alarm.gif';
import VideoFusionWin from './components/VideoFusionWin.vue';
@ -231,6 +235,7 @@ import { nextTick } from 'vue';
VideoFusionWin,
AISInfoDetail,
AISInfoWindow,
TailAfterWindow,
},
props: {
//
@ -475,12 +480,12 @@ import { nextTick } from 'vue';
PropsDrawInitShow = this.drawInitShow;
PropsKeyControlInitShow = this.keyControlInitShow;
///////////////////////////////////////////////////////////////////////////
//AIS
// AIS
AISInfoWindowShow = false;
// guid
ship_guid = '123456';
// ais
ship_aisData = {};
//
TailAfterWindowShow = false;
// id
ship_guid = '';
//
// pin: any = undefined;
@ -1154,7 +1159,13 @@ import { nextTick } from 'vue';
});
// mqtt
$mitt.on('deviceCmd', (message: any) => {
drawAllShips(message);
let data = JSON.parse(message);
//
drawRadarShipsList(data);
// AIS
drawAISShipsList(data);
//
drawMixShipsList(data);
});
}
}

531
src/views/earthMap/edit/EarthCompTest.vue

@ -13,8 +13,7 @@
</header>
</div>
<div>
<a-radio-group default-value="satellite" button-style="solid" size="small" @change="radioChange"
class="radioBtn" v-show="radioBtnShow">
<a-radio-group default-value="satellite" button-style="solid" size="small" @change="radioChange" class="radioBtn" v-show="radioBtnShow">
<a-radio-button value="satellite"> 卫星影像</a-radio-button>
<a-radio-button value="vector"> 矢量地图</a-radio-button>
</a-radio-group>
@ -30,8 +29,14 @@
<a-button @click="roamPathSet()">视频融合</a-button>
</div>
<!-- 视频融合 -->
<VideoFusionWin v-if="VideoFusionWinShow" :cameraList="cameraList" :monitorPosition="monitorPosition"
:updateModel="toItemObj.updateModel" :isUpdate="toItemObj.isUpdate" :userSave="toItemObj.userSave">
<VideoFusionWin
v-if="VideoFusionWinShow"
:cameraList="cameraList"
:monitorPosition="monitorPosition"
:updateModel="toItemObj.updateModel"
:isUpdate="toItemObj.isUpdate"
:userSave="toItemObj.userSave"
>
</VideoFusionWin>
<!-- 地标弹窗 -->
<!-- <div id="poiModal" class="poiModal" v-show="poiModalShow" ref="poiModal">
@ -50,62 +55,78 @@
</audio>
<!-- 云台控制弹窗 -->
<video-window :id="videoWindowProps.id" :visible.sync="videoWindowProps.visible" :title="videoWindowProps.title"
:videoUrl="videoWindowProps.videoUrl" :cameraIp="videoWindowProps.cameraIp"
:cameraUser="videoWindowProps.cameraUser" :cameraPwd="videoWindowProps.cameraPwd"
:isAlarm="videoWindowProps.isAlarm" :playRecord="videoWindowProps.playRecord"
:warnTime="videoWindowProps.warnTime" :warnEvent="videoWindowProps.warnEvent" />
<video-window
:id="videoWindowProps.id"
:visible.sync="videoWindowProps.visible"
:title="videoWindowProps.title"
:videoUrl="videoWindowProps.videoUrl"
:cameraIp="videoWindowProps.cameraIp"
:cameraUser="videoWindowProps.cameraUser"
:cameraPwd="videoWindowProps.cameraPwd"
:isAlarm="videoWindowProps.isAlarm"
:playRecord="videoWindowProps.playRecord"
:warnTime="videoWindowProps.warnTime"
:warnEvent="videoWindowProps.warnEvent"
/>
<!-- 左侧操作栏 -->
<Toolbar v-if="toolbarShow" :setLabelStatus="setLabelStatus"></Toolbar>
<AddModelWin v-if="addModelWinShow" :setLabelStatus="setLabelStatus" :czmObject="czmObject" :node="node"
:type="type" :lineId="lineId" :areaCode="areaCode" :areaByNodeId="areaByNodeIdModel"
:setIconByRef="setIconByRef" :el="el" :eidtId="eidtId"></AddModelWin>
<AddModelWin
v-if="addModelWinShow"
:setLabelStatus="setLabelStatus"
:czmObject="czmObject"
:node="node"
:type="type"
:lineId="lineId"
:areaCode="areaCode"
:areaByNodeId="areaByNodeIdModel"
:setIconByRef="setIconByRef"
:el="el"
:eidtId="eidtId"
></AddModelWin>
<AddRoamVideo v-if="addRoamVideoShow"></AddRoamVideo>
</div>
</template>
<script setup lang="ts">
import { toRefs, watch, nextTick, ref, reactive, onMounted, getCurrentInstance, onBeforeUnmount } from 'vue';
import sceneTree from '@/assets/earthMap/resjson/sc.json';
import { defHttp } from '/@/utils/http/axios';
import earthUtils from '@/utils/earthMap/earth';
import _ from 'lodash';
import $ from 'jquery';
import { useUserStore } from '/@/store/modules/user';
import { useEarthMapStore } from '/@/store/modules/earthMap';
import Toolbar from '@/components/earthMap/Toolbar.vue';
import AddModelWin from '@/components/earthMap/toolbar/AddModelWin.vue';
import AddRoamVideo from '@/components/earthMap/toolbar/AddRoamVideo.vue';
import VideoSplitScreen from '@/components/earthMap/VideoSplitScreen.vue';
import VideoWindow from '@/components/earthMap/VideoWindow.vue';
import WarnInfoList from '@/components/earthMap/WarnInfoList.vue';
import { getRealTime } from '@/utils/date';
import $mitt from '@/utils/earthMap/mitt';
import { drawInit } from '@/utils/earthMap/earthDraw';
import { keyControlInit } from '@/utils/earthMap/keyControlInit';
import redFlag from '@/assets/earthMap/redFlag.png';
import { addModel, addPin, addViewShedRadar, addShipGroundImg, addShipTrack } from '@/utils/earthMap/earthObj';
import { drawAllShips } from '@/utils/earthMap/shipDraw';
import hidePng from '@/assets/earthMap/hide.png';
import alarmImg from '@/assets/earthMap/alarm.gif';
import VideoFusionWin from './components/VideoFusionWin.vue';
import { useMessage } from "/@/hooks/web/useMessage";
import circleDot2 from '@/assets/earthMap/circleDot2.png';
import circleDot1 from '@/assets/earthMap/circleDot1.png';
import circleDot3 from '@/assets/earthMap/circleDot3.png';
const userStore = useUserStore();
const store = useEarthMapStore();
const { proxy } = getCurrentInstance();
const { createMessage } = useMessage();
const audio = ref() //
const props = defineProps({
});
class HandleNodeType {
import { toRefs, watch, nextTick, ref, reactive, onMounted, getCurrentInstance, onBeforeUnmount } from 'vue';
import sceneTree from '@/assets/earthMap/resjson/sc.json';
import { defHttp } from '/@/utils/http/axios';
import earthUtils from '@/utils/earthMap/earth';
import _ from 'lodash';
import $ from 'jquery';
import { useUserStore } from '/@/store/modules/user';
import { useEarthMapStore } from '/@/store/modules/earthMap';
import Toolbar from '@/components/earthMap/Toolbar.vue';
import AddModelWin from '@/components/earthMap/toolbar/AddModelWin.vue';
import AddRoamVideo from '@/components/earthMap/toolbar/AddRoamVideo.vue';
import VideoSplitScreen from '@/components/earthMap/VideoSplitScreen.vue';
import VideoWindow from '@/components/earthMap/VideoWindow.vue';
import WarnInfoList from '@/components/earthMap/WarnInfoList.vue';
import { getRealTime } from '@/utils/date';
import $mitt from '@/utils/earthMap/mitt';
import { drawInit } from '@/utils/earthMap/earthDraw';
import { keyControlInit } from '@/utils/earthMap/keyControlInit';
import redFlag from '@/assets/earthMap/redFlag.png';
import { addModel, addPin, addViewShedRadar, addShipTrack } from '@/utils/earthMap/earthObj';
import { drawAllShips } from '@/utils/earthMap/shipDraw';
import hidePng from '@/assets/earthMap/hide.png';
import alarmImg from '@/assets/earthMap/alarm.gif';
import VideoFusionWin from './components/VideoFusionWin.vue';
import { useMessage } from '/@/hooks/web/useMessage';
import circleDot2 from '@/assets/earthMap/circleDot2.png';
import circleDot1 from '@/assets/earthMap/circleDot1.png';
import circleDot3 from '@/assets/earthMap/circleDot3.png';
const userStore = useUserStore();
const store = useEarthMapStore();
const { proxy } = getCurrentInstance();
const { createMessage } = useMessage();
const audio = ref(); //
const props = defineProps({});
class HandleNodeType {
#sn;
#sensorCallback;
#modelCallback;
@ -166,33 +187,33 @@ class HandleNodeType {
this.#default ? this.#default() : null;
}
}
}
}
function setClassEl(setClassEl1, setClassEl2, checked) {
function setClassEl(setClassEl1, setClassEl2, checked) {
if (checked) {
setClassChecked(setClassEl1, setClassEl2);
} else {
setClassNoChecked(setClassEl1, setClassEl2);
}
}
}
function setClassChecked(setClassEl1, setClassEl2) {
function setClassChecked(setClassEl1, setClassEl2) {
// node.checkStatus = 'checked'
// node.disabled = ''
//*** */
setClassEl1.className = 'xbsj-checkbox-wrapper xbsj-checkbox-wrapper-checked xbsj-checkbox-default';
setClassEl2.className = 'xbsj-checkbox xbsj-checkbox-checked';
}
}
function setClassNoChecked(setClassEl1, setClassEl2) {
function setClassNoChecked(setClassEl1, setClassEl2) {
// node.checkStatus = ''
// node.disabled = 'disabled'
//
setClassEl1.className = 'xbsj-checkbox-wrapper xbsj-checkbox-wrapper-disabled xbsj-checkbox-default';
setClassEl2.className = 'xbsj-checkbox xbsj-checkbox-disabled';
}
}
function classMutationObserver(el, el1, checkedStauts, id) {
function classMutationObserver(el, el1, checkedStauts, id) {
// or
const config = { attributes: true, childList: false, subtree: false };
const callback1 = function (mutationsList, observer) {
@ -218,9 +239,9 @@ function classMutationObserver(el, el1, checkedStauts, id) {
const observer1 = new MutationObserver(callback1);
//
observer1.observe(el, config);
}
}
function disabledMutationObserver(el) {
function disabledMutationObserver(el) {
const config = { attributes: true, childList: false, subtree: false };
const callback1 = function (mutationsList, observer) {
const el1 = mutationsList[0];
@ -231,23 +252,22 @@ function disabledMutationObserver(el) {
const observe1 = new MutationObserver(callback1);
//
observe1.observe(el, config);
}
//
let _earth: any = undefined;
let _viewer: any = undefined;
}
let earthTitle = '态势监控一张图';
const realTime: any = ref('……');
// EarthCesiumvue使线
//
let _earth: any = undefined;
let _viewer: any = undefined;
_earthUI = undefined;
_pin = undefined;
let _handler: any = undefined;
sceneTree: any = sceneTree;
let earthTitle = '态势监控一张图';
const realTime: any = ref('……');
// EarthCesiumvue使线
_earthUI = undefined;
_pin = undefined;
let _handler: any = undefined;
sceneTree: any = sceneTree;
let url: any = {
let url: any = {
queryLabelList: 'military/msMapLabel/queryLabelAndDeviceList',
queryLineList: 'military/msMapLine/list',
queryCameraInfo: 'military/camera/site/getCameraInfoForEarth',
@ -295,20 +315,20 @@ let url: any = {
perimeterControl: '/third/api/perimeterControl',
//
sendRadarAlarmByWebSocket: '/military/warn/sendRadarAlarmByWebSocket',
};
let cameraData: any = {};
const cameraModalShow = ref(false);
poiModalShow = false;
let radioBtnShow = ref(true);
glmId: any = [];
let spinning = ref(false);
let earthChangeSpin = ref(false);
let websock: any = [];
let timer: any = null; //
let timer2: any = null; //
// -
let alarmTrackClearTimer: any = null;
let videoWindowProps: any = ref({
};
let cameraData: any = {};
const cameraModalShow = ref(false);
poiModalShow = false;
let radioBtnShow = ref(true);
glmId: any = [];
let spinning = ref(false);
let earthChangeSpin = ref(false);
let websock: any = [];
let timer: any = null; //
let timer2: any = null; //
// -
let alarmTrackClearTimer: any = null;
let videoWindowProps: any = ref({
visible: false,
isAlarm: false,
id: '',
@ -327,62 +347,59 @@ let videoWindowProps: any = ref({
warnType: 0,
warnContent: '',
},
});
// - ref
let sceneTreeOldRefValue = '';
let sceneInfo: any = null;
// By Ref
nodeConfigByRef = new Map();
let nodeCheckedByRef = new Map();
let areaByNodeId = new Map();
let statusByNodeId = new Map();
let imgByRef = new Map();
let radarAlarmDataMap = new Map();
wbUnifiedResponse = false;
let hostDeviceMapById = new Map();
let alarmInfoMap = new Map();
toolbarShow = false;
//addModelWin
addModelWinShow = false;
czmObject: any = null;
node: any = null;
type = '';
lineId = '';
areaCode = '';
areaByNodeIdModel = '';
el: any = null;
eidtId: any = null;
//addroamVideo
addRoamVideoShow = false;
//
const VideoFusionWinShow = ref(false);
//
toItemObj: any = {
});
// - ref
let sceneTreeOldRefValue = '';
let sceneInfo: any = null;
// By Ref
nodeConfigByRef = new Map();
let nodeCheckedByRef = new Map();
let areaByNodeId = new Map();
let statusByNodeId = new Map();
let imgByRef = new Map();
let radarAlarmDataMap = new Map();
wbUnifiedResponse = false;
let hostDeviceMapById = new Map();
let alarmInfoMap = new Map();
toolbarShow = false;
//addModelWin
addModelWinShow = false;
czmObject: any = null;
node: any = null;
type = '';
lineId = '';
areaCode = '';
areaByNodeIdModel = '';
el: any = null;
eidtId: any = null;
//addroamVideo
addRoamVideoShow = false;
//
const VideoFusionWinShow = ref(false);
//
toItemObj: any = {
updateModel: {},
isUpdate: true,
userSave: {},
};
//
domKey: any = '';
//
cameraList: any = [];
//
monitorPosition: any = [];
onMounted(async () => {
window.XE.ready().then(() => {
};
//
domKey: any = '';
//
cameraList: any = [];
//
monitorPosition: any = [];
onMounted(async () => {
window.XE.ready()
.then(() => {
//
return window.XE.HTML.loadJS('/earthsdk/XbsjEarth-Plugins/plottingSymbol/plottingSymbol.js');
}).then(async () => {
})
.then(async () => {
//
await initMap()
await initMap();
//
window.guid = guid;
//
@ -394,8 +411,9 @@ onMounted(async () => {
return false;
};
return true
}).then(() => {
return true;
})
.then(() => {
// DOM jq
nextTick(() => {
{
@ -414,7 +432,7 @@ onMounted(async () => {
});
}
});
return true
return true;
})
.then(() => {
//
@ -428,20 +446,19 @@ onMounted(async () => {
radarAlarmTimeOutCheck();
}, 6 * 1000);
}
return true
return true;
});
});
})
//
function initMap() {
//
function initMap() {
_earth = new window.XE.Earth('earthContainer');
window.$earth = _earth;
window.$viewer = _viewer = window.$earth.czm.viewer;
}
}
//
async function fly() {
//
async function fly() {
let position, rotation, viewDistance, duration;
const sceneId = userStore.userInfo?.sceneId;
await defHttp
@ -476,16 +493,15 @@ async function fly() {
_earth.camera.flyTo(position, viewDistance, rotation, duration);
};
});
}
}
/**
/**
* 保存更改的ref到模型和后台数据中;
* @param {Object} model 当前模型
* @param {string} newRef 新的ref
* @param {string} oldRef 旧的ref
*/
const changeRef = _.debounce(function (model, newRef, oldRef) {
const changeRef = _.debounce(function (model, newRef, oldRef) {
// ref
if (newRef !== oldRef && oldRef !== '') {
//
@ -520,32 +536,28 @@ const changeRef = _.debounce(function (model, newRef, oldRef) {
})
.run();
}
}, 150);
function handleNodeType(sn) {
}, 150);
function handleNodeType(sn) {
return new HandleNodeType(sn);
}
//
function guid() {
}
//
function guid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = (Math.random() * 16) | 0,
v = c == 'x' ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
}
}
//
function roamPathSet() {
//
function roamPathSet() {
//
VideoFusionWinShow.value = true;
//
cameraModalShow.value = false;
}
function listenMittHandler(earthUI = null) {
}
function listenMittHandler(earthUI = null) {
$mitt.on('winShow', function (e: any) {
VideoFusionWinShow.value = e;
});
@ -599,21 +611,18 @@ function listenMittHandler(earthUI = null) {
$mitt.on('deviceCmd', (message: any) => {
drawAllShips(message);
});
}
}
// /
function showAlarmPin(show) {
// /
function showAlarmPin(show) {
alarmInfoMap.forEach((item, _index) => {
item.pin.show = show;
item.pin._div.hidden = !show;
item.scanline.show = !show;
});
}
// on-change-title 使 lodash.debounce ()
const handleChangeTitle = _.debounce(function (options) {
}
// on-change-title 使 lodash.debounce ()
const handleChangeTitle = _.debounce(function (options) {
const sn = options.item._inner.sn;
const newTitle = options.title;
@ -680,10 +689,10 @@ const handleChangeTitle = _.debounce(function (options) {
});
})
.run();
}, 150);
}, 150);
//
function handlerModelDelete(url, params) {
//
function handlerModelDelete(url, params) {
// return deleteAction(url, params).then((res) => {
return defHttp
.delete(
@ -700,16 +709,16 @@ function handlerModelDelete(url, params) {
createMessage.error('删除失败');
}
});
}
}
//
function getRealTime() {
//
function getRealTime() {
timer2 = setInterval(() => {
realTime.value = getRealTime();
}, 1000);
}
}
const cameraPositionChange = _.debounce(
const cameraPositionChange = _.debounce(
(that) => {
let height = window.$earth.camera.position[2];
if (height < 100) {
@ -722,9 +731,9 @@ const cameraPositionChange = _.debounce(
},
500,
{ maxWait: 1000 }
);
//
function setIconByRef(ref, el) {
);
//
function setIconByRef(ref, el) {
const status = statusByNodeId.get(ref);
if (status != undefined && status != null) {
let img = imgByRef.get(ref);
@ -745,9 +754,9 @@ function setIconByRef(ref, el) {
}
img.setAttribute('style', 'width:16px;height:16px;margin-top:7px');
}
}
}
function getRandomArr(arr, count) {
function getRandomArr(arr, count) {
//
var shuffled = arr.slice(0),
i = arr.length,
@ -762,9 +771,9 @@ function getRandomArr(arr, count) {
shuffled[i] = temp;
}
return shuffled.slice(min);
}
}
function setLoginPoint(data: any) {
function setLoginPoint(data: any) {
let position = [data.lon, data.lat, 0];
let rotation = [data.rotationX, data.rotationY, data.rotationZ];
let viewDistance = data.viewDistance;
@ -799,11 +808,10 @@ function setLoginPoint(data: any) {
pin.onclick = function () {
_earth.camera.flyTo(position, viewDistance, rotation, duration);
};
}
}
//
function getCameraInfo(models, type) {
//
function getCameraInfo(models, type) {
return new Promise((resolve, reject) => {
//线
defHttp.get({ url: url.queryCameraInfo }, { isTransformResponse: false }).then(async (res) => {
@ -815,10 +823,9 @@ function getCameraInfo(models, type) {
}
});
});
}
}
function getPatrolRouteInfo(models) {
function getPatrolRouteInfo(models) {
return new Promise((resolve, reject) => {
//线
defHttp.get({ url: url.queryPatrolRouteInfo }, { isTransformResponse: false }).then(async (res) => {
@ -852,15 +859,14 @@ function getPatrolRouteInfo(models) {
}
});
});
}
}
function removeHandler() {
function removeHandler() {
_handler.removeInputAction(window.Cesium.ScreenSpaceEventType.MOUSE_MOVE); //
_handler.removeInputAction(window.Cesium.ScreenSpaceEventType.LEFT_CLICK); //
}
}
function radioChange(e) {
function radioChange(e) {
loadingStatus();
if (`${e.target.value}` == 'satellite') {
window.$earth.sceneTree.$refs.satellite.czmObject.show = true;
@ -869,29 +875,28 @@ function radioChange(e) {
window.$earth.sceneTree.$refs.vector.czmObject.show = true;
window.$earth.sceneTree.$refs.satellite.czmObject.show = false;
}
}
}
function radioChangeBtnShow(callback) {
function radioChangeBtnShow(callback) {
radioBtnShow.value = !radioBtnShow.value;
callback(radioBtnShow.value); //
}
function loadingStatus() {
}
function loadingStatus() {
earthChangeSpin.value = !earthChangeSpin.value; //
setTimeout(() => {
earthChangeSpin.value = !earthChangeSpin.value; //3
}, 3000);
}
}
function keepAlive() {
defHttp.get({ url: url.keepAlive }, { isTransformResponse: false }).then((res) => { });
}
function keepAlive() {
defHttp.get({ url: url.keepAlive }, { isTransformResponse: false }).then((res) => {});
}
function closeClient() {
function closeClient() {
chrome.call('close');
}
}
function setLabelStatus(device, labelCode, id, code) {
function setLabelStatus(device, labelCode, id, code) {
const args = {
device: device,
code: code, // 0- 1- 2- 3-
@ -954,8 +959,8 @@ function setLabelStatus(device, labelCode, id, code) {
return err;
});
}
}
function getAllModelInfo(models) {
}
function getAllModelInfo(models) {
return new Promise((resolve, reject) => {
//
@ -1148,9 +1153,9 @@ function getAllModelInfo(models) {
}
});
});
}
//
function showOrHideChild(clickNode, earthUI, parentChecked) {
}
//
function showOrHideChild(clickNode, earthUI, parentChecked) {
const childs = clickNode.children;
if (childs && childs.length > 0) {
for (const child of childs) {
@ -1184,12 +1189,10 @@ function showOrHideChild(clickNode, earthUI, parentChecked) {
}
}
}
}
}
/* websocket-start */
function initWebSocket(configName) {
/* websocket-start */
function initWebSocket(configName) {
if ('WebSocket' in window) {
let url = '';
switch (configName) {
@ -1220,14 +1223,14 @@ function initWebSocket(configName) {
} else {
console.log('当前浏览器不支持websocket,请更换浏览器!');
}
}
function websocketonopen(e) {
}
function websocketonopen(e) {
console.log('WebSocket连接成功');
}
function websocketonerror(e) {
}
function websocketonerror(e) {
console.log('WebSocket连接发生错误');
}
let loreadAlarmInfo = _.debounce(
}
let loreadAlarmInfo = _.debounce(
(url, eventSerialNum) => {
defHttp
.get(
@ -1248,8 +1251,8 @@ let loreadAlarmInfo = _.debounce(
},
2000,
{ maxWait: 3000, trailing: true }
);
async function websocketonmessage(e) {
);
async function websocketonmessage(e) {
//
var data = eval('(' + e.data + ')');
const cesium = window.Cesium;
@ -1571,12 +1574,12 @@ async function websocketonmessage(e) {
} else if (data.cmd == 'eventPublish') {
window.getEventData();
}
}
function websocketclose(e) {
}
function websocketclose(e) {
console.log('connection closed (' + e.code + ')');
createMessage.warn('websocket连接已断开', 3);
}
function websocketdosend(configName) {
}
function websocketdosend(configName) {
//
spinning.value = !spinning.value; //
console.log('websock[configName]', websock[configName]);
@ -1599,11 +1602,10 @@ function websocketdosend(configName) {
spinning.value = !spinning.value; //
}, 3000);
}
}
/* websocket-end */
}
/* websocket-end */
function radarAlarmTimeOutCheck() {
function radarAlarmTimeOutCheck() {
const now = Date.now();
const timeout = 5 * 60 * 1000;
//
@ -1616,8 +1618,8 @@ function radarAlarmTimeOutCheck() {
clearAlarmModel(key);
}
});
}
function clearRadarAlarmModel(radarAlarmDataMap, eventNum) {
}
function clearRadarAlarmModel(radarAlarmDataMap, eventNum) {
if (radarAlarmDataMap.has(eventNum)) {
let alarmData = radarAlarmDataMap.get(eventNum);
for (let target of alarmData.target) {
@ -1629,8 +1631,8 @@ function clearRadarAlarmModel(radarAlarmDataMap, eventNum) {
}
radarAlarmDataMap.delete(eventNum);
}
}
function clearAlarmModel(eventNum) {
}
function clearAlarmModel(eventNum) {
// let alarmInfoMapCopy = alarmInfoMap;
// let radarAlarmDataMapCopy = radarAlarmDataMap;
if (alarmInfoMap.has(eventNum)) {
@ -1642,11 +1644,10 @@ function clearAlarmModel(eventNum) {
alarmInfoMap.delete(eventNum);
}
clearRadarAlarmModel(radarAlarmDataMap, eventNum);
}
}
//
async function getHeigthByLonLat(lon = 88.8296258, lat = 27.4061859) {
//
async function getHeigthByLonLat(lon = 88.8296258, lat = 27.4061859) {
var positions = [window.Cesium.Cartographic.fromDegrees(lon, lat)];
// var promise = Cesium.sampleTerrain(this._viewer.terrainProvider, 13, positions);
var promise = window.Cesium.sampleTerrainMostDetailed(_viewer.terrainProvider, positions);
@ -1659,9 +1660,9 @@ async function getHeigthByLonLat(lon = 88.8296258, lat = 27.4061859) {
/* var terCartographic = new Cesium.Cartographic(1.5503694435245020004000376611976, 0.47832817936864542131039019315313, 0)
var terHigh = this._viewer.scene.globe.getHeight(terCartographic);
return terHigh; */
}
}
function cloneModel(modelObject: any) {
function cloneModel(modelObject: any) {
if (modelObject.czmObject.xbsjType === 'Model') {
const modelConfig = {
ref: '',
@ -1713,8 +1714,8 @@ function cloneModel(modelObject: any) {
}
// return model
}
function cloneShamNode(oldRef, id, title) {
}
function cloneShamNode(oldRef, id, title) {
const shamNode = window.$earth.sceneTree.$refs['node_' + oldRef];
const newShamNode = {
ref: 'node_' + id,
@ -1724,8 +1725,8 @@ function cloneShamNode(oldRef, id, title) {
};
// that.currentModel = response.result
shamNode.parent.children.push(newShamNode);
}
function getAreaCode(item) {
}
function getAreaCode(item) {
const currentRef = item._inner.sn.ref;
if (!areaByNodeId.has(currentRef)) {
if (item.parent) {
@ -1734,9 +1735,9 @@ function getAreaCode(item) {
} else {
return areaByNodeId.get(currentRef);
}
}
}
function setAllLabelStatus(selectRef, item, wbUnifiedResponse) {
function setAllLabelStatus(selectRef, item, wbUnifiedResponse) {
//
if (selectRef.startsWith('monitor')) {
let grandsons: any = [];
@ -1801,7 +1802,8 @@ function setAllLabelStatus(selectRef, item, wbUnifiedResponse) {
{
url: url.setDefenseArea,
params: args,
}, { isTransformResponse: false }
},
{ isTransformResponse: false }
)
.then((response) => {
if (!response.success) {
@ -1886,12 +1888,10 @@ function setAllLabelStatus(selectRef, item, wbUnifiedResponse) {
// break
}
}
}
}
//
onBeforeUnmount(() => {
//
onBeforeUnmount(() => {
// vue
_earth = _earth && _earth.destroy();
websocketclose(null);
@ -1899,6 +1899,5 @@ onBeforeUnmount(() => {
clearInterval(timer);
clearInterval(timer2);
clearInterval(alarmTrackClearTimer);
})
});
</script>

1683
src/views/earthMap/show/EarthComp.vue

File diff suppressed because it is too large

8
src/views/military/modules/earthMap/camera/MsCameraSiteList.vue

@ -2,7 +2,7 @@
视频监控点位管理
目录位置三维地图管理 -> 视频监控点位管理
功能概述所在场景下的防区的监控杆位置名称
功能概述所在场景下的防区的监控杆位置名称 已弃用
-->
<template>
<div>
@ -251,9 +251,11 @@
{
url: '/military/msMapLine/list',
params: {
sceneId: userStore.userInfo?.sceneId + "*"
sceneId: userStore.userInfo?.sceneId + '*',
},
},{ isTransformResponse: false })
},
{ isTransformResponse: false }
)
.then((res) => {
if (res.success) {
lineSelect.value = res.result.records;

Loading…
Cancel
Save