【发布时间】:2015-08-17 09:53:36
【问题描述】:
我有这样的要求
Source,
waypoint 1,
waypoint 2,
waypoint 3,
Destination
我需要Source到waypoint 1的路径是一种颜色,waypoint 1到waypoint 2是另一种颜色..分别。
在这里,我将整个路径显示为单(红色)颜色。但是当我们移动到下一个航点时,我需要更改不同的颜色
mapSite.getDirection = function(latitudeValue, longitudeValue, waypts) {
document.getElementById('directionsPanel').innerHTML = "";
directionsDisplay = new google.maps.DirectionsRenderer({
polylineOptions: {
strokeColor: "red"
}
});
var site = new google.maps.LatLng(latitudeValue, longitudeValue);
var mapOptions = {
center: site,
zoom: 9,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById('map'), mapOptions);
mapSite.map = map;
directionsDisplay.setMap(mapSite.map);
var start = mapSite.latitude + "," + mapSite.longitude;
var end = latitudeValue + "," + longitudeValue;
var request = {
origin: start,
destination: end,
waypoints: waypts,
travelMode: google.maps.TravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
var route = response.routes[0];
directionsDisplay.setPanel(document.getElementById('directionsPanel'));
}
});
};
【问题讨论】:
标签: javascript angularjs google-maps ionic