Ignore:
Timestamp:
Aug 26, 2011, 7:34:45 PM (13 years ago)
Author:
rick
Message:

Allow filtering on signals as well.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/wlheatmap/static/heatmap_extensions.js

    r9577 r9578  
    5858      $("#sig_value").text("All AccessPoints Signal Strength: " + min + " - " + max);
    5959      $("#signallayer font").text("All AccessPoints Signal: " + min + " - " + max);
     60  };
     61
     62  function update_sig_slider(min,max) {
     63      $("#select_sig_value").text("Signal Strength: " + min + " - " + max);
    6064  };
    6165
     
    7680    },
    7781  });
     82  $("#select_sig_slider").slider({
     83    range: true,
     84    min: 0,
     85    max: 100,
     86    values: [0,100],
     87    // while sliding, it changes the text above the slider to show the values realtime
     88    slide: function(event, sig){
     89      update_sig_slider(sig.values[0], sig.values[1]);
     90    },
     91  });
    7892
    7993
     
    8498    signallayer[0].redraw();
    8599    update_slider(min,max);
     100
     101    $("#select_sig_slider").slider( "option", "values", [min,max] );
     102    update_sig_slider(min,max);
    86103  };
    87104
     
    323340
    324341    // some checks if values are correct, and adding them to parts of the link
    325     if (user != ''){user='&meetrondje__gebruiker__naam='+user;}
    326     if (dataset != ''){dataset='&meetrondje__naam='+dataset;}
    327     if (wlnode != ''){wlnode='&accespoint__ssid='+wlnode;}
     342    if (user == 'all') {
     343      user = '';
     344    } else {
     345      user='&meetrondje__gebruiker__naam='+user;
     346    }
     347    if (dataset == 'all') {
     348      dataset = '';
     349    } else {
     350      dataset='&meetrondje__naam='+dataset;
     351    }
     352    if (wlnode == 'all'){
     353      wlnode='';
     354    } else {
     355      wlnode='&accespoint__ssid='+wlnode;
     356    }
    328357    if (start_date && end_date){
    329358      sd_d=start_date.substr(0,2);
     
    352381      end_date='&meetrondje__datum__lte=' + ed_y +'-'+ ed_m +'-'+ ed_d;
    353382    }
    354     if (colour != 'NaN,NaN,NaN'){colour=colour;}
    355     else {colour = Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256);}
    356     if (lname != ''){lname=lname;}
    357     else {lname = 'Custom Filter';}
     383    if (colour != 'NaN,NaN,NaN'){
     384      colour=colour;
     385    } else {
     386      colour = Math.floor(Math.random()*256)+','+Math.floor (Math.random()*256)+','+Math.floor(Math.random()*256);
     387    }
     388    if (lname == ''){
     389      lname= 'Custom Filter';
     390    }
     391
     392    var min = $("#select_sig_slider").slider("values")[0];
     393    var max = $("#select_sig_slider").slider("values")[1];
     394    signal = '&signaal__gte=' + min + '&signaal__lte=' + max;
    358395
    359396    // setting layer
     
    361398      initialize: function(name, options) {
    362399        var url = [
    363           "tile/${z}/${x},${y}.png?&colour=" + colour + user + dataset + wlnode + start_date + end_date
     400          "tile/${z}/${x},${y}.png?colour=" + colour + user + dataset + wlnode + start_date + end_date + signal
    364401        ];
    365402        options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
Note: See TracChangeset for help on using the changeset viewer.