fix:修改地图addlayer,修改小车刷新频率

This commit is contained in:
2025-01-02 11:23:59 +08:00
parent 09e68c12fa
commit 172c2501cb
3 changed files with 17 additions and 14 deletions
+6 -3
View File
@@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-10-14 10:46:23 * @Date: 2024-10-14 10:46:23
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-12-26 10:02:28 * @LastEditTime: 2025-01-02 10:33:02
* @FilePath: \znxjxt-ui\src\components\map\fssm-map.vue * @FilePath: \znxjxt-ui\src\components\map\fssm-map.vue
* @Description: 公共地图 * @Description: 公共地图
--> -->
@@ -335,7 +335,9 @@ export default {
}), }),
visible: true, visible: true,
}); });
map.addLayer(tianditu_cva_c, tianditu_vec_c, tianditu_img_c); map.addLayer(tianditu_cva_c);
map.addLayer(tianditu_vec_c);
map.addLayer(tianditu_img_c);
} else { } else {
// 外网 // 外网
tianditu_cva_c = new TileLayer({ tianditu_cva_c = new TileLayer({
@@ -348,7 +350,8 @@ export default {
}), }),
visible: true, visible: true,
}); });
map.addLayer(tianditu_cva_c, tianditu_img_c); map.addLayer(tianditu_cva_c);
map.addLayer(tianditu_img_c);
} }
// 图层点击事件 // 图层点击事件
map.on("singleclick", (e) => { map.on("singleclick", (e) => {
+6 -6
View File
@@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-10-17 11:34:00 * @Date: 2024-10-17 11:34:00
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-12-31 11:35:20 * @LastEditTime: 2025-01-02 10:37:46
* @FilePath: \znxjxt-ui\src\views\big-screen\index.vue * @FilePath: \znxjxt-ui\src\views\big-screen\index.vue
* @Description: 大屏首页 * @Description: 大屏首页
--> -->
@@ -1594,14 +1594,14 @@ export default {
const currentLocation = item.getGeometry().getCoordinates(); const currentLocation = item.getGeometry().getCoordinates();
const targetLocation = itemMessage.data.location; const targetLocation = itemMessage.data.location;
// 计算两点之间的差值 // 计算两点之间的差值
const dx = (targetLocation[0] * 1 - currentLocation[0] * 1) / 100; const dx = (targetLocation[0] * 1 - currentLocation[0] * 1) / 20;
const dy = (targetLocation[1] * 1 - currentLocation[1] * 1) / 100; const dy = (targetLocation[1] * 1 - currentLocation[1] * 1) / 20;
// 设置计数器 // 设置计数器
let count = 0; let count = 0;
// 创建定时器,每10ms移动一次,总共移动100次,约1秒完成 // 创建定时器,每50ms移动一次,总共移动20次,约1秒完成
const timer = setInterval(() => { const timer = setInterval(() => {
count++; count++;
if (count >= 100) { if (count >= 20) {
clearInterval(timer); clearInterval(timer);
return; return;
} }
@@ -1626,7 +1626,7 @@ export default {
}), }),
}), }),
]); ]);
}, 10); }, 50);
} }
}); });
} else { } else {
@@ -67,15 +67,15 @@ export default {
const targetLocation = itemMessage.data.location; const targetLocation = itemMessage.data.location;
// 计算两点之间的差值 // 计算两点之间的差值
const dx = const dx =
(targetLocation[0] * 1 - currentLocation[0] * 1) / 100; (targetLocation[0] * 1 - currentLocation[0] * 1) / 20;
const dy = const dy =
(targetLocation[1] * 1 - currentLocation[1] * 1) / 100; (targetLocation[1] * 1 - currentLocation[1] * 1) / 20;
// 设置计数器 // 设置计数器
let count = 0; let count = 0;
// 创建定时器,每10ms移动一次,总共移动100次,约1秒完成 // 创建定时器,每50ms移动一次,总共移动20次,约1秒完成
const timer = setInterval(() => { const timer = setInterval(() => {
count++; count++;
if (count >= 100) { if (count >= 20) {
clearInterval(timer); clearInterval(timer);
return; return;
} }
@@ -100,7 +100,7 @@ export default {
}), }),
}), }),
]); ]);
}, 10); }, 50);
} }
}); });
} else { } else {