Guest User

Untitled

a guest
Feb 19th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. var directionsDisplay = new google.maps.DirectionsRenderer({
  2. suppressMarkers : true // не использовать маркеры
  3. });
  4.  
  5. // ...............
  6.  
  7. if (status == google.maps.DirectionsStatus.OK) {
  8. var markerCounter = 1; //счетчик маркеров
  9. directionsDisplay.setDirections(response);
  10. // добавим свои маркеры
  11. var route = response.routes[0];
  12. // маркер начала движения
  13. addMarker(route.legs[0].start_location, markerCounter++);
  14. // маркеры по всему маршруту, включая конец
  15. for (var i = 0; i < route.legs.length; i++) {
  16. addMarker(route.legs[i].end_location, markerCounter++);
  17. }
  18. }
  19.  
  20. // ...............
  21.  
  22. /** создает маркер с числовым номером i */
  23. function addMarker(position, i) {
  24. return new google.maps.Marker({
  25. icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=' + i + '|FF0000|000000',
  26. position: position,
  27. map: map
  28. });
  29. }
Add Comment
Please, Sign In to add comment