|
|
@ -65,6 +65,11 @@ const props = defineProps({ |
|
|
|
type: String, |
|
|
|
default: '', |
|
|
|
}, |
|
|
|
// 所属场景数据 |
|
|
|
sceneId: { |
|
|
|
type: String, |
|
|
|
default: '', |
|
|
|
}, |
|
|
|
}); |
|
|
|
//地图提供 |
|
|
|
const mapURL = import.meta.env.VITE_GLOB_EARTHMAP_URL + import.meta.env.VITE_GLOB_SATELLITE_URL |
|
|
@ -424,6 +429,8 @@ watch( |
|
|
|
); |
|
|
|
|
|
|
|
onMounted(async () => { |
|
|
|
// console.log("pops",props); |
|
|
|
|
|
|
|
await loadingData(); |
|
|
|
}); |
|
|
|
|
|
|
@ -435,112 +442,52 @@ function handleCancel() { |
|
|
|
} |
|
|
|
async function drawingsReadyDefault(e) { |
|
|
|
let viewer = e.viewer |
|
|
|
console.log("viewer", viewer); |
|
|
|
console.log("e", e); |
|
|
|
// console.log("viewer", viewer); |
|
|
|
// console.log("e", e); |
|
|
|
$viewer.value = viewer; |
|
|
|
// 取消双击旋转事件 |
|
|
|
$viewer.value.cesiumWidget.screenSpaceEventHandler.removeInputAction(window.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK); |
|
|
|
|
|
|
|
// 获取部门信息 |
|
|
|
await getSceneInfo(); |
|
|
|
// 飞入事件 |
|
|
|
await fly(viewer); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取部门信息 |
|
|
|
async function getSceneInfo() { |
|
|
|
// 登录人部门信息 |
|
|
|
const orgCode: any = 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",response); |
|
|
|
const records = response.result.records |
|
|
|
// 设置岛屿信息为数组 |
|
|
|
sceneInfo.value = records; |
|
|
|
return records; |
|
|
|
}); |
|
|
|
} else { |
|
|
|
await defHttp.get({ |
|
|
|
url: '/military/msMapScene/queryByOrgCode', |
|
|
|
params: { orgCode: orgCode } |
|
|
|
}, { isTransformResponse: false }) |
|
|
|
.then((response) => { |
|
|
|
const data = response.result; |
|
|
|
// 设置岛屿信息为Object |
|
|
|
sceneInfo.value = data; |
|
|
|
return data; |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//飞入 |
|
|
|
function fly(viewer: any = null) { |
|
|
|
let position, rotation, viewDistance, duration; |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* @description 飞入 |
|
|
|
* 新建则飞入用户所属场景 |
|
|
|
* 编辑则飞入区域所属场景 |
|
|
|
* |
|
|
|
**/ |
|
|
|
async function fly(viewer: any = null) { |
|
|
|
//判断sceneId |
|
|
|
// const sceneId: any = props.sceneId == '' ? userStore.userInfo?.sceneId : props.sceneId; |
|
|
|
const sceneId: any = props.sceneId; |
|
|
|
// 获取当前坐标系标准 |
|
|
|
let ellipsoid = viewer.scene.globe.ellipsoid; |
|
|
|
|
|
|
|
// |
|
|
|
let parentData = |
|
|
|
sceneInfo.value instanceof Array |
|
|
|
? sceneInfo.value.filter((item, index) => { |
|
|
|
return item.sceneCode == "00001-00001"; |
|
|
|
}) |
|
|
|
: sceneInfo.value; |
|
|
|
//过滤掉总部层级的 |
|
|
|
let data = sceneInfo.value instanceof Array ? |
|
|
|
sceneInfo.value.filter((item, index) => { |
|
|
|
return item.sceneCode.length > 3; |
|
|
|
}) |
|
|
|
: sceneInfo.value; |
|
|
|
// console.log("data",data); |
|
|
|
// console.log("this.sceneInfo",this.sceneInfo); |
|
|
|
if (data) { |
|
|
|
if (!(data instanceof Array)) { |
|
|
|
// debugger; |
|
|
|
// 各岛礁 |
|
|
|
position = [data.lon, data.lat, data.altitude]; |
|
|
|
rotation = [data.rotationX, data.rotationY, data.rotationZ]; |
|
|
|
viewDistance = data.viewDistance; |
|
|
|
duration = data.duration ? data.duration : 0; |
|
|
|
// viewer.camera.flyTo(position, viewDistance, rotation, duration); |
|
|
|
// console.log("data", position, viewDistance, rotation, duration); |
|
|
|
} else { |
|
|
|
// 总指挥中心 |
|
|
|
position = [parentData[0].lon, parentData[0].lat, parentData[0].altitude]; |
|
|
|
rotation = [parentData[0].rotationX, parentData[0].rotationY, parentData[0].rotationZ]; |
|
|
|
viewDistance = parentData[0].viewDistance; |
|
|
|
duration = parentData[0].duration; |
|
|
|
// console.log("data", position, viewDistance, rotation, duration); |
|
|
|
await defHttp.get({ |
|
|
|
url: '/military/msMapScene/list', |
|
|
|
params: { |
|
|
|
sceneCode: sceneId, |
|
|
|
} |
|
|
|
}, { isTransformResponse: false }).then((response) => { |
|
|
|
let res = response.result.records[0] |
|
|
|
// 根据坐标系标准,将地理坐标转换为笛卡尔坐标 |
|
|
|
let CartesianPosition = ellipsoid.cartographicToCartesian({ |
|
|
|
longitude: position[0], |
|
|
|
latitude: position[1], |
|
|
|
height: position[2] |
|
|
|
longitude: res.cameraLon, |
|
|
|
latitude: res.cameraLat, |
|
|
|
height: res.cameraAltitude, |
|
|
|
}); |
|
|
|
// console.log("CartesianPosition", CartesianPosition); |
|
|
|
// console.log("response", response); |
|
|
|
viewer.camera.position = CartesianPosition |
|
|
|
} |
|
|
|
else { |
|
|
|
// 没权限人员控制 |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function drawEvt(e, viewer) { |
|
|
|
const restoreCursor = getComputedStyle(viewer.canvas).cursor; |
|
|
|
if (e.finished) { |
|
|
|