|
|
@ -24,6 +24,11 @@ export default {
|
|
|
|
type: Array,
|
|
|
|
type: Array,
|
|
|
|
default: () => [],
|
|
|
|
default: () => [],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// 感知设备
|
|
|
|
|
|
|
|
camera_list: {
|
|
|
|
|
|
|
|
type: Array,
|
|
|
|
|
|
|
|
default: () => [],
|
|
|
|
|
|
|
|
},
|
|
|
|
// 车辆轨迹
|
|
|
|
// 车辆轨迹
|
|
|
|
new_line: {
|
|
|
|
new_line: {
|
|
|
|
type: Array,
|
|
|
|
type: Array,
|
|
|
@ -107,6 +112,26 @@ export default {
|
|
|
|
that.$emit("get_car_text", item);
|
|
|
|
that.$emit("get_car_text", item);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// 感知设备点位上图
|
|
|
|
|
|
|
|
that.camera_list.forEach((item) => {
|
|
|
|
|
|
|
|
var camera_point = new BMap.Point(item.longitude, item.latitude);
|
|
|
|
|
|
|
|
// 自定义图标;
|
|
|
|
|
|
|
|
var camera_icon = {};
|
|
|
|
|
|
|
|
camera_icon = new BMap.Icon(
|
|
|
|
|
|
|
|
require("@/assets/factor/factor04.png"),
|
|
|
|
|
|
|
|
new BMap.Size(20, 40),
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
imageOffset: new BMap.Size(0, 0, 5), // 设置图片偏移
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
var camera_marker = new BMap.Marker(camera_point, { icon: camera_icon }); // 创建点位
|
|
|
|
|
|
|
|
map.addOverlay(camera_marker);
|
|
|
|
|
|
|
|
// camera_marker.addEventListener("click", function () {
|
|
|
|
|
|
|
|
// // 查看车辆轨迹
|
|
|
|
|
|
|
|
// // 查看轨迹的点击事件是要重新创建地图的,以该车坐标为中心
|
|
|
|
|
|
|
|
// that.$emit("get_car_text", item);
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
});
|
|
|
|
}, 500);
|
|
|
|
}, 500);
|
|
|
|
map.centerAndZoom(
|
|
|
|
map.centerAndZoom(
|
|
|
|
new BMap.Point(this.center_point[0], this.center_point[1]),
|
|
|
|
new BMap.Point(this.center_point[0], this.center_point[1]),
|
|
|
@ -210,14 +235,19 @@ export default {
|
|
|
|
styleJson,
|
|
|
|
styleJson,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
console.log("item", item);
|
|
|
|
//let that = this; // 不改指向后面很多函数无法执行
|
|
|
|
//let that = this; // 不改指向后面很多函数无法执行
|
|
|
|
let label = new BMap.Label();
|
|
|
|
// let label = new BMap.Label();
|
|
|
|
|
|
|
|
// 以车辆出发点为中心重新绘制地图
|
|
|
|
|
|
|
|
//119.460741
|
|
|
|
|
|
|
|
//29.531762999999998
|
|
|
|
|
|
|
|
//29.531762
|
|
|
|
setTimeout(() => {
|
|
|
|
setTimeout(() => {
|
|
|
|
var point = new BMap.Point(item.longitude, item.latitude);
|
|
|
|
var point = new BMap.Point(new_line[0].longitude, new_line[0].latitude);
|
|
|
|
// 自定义图标;
|
|
|
|
// 自定义起点图标;
|
|
|
|
var myIcon = {};
|
|
|
|
var myIcon = {};
|
|
|
|
myIcon = new BMap.Icon(
|
|
|
|
myIcon = new BMap.Icon(
|
|
|
|
require("@/assets/factor/factor03.png"),
|
|
|
|
require("@/assets/factor/car_start.png"),
|
|
|
|
new BMap.Size(20, 40),
|
|
|
|
new BMap.Size(20, 40),
|
|
|
|
{
|
|
|
|
{
|
|
|
|
imageOffset: new BMap.Size(0, 0, 5), // 设置图片偏移
|
|
|
|
imageOffset: new BMap.Size(0, 0, 5), // 设置图片偏移
|
|
|
@ -225,6 +255,21 @@ export default {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
var marker = new BMap.Marker(point, { icon: myIcon }); // 创建点位
|
|
|
|
var marker = new BMap.Marker(point, { icon: myIcon }); // 创建点位
|
|
|
|
map.addOverlay(marker);
|
|
|
|
map.addOverlay(marker);
|
|
|
|
|
|
|
|
// 自定义终点坐标
|
|
|
|
|
|
|
|
var end_point = new BMap.Point(
|
|
|
|
|
|
|
|
new_line[new_line.length - 1].longitude,
|
|
|
|
|
|
|
|
new_line[new_line.length - 1].latitude
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
var end_icon = {};
|
|
|
|
|
|
|
|
end_icon = new BMap.Icon(
|
|
|
|
|
|
|
|
require("@/assets/factor/car_end.png"),
|
|
|
|
|
|
|
|
new BMap.Size(20, 40),
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
imageOffset: new BMap.Size(0, 0, 5), // 设置图片偏移
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
var end_marker = new BMap.Marker(end_point, { icon: end_icon }); // 创建点位
|
|
|
|
|
|
|
|
map.addOverlay(end_marker);
|
|
|
|
|
|
|
|
|
|
|
|
// 车辆轨迹绘画
|
|
|
|
// 车辆轨迹绘画
|
|
|
|
var line_point = [];
|
|
|
|
var line_point = [];
|
|
|
@ -243,61 +288,61 @@ export default {
|
|
|
|
map.addOverlay(polyline);
|
|
|
|
map.addOverlay(polyline);
|
|
|
|
}, 500);
|
|
|
|
}, 500);
|
|
|
|
|
|
|
|
|
|
|
|
map.centerAndZoom(new BMap.Point(item.longitude, item.latitude), 16); // 创建点坐标
|
|
|
|
map.centerAndZoom(new BMap.Point(item.longitude, item.latitude), 8); // 创建点坐标
|
|
|
|
map.setMinZoom(12); // 初始化地图,设置中心点坐标和地图级别
|
|
|
|
map.setMinZoom(12); // 初始化地图,设置中心点坐标和地图级别
|
|
|
|
map.setMaxZoom(19);
|
|
|
|
map.setMaxZoom(19);
|
|
|
|
map.enableScrollWheelZoom(true);
|
|
|
|
map.enableScrollWheelZoom(true);
|
|
|
|
|
|
|
|
|
|
|
|
showBoundaryx(MapLine.features[5]);
|
|
|
|
// showBoundaryx(MapLine.features[5]);
|
|
|
|
|
|
|
|
|
|
|
|
function showBoundaryx(city) {
|
|
|
|
// function showBoundaryx(city) {
|
|
|
|
var paths = [];
|
|
|
|
// var paths = [];
|
|
|
|
var list = city.geometry.coordinates;
|
|
|
|
// var list = city.geometry.coordinates;
|
|
|
|
var polygon = {};
|
|
|
|
// var polygon = {};
|
|
|
|
if (list.length > 1) {
|
|
|
|
// if (list.length > 1) {
|
|
|
|
for (let a = 0; a < list.length; a++) {
|
|
|
|
// for (let a = 0; a < list.length; a++) {
|
|
|
|
paths = [];
|
|
|
|
// paths = [];
|
|
|
|
for (let i = 0; i < list[a][0].length; i++) {
|
|
|
|
// for (let i = 0; i < list[a][0].length; i++) {
|
|
|
|
let lat = list[a][0][i][1],
|
|
|
|
// let lat = list[a][0][i][1],
|
|
|
|
lng = list[a][0][i][0];
|
|
|
|
// lng = list[a][0][i][0];
|
|
|
|
paths.push(new BMap.Point(lng, lat));
|
|
|
|
// paths.push(new BMap.Point(lng, lat));
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
console.log('paths',paths);
|
|
|
|
// console.log('paths',paths);
|
|
|
|
polygon = new BMap.Polygon(paths, {
|
|
|
|
// polygon = new BMap.Polygon(paths, {
|
|
|
|
fillColor: "#3b4c44",
|
|
|
|
// fillColor: "#3b4c44",
|
|
|
|
strokeColor: "#0f1423",
|
|
|
|
// strokeColor: "#0f1423",
|
|
|
|
fillOpacity: 0.6,
|
|
|
|
// fillOpacity: 0.6,
|
|
|
|
strokeWeight: 1,
|
|
|
|
// strokeWeight: 1,
|
|
|
|
}); //创建多边形
|
|
|
|
// }); //创建多边形
|
|
|
|
polygon.disableMassClear();
|
|
|
|
// polygon.disableMassClear();
|
|
|
|
map.addOverlay(polygon); //增加多边形
|
|
|
|
// map.addOverlay(polygon); //增加多边形
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
} else {
|
|
|
|
// } else {
|
|
|
|
for (let i = 0; i < list[0].length; i++) {
|
|
|
|
// for (let i = 0; i < list[0].length; i++) {
|
|
|
|
let lat = list[0][i][1],
|
|
|
|
// let lat = list[0][i][1],
|
|
|
|
lng = list[0][i][0];
|
|
|
|
// lng = list[0][i][0];
|
|
|
|
paths.push(new BMap.Point(lng, lat));
|
|
|
|
// paths.push(new BMap.Point(lng, lat));
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
console.log('paths',paths);
|
|
|
|
// console.log('paths',paths);
|
|
|
|
polygon = new BMap.Polygon(paths, {
|
|
|
|
// polygon = new BMap.Polygon(paths, {
|
|
|
|
fillColor: "#3b4c44",
|
|
|
|
// fillColor: "#3b4c44",
|
|
|
|
strokeColor: "#0f1423",
|
|
|
|
// strokeColor: "#0f1423",
|
|
|
|
fillOpacity: 0.6,
|
|
|
|
// fillOpacity: 0.6,
|
|
|
|
strokeWeight: 1,
|
|
|
|
// strokeWeight: 1,
|
|
|
|
}); //创建多边形
|
|
|
|
// }); //创建多边形
|
|
|
|
polygon.disableMassClear();
|
|
|
|
// polygon.disableMassClear();
|
|
|
|
map.addOverlay(polygon); //增加多边形
|
|
|
|
// map.addOverlay(polygon); //增加多边形
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
polygon.infowindow = new BMap.InfoWindow();
|
|
|
|
// polygon.infowindow = new BMap.InfoWindow();
|
|
|
|
polygon.infowindow.name = city.properties.name;
|
|
|
|
// polygon.infowindow.name = city.properties.name;
|
|
|
|
polygon.addEventListener("mouseover", function () {
|
|
|
|
// polygon.addEventListener("mouseover", function () {
|
|
|
|
polygon.setFillColor("#ffa500");
|
|
|
|
// polygon.setFillColor("#ffa500");
|
|
|
|
});
|
|
|
|
// });
|
|
|
|
polygon.addEventListener("mouseout", function () {
|
|
|
|
// polygon.addEventListener("mouseout", function () {
|
|
|
|
map.removeOverlay(label);
|
|
|
|
// map.removeOverlay(label);
|
|
|
|
polygon.setFillColor("#3b4c44");
|
|
|
|
// polygon.setFillColor("#3b4c44");
|
|
|
|
});
|
|
|
|
// });
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|