forked from integrated_whb/integrated_whb_vue
历史轨迹增加计算移动速度逻辑
parent
5122d11abb
commit
e92fd99252
|
@ -697,7 +697,9 @@ var CustomCesium;
|
|||
l = new S.Tween({x: a._value.x, y: a._value.y, z: a._value.z});
|
||||
l.to({x: o.x, y: o.y, z: o.z}, n), l.onUpdate((({x: e, y: t, z: i}) => {
|
||||
let n = new Cesium.Cartesian3(e, t, i);
|
||||
if(this.entity){
|
||||
this.entity.position = n;
|
||||
}
|
||||
let a = r.Cartesian3ToWGS84(this.icy.viewer, n);
|
||||
s(a)
|
||||
})), l.start()
|
||||
|
@ -1387,7 +1389,9 @@ var CustomCesium;
|
|||
a = new S.Tween({x: n._value.x, y: n._value.y, z: n._value.z});
|
||||
a.to({x: s.x, y: s.y, z: s.z}, r), a.onUpdate((({x: e, y: t, z: i}) => {
|
||||
let r = new Cesium.Cartesian3(e, t, i);
|
||||
this.entity.position = r
|
||||
if(this.entity){
|
||||
this.entity.position = r;
|
||||
}
|
||||
})), a.start()
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,8 @@ const {
|
|||
currentData[0],
|
||||
currentData[1]
|
||||
)
|
||||
: undefined
|
||||
: undefined,
|
||||
1000 / data.speed
|
||||
);
|
||||
},
|
||||
});
|
||||
|
@ -156,10 +157,10 @@ const fnGetData = async () => {
|
|||
ElMessage.warning("请选择时间");
|
||||
return;
|
||||
}
|
||||
hadleDestroy();
|
||||
data.positions = [];
|
||||
pause();
|
||||
reset();
|
||||
hadleDestroy();
|
||||
await getTrajectoriesData(
|
||||
data.searchForm.personnel,
|
||||
data.searchForm.dates[0],
|
||||
|
@ -210,6 +211,7 @@ const fnPause = () => {
|
|||
|
||||
onBeforeUnmount(() => {
|
||||
console.log("onBeforeUnmount");
|
||||
pause();
|
||||
hadleDestroy();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</template>
|
||||
<script setup>
|
||||
import { reactive } from "vue";
|
||||
import { reduction } from "../js/map";
|
||||
import { flyTo, reduction } from "../js/map";
|
||||
import { useFullscreen } from "@vueuse/core";
|
||||
|
||||
const { isFullscreen, toggle } = useFullscreen();
|
||||
|
@ -44,6 +44,7 @@ const data = reactive({
|
|||
.href,
|
||||
check: false,
|
||||
label: "返回中心点",
|
||||
action: flyTo,
|
||||
},
|
||||
{
|
||||
img: new URL("/src/assets/images/map/rico3.png", import.meta.url).href,
|
||||
|
|
|
@ -100,16 +100,16 @@ export const showLine = (positions) => {
|
|||
* entityArr 接收人物模型分组
|
||||
* billboardArr 接收人物铭牌分组
|
||||
*/
|
||||
export const peoMovement = (id, lon, lat, height, alt) => {
|
||||
export const peoMovement = (id, lon, lat, height, alt,speed) => {
|
||||
entityArr.children.forEach((b, m) => {
|
||||
if (b.entity._id === id) {
|
||||
b.updateAngle([alt, 0, 0]); // 改变人物朝向
|
||||
b.animationMove(lon, lat, height, 1000, () => {}); // 人物平滑移动
|
||||
b.animationMove(lon, lat, height, speed, () => {}); // 人物平滑移动
|
||||
billboardArr.children[m].animationMove(
|
||||
lon,
|
||||
lat,
|
||||
Number(Number(height) + 2.05),
|
||||
1000
|
||||
speed
|
||||
); // 人物铭牌平滑移动
|
||||
} else {
|
||||
console.log(`人物移动数据错误`);
|
||||
|
|
|
@ -18,6 +18,8 @@ import { getVideoManagerView } from "@/request/video_manager.js";
|
|||
const loadMap = 3;
|
||||
let $entityTransparent = [];
|
||||
const clickModel = new Map();
|
||||
let centerLon = 0;
|
||||
let centerLat = 0;
|
||||
export const initMap = (corp) => {
|
||||
window.$scene = new window.CustomCesium.Scene(
|
||||
"map",
|
||||
|
@ -36,7 +38,9 @@ export const initMap = (corp) => {
|
|||
),
|
||||
});
|
||||
const [wgsLat, wgsLon] = bd09ToWgs84(corp.LATITUDE, corp.LONGITUDE);
|
||||
flyTo(wgsLon, wgsLat);
|
||||
centerLon = wgsLon;
|
||||
centerLat = wgsLat;
|
||||
flyTo();
|
||||
// 亮度设置
|
||||
const stages = window.$icy.viewer.scene.postProcessStages;
|
||||
window.$icy.viewer.scene.brightness =
|
||||
|
@ -127,13 +131,12 @@ const transformlng = (lng, lat) => {
|
|||
return ret;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const flyTo = (lng, lat) => {
|
||||
export const flyTo = () => {
|
||||
window.$carmer.flyTo({
|
||||
// 视角飞入
|
||||
maxHeight: 1500,
|
||||
time: 1,
|
||||
position: [lng, lat, 200],
|
||||
position: [centerLon, centerLat, 200],
|
||||
angle: [0, -60, 0],
|
||||
});
|
||||
};
|
||||
|
|
|
@ -25,6 +25,11 @@ const { open, close } = useWebSocket(
|
|||
const msg = unzip(event.data);
|
||||
const decodedMsg = JSON.parse(decodeURIComponent(msg));
|
||||
if (decodedMsg.msg === "000") {
|
||||
console.log(decodedMsg.data);
|
||||
// decodedMsg.data = [
|
||||
// "8379,119.447708695738,39.918422294137,-232.39015608699566,0.12000000000000001,,1,0,大大",
|
||||
// "9979,119.447611105937,39.918443403627,-343.76932562302534,0.12000000000000001,9979,1,0,测试一",
|
||||
// ];
|
||||
peoMovement(decodedMsg.data);
|
||||
}
|
||||
if (decodedMsg.msg === "006") {
|
||||
|
@ -32,7 +37,7 @@ const { open, close } = useWebSocket(
|
|||
}
|
||||
},
|
||||
onDisconnected: () => {
|
||||
if (entityArr) {
|
||||
if (entityArr && entityArr.children) {
|
||||
entityArr.children.forEach((e) => {
|
||||
e.destroy();
|
||||
});
|
||||
|
@ -159,25 +164,32 @@ const unzip = (b64Data) => {
|
|||
function peoMovement(moveData) {
|
||||
const map = new Map();
|
||||
moveData.forEach((i, n) => {
|
||||
let addFlag = false;
|
||||
map.set(i.split(",")[0], n);
|
||||
if (!entityArr || !entityArr.children) {
|
||||
addFlag = true;
|
||||
entityArr = new window.CustomCesium.GroupModel("人物模型");
|
||||
billboardArr = new window.CustomCesium.GroupModel("人物姓名");
|
||||
const entity = i.split(",");
|
||||
console.log(entity[0], 111111);
|
||||
addEntity(entity[0], entity[8], entity[1], entity[2], entity[4]);
|
||||
addBillboard(entity[0], entity[8], entity[1], entity[2], entity[4]);
|
||||
}
|
||||
|
||||
entityArr.children.forEach((b, m) => {
|
||||
if (!b.entity) {
|
||||
addFlag = true;
|
||||
const entity = i.split(",");
|
||||
console.log(entity[0], 2222222);
|
||||
addEntity(entity[0], entity[8], entity[1], entity[2], entity[4]);
|
||||
addBillboard(entity[0], entity[8], entity[1], entity[2], entity[4]);
|
||||
return;
|
||||
}
|
||||
const index = map.get(b.entity._id);
|
||||
const item = moveData[index];
|
||||
if (index !== undefined) {
|
||||
const entity = i.split(",");
|
||||
if (index !== undefined && entity[0] === b.entity._id) {
|
||||
addFlag = true;
|
||||
const itData = item.split(","); // itData下标:0=【卡号】,(1,2,4)=【lon,lat,alt】,3=【人物朝向角度】,5=【工号】,6=【当前楼层】
|
||||
if (itData[4] != null && itData.length >= 6) {
|
||||
b.updateAngle([itData[3], 0, 0]); // 改变人物朝向
|
||||
|
@ -185,25 +197,28 @@ function peoMovement(moveData) {
|
|||
itData[1],
|
||||
itData[2],
|
||||
Number(itData[4]),
|
||||
2000,
|
||||
1000,
|
||||
() => {}
|
||||
); // 人物平滑移动
|
||||
billboardArr.children[m].animationMove(
|
||||
itData[1],
|
||||
itData[2],
|
||||
Number(Number(itData[4]) + 2.05),
|
||||
2000
|
||||
1000
|
||||
); // 人物铭牌平滑移动
|
||||
} else {
|
||||
console.log(`人物移动数据错误,错误参数:'${item}'`);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
});
|
||||
|
||||
if (!addFlag) {
|
||||
const entity = i.split(",");
|
||||
console.log(entity[0], 333333);
|
||||
addEntity(entity[0], entity[8], entity[1], entity[2], entity[4]);
|
||||
addBillboard(entity[0], entity[8], entity[1], entity[2], entity[4]);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export const handleFence = async (b) => {
|
||||
|
|
|
@ -234,13 +234,13 @@
|
|||
<el-radio v-model="data.form.FOURTYPE" :label="1">
|
||||
平面四色图
|
||||
</el-radio>
|
||||
<el-radio
|
||||
v-model="data.form.FOURTYPE"
|
||||
:label="2"
|
||||
@change="fnProhibitSelect"
|
||||
>
|
||||
3D图
|
||||
</el-radio>
|
||||
<!-- <el-radio-->
|
||||
<!-- v-model="data.form.FOURTYPE"-->
|
||||
<!-- :label="2"-->
|
||||
<!-- @change="fnProhibitSelect"-->
|
||||
<!-- >-->
|
||||
<!-- 3D图-->
|
||||
<!-- </el-radio>-->
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-if="data.form.FOURTYPE === 1" :span="24">
|
||||
|
|
Loading…
Reference in New Issue