1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| google.maps.event.addListener(map, 'rightclick', function (event) {
if (directionsDisplay.getDirections() == null) {
clearOverlays();
clearForm();
placeMarker(event.latLng);
}
else {
loadItineraire(directionsDisplay.getDirections());
}
});
function loadItineraire(result) {//directionsDisplay.getDirections()
var itineraire = result.routes[0].legs[0];
document.getElementById('latitude').value = itineraire.end_location.lat();
document.getElementById('longitude').value = itineraire.end_location.lng(); //formatted_address
codeLatLng(itineraire.end_location.lat(), itineraire.end_location.lng(), 'adresse');
document.getElementById('LatOrg').value = itineraire.start_location.lat();
document.getElementById('LongOrg').value = itineraire.start_location.lng(); //formatted_address
codeLatLng(itineraire.start_location.lat(), itineraire.start_location.lng(), 'txtorigine');
computeTotalDistance(result);
showForm();
} |
Partager