|
|
@ -2,7 +2,7 @@ |
|
|
|
* @Author: Fuyuu 1805498209@qq.com |
|
|
|
* @Date: 2024-01-03 17:42:49 |
|
|
|
* @LastEditors: Fuyuu 1805498209@qq.com |
|
|
|
* @LastEditTime: 2024-01-24 14:16:26 |
|
|
|
* @LastEditTime: 2024-01-26 16:30:29 |
|
|
|
* @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
|
|
|
|
*/ |
|
|
@ -41,12 +41,10 @@ const drawShips = function (shipItem, shipType) { |
|
|
|
let options = { |
|
|
|
id: shipItem.trackId, // 船只ID 通过雷达获取
|
|
|
|
name: shipType == 1 ? `${shipItem.trackId}号船_radar` : shipType == 2 ? `${shipItem.trackId}号船_ais` : `${shipItem.trackId}号船_mix`, // 船只名称 具有区分不同数据类型船只的特殊标识
|
|
|
|
modelUrl: |
|
|
|
shipType == 1 |
|
|
|
? window._CONFIG['domianURL'] + '/sys/common/static/greenShip.gltf' |
|
|
|
: shipType == 2 |
|
|
|
? window._CONFIG['domianURL'] + '/sys/common/static/yellowShip.gltf' |
|
|
|
: window._CONFIG['domianURL'] + '/sys/common/static/tongyongchuan.gltf', // 模型资源路径
|
|
|
|
modelToViewer: [ |
|
|
|
[0, 3999], |
|
|
|
[4000, 24999], |
|
|
|
], // 不同相机高度范围数组 1:1~3999 2:4000~24999 3:25000~
|
|
|
|
position: [ |
|
|
|
toRadians(shipType == 3 ? shipItem.longitude + 0.0001 : shipType == 2 ? shipItem.longitude + 0.00005 : shipItem.longitude), |
|
|
|
toRadians(shipType == 3 ? shipItem.latitude + 0.0001 : shipType == 2 ? shipItem.latitude + 0.00005 : shipItem.latitude), |
|
|
@ -64,7 +62,7 @@ const drawShips = function (shipItem, shipType) { |
|
|
|
* 绘制地球上所有雷达船只 |
|
|
|
* @param radarItem 雷达船只数据 |
|
|
|
*/ |
|
|
|
export const drawRadarShipsList = function (radarItem, isShowTrack) { |
|
|
|
export const drawRadarShipsList = function (radarItem, isShowRadarTrack, isShowRadarShip) { |
|
|
|
// 接收到的单个雷达船只信息
|
|
|
|
let radarData = radarItem.radarTrack; |
|
|
|
// 获取store中的雷达船只数据列表
|
|
|
@ -84,17 +82,21 @@ export const drawRadarShipsList = function (radarItem, isShowTrack) { |
|
|
|
// 新增船只轨迹信息
|
|
|
|
let trackData = addShipTrack([[toRadians(radarData.longitude), toRadians(radarData.latitude), 0]], 1); |
|
|
|
// 根据按钮状态决定轨迹显隐
|
|
|
|
trackData.show = isShowTrack; |
|
|
|
trackData.show = isShowRadarTrack; |
|
|
|
// 新增船只模型信息
|
|
|
|
let modelData = drawShips(radarData, 1); |
|
|
|
// 根据按钮状态决定模型显隐
|
|
|
|
modelData.show = isShowRadarShip; |
|
|
|
// 将时间戳转换
|
|
|
|
let time = new Date(Math.floor(radarData.timestamp / 1000) * 1000) |
|
|
|
let time = new Date(Math.floor(radarData.timestamp / 1000) * 1000); |
|
|
|
// 添加新的雷达船只
|
|
|
|
radarShipList.push({ |
|
|
|
name: `${radarData.trackId}号船_radar`, // 名称
|
|
|
|
trackId: radarData.trackId, // 船只id
|
|
|
|
guid: drawShips(radarData, 1).xbsjGuid, // 船只场景id
|
|
|
|
guid: modelData.xbsjGuid, // 船只场景id
|
|
|
|
track_guid: trackData.xbsjGuid, // 根据不同的数据类型绘制不同的轨迹线 轨迹线guid,用于轨迹显隐
|
|
|
|
radarId: radarData.radarId, // 雷达ID
|
|
|
|
timestamp: `${time.getFullYear()}-${time.getMonth()+1}-${time.getDate()} ${time.getHours()}:${time.getMinutes()}:${time.getSeconds()}`, // 时间
|
|
|
|
timestamp: `${time.getFullYear()}-${time.getMonth() + 1}-${time.getDate()} ${time.getHours()}:${time.getMinutes()}:${time.getSeconds()}`, // 时间
|
|
|
|
azimuth: radarData.azimuth, // 方位角
|
|
|
|
course: radarData.course, // 航向
|
|
|
|
latitude: radarData.latitude, // 纬度
|
|
|
@ -113,7 +115,7 @@ export const drawRadarShipsList = function (radarItem, isShowTrack) { |
|
|
|
* 绘制地球上所有ais船只(暂无AIS数据,使用雷达数据进行模拟) |
|
|
|
* @param aisItem AIS船只数据 |
|
|
|
*/ |
|
|
|
export const drawAISShipsList = function (aisItem, isShowTrack) { |
|
|
|
export const drawAISShipsList = function (aisItem, isShowAISTrack, isShowAISShip) { |
|
|
|
// 接收到的单个ais船只信息
|
|
|
|
let aisData = aisItem.radarTrack; |
|
|
|
// 获取store中的ais船只数据列表
|
|
|
@ -135,7 +137,11 @@ export const drawAISShipsList = function (aisItem, isShowTrack) { |
|
|
|
// 新增船只轨迹信息
|
|
|
|
let trackData = addShipTrack([[toRadians(aisData.longitude + 0.00005), toRadians(aisData.latitude + 0.00005), 0]], 2); |
|
|
|
// 根据按钮状态决定轨迹显隐
|
|
|
|
trackData.show = isShowTrack; |
|
|
|
trackData.show = isShowAISTrack; |
|
|
|
// 新增船只模型信息
|
|
|
|
let modelData = drawShips(aisData, 2); |
|
|
|
// 根据按钮状态决定模型显隐
|
|
|
|
modelData.show = isShowAISShip; |
|
|
|
// 添加新的ais船只
|
|
|
|
aisShipList.push({ |
|
|
|
name: `${aisData.trackId}号船_ais`, // 名称
|
|
|
@ -154,7 +160,7 @@ export const drawAISShipsList = function (aisItem, isShowTrack) { |
|
|
|
nationality: 'CN', // 国籍
|
|
|
|
pre_arrival_time: '2024-01-08 14:40:11', // 预到时间
|
|
|
|
trackId: aisData.trackId, // 船只id
|
|
|
|
guid: drawShips(aisData, 2).xbsjGuid, // 船只场景id
|
|
|
|
guid: modelData.xbsjGuid, // 船只场景id
|
|
|
|
track_guid: trackData.xbsjGuid, // 根据不同的数据类型绘制不同的轨迹线 轨迹线guid,用于轨迹显隐
|
|
|
|
azimuth: aisData.azimuth, // 方位角
|
|
|
|
course: aisData.course, // 航向
|
|
|
@ -171,7 +177,7 @@ export const drawAISShipsList = function (aisItem, isShowTrack) { |
|
|
|
* 绘制地球上所有融合船只(暂无融合数据,使用雷达数据进行模拟) |
|
|
|
* @param mixItem 融合船只数据 |
|
|
|
*/ |
|
|
|
export const drawMixShipsList = function (mixItem, isShowTrack) { |
|
|
|
export const drawMixShipsList = function (mixItem, isShowMixTrack, isShowMixShip) { |
|
|
|
// 接收到的单个融合船只信息
|
|
|
|
let mixData = mixItem.radarTrack; |
|
|
|
// 获取store中的融合船只数据列表
|
|
|
@ -191,12 +197,16 @@ export const drawMixShipsList = function (mixItem, isShowTrack) { |
|
|
|
// 新增船只轨迹信息
|
|
|
|
let trackData = addShipTrack([[toRadians(mixData.longitude + 0.0001), toRadians(mixData.latitude + 0.0001), 0]], 3); |
|
|
|
// 根据按钮状态决定轨迹显隐
|
|
|
|
trackData.show = isShowTrack; |
|
|
|
trackData.show = isShowMixTrack; |
|
|
|
// 新增船只模型信息
|
|
|
|
let modelData = drawShips(mixData, 3); |
|
|
|
// 根据按钮状态决定模型显隐
|
|
|
|
modelData.show = isShowMixShip; |
|
|
|
// 添加新的融合船只
|
|
|
|
mixShipList.push({ |
|
|
|
name: `${mixData.trackId}号船_mix`, // 名称
|
|
|
|
trackId: mixData.trackId, // 船只id
|
|
|
|
guid: drawShips(mixData, 3).xbsjGuid, // 船只场景id
|
|
|
|
guid: modelData.xbsjGuid, // 船只场景id
|
|
|
|
track_guid: trackData.xbsjGuid, // 根据不同的数据类型绘制不同的轨迹线 轨迹线guid,用于轨迹显隐
|
|
|
|
azimuth: mixData.azimuth, // 方位角
|
|
|
|
course: mixData.course, // 航向
|
|
|
|