almost working
[unfold.git] / plugins / senslabmap / static / js / senslabmap.js
index 71de05a..10abf41 100644 (file)
     },
     
     initialize_map: function() {
-      console.log("init toto");
-      // TODO: this is static, retrieve directly nodes
-      nodes = nodes_gre;
-      init();
-      parseNodebox();
+      this.nodes = [];
+      this.id = 0;
     },
 
     refresh: function() {
     },
     
     on_show: function(e) {
-      /* GUI setup and event binding */
       e.data.refresh();
     },
     
-    on_all_new_record: function(record) {
-      console.log("All New Record : " + record);
-    },
-    
-    on_new_record: function(record) {
-      console.log("New Record : " + record);
-    },
-
-    on_query_in_progress: function()
-    {
-      console.log('on_query_in_progress');
+    on_all_new_record: function(n) {
+      // format is : [name, x, y, z, uid, state]
+      // state = "Busy", "Alive" or "Down"
+      this.id++;
+      node = [this.id, n.x, n.y, n.z, this.id, "Alive"];
+      this.nodes.push(node);
+      console.log("node id " + this.id);
     },
     
-    on_query_done: function()
-    {
-      console.log('on_query_done');
-    },
-
-    on_all_query_in_progress: function()
-    {
-      console.log('on_all_query_in_progress');
-    },
-    
-    on_all_query_done: function()
-    {
-      console.log('on_all_query_done');
+    on_all_query_done: function() {
+      nodes = this.nodes;
+      init();
+      parseNodebox();
     }
   });
   $.plugin('SensLabMap', SensLabMap);