Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
window.navigator.geolocation.getCurrentPosition(point => {
this.centerPoint = gcoord.transform([point.coords.longitude, point.coords.latitude], gcoord.WGS84, gcoord.AMap);
}, error => {
this.msg.add(error.message);
this.busmap.pointUpdated.subscribe((bus: server.车辆实时坐标信息) => {
let bms = this.busmarkers.filter(v => v.onBoardid == bus.onBoardid);
if (bms == null || bms.length <= 0)
this.busmarkers.push({
onBoardid: bus.onBoardid,
marker: gcoord.transform([bus.经度, bus.纬度], gcoord.WGS84, gcoord.AMap),
label: {
offset: {
x: 0,
y: -30
},
content: bus.onBoardid.toString()
}
});
else
bms[0].marker = gcoord.transform([bus.经度, bus.纬度], gcoord.WGS84, gcoord.AMap);
});
}
constructor(private t: TitleService, private msg: MessageService, private busmap: BusMapService) {
t.setTitle(this.title);
this.subscribeToEvents();
this.centerPoint = gcoord.transform(this.centerPoint, gcoord.WGS84, gcoord.AMap);
this.busicon = {
size: {
width: 24,
height: 12
},
imageSize: {
width: 24,
height: 12
},
image: "/assets/icons/bus_r.png"
};
}
this.busmap.pointUpdated.subscribe((bus: server.车辆实时坐标信息) => {
let bms = this.busmarkers.filter(v => v.onBoardid == bus.onBoardid);
if (bms == null || bms.length <= 0)
this.busmarkers.push({
onBoardid: bus.onBoardid,
marker: gcoord.transform([bus.经度, bus.纬度], gcoord.WGS84, gcoord.AMap),
label: {
offset: {
x: 0,
y: -30
},
content: bus.onBoardid.toString()
}
});
else
bms[0].marker = gcoord.transform([bus.经度, bus.纬度], gcoord.WGS84, gcoord.AMap);
});
}