Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ActualMarker1(){
- rIcon = L.icon({
- iconUrl: "marcadores/marker-icon-violet.png",
- })
- for ( var i=0; i < markers.length; ++i ){
- L.marker( [markers[0].lat, markers[0].lng], {icon: rIcon} )
- .bindPopup( 'Evasión Control' ).addTo( cities );
- }
- }
- function ActualMarker2(){
- rIcon = L.icon({
- iconUrl: "marcadores/marker-icon-green.png",
- })
- for ( var i=0; i < markers.length; ++i ){
- L.marker( [markers[0].lat, markers[0].lng], {icon: rIcon} )
- .bindPopup( 'Emisiones Diesel' ).addTo( cities );
- }
- }
- function ActualMarker3(){
- rIcon = L.icon({
- iconUrl: "marcadores/marker-icon-yellow.png",
- })
- for ( var i=0; i < markers.length; ++i ){
- L.marker( [markers[0].lat, markers[0].lng], {icon: rIcon} )
- .bindPopup( 'Control Taximetros' ).addTo( cities );
- }
- }
- function ActualMarker4(){
- rIcon = L.icon({
- iconUrl: "marcadores/marker-icon-violet.png",
- })
- for ( var i=0; i < markers.length; ++i ){
- L.marker( [markers[1].lat, markers[1].lng], {icon: rIcon} )
- .bindPopup( 'Evasión Control' ).addTo( cities );
- }
- }
- function ActualMarker5(){
- rIcon = L.icon({
- iconUrl: "marcadores/marker-icon-green.png",
- })
- for ( var i=0; i < markers.length; ++i ){
- L.marker( [markers[1].lat, markers[1].lng], {icon: rIcon} )
- .bindPopup( 'Emisiones Diesel' ).addTo( cities );
- }
- }
- function ActualMarker6(){
- rIcon = L.icon({
- iconUrl: "marcadores/marker-icon-yellow.png",
- })
- for ( var i=0; i < markers.length; ++i ){
- L.marker( [markers[1].lat, markers[1].lng], {icon: rIcon} )
- .bindPopup( 'Control Taximetros' ).addTo( cities );
- }
- }
- function ActualMarker7(){
- rIcon = L.icon({
- iconUrl: "marcadores/marker-icon-violet.png",
- })
- for ( var i=0; i < markers.length; ++i ){
- L.marker( [markers[2].lat, markers[2].lng], {icon: rIcon} )
- .bindPopup( 'Evasión Control' ).addTo( cities );
- }
- }
- function ActualMarker8(){
- rIcon = L.icon({
- iconUrl: "marcadores/marker-icon-green.png",
- })
- for ( var i=0; i < markers.length; ++i ){
- L.marker( [markers[2].lat, markers[2].lng], {icon: rIcon} )
- .bindPopup( 'Emisiones Diesel' ).addTo( cities );
- }
- }
- function ActualMarker9(){
- rIcon = L.icon({
- iconUrl: "marcadores/marker-icon-yellow.png",
- })
- for ( var i=0; i < markers.length; ++i ){
- L.marker( [markers[2].lat, markers[2].lng], {icon: rIcon} )
- .bindPopup( 'Control Taximetros' ).addTo( cities );
- }
- }
- <?php
- for($i=0; $i<count($f_result); $i++){
- if($f_result[0]->ot == 95)
- {
- echo "<script>";
- echo "ActualMarker1();";
- echo "</script>";
- }elseif($f_result[0]->ot == 98)
- {
- echo "<script>";
- echo "ActualMarker2();";
- echo "</script>";
- }elseif($f_result[0]->ot == 102)
- {
- echo "<script>";
- echo "ActualMarker3();";
- echo "</script>";
- }
- if($f_result[1]->ot == 95)
- {
- echo "<script>";
- echo "ActualMarker4();";
- echo "</script>";
- }elseif($f_result[1]->ot == 98)
- {
- echo "<script>";
- echo "ActualMarker5();";
- echo "</script>";
- }elseif($f_result[1]->ot == 102)
- {
- echo "<script>";
- echo "ActualMarker6();";
- echo "</script>";
- }
- if($f_result[2]->ot == 95)
- {
- echo "<script>";
- echo "ActualMarker7();";
- echo "</script>";
- }elseif($f_result[2]->ot == 98)
- {
- echo "<script>";
- echo "ActualMarker8();";
- echo "</script>";
- }elseif($f_result[2]->ot == 102)
- {
- echo "<script>";
- echo "ActualMarker9();";
- echo "</script>";
- }else{
- echo "esto no esta funcionando bien";
- }
- }
- ?>
- const valores = [
- {
- iconUrl: "marcadores/marker-icon-violet.png",
- markerIndex: 0,
- texto: 'Evasión Control'
- },
- {
- iconUrl: "marcadores/marker-icon-green.png",
- markerIndex: 0,
- texto: 'Emisiones Diesel'
- },
- ...
- function ActualMarker(indice) {
- const iconUrls = [ "marcadores/marker-icon-violet.png", "marcadores/marker-icon-green.png", "marcadores/marker-icon-yellow.png" ];
- const textos = ['Evasión Control', 'Emisiones Diesel', 'Control Taximetros'];
- const iconUrl = iconUrls[ (indice-1) % 3 ];
- const texto = textos[ (indice-1) % 3 ];
- const markerIndex = Math.floor( indice / 3 );
- rIcon = L.icon({ iconUrl: iconUrl })
- for (var i = 0; i < markers.length; ++i) {
- L.marker([markers[ markerIndex ].lat, markers[ markerIndex ].lng], {
- icon: rIcon
- })
- .bindPopup( texto ).addTo(cities);
- }
- }
- // no usas $i en ningún lugar del bucle, ¿seguro que es correcto?
- for($i=0; $i<count($f_result); $i++){
- switch ($f_result[0]) {
- case 95: echo '<script>ActualMarker(1)</script>'; break;
- case 98: echo '<script>ActualMarker(2)</script>'; break;
- case 102: echo '<script>ActualMarker(3)</script>'; break;
- }
- switch ($f_result[1]) {
- case 95: echo '<script>ActualMarker(4)</script>'; break;
- case 98: echo '<script>ActualMarker(5)</script>'; break;
- case 102: echo '<script>ActualMarker(6)</script>'; break;
- }
- switch ($f_result[2]) {
- case 95: echo '<script>ActualMarker(7)</script>'; break;
- case 98: echo '<script>ActualMarker(8)</script>'; break;
- case 102: echo '<script>ActualMarker(9)</script>'; break;
- default: echo "esto no esta funcionando bien"; break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement