我正在使用Ionic应用程序,并使用由Google提供的Ionic Google Map Native和Directions服务我通过使用以下代码绘制了多条路线:
calculateAndDisplayRoute() {
var points = [];
this.directionsService.route({
origin: this.start,
destination: this.end,
travelMode: 'DRIVING',
provideRouteAlternatives: true
}, (response, status) => {
if (status === 'OK') {
var step = 1;
for(var j=0;j<response.routes.length;j++){
points=[]
for (var i = 0; i < response.routes[j].overview_path.length; i++) {
points.push(response.routes[j].overview_path[i].toJSON())
}
let position=points[20]
this.drawRoutePolyLine(points,j,position)
step=step+1
}
} else {
window.alert('Directions request failed due to ' + status);
}
});
} 帮助我添加信息窗口