Browse Source

修改飞入方法,与区域管理关联

master
DIAMOND 1 year ago
parent
commit
724cae0b56
  1. 58
      src/views/earthMap/edit/EarthComp.vue
  2. 2
      src/views/earthMap/show/EarthComp.vue
  3. 4
      src/views/military/modules/ai/monitorArea/DtMonitorAreaList.vue
  4. 12
      src/views/military/modules/ai/monitorArea/components/DtMonitorAreaForm.vue
  5. 117
      src/views/military/modules/ai/monitorArea/components/VCEarthViewer.vue

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

@ -813,14 +813,19 @@
// this.createRealTimeObj(earthUI) // this.createRealTimeObj(earthUI)
// //
this.listenMouseHandler(earthUI); this.listenMouseHandler(earthUI);
//
await this.getSceneInfo();
// //
// await this.getSceneInfo();
//
await this.newfly();
//线 //线
await this.createBBHLine(earthUI); await this.createBBHLine(earthUI);
// // //
await this.fly(); // await this.fly();
// //
// console.log("earthUI",earthUI); // console.log("earthUI",earthUI);
@ -841,6 +846,40 @@
}); });
} }
// 20231222
async newfly(){
let position, rotation, viewDistance, duration;
const sceneId = this.userStore.userInfo?.sceneId;
await defHttp.get({
url: '/military/msMapScene/list',
params: {
pageNo: 1,
pageSize: 999,
sceneCode: sceneId + "*",
column: 'sceneCode',
order: 'asc',
}
}, { isTransformResponse: false }).then((response) => {
console.log("newfly",response);
// 屿
this.sceneInfo = response.result.records;
return response.result.records;
}).then((res)=>{
//
position = [res[0].cameraLon, res[0].cameraLat, res[0].cameraAltitude];
rotation = [res[0].rotationX, res[0].rotationY, res[0].rotationZ];
viewDistance = res[0].viewDistance;
duration = res[0].duration;
this._earth.camera.flyTo(position, viewDistance, rotation, duration);
//
window.$flyTo = this.flyTo = () => {
this._earth.camera.flyTo(position, viewDistance, rotation, duration);
};
})
}
//
async fly() { async fly() {
let position, rotation, viewDistance, duration; let position, rotation, viewDistance, duration;
// //
@ -935,6 +974,7 @@
}; };
} }
//
async getSceneInfo() { async getSceneInfo() {
// //
// const orgCode = Vue.ls.get(USER_INFO).orgCode; // const orgCode = Vue.ls.get(USER_INFO).orgCode;
@ -956,7 +996,7 @@
order: 'asc', order: 'asc',
} }
}, { isTransformResponse: false }).then((response) => { }, { isTransformResponse: false }).then((response) => {
// console.log("response",response); console.log("总部",response);
const records = response.result.records const records = response.result.records
// 屿 // 屿
@ -965,7 +1005,7 @@
}); });
} else { } else {
await defHttp.get({ url: '/military/msMapScene/queryByOrgCode', params: { orgCode: orgCode } }, { isTransformResponse: false }).then((response) => { await defHttp.get({ url: '/military/msMapScene/queryByOrgCode', params: { orgCode: orgCode } }, { isTransformResponse: false }).then((response) => {
console.log("岛屿",response);
const data = response.result; const data = response.result;
// 屿Object // 屿Object
this.sceneInfo = data; this.sceneInfo = data;
@ -998,7 +1038,7 @@
} }
} }
/* 使用async/await 处理异步方法顺序执行。成功的操作放到try里,失败的放在catch里 */ /* 使用async/await 处理异步方法顺序执行。成功的操作放到try里,失败的放在catch里 */
async createBBHLine(earthUI =null) { async createBBHLine(earthUI= null) {
let models: any = null; let models: any = null;
let type = 0; let type = 0;
if (!(this.sceneInfo instanceof Array)) { if (!(this.sceneInfo instanceof Array)) {
@ -1014,7 +1054,7 @@
models = { models = {
ref: 'main', ref: 'main',
expand: true, expand: true,
title: '岛礁', title: this.sceneInfo[0].sceneName,
children: [], children: [],
}; };
for (let record of this.sceneInfo) { for (let record of this.sceneInfo) {
@ -1029,7 +1069,7 @@
}); });
} }
} }
// console.log('models',models); console.log('models',models);
// //
// console.log(""); // console.log("");

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

@ -993,7 +993,7 @@
}); });
} }
} }
// console.log('models',models); console.log('models1',models);
// //
// console.log(""); // console.log("");

4
src/views/military/modules/ai/monitorArea/DtMonitorAreaList.vue

@ -102,7 +102,8 @@
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import DtMonitorDeviceList from './areaDevice/DtMonitorDeviceList.vue'; import DtMonitorDeviceList from './areaDevice/DtMonitorDeviceList.vue';
import MonitorAreaLinkageList from './linkageDevice/MonitorAreaLinkageList.vue'; import MonitorAreaLinkageList from './linkageDevice/MonitorAreaLinkageList.vue';
import { useUserStore } from '/@/store/modules/user';
const userStore = useUserStore();
const deviceInfo = ref(); // const deviceInfo = ref(); //
// //
const AreaDeviceShow = ref(false); const AreaDeviceShow = ref(false);
@ -131,6 +132,7 @@
fixed: 'right', fixed: 'right',
}, },
beforeFetch: (params) => { beforeFetch: (params) => {
// params.sceneId = userStore.userInfo?.sceneId + '*';
return Object.assign(params, queryParam); return Object.assign(params, queryParam);
}, },
}, },

12
src/views/military/modules/ai/monitorArea/components/DtMonitorAreaForm.vue

@ -78,7 +78,7 @@
<!-- <EarthMapModal v-model:areaData="formData.areaData" v-model:drawData="formData.drawData" :visible="mapVisible" <!-- <EarthMapModal v-model:areaData="formData.areaData" v-model:drawData="formData.drawData" :visible="mapVisible"
:enableTile="false" :enablePointer="true" @closeWin="() => { mapVisible = false }" @clearAreaData="clearAreaData"> :enableTile="false" :enablePointer="true" @closeWin="() => { mapVisible = false }" @clearAreaData="clearAreaData">
</EarthMapModal> --> </EarthMapModal> -->
<VCEarthViewer v-if="mapVisible" v-model:areaData="formData.areaData" v-model:drawData="formData.drawData"> </VCEarthViewer> <VCEarthViewer v-if="mapVisible" :sceneId="formData.sceneId" v-model:areaData="formData.areaData" v-model:drawData="formData.drawData"> </VCEarthViewer>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -90,15 +90,14 @@
import { Form, notification } from 'ant-design-vue'; import { Form, notification } from 'ant-design-vue';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import type { Rule } from 'ant-design-vue/es/form'; import type { Rule } from 'ant-design-vue/es/form';
import { useUserStore } from '/@/store/modules/user';
import VCEarthViewer from './VCEarthViewer.vue'; import VCEarthViewer from './VCEarthViewer.vue';
import Area from '@/views/military/modules/ai/MonitorArea/components/Area.vue'; import Area from '@/views/military/modules/ai/MonitorArea/components/Area.vue';
import AreaByXbsjEarthUI from '@/views/military/modules/ai/MonitorArea/components/AreaByXbsjEarthUI.vue'; import AreaByXbsjEarthUI from '@/views/military/modules/ai/MonitorArea/components/AreaByXbsjEarthUI.vue';
import EarthMapModal from '/@/views/military/modules/earthMap/scene/model/mapModel/EarthMapModal.vue'; import EarthMapModal from '/@/views/military/modules/earthMap/scene/model/mapModel/EarthMapModal.vue';
import locationPng from '@/assets/images/getLocation.png'; import locationPng from '@/assets/images/getLocation.png';
import { FormatPainterOutlined } from '@ant-design/icons-vue'; const userStore = useUserStore();
// //
const modelCodeList: any = ref([]); const modelCodeList: any = ref([]);
// //
@ -125,6 +124,7 @@
field3: '', field3: '',
sysAreaCode: '', sysAreaCode: '',
sysUnitCode: '', sysUnitCode: '',
sceneId:'',
}); });
const { createMessage } = useMessage(); const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } }); const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
@ -173,7 +173,9 @@
* 新增 * 新增
*/ */
function add() { function add() {
edit({}); edit({
sceneId: userStore.userInfo?.sceneId
});
} }
/** /**

117
src/views/military/modules/ai/monitorArea/components/VCEarthViewer.vue

@ -65,6 +65,11 @@ const props = defineProps({
type: String, type: String,
default: '', default: '',
}, },
//
sceneId: {
type: String,
default: '',
},
}); });
// //
const mapURL = import.meta.env.VITE_GLOB_EARTHMAP_URL + import.meta.env.VITE_GLOB_SATELLITE_URL const mapURL = import.meta.env.VITE_GLOB_EARTHMAP_URL + import.meta.env.VITE_GLOB_SATELLITE_URL
@ -424,6 +429,8 @@ watch(
); );
onMounted(async () => { onMounted(async () => {
// console.log("pops",props);
await loadingData(); await loadingData();
}); });
@ -435,112 +442,52 @@ function handleCancel() {
} }
async function drawingsReadyDefault(e) { async function drawingsReadyDefault(e) {
let viewer = e.viewer let viewer = e.viewer
console.log("viewer", viewer); // console.log("viewer", viewer);
console.log("e", e); // console.log("e", e);
$viewer.value = viewer; $viewer.value = viewer;
// //
$viewer.value.cesiumWidget.screenSpaceEventHandler.removeInputAction(window.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK); $viewer.value.cesiumWidget.screenSpaceEventHandler.removeInputAction(window.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
//
await getSceneInfo();
// //
await fly(viewer); await fly(viewer);
} }
//
async function getSceneInfo() {
//
const orgCode: any = userStore.userInfo?.orgCode;
// this.orgCode = orgCode;
// console.log("orgCode",orgCode);
// 3屿 /**
if (orgCode.length == 3) { *
// * @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;
await defHttp.get({ await defHttp.get({
url: '/military/msMapScene/list', url: '/military/msMapScene/list',
params: { params: {
pageNo: 1, sceneCode: sceneId,
pageSize: 999,
sceneCode: "00001-00001*",
column: 'sysOrgCode',
order: 'asc',
} }
}, { isTransformResponse: false }).then((response) => { }, { isTransformResponse: false }).then((response) => {
// console.log("response",response); let res = response.result.records[0]
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;
//
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);
}
// //
let CartesianPosition = ellipsoid.cartographicToCartesian({ let CartesianPosition = ellipsoid.cartographicToCartesian({
longitude: position[0], longitude: res.cameraLon,
latitude: position[1], latitude: res.cameraLat,
height: position[2] height: res.cameraAltitude,
}); });
// console.log("CartesianPosition", CartesianPosition); // console.log("CartesianPosition", CartesianPosition);
// console.log("response", response);
viewer.camera.position = CartesianPosition viewer.camera.position = CartesianPosition
} });
else {
//
}
} }
function drawEvt(e, viewer) { function drawEvt(e, viewer) {
const restoreCursor = getComputedStyle(viewer.canvas).cursor; const restoreCursor = getComputedStyle(viewer.canvas).cursor;
if (e.finished) { if (e.finished) {

Loading…
Cancel
Save