Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ActualMarker(){
- var rIcon = L.icon({
- iconUrl: 'marcadores/marker-icon-violet.png',
- })
- var rIcon2 = L.icon({
- iconUrl: 'marcadores/marker-icon-green.png',
- })
- var rIcon3 = L.icon({
- iconUrl: 'marcadores/icon-red.png',
- })
- var rIcon4 = L.icon({
- iconUrl: 'marcadores/marker-icon-yellow.png',
- })
- var rIcon5 = L.icon({
- iconUrl: 'marcadores/marker-icon-black.png',
- })
- var rIcon6 = L.icon({
- iconUrl: 'marcadores/marker-icon-orange.png',
- })
- var fecha = new Date();
- var segundos = fecha.getSeconds();
- for ( var i=0; i < markers.length; ++i )
- {
- if (segundos >= 0 && segundos < 10){
- L.marker( [markers[0].lat, markers[0].lng], {icon: rIcon} )
- .bindPopup( 'Tráfico Lento' ).addTo( cities );
- L.marker( [markers[1].lat, markers[1].lng], {icon: rIcon} )
- .bindPopup( 'Tráfico Lento' ).addTo( cities );
- L.marker( [markers[2].lat, markers[2].lng], {icon: rIcon} )
- .bindPopup( 'Tráfico Lento' ).addTo( cities );
- }else if (segundos >= 11 && segundos < 20){
- L.marker( [markers[2].lat, markers[2].lng], {icon: rIcon2} )
- .bindPopup( 'Operativo Carabineros' ).addTo( cities );
- L.marker( [markers[3].lat, markers[3].lng], {icon: rIcon2} )
- .bindPopup( 'Operativo Carabineros' ).addTo( cities );
- L.marker( [markers[4].lat, markers[4].lng], {icon: rIcon2} )
- .bindPopup( 'Operativo Carabineros' ).addTo( cities );
- } else if (segundos >= 20 && segundos < 30){
- L.marker( [markers[4].lat, markers[4].lng], {icon: rIcon3} )
- .bindPopup( 'Vehículo Confiscado' ).addTo( cities );
- L.marker( [markers[5].lat, markers[5].lng], {icon: rIcon3} )
- .bindPopup( 'Vehículo Confiscado' ).addTo( cities );
- L.marker( [markers[6].lat, markers[6].lng], {icon: rIcon3} )
- .bindPopup( 'Vehículo Confiscado' ).addTo( cities );
- } else if (segundos >= 30 && segundos < 40){
- L.marker( [markers[6].lat, markers[6].lng], {icon: rIcon4} )
- .bindPopup( 'Inspector' ).addTo( cities );
- L.marker( [markers[7].lat, markers[7].lng], {icon: rIcon4} )
- .bindPopup( 'Inspector' ).addTo( cities );
- L.marker( [markers[1].lat, markers[1].lng], {icon: rIcon4} )
- .bindPopup( 'Inspector' ).addTo( cities );
- } else if (segundos >= 40 && segundos < 50){
- L.marker( [markers[5].lat, markers[5].lng], {icon: rIcon5} )
- .bindPopup( 'Accidente Tránsito' ).addTo( cities );
- L.marker( [markers[3].lat, markers[3].lng], {icon: rIcon5} )
- .bindPopup( 'Accidente Tránsito' ).addTo( cities );
- L.marker( [markers[2].lat, markers[2].lng], {icon: rIcon5} )
- .bindPopup( 'Accidente Tránsito' ).addTo( cities );
- } else {
- L.marker( [markers[6].lat, markers[6].lng], {icon: rIcon6} )
- .bindPopup( 'Vehículo de Carga Detenido' ).addTo( cities );
- L.marker( [markers[4].lat, markers[4].lng], {icon: rIcon6} )
- .bindPopup( 'Vehículo de Carga Detenido' ).addTo( cities );
- L.marker( [markers[3].lat, markers[3].lng], {icon: rIcon6} )
- .bindPopup( 'Vehículo de Carga Detenido' ).addTo( cities );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement