线加粗

This commit is contained in:
zengmingjie 2025-06-29 20:24:33 +08:00
parent a78106da90
commit bdf4e5148f
2 changed files with 29 additions and 8 deletions

View File

@ -373,7 +373,6 @@ export default {
if (existingTimer) { if (existingTimer) {
clearInterval(existingTimer); // clearInterval(existingTimer); //
} }
console.log(this.lonAndLat, "this.lonAndLat");
// 15 // 15
newItem.currTime = window.mapConfig.currTime; newItem.currTime = window.mapConfig.currTime;
// //
@ -531,7 +530,6 @@ export default {
} }
}, },
closeNavigation(drone) { closeNavigation(drone) {
console.log(drone.app_lat, drone.app_lon, "导航");
// drone.app_lon drone.app_lat // drone.app_lon drone.app_lat
if (!drone || !drone.app_lon || !drone.app_lat) { if (!drone || !drone.app_lon || !drone.app_lat) {
this.$message.error("无人机的经纬度信息无效"); this.$message.error("无人机的经纬度信息无效");
@ -574,7 +572,6 @@ export default {
const naviUrl = `https://uri.amap.com/navigation?to=${ const naviUrl = `https://uri.amap.com/navigation?to=${
drone.app_lon + "," + drone.app_lat drone.app_lon + "," + drone.app_lat
},飞手位置&callnative=1`; },飞手位置&callnative=1`;
console.log(naviUrl, "naviUrl");
try { try {
// qrCodes // qrCodes
const qrCodeDataUrl = await QRCode.toDataURL(naviUrl, { const qrCodeDataUrl = await QRCode.toDataURL(naviUrl, {
@ -660,6 +657,7 @@ export default {
return setInterval(() => { return setInterval(() => {
if (item.currTime > 0) { if (item.currTime > 0) {
item.currTime--; item.currTime--;
console.log(item.currTime, "item.currTime");
// //
const index = this.drones.findIndex( const index = this.drones.findIndex(
(d) => d.BatchId === item.BatchId (d) => d.BatchId === item.BatchId
@ -806,7 +804,7 @@ export default {
const trackStyleljx = new Style({ const trackStyleljx = new Style({
stroke: new Stroke({ stroke: new Stroke({
color: this.getRandomColor(), color: this.getRandomColor(),
width: 2, width: 5,
lineDash: [4, 4], lineDash: [4, 4],
zIndex: 1 zIndex: 1
}) })
@ -828,9 +826,12 @@ export default {
getRandomColor() { getRandomColor() {
const letters = "0123456789ABCDEF"; const letters = "0123456789ABCDEF";
let color = "#"; let color = "#";
for (let i = 0; i < 6; i++) { color += "0";
color += letters[Math.floor(Math.random() * 16)]; color += letters[Math.floor(Math.random() * 4)];
} color += letters[Math.floor(Math.random() * 16)];
color += letters[Math.floor(Math.random() * 16)];
color += letters[Math.floor(Math.random() * 16)];
color += letters[Math.floor(Math.random() * 16)];
return color; return color;
} }
} }

View File

@ -434,7 +434,14 @@ export function mapUavFiex(options, map) {
name: "无人机轨迹" name: "无人机轨迹"
}); });
track.setId(item.BatchId + "_track"); track.setId(item.BatchId + "_track");
track.setStyle(
new Style({
stroke: new Stroke({
color: getRandomColor(), // 线条颜色(可自定义)
width: 5 // 线条宽度(调整此值以控制粗细,单位为像素)
})
})
);
graphicLayer.getSource().addFeature(graphic); graphicLayer.getSource().addFeature(graphic);
graphicLayerGJ.getSource().addFeature(track); graphicLayerGJ.getSource().addFeature(track);
// graphicLayerGJ.setStyle(null); // graphicLayerGJ.setStyle(null);
@ -526,3 +533,16 @@ export function mapUavFiex(options, map) {
}); });
} }
} }
// 随机颜色生成函数
function getRandomColor() {
const letters = "0123456789ABCDEF";
let color = "#";
color += "0";
color += letters[Math.floor(Math.random() * 4)];
color += letters[Math.floor(Math.random() * 16)];
color += letters[Math.floor(Math.random() * 16)];
color += letters[Math.floor(Math.random() * 16)];
color += letters[Math.floor(Math.random() * 16)];
return color;
}