2 var SensLabMap = Plugin.extend({
3 init: function(options, element) {
4 this.classname="senslabmap";
5 this._super(options, element);
7 this.elmt().on('show', this, this.on_show);
9 var query = manifold.query_store.find_analyzed_query(options.query_uuid);
10 this.method = query.object;
11 this.key = manifold.metadata.get_key(this.method);
13 /* Setup query and record handlers */
14 this.listen_query(options.query_uuid);
15 this.listen_query(options.query_all_uuid, 'all');
21 on_show: function(e) {
25 on_all_new_record: function(node) {
26 Senslab.normalize(node);
27 if (node.normalized) {
29 if ($.inArray(site, this.sites) == -1) {
30 this.sites.push(site);
31 this.nodes[site] = [];
33 this.nodes[site].push(node);
35 // xxx would need a smarter way to report these only on nodes that deserve it
36 // these messages are all over the place in a PL setup and tend to hide helpful signal
37 // console.warn("node has no site:");
38 // console.warn(node);
42 on_all_query_done: function() {
43 var uuid = this.options.query_uuid;
46 Senslab.createMaps($("#maps-container"), this.sites, this.nodes);
47 Senslab.notify = function(node) {
48 manifold.raise_event(uuid, node.selected ? SET_ADD : SET_REMOVED, node[key]);
52 $.plugin('SensLabMap', SensLabMap);