X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fpres_view_map%2Fafficher_par_id.js;fp=plugins%2Fpres_view_map%2Fafficher_par_id.js;h=013d4e42276d2145877e17f8f8b2710d10ee91da;hb=a09c116497c4fce2e8e2290e7255a3ec946163be;hp=0000000000000000000000000000000000000000;hpb=96cf681a06ae76e67bb186e5bc02a696a9784c3d;p=unfold.git diff --git a/plugins/pres_view_map/afficher_par_id.js b/plugins/pres_view_map/afficher_par_id.js new file mode 100644 index 00000000..013d4e42 --- /dev/null +++ b/plugins/pres_view_map/afficher_par_id.js @@ -0,0 +1,112 @@ +/* + + Gére les affichages static, dynamiques ( le static est utiliser pour afficher un marker a la fois ) + sinon affiche une erreur + +*/ + +var animation = []; +var temps ; +var toto = 0; +var save_long ; +function afficher_par_id (id,method) +{ + toto = 0 ; + animation[id] = []; + switch ( method ) + { + case 'static': + switch ( ref[id] ) + { + case 'marker' : + for ( var i = 0; i < opt_marker[id].length ; i++ ) + { + marker[id][i] = new google.maps.Marker(opt_marker[id][i]); + marker[id][i].setVisible ( true ); + } + break; + + case 'line' : + for ( var i = 0; i < opt_line[id].length ; i++ ) + { + line[id][i] = new google.maps.Polyline(opt_line[id][i]); + line[id][i].setVisible ( true ); + } + break; + case 'circle' : + for ( var i = 0; i < opt_circle[id].length ; i++ ) + { + circle[id][i] = new google.maps.Circle(opt_circle[id][i]); + circle[id][i].setVisible ( true ); + } + break; + default : + { alert ( " mauvaise referance" ); } + break; + } + + break; + + case 'animation': + document.getElementById("statusbar").innerHTML = "ANIMATION EN COURS " ; + switch ( ref[id] ) + { + case 'marker': + save_long = opt_marker[id].length; + + for ( var i = 0; i < opt_marker[id].length ; i++ ) + { + temps =(10.5 - j( "#interval_animation" ).slider( "option", "value" )) * 1000 *(i+1) ; + animation [id][i] = setTimeout ( function() + { + marker[id][toto] = new google.maps.Marker(opt_marker[id][toto]); + marker[id][toto].setVisible ( true ); + map.panTo ( pos_marker[id][toto]); + toto++; + if ( toto == save_long) document.getElementById("statusbar").innerHTML = "ANIMATION TERMINEE " ; + }, temps ); + } + break; + case 'line' : + save_long = opt_line[id].length; + for ( var i = 0; i < opt_line[id].length ; i++ ) + { + temps =(10.5 - j( "#interval_animation" ).slider( "option", "value" )) * 1000 *(i+1) ; + animation [id][i] = setTimeout ( function() + { + + line[id][toto] = new google.maps.Polyline(opt_line[id][toto]); + line[id][toto].setVisible ( true ); + map.panTo ( pos_line[id][toto][0]); + toto++; + if ( toto == save_long) document.getElementById("statusbar").innerHTML = "ANIMATION TERMINEE " ; + }, temps ); + } + break; + case 'circle' : + save_long = opt_circle[id].length; + for ( var i = 0; i < opt_circle[id].length ; i++ ) + { + temps =(10.5 - j( "#interval_animation" ).slider( "option", "value" )) * 1000 *(i+1) ; + setTimeout ( function() + { + + circke[id][toto] = new google.maps.Circle(opt_circle[id][toto]); + circle[id][toto].setVisible ( true ); + map.panTo ( pos_circle[id][toto][0]); + toto++; + if ( toto == save_long) document.getElementById("statusbar").innerHTML = "ANIMATION TERMINEE " ; + }, temps ); + } + default : + {} + break; + } + ; + break ; + + default: + alert ( "afficher_par_id : Erreur dans la method" ); + break; + } +}