|
|
@ -814,40 +814,19 @@ |
|
|
|
//监听鼠标事件 |
|
|
|
this.listenMouseHandler(earthUI); |
|
|
|
|
|
|
|
|
|
|
|
// 获取部门信息 //已弃用 |
|
|
|
// await this.getSceneInfo(); |
|
|
|
// 新的飞入方法 |
|
|
|
await this.newfly(); |
|
|
|
// 飞入方法 |
|
|
|
await this.fly(); |
|
|
|
|
|
|
|
//加载地图线路资源 |
|
|
|
await this.createBBHLine(earthUI); |
|
|
|
|
|
|
|
//飞入地点 //已弃用 |
|
|
|
// await this.fly(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//创建工具栏 |
|
|
|
// console.log("earthUI",earthUI); |
|
|
|
|
|
|
|
this.toolbarShow = true |
|
|
|
// window.$flyTo = this.flyTo |
|
|
|
// console.log("window.$flyTo",window); |
|
|
|
// console.log("this.flyTo",this); |
|
|
|
// earthUI.showPropertyWindow( |
|
|
|
// { |
|
|
|
// flyTo: this.flyTo, |
|
|
|
// setLabelStatus: this.setLabelStatus, |
|
|
|
// }, |
|
|
|
// { |
|
|
|
// component: Toolbar, |
|
|
|
// } |
|
|
|
// ); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
//新的飞入方法 20231222 |
|
|
|
async newfly(){ |
|
|
|
//飞入方法 20231222 |
|
|
|
async fly(){ |
|
|
|
let position, rotation, viewDistance, duration; |
|
|
|
const sceneId = this.userStore.userInfo?.sceneId; |
|
|
|
await defHttp.get({ |
|
|
@ -855,8 +834,8 @@ |
|
|
|
params: { |
|
|
|
pageNo: 1, |
|
|
|
pageSize: 999, |
|
|
|
sceneCode: sceneId + "*", |
|
|
|
column: 'sceneCode', |
|
|
|
sceneId: sceneId + "*", |
|
|
|
column: 'sceneId', |
|
|
|
order: 'asc', |
|
|
|
} |
|
|
|
}, { isTransformResponse: false }).then((response) => { |
|
|
@ -879,63 +858,6 @@ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//已弃用 |
|
|
|
async fly() { |
|
|
|
let position, rotation, viewDistance, duration; |
|
|
|
// |
|
|
|
let parentData = |
|
|
|
this.sceneInfo instanceof Array |
|
|
|
? this.sceneInfo.filter((item, index) => { |
|
|
|
return item.sceneCode == "00001-00001"; |
|
|
|
}) |
|
|
|
: this.sceneInfo; |
|
|
|
//过滤掉总部层级的 |
|
|
|
let data = this.sceneInfo instanceof Array ? |
|
|
|
this.sceneInfo.filter((item, index) => { |
|
|
|
return item.sceneCode.length > 3; |
|
|
|
}) |
|
|
|
: this.sceneInfo; |
|
|
|
// console.log("data",data); |
|
|
|
// console.log("this.sceneInfo",this.sceneInfo); |
|
|
|
if (data) { |
|
|
|
if (!(data instanceof Array)) { |
|
|
|
// debugger; |
|
|
|
// 各岛礁 |
|
|
|
// position = [data.lon, data.lat, data.altitude]; |
|
|
|
position = [data.cameraLon, data.cameraLat, data.cameraAltitude]; |
|
|
|
rotation = [data.rotationX, data.rotationY, data.rotationZ]; |
|
|
|
viewDistance = data.viewDistance; |
|
|
|
duration = data.duration ? data.duration : 0; |
|
|
|
this._earth.camera.flyTo(position, viewDistance, rotation, duration); |
|
|
|
// 地图复原事件 |
|
|
|
window.$flyTo = this.flyTo = () => { |
|
|
|
this._earth.camera.flyTo(position, viewDistance, rotation, duration); |
|
|
|
}; |
|
|
|
} else { |
|
|
|
// 总指挥中心 |
|
|
|
// position = [parentData[0].lon, parentData[0].lat, parentData[0].altitude]; |
|
|
|
position = [parentData[0].cameraLon, parentData[0].cameraLat, parentData[0].cameraAltitude]; |
|
|
|
rotation = [parentData[0].rotationX, parentData[0].rotationY, parentData[0].rotationZ]; |
|
|
|
viewDistance = parentData[0].viewDistance; |
|
|
|
duration = parentData[0].duration; |
|
|
|
// 先飞入到能看见红旗 |
|
|
|
this._earth.camera.flyTo(position, viewDistance, rotation, duration); |
|
|
|
// 地图复原事件 |
|
|
|
window.$flyTo = this.flyTo = () => { |
|
|
|
this._earth.camera.flyTo(position, viewDistance, rotation, duration); |
|
|
|
}; |
|
|
|
for (let record of data) { |
|
|
|
if (record.sceneCode.length == 11) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
// 设置红旗 |
|
|
|
this.setLoginPoint(record); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 没权限人员控制 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
setLoginPoint(data) { |
|
|
|
let position = [data.lon, data.lat, 0]; |
|
|
@ -974,45 +896,6 @@ |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
//已弃用 |
|
|
|
async getSceneInfo() { |
|
|
|
// 登录人部门信息 |
|
|
|
// const orgCode = Vue.ls.get(USER_INFO).orgCode; |
|
|
|
// const userStore = useUserStore() |
|
|
|
const orgCode = this.userStore.userInfo?.orgCode; |
|
|
|
this.orgCode = orgCode; |
|
|
|
// console.log("orgCode",orgCode); |
|
|
|
|
|
|
|
// 登录人部门信息长度为3则为总部,否则为岛屿 |
|
|
|
if (orgCode.length == 3) { |
|
|
|
// 总部 |
|
|
|
await defHttp.get({ |
|
|
|
url: '/military/msMapScene/list', |
|
|
|
params: { |
|
|
|
pageNo: 1, |
|
|
|
pageSize: 999, |
|
|
|
sceneCode: "00001-00001*", |
|
|
|
column: 'sysOrgCode', |
|
|
|
order: 'asc', |
|
|
|
} |
|
|
|
}, { isTransformResponse: false }).then((response) => { |
|
|
|
console.log("总部",response); |
|
|
|
|
|
|
|
const records = response.result.records |
|
|
|
// 设置岛屿信息为数组 |
|
|
|
this.sceneInfo = records; |
|
|
|
return records; |
|
|
|
}); |
|
|
|
} else { |
|
|
|
await defHttp.get({ url: '/military/msMapScene/queryByOrgCode', params: { orgCode: orgCode } }, { isTransformResponse: false }).then((response) => { |
|
|
|
console.log("岛屿",response); |
|
|
|
const data = response.result; |
|
|
|
// 设置岛屿信息为Object |
|
|
|
this.sceneInfo = data; |
|
|
|
return data; |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//设置按钮颜色状态 |
|
|
|
setIconByRef(ref, el) { |
|
|
@ -1039,36 +922,27 @@ |
|
|
|
} |
|
|
|
/* 使用async/await 处理异步方法顺序执行。成功的操作放到try里,失败的放在catch里 */ |
|
|
|
async createBBHLine(earthUI= null) { |
|
|
|
let models: any = null; |
|
|
|
let type = 0; |
|
|
|
if (!(this.sceneInfo instanceof Array)) { |
|
|
|
type = 2; |
|
|
|
models = { |
|
|
|
ref: 'areas', |
|
|
|
expand: true, |
|
|
|
title: '岛礁', |
|
|
|
children: [], |
|
|
|
}; |
|
|
|
} else { |
|
|
|
type = 1; |
|
|
|
models = { |
|
|
|
console.log("MyScene",this.userStore.userInfo?.sceneId); |
|
|
|
let type = 1; //** |
|
|
|
|
|
|
|
let models: any = { |
|
|
|
ref: 'main', |
|
|
|
expand: true, |
|
|
|
title: this.sceneInfo[0].sceneName, |
|
|
|
children: [], |
|
|
|
}; |
|
|
|
} |
|
|
|
for (let record of this.sceneInfo) { |
|
|
|
if (record.parentSceneCode.length == 5) { |
|
|
|
if (record.sceneId == this.userStore.userInfo?.sceneId) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
models.children.push({ |
|
|
|
ref: record.sysOrgCode, |
|
|
|
ref: record.sceneId, |
|
|
|
expand: false, |
|
|
|
title: record.sceneName, |
|
|
|
children: [], |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
console.log('models',models); |
|
|
|
|
|
|
|
// 加载区域 |
|
|
@ -1774,6 +1648,8 @@ |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
//请求地图标志信息 |
|
|
|
defHttp.get({ url: this.url.queryLabelList }, { isTransformResponse: false }).then(async (res) => { |
|
|
|
console.log("请求地图标志信息",res); |
|
|
|
|
|
|
|
if (res.success) { |
|
|
|
const labelItems = await this.setLabel(res.result, models, type); |
|
|
|
resolve(labelItems); |
|
|
|