Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. function ActualMarker(){
  2. var rIcon = L.icon({
  3. iconUrl: 'marcadores/marker-icon-violet.png',
  4. })
  5. var rIcon2 = L.icon({
  6. iconUrl: 'marcadores/marker-icon-green.png',
  7. })
  8. var rIcon3 = L.icon({
  9. iconUrl: 'marcadores/icon-red.png',
  10. })
  11. var rIcon4 = L.icon({
  12. iconUrl: 'marcadores/marker-icon-yellow.png',
  13. })
  14. var rIcon5 = L.icon({
  15. iconUrl: 'marcadores/marker-icon-black.png',
  16. })
  17. var rIcon6 = L.icon({
  18. iconUrl: 'marcadores/marker-icon-orange.png',
  19. })
  20.  
  21. var fecha = new Date();
  22. var segundos = fecha.getSeconds();
  23.  
  24. for ( var i=0; i < markers.length; ++i )
  25. {
  26. if (segundos >= 0 && segundos < 10){
  27. L.marker( [markers[0].lat, markers[0].lng], {icon: rIcon} )
  28. .bindPopup( 'Tráfico Lento' ).addTo( cities );
  29.  
  30. L.marker( [markers[1].lat, markers[1].lng], {icon: rIcon} )
  31. .bindPopup( 'Tráfico Lento' ).addTo( cities );
  32.  
  33. L.marker( [markers[2].lat, markers[2].lng], {icon: rIcon} )
  34. .bindPopup( 'Tráfico Lento' ).addTo( cities );
  35.  
  36. }else if (segundos >= 11 && segundos < 20){
  37.  
  38. L.marker( [markers[2].lat, markers[2].lng], {icon: rIcon2} )
  39. .bindPopup( 'Operativo Carabineros' ).addTo( cities );
  40.  
  41. L.marker( [markers[3].lat, markers[3].lng], {icon: rIcon2} )
  42. .bindPopup( 'Operativo Carabineros' ).addTo( cities );
  43.  
  44. L.marker( [markers[4].lat, markers[4].lng], {icon: rIcon2} )
  45. .bindPopup( 'Operativo Carabineros' ).addTo( cities );
  46.  
  47. } else if (segundos >= 20 && segundos < 30){
  48.  
  49.  
  50. L.marker( [markers[4].lat, markers[4].lng], {icon: rIcon3} )
  51. .bindPopup( 'Vehículo Confiscado' ).addTo( cities );
  52.  
  53. L.marker( [markers[5].lat, markers[5].lng], {icon: rIcon3} )
  54. .bindPopup( 'Vehículo Confiscado' ).addTo( cities );
  55.  
  56. L.marker( [markers[6].lat, markers[6].lng], {icon: rIcon3} )
  57. .bindPopup( 'Vehículo Confiscado' ).addTo( cities );
  58.  
  59. } else if (segundos >= 30 && segundos < 40){
  60.  
  61. L.marker( [markers[6].lat, markers[6].lng], {icon: rIcon4} )
  62. .bindPopup( 'Inspector' ).addTo( cities );
  63.  
  64. L.marker( [markers[7].lat, markers[7].lng], {icon: rIcon4} )
  65. .bindPopup( 'Inspector' ).addTo( cities );
  66.  
  67. L.marker( [markers[1].lat, markers[1].lng], {icon: rIcon4} )
  68. .bindPopup( 'Inspector' ).addTo( cities );
  69.  
  70. } else if (segundos >= 40 && segundos < 50){
  71.  
  72. L.marker( [markers[5].lat, markers[5].lng], {icon: rIcon5} )
  73. .bindPopup( 'Accidente Tránsito' ).addTo( cities );
  74.  
  75. L.marker( [markers[3].lat, markers[3].lng], {icon: rIcon5} )
  76. .bindPopup( 'Accidente Tránsito' ).addTo( cities );
  77.  
  78. L.marker( [markers[2].lat, markers[2].lng], {icon: rIcon5} )
  79. .bindPopup( 'Accidente Tránsito' ).addTo( cities );
  80.  
  81. } else {
  82.  
  83. L.marker( [markers[6].lat, markers[6].lng], {icon: rIcon6} )
  84. .bindPopup( 'Vehículo de Carga Detenido' ).addTo( cities );
  85.  
  86. L.marker( [markers[4].lat, markers[4].lng], {icon: rIcon6} )
  87. .bindPopup( 'Vehículo de Carga Detenido' ).addTo( cities );
  88.  
  89. L.marker( [markers[3].lat, markers[3].lng], {icon: rIcon6} )
  90. .bindPopup( 'Vehículo de Carga Detenido' ).addTo( cities );
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement