fix:调整大屏车辆打点,跟车地图中心点修改,视频调试

This commit is contained in:
SunTao 2024-12-04 09:50:55 +08:00
parent 7b745c6f4c
commit 4e8fd26ced
5 changed files with 159 additions and 115 deletions

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com
* @Date: 2024-10-14 10:46:23
* @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-12-03 10:56:51
* @LastEditTime: 2024-12-04 09:16:07
* @FilePath: \znxjxt-ui\src\components\map\fssm-map.vue
* @Description: 公共地图
-->

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com
* @Date: 2024-10-17 11:34:00
* @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-12-03 13:03:48
* @LastEditTime: 2024-12-04 09:28:41
* @FilePath: \znxjxt-ui\src\views\big-screen\index.vue
* @Description: 大屏首页
-->
@ -495,6 +495,10 @@ export default {
//
carMapPointSource: null,
//
carPointList: [],
// features
mapPointFeatures: [],
};
},
created() {
@ -767,17 +771,6 @@ export default {
//
type: "icon",
});
//
// feature.setStyle([
// new Style({
// image: new Icon({
// crossOrigin: "anonymous",
// src: logo,
// //
// scale: 0.05,
// }),
// }),
// ]);
features.push(feature);
});
const clusterSource = new Cluster({
@ -1018,6 +1011,8 @@ export default {
// 线
if (feature.getProperties().type === "line") {
console.log(feature, "线段参数");
} else if (feature.getProperties().type === "carPoint") {
console.log(feature, "小车点位");
} else {
if (features.length === 1) {
//
@ -1028,7 +1023,7 @@ export default {
//
this.screenImage = selectFeature.get("data");
this.showImageDialog = true;
console.log(selectFeature.get("data"));
// console.log(selectFeature.get("data"));
} else {
//
//
@ -1101,6 +1096,8 @@ export default {
//
const data = { type: "carLocation", status: false };
this.$ws.send(data);
this.carPointList = [];
this.mapPointFeatures = [];
//
this.showIconList = false;
//
@ -1222,20 +1219,19 @@ export default {
* @return {*}
*/
handleMessage() {
this.$ws.on("message", (item) => {
if (item.type === "carPosition") {
if (!this.carMapPointSource) {
this.drawCarMapPoint(item.data);
} else {
this.$ws.on("message", (itemMessage) => {
if (itemMessage.type === "carPosition") {
if (this.carPointList.includes(itemMessage.data.entityId)) {
//
const currentLocation = this.carMapPointSource
.getFeatures()[0]
.getGeometry()
.getCoordinates();
const targetLocation = item.data.location;
this.carMapPointSource.getFeatures().forEach((item) => {
if (item.get("data") === itemMessage.data.entityId) {
const currentLocation = item.getGeometry().getCoordinates();
const targetLocation = itemMessage.data.location;
//
const dx = (targetLocation[0] * 1 - currentLocation[0] * 1) / 100;
const dy = (targetLocation[1] * 1 - currentLocation[1] * 1) / 100;
const dx =
(targetLocation[0] * 1 - currentLocation[0] * 1) / 100;
const dy =
(targetLocation[1] * 1 - currentLocation[1] * 1) / 100;
//
let count = 0;
// ,10ms,100,1
@ -1251,9 +1247,9 @@ export default {
const y = currentLocation[1] * 1 + dy * count;
//
const [features] = this.carMapPointSource.getFeatures();
features.setGeometry(new Point([x, y]));
features.setStyle([
// const [features] = this.carMapPointSource.getFeatures();
item.setGeometry(new Point([x, y]));
item.setStyle([
new Style({
image: new Icon({
crossOrigin: "anonymous",
@ -1261,12 +1257,18 @@ export default {
//
scale: 0.04,
// ,180*π
rotation: (item.data.direction - 90) * (Math.PI / 180),
rotation:
(itemMessage.data.direction - 90) * (Math.PI / 180),
}),
}),
]);
}, 10);
}
});
} else {
this.carPointList.push(itemMessage.data.entityId);
this.drawCarMapPoint(itemMessage.data);
}
}
});
},
@ -1277,10 +1279,10 @@ export default {
* @return {void}
*/
drawCarMapPoint(item) {
const features = [];
// const features = [];
const feature = new Feature({
geometry: new Point(item.location),
data: item,
data: item.entityId,
type: "carPoint",
});
//
@ -1296,9 +1298,9 @@ export default {
}),
}),
]);
features.push(feature);
this.mapPointFeatures.push(feature);
this.carMapPointSource = new VectorSource({
features,
features: this.mapPointFeatures,
});
const carMapPointLayer = new VectorLayer({
source: this.carMapPointSource,

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com
* @Date: 2024-11-15 13:14:03
* @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-12-03 14:32:34
* @LastEditTime: 2024-12-04 09:48:03
* @FilePath: \znxjxt-ui\src\views\big-screen\overview-components\components\inspection-follow.vue
* @Description: 总览大屏-巡检车辆-跟车弹窗
-->
@ -28,10 +28,20 @@ export default {
components: {
FssmMap,
},
props: {
dialogItem: {
type: Object,
default: () => {},
},
},
data() {
return {
//
carLayerSource: null,
carMapPointSource: null,
//
carPointList: [],
// features
mapPointFeatures: [],
//
defectLayerSource: null,
};
@ -45,21 +55,19 @@ export default {
* @return {*}
*/
handleMessage() {
this.$ws.on("message", (item) => {
if (item.type === "carPosition") {
if (!this.carMapPointSource) {
this.drawCarMapPoint(item.data);
} else {
this.$ws.on("message", (itemMessage) => {
if (itemMessage.type === "carPosition") {
if (this.carPointList.includes(itemMessage.data.entityId)) {
//
const currentLocation = this.carMapPointSource
.getFeatures()[0]
.getGeometry()
.getCoordinates();
const targetLocation = item.data.location;
this.carMapPointSource.getFeatures().forEach((item) => {
if (item.get("data") === itemMessage.data.entityId) {
const currentLocation = item.getGeometry().getCoordinates();
const targetLocation = itemMessage.data.location;
//
const dx = (targetLocation[0] * 1 - currentLocation[0] * 1) / 100;
const dy = (targetLocation[1] * 1 - currentLocation[1] * 1) / 100;
const dx =
(targetLocation[0] * 1 - currentLocation[0] * 1) / 100;
const dy =
(targetLocation[1] * 1 - currentLocation[1] * 1) / 100;
//
let count = 0;
// ,10ms,100,1
@ -73,32 +81,57 @@ export default {
//
const x = currentLocation[0] * 1 + dx * count;
const y = currentLocation[1] * 1 + dy * count;
//
const [features] = this.carMapPointSource.getFeatures();
features.setGeometry(new Point([x, y]));
features.setStyle([
// const [features] = this.carMapPointSource.getFeatures();
item.setGeometry(new Point([x, y]));
item.setStyle([
new Style({
image: new Icon({
crossOrigin: "anonymous",
src: logo,
//
scale: 0.03,
scale: 0.04,
// ,180*π
rotation: (item.data.direction - 90) * (Math.PI / 180),
rotation:
(itemMessage.data.direction - 90) * (Math.PI / 180),
}),
}),
]);
}, 10);
}
} else if (item.type === "defect") {
});
} else {
this.carPointList.push(itemMessage.data.entityId);
this.drawCarMapPoint(itemMessage.data);
//
if (this.dialogItem.extId === itemMessage.data.entityId) {
this.$nextTick(() => {
const map = this.$refs.carMap.instance.get("map");
map.getView().setCenter(itemMessage.data.location);
});
}
}
} else if (itemMessage.type === "defect") {
if (!this.defectLayerSource) {
this.drawDefectMapPoint(item.data);
this.drawDefectMapPoint(itemMessage.data);
} else {
const feature = new Feature({
geometry: new Point(item.geometry.coordinates),
data: item,
geometry: new Point(itemMessage.geometry.coordinates),
data: itemMessage,
type: "defectPoint",
});
//
feature.setStyle([
new Style({
image: new Icon({
crossOrigin: "anonymous",
src: require(`@/assets/screen/index/${itemMessage.defecttype}.png`),
//
scale: 0.5,
}),
}),
]);
this.defectLayerSource.addFeature(feature);
}
}
@ -114,7 +147,7 @@ export default {
const features = [];
const feature = new Feature({
geometry: new Point(item.location),
data: item,
data: item.entityId,
type: "carPoint",
});
//
@ -130,9 +163,9 @@ export default {
}),
}),
]);
features.push(feature);
this.mapPointFeatures.push(feature);
this.carMapPointSource = new VectorSource({
features,
features: this.mapPointFeatures,
});
const carMapPointLayer = new VectorLayer({
source: this.carMapPointSource,
@ -185,6 +218,12 @@ export default {
});
},
},
destroyed() {
this.carPointList = [];
this.mapPointFeatures = [];
this.carMapPointSource = null;
this.defectLayerSource = null;
},
};
</script>

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com
* @Date: 2024-11-08 09:40:18
* @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-12-03 14:10:16
* @LastEditTime: 2024-12-04 09:41:55
* @FilePath: \znxjxt-ui\src\views\big-screen\overview-components\inspection-vehicles.vue
* @Description: 总览大屏-巡检车辆
-->
@ -125,7 +125,10 @@
destroy-on-close
@close="followCancel"
>
<inspection-follow v-if="followTitle === '跟车详情'"></inspection-follow>
<inspection-follow
v-if="followTitle === '跟车详情'"
:dialogItem="dialogItem"
></inspection-follow>
</el-dialog>
<!-- 视频弹窗 -->
@ -235,6 +238,7 @@ export default {
followCar(val) {
this.followTitle = "跟车详情";
this.showCarVisible = true;
this.dialogItem = val;
const carData = { type: "carLocation", status: true };
const defectData = { type: "defect", status: true };
this.$ws.send(carData);
@ -278,7 +282,6 @@ export default {
this.showViewVisible = false;
closeVideoUrl({ id: this.dialogItem.clientId }).then(({ code, data }) => {
if (code === 200) {
console.log(data);
this.dialogItem = {};
}
});

View File

@ -180,7 +180,7 @@
icon="el-icon-check"
size="mini"
:disabled="multiple"
@click="handleConfirm(1)"
@click="handleConfirm(2)"
>是病害
</el-button>
</el-col>
@ -191,7 +191,7 @@
icon="el-icon-close"
size="mini"
:disabled="multiple"
@click="handleConfirm(0)"
@click="handleConfirm(3)"
>不是病害
</el-button>
</el-col>