| | |
| | | convertor.translate([point], 1, 5, (data) => { |
| | | if (data.status === 0) { |
| | | const bdPoint = data.points[0]; |
| | | //显示车辆图标 |
| | | const myIcon = new BMap.Icon( |
| | | "/car_blue.png", |
| | | new BMap.Size(20, 20), |
| | | { |
| | | imageSize: new BMap.Size(20, 20), |
| | | anchor: new BMap.Size(10, 10), |
| | | } |
| | | ); |
| | | const marker = new BMap.Marker(bdPoint, { |
| | | icon: myIcon, |
| | | rotation: item.direction, |
| | | }); |
| | | // 移除之前的标记点 |
| | | if (this.currentMarker) { |
| | | this.map.removeOverlay(this.currentMarker); |
| | | } |
| | | this.currentMarker=marker; |
| | | this.map.addOverlay(marker); |
| | | this.map.setCenter(bdPoint); |
| | | this.map.setZoom(15); |
| | | } |