Ignore:
Timestamp:
Jun 15, 2011, 2:46:41 PM (13 years ago)
Author:
dennisw
Message:

Changed 'Wireless Leiden Only' to red.
Changed 'All accespoints' to grey.
Added a mass-add button for users and Wireless Leiden nodes. These will create a new layer per item with random colour.
Added the permalink control. URLs aren't working yet though.

Location:
src/django_gheat/website/static
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/website/static/OpenStreetMap.js

    r9189 r9263  
    156156    initialize: function(name, options) {
    157157        var url = [
    158             "/website/tile/${z}/${x},${y}.png?colour=255,0,0"
     158            "/website/tile/${z}/${x},${y}.png?colour=90,90,90"
    159159        ];
    160160        options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
     
    169169    initialize: function(name, options) {
    170170        var url = [
    171             "/website/tile/${z}/${x},${y}.png?colour=0,0,255&accespoint__ssid__icontains=WirelessLeiden"
     171            "/website/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden"
    172172        ];
    173173        options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
  • src/django_gheat/website/static/heatmap.js

    r9210 r9263  
    99                                //new OpenLayers.Control.PanZoomBar(),
    1010                                //new OpenLayers.Control.ScaleLine(),
     11                                new OpenLayers.Control.Permalink(),
    1112                                new OpenLayers.Control.LayerSwitcher(),
    1213                                new OpenLayers.Control.MousePosition({ 'displayProjection' : projection_wgs }),
  • src/django_gheat/website/static/heatmap_extensions.js

    r9253 r9263  
    1313}
    1414
    15 // set filter values
    1615$(document).ready(function() {
     16  var userlist = new Array();
     17  var nodelist = new Array();
    1718
    1819  // Fastest?: http://stackoverflow.com/questions/170986/what-is-the-best-way-to-add-options-to-a-select-from-an-array-with-jquery
     
    2122      $.each(json, function(i,json){
    2223        $("#select_user").append($("<option/>").attr("value",json.gebruiker).text(json.gebruiker));
     24        userlist.push(json.gebruiker);
     25        document.getElementById('filter_text').innerHTML+=("<br />User added to array: " + json.gebruiker);
    2326        $.each(json.meetrondje, function(m, meetrondje){
    2427          $("#select_dataset").append($("<option/>").attr({"class":json.gebruiker, "value":meetrondje.naam}).text(meetrondje.naam));
    2528          $.each(meetrondje.nodes, function(n, nodes){
    2629            $("#select_node").append($("<option/>").attr({"class":meetrondje.naam, "value":nodes}).text(nodes));
     30            if(jQuery.inArray(nodes, nodelist)<0){
     31              document.getElementById('filter_text').innerHTML+=("<br />Node added to array: " + nodes);
     32              nodelist.push(nodes);
     33            }
    2734          });
    2835        });
     
    3340    }
    3441  );
    35 });
    3642
    37 // add filter
    38 $(function(){
     43  // add filter per user
     44  $('#user_filter').click(function(){
     45    $.each(userlist, function(u, user){
     46      colour = '&colour='+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256);
     47      OpenLayers.Layer.OSM.Overlay = OpenLayers.Class(OpenLayers.Layer.OSM, {
     48        initialize: function(name, options) {
     49          var url = [
     50            "/website/tile/${z}/${x},${y}.png?" + colour + "&meetrondje__gebruiker__naam=" + user
     51          ];
     52          document.getElementById('filter_text').innerHTML+="<br />Added: " + url;
     53          options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
     54          var newArguments = [name, url, options];
     55          OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
     56        },
     57      CLASS_NAME: "OpenLayers.Layer.Overlay"
     58      });
     59      filterlayer = new OpenLayers.Layer.OSM.Overlay("User: "+ user, {isBaseLayer: false, visibility: true});
     60      map.addLayer(filterlayer);
     61    });
     62  });
     63
     64  // add filter per node
     65  $('#node_filter').click(function(){
     66    $.each(nodelist, function(n, node){
     67      colour = '&colour='+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256);
     68      OpenLayers.Layer.OSM.Overlay = OpenLayers.Class(OpenLayers.Layer.OSM, {
     69        initialize: function(name, options) {
     70          var url = [
     71            "/website/tile/${z}/${x},${y}.png?" + colour + "&accespoint__ssid=" + node
     72          ];
     73          document.getElementById('filter_text').innerHTML+="<br />Added: " + url;
     74          options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
     75          var newArguments = [name, url, options];
     76          OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
     77        },
     78      CLASS_NAME: "OpenLayers.Layer.Overlay"
     79      });
     80      filterlayer = new OpenLayers.Layer.OSM.Overlay("Node: "+ node, {isBaseLayer: false, visibility: true});
     81      map.addLayer(filterlayer);
     82    });
     83  });
     84
     85  // add custom filter
    3986  $('#add_filter').click(function(){
    40 
     87    //get values from elements
    4188    user = $('#select_user option:selected').text();
    4289    dataset = $('#select_dataset option:selected').text();
     
    5198    colour = parseInt((colour.substr(3, 2)),16) + ',' + parseInt((colour.substr(5, 2)),16) + ',' + parseInt((colour.substr(7, 2)),16);
    5299
     100    // some checks if values are correct, and adding them to parts of the link
    53101    if (user != ''){user='&meetrondje__gebruiker__naam='+user;}
    54102    if (dataset != ''){dataset='&meetrondje__naam='+dataset;}
     
    80128      end_date='&meetrondje__datum__lte=' + ed_y +'-'+ ed_m +'-'+ ed_d;
    81129    }
    82 
    83 
    84130    if (colour != 'NaN,NaN,NaN'){colour='colour='+colour;}
    85131    else {colour = '&colour='+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256);}
     
    87133    else {lname = 'Custom Filter';}
    88134
    89     var baseurl = "/website/tile/${z}/${x},${y}.png?";
    90 
     135    // setting layer
    91136    OpenLayers.Layer.OSM.Overlay = OpenLayers.Class(OpenLayers.Layer.OSM, {
    92137      initialize: function(name, options) {
    93138        var url = [
    94           baseurl + colour + user + dataset + wlnode + start_date + end_date /* + enc */
     139          "/website/tile/${z}/${x},${y}.png?" + colour + user + dataset + wlnode + start_date + end_date
    95140        ];
    96141        document.getElementById('filter_text').innerHTML+="<br />Added: " + url;
     
    102147    });
    103148
     149    // adding layer
    104150    filterlayer = new OpenLayers.Layer.OSM.Overlay(lname, {isBaseLayer: false, visibility: true});
    105151    map.addLayer(filterlayer);
Note: See TracChangeset for help on using the changeset viewer.