plugins: updated query_editor
[myslice.git] / plugins / pres_view / afficher_par_id.js
1 /* 
2
3         Gére les affichages static, dynamiques ( le static est utiliser pour afficher un marker a la fois ) 
4         sinon affiche une erreur
5
6 */
7
8 var animation = [];
9 var temps ;
10 var toto = 0;
11 var save_long ;
12 function afficher_par_id (id,method)
13 {
14         toto = 0 ;
15         animation[id] = [];
16         switch ( method )
17                 {
18                         case 'static':
19                                 switch ( ref[id] ) 
20                                         {
21                                                 case 'marker' :
22                                                         for ( var i = 0; i < opt_marker[id].length ; i++ ) 
23                                                         {
24                                                                 marker[id][i] = new google.maps.Marker(opt_marker[id][i]);
25                                                                 marker[id][i].setVisible ( true );
26                                                         }
27                                                 break;
28                                                 
29                                                 case 'line' :
30                                                         for ( var i = 0; i < opt_line[id].length ; i++ ) 
31                                                         {
32                                                                 line[id][i] = new google.maps.Polyline(opt_line[id][i]);
33                                                                 line[id][i].setVisible ( true );
34                                                         }
35                                                 break;
36                                                 case 'circle' :
37                                                         for ( var i = 0; i < opt_circle[id].length ; i++ ) 
38                                                         {
39                                                                 circle[id][i] = new google.maps.Circle(opt_circle[id][i]);
40                                                                 circle[id][i].setVisible ( true );
41                                                         }
42                                                 break;
43                                                 default :
44                                                         { alert ( " mauvaise referance" ); }
45                                                 break;
46                                         }
47                                         
48                         break;
49                         
50                         case 'animation':
51                                 document.getElementById("statusbar").innerHTML = "ANIMATION EN COURS " ;
52                                 switch ( ref[id] ) 
53                                         {
54                                                 case 'marker':
55                                                 save_long = opt_marker[id].length;
56                                                 
57                                                 for ( var i = 0; i < opt_marker[id].length ; i++ )
58                                                 {
59                                                         temps =(10.5 - j( "#interval_animation" ).slider( "option", "value" )) * 1000 *(i+1) ;
60                                                         animation [id][i] = setTimeout ( function()
61                                                         {       
62                                                                 marker[id][toto] = new google.maps.Marker(opt_marker[id][toto]);
63                                                                 marker[id][toto].setVisible ( true );
64                                                                 map.panTo ( pos_marker[id][toto]);
65                                                                 toto++;
66                                                                 if ( toto == save_long)  document.getElementById("statusbar").innerHTML = "ANIMATION TERMINEE " ;
67                                                         }, temps );
68                                                 }
69                                                 break;
70                                                 case 'line' :
71                                                 save_long = opt_line[id].length;
72                                                 for ( var i = 0; i < opt_line[id].length ; i++ )
73                                                 {
74                                                         temps =(10.5 - j( "#interval_animation" ).slider( "option", "value" )) * 1000 *(i+1) ;
75                                                         animation [id][i] = setTimeout ( function()
76                                                         {       
77                                                                 
78                                                                 line[id][toto] = new google.maps.Polyline(opt_line[id][toto]);
79                                                                 line[id][toto].setVisible ( true );
80                                                                 map.panTo ( pos_line[id][toto][0]);
81                                                                 toto++;
82                                                                 if ( toto == save_long)  document.getElementById("statusbar").innerHTML = "ANIMATION TERMINEE " ;
83                                                         }, temps );
84                                                 }
85                                                 break;
86                                                 case 'circle' :
87                                                 save_long = opt_circle[id].length;
88                                                 for ( var i = 0; i < opt_circle[id].length ; i++ )
89                                                 {
90                                                         temps =(10.5 - j( "#interval_animation" ).slider( "option", "value" )) * 1000 *(i+1) ;
91                                                         setTimeout ( function()
92                                                         {       
93                                                                 
94                                                                 circke[id][toto] = new google.maps.Circle(opt_circle[id][toto]);
95                                                                 circle[id][toto].setVisible ( true );
96                                                                 map.panTo ( pos_circle[id][toto][0]);
97                                                                 toto++;
98                                                                 if ( toto == save_long)  document.getElementById("statusbar").innerHTML = "ANIMATION TERMINEE " ;
99                                                         }, temps );
100                                                 }
101                                                 default :
102                                                         {}
103                                                 break;
104                                         }
105                                 ;
106                         break ;
107                         
108                         default:
109                                 alert ( "afficher_par_id : Erreur dans la method" );
110                         break;
111                 }
112 }