Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var directionsDisplay = new google.maps.DirectionsRenderer({
- suppressMarkers : true // не использовать маркеры
- });
- // ...............
- if (status == google.maps.DirectionsStatus.OK) {
- var markerCounter = 1; //счетчик маркеров
- directionsDisplay.setDirections(response);
- // добавим свои маркеры
- var route = response.routes[0];
- // маркер начала движения
- addMarker(route.legs[0].start_location, markerCounter++);
- // маркеры по всему маршруту, включая конец
- for (var i = 0; i < route.legs.length; i++) {
- addMarker(route.legs[i].end_location, markerCounter++);
- }
- }
- // ...............
- /** создает маркер с числовым номером i */
- function addMarker(position, i) {
- return new google.maps.Marker({
- icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=' + i + '|FF0000|000000',
- position: position,
- map: map
- });
- }
Add Comment
Please, Sign In to add comment