|
|
@@ -222,7 +222,7 @@
|
|
|
|
|
|
|
|
|
const initMap = () => {
|
|
|
- var map = new BMap.Map("deviceContainer"); // 创建地图实例
|
|
|
+ var map = new BMapGL.Map("deviceContainer"); // 创建地图实例
|
|
|
var centerPoint = null; // 创建点坐标
|
|
|
const deviceData = currentDevice.value.data
|
|
|
if(deviceData){
|
|
|
@@ -230,14 +230,14 @@
|
|
|
const location = deviceJson.location
|
|
|
if(location != null && location != undefined){
|
|
|
if(centerPoint == null){
|
|
|
- centerPoint = new BMap.Point(location.lng, location.lat)
|
|
|
+ centerPoint = new BMapGL.Point(location.lng, location.lat)
|
|
|
}
|
|
|
console.log("location:",location)
|
|
|
- var point = new BMap.Point(location.lng, location.lat)
|
|
|
- var circle = new BMap.Circle(point,location.radius,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.2});
|
|
|
- var marker = new BMap.Marker(point)
|
|
|
- marker.enableDragging()
|
|
|
-
|
|
|
+ var point = new BMapGL.Point(location.lng, location.lat)
|
|
|
+ var circle = new BMapGL.Circle(point, 500, {strokeColor: 'red',strokeWeight: 1,strokeOpacity: 1, fillOpacity: 0});
|
|
|
+ var marker = new BMapGL.Marker(point)
|
|
|
+ //marker.enableDragging()
|
|
|
+ map.clearOverlays()
|
|
|
map.addOverlay(marker)
|
|
|
map.addOverlay(circle)
|
|
|
|
|
|
@@ -246,7 +246,7 @@
|
|
|
height: 100, // 信息窗口高度
|
|
|
title : currentDevice.value.mac , // 信息窗口标题
|
|
|
}
|
|
|
- var infoWindow = new BMap.InfoWindow(location.address, opts); // 创建信息窗口对象
|
|
|
+ var infoWindow = new BMapGL.InfoWindow(location.address, opts); // 创建信息窗口对象
|
|
|
marker.addEventListener("click", function(e){
|
|
|
map.openInfoWindow(infoWindow,e.point); //开启信息窗口
|
|
|
});
|
|
|
@@ -266,10 +266,11 @@
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
- map.centerAndZoom(centerPoint, 14); // 初始化地图,设置中心点坐标和地图级别
|
|
|
+ map.centerAndZoom(centerPoint, 15); // 初始化地图,设置中心点坐标和地图级别
|
|
|
}
|
|
|
map.enableScrollWheelZoom(true);
|
|
|
- map.addControl(new BMap.NavigationControl());
|
|
|
+ map.addControl(new BMapGL.NavigationControl());
|
|
|
+ map.setMapType(BMAP_SATELLITE_MAP);
|
|
|
|
|
|
|
|
|
};
|