plugins: updated query_editor
[myslice.git] / plugins / pres_view / static / js / recup_direct.js
1 /* 
2
3                 meme chose que recup_data sauf qu'il n'y a pas besoin d'url puisque cela r�agi a l'envoi du d�mon 
4                 
5 */
6
7
8 function recup_direct(data, method,id) 
9                                 {
10                                         //j.each(data   , function(key, val) 
11                                         //{                     
12                                                 //alert ( data.data.print_method );
13                                                 switch ( data.data.print_method )
14                                                         {
15                                                                 case 'marker' :
16                                                                                 pos_marker[id]= [];
17                                                                                 opt_marker[id] =[];
18                                                                                 marker[id]= [];
19                                                                                 ref[id] = 'marker';
20                                                                 break;
21                                                                 case 'line' :
22                                                                                 opt_line[id] =[];
23                                                                                 pos_line[id]= [];
24                                                                                 line[id]= [];
25                                                                                 ref[id] = 'line';
26                                                                 break;
27                                                                 case 'circle' :
28                                                                                 opt_circle[id] =[];
29                                                                                 pos_circle[id]= [];
30                                                                                 circle[id]= [];
31                                                                                 ref[id] = 'circle';
32                                                                 break;
33                                                                 default:
34                                                                         alert ("unknown method");
35                                                                 break;
36                                                         }       
37                                                 for ( var i= 0; i<data.data.message.length;i++)
38                                                 {
39                                                         var longueur;
40                                                         switch ( data.data.print_method )
41                                                         {
42                                                                 case 'marker' :
43                                                                         pos_marker[id].push( new google.maps.LatLng(data.data.message[i].ape_position[0].latitude,data.data.message[i].ape_position[0].longitude));
44
45                                                                                 opt_marker[id].push 
46                                                                                 ({
47                                                                                         position: pos_marker[id][pos_marker[id].length - 1],
48                                                                                         visible: true,
49                                                                                         map : map
50                                                                                         //title : data.data.message.ape_timestamp
51                                                                                 });
52                                                                         
53                                                                         //marker[id].push( new google.maps.Marker(opt_marker[id][opt_marker[id].length - 1 ])); 
54                                                                         if ( data.data.print_options )
55                                                                         {
56                                                                                 opt_conf[id] = data.data.print_options;
57                                                                         }
58                                                                         
59                                                                 break;
60                                                                 
61                                                                 case 'line' :
62                                                                         for ( var j = 0 ; j < val[i].params.data.message.ape_position.length ; j++ ) 
63                                                                         {
64                                                                                 pos_line[id].push(new google.maps.LatLng(data.data.message[i].ape_position[j].latitude,data.data.message[i].ape_position[j].longitude)) ;
65                                                                         }       
66                                                                         
67                                                                         opt_line[id].push
68                                                                         ({
69                                                                                 path : pos_line[id] ,
70                                                                                 map : map,
71                                                                                 strokeColor: "#FF0000",
72                                                                                 strokeOpacity: 1.0,
73                                                                                 strokeWeight: 2
74                                                                         })
75
76                                                                         if ( data.data.print_options )
77                                                                         {
78                                                                                 opt_conf[id] = data.data.print_options;
79                                                                         }
80                                                                         
81                                                                 break;
82                                                                 
83                                                                 case 'circle':
84                                                                 
85                                                                         longueur = circle.length;
86                                                                         circle[longueur] = [];
87                                                                         // circle[longueur].push (val[i].message.ape_position[0].latitude) ; pour le timestamp
88                                                                         pos_circle[longueur].push(new google.maps.LatLng(val[i].data.message.ape_position[0].latitude,val[i].data.message.ape_position[1].longitude));
89                                                                         // pos_circle[longueur].push circle[longueur][1][1] = val[i].message.ape_position[0].radian;
90                                                                         opt_circle.push({
91                                                                                 map : map,
92                                                                                 center : pos_circle[longueur][0],
93                                                                                 radius : pos_circle[longueur][1]
94                                                                         })
95                                                                         if ( data.data.print_options )
96                                                                         {
97                                                                                 opt_conf[id] = data.data.print_options;
98                                                                         }
99                                                                         
100                                                                 break;
101                                                                 
102                                                                 default :
103                                                                         alert("pas bon");
104                                                                 break;
105                                                         }
106                                                                 
107                                                 }
108                                                 
109                                         //});
110                                         afficher_par_id(id,"static");
111                                         set_options(id);
112                                 }
113