Commit 5c7b1ebf authored by 纪泽龙's avatar 纪泽龙

增加回放小车的点

parent 357e616d
/* /*
* @Author: your name * @Author: your name
* @Date: 2022-01-11 13:45:12 * @Date: 2022-01-11 13:45:12
* @LastEditTime: 2022-03-21 17:43:29 * @LastEditTime: 2022-03-21 18:13:58
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /test/hello-world/src/utils/mapClass.js * @FilePath: /test/hello-world/src/utils/mapClass.js
...@@ -682,7 +682,7 @@ export class EditorMap { ...@@ -682,7 +682,7 @@ export class EditorMap {
* @param {*} path 轨迹回访率丼 * @param {*} path 轨迹回访率丼
* @return {*} * @return {*}
*/ */
backTrack(vehicleId, path,times) { backTrack(vehicleId, path, times) {
this.infowindowClose(); this.infowindowClose();
AMap.plugin("AMap.MoveAnimation", () => { AMap.plugin("AMap.MoveAnimation", () => {
...@@ -712,13 +712,15 @@ export class EditorMap { ...@@ -712,13 +712,15 @@ export class EditorMap {
}); });
// 每个path的点 // 每个path的点
marker.pointArr = []; // marker.pointArr = [];
// carTarget // carTarget
//点击的时候,先传进来一个点 //点击的时候,先传进来一个点
const carPathData = { ...marker.getExtData() }; const carPathData = { ...marker.getExtData(), time: times[0] };
carPathData.iconType = 14; carPathData.iconType = 14;
this.addDevice(carPathData,null); this.addDevice(carPathData, null);
// marker.pointArr.push(point);
marker.on("moveend", (e) => { marker.on("moveend", (e) => {
// this.addDevice(carPathData,carBackComponent); // this.addDevice(carPathData,carBackComponent);
// 如果不是最后一个点,就创建一个新的worderpoint,如果是就不创建,并且把自身删除 // 如果不是最后一个点,就创建一个新的worderpoint,如果是就不创建,并且把自身删除
...@@ -726,14 +728,15 @@ export class EditorMap { ...@@ -726,14 +728,15 @@ export class EditorMap {
let z = { let z = {
longitude: e.pos[0], longitude: e.pos[0],
latitude: e.pos[1], latitude: e.pos[1],
iconType: 14,
time: times[e.index], time: times[e.index],
}; };
if (e.index == path.length - 1) { // if (e.index == path.length - 1) {
} else { // point = this.addDevice(z, null);
// } else {
this.addDevice(z, null); this.addDevice(z, null);
// workPoint.infoWindow.open(map,e.passedPos); // workPoint.infoWindow.open(map,e.passedPos);
marker.pointArr.push(workPoint); // }
}
console.log("定点", e); console.log("定点", e);
}); });
...@@ -755,9 +758,8 @@ export class EditorMap { ...@@ -755,9 +758,8 @@ export class EditorMap {
// 停止运动 // 停止运动
item.stopMove(); item.stopMove();
// 删除每个点 // 删除每个点
item.pointArr?.forEach((iten) => { console.log(item.pointArr);
this.map.remove(iten);
});
if (item.polyline) { if (item.polyline) {
this.map.remove(item.polyline); this.map.remove(item.polyline);
} }
...@@ -770,6 +772,9 @@ export class EditorMap { ...@@ -770,6 +772,9 @@ export class EditorMap {
// 最后把数组清空 // 最后把数组清空
this.allDevice["9"] = []; this.allDevice["9"] = [];
// 把car的路径点也清空 // 把car的路径点也清空
this.allDevice["14"]?.forEach((iten) => {
this.map.remove(iten);
});
this.allDevice["14"] = []; this.allDevice["14"] = [];
this.infowindowClose(); this.infowindowClose();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment