Changeset 9570


Ignore:
Timestamp:
Aug 25, 2011, 3:07:00 PM (13 years ago)
Author:
rick
Message:

Make signal dynamic default and redo some init calls.

Location:
src/django_gheat/wlheatmap
Files:
3 edited

Legend:

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

    r9549 r9570  
    44var map;
    55
    6 function init(){
    7 
     6function init_heatmap(){
    87  var lat = getURLParameter('lat');
    98  var lon = getURLParameter('lon');
     
    5453
    5554  layerHeatmap2 = new OpenLayers.Layer.OSM.Overlay2("All Access points", {isBaseLayer: false, visibility: false});
    56   map.addLayer(layerHeatmap2);
     55  //map.addLayer(layerHeatmap2);
     56
     57  signallayer = new OpenLayers.Layer.OSM.Overlay4("signallayer", {isBaseLayer: false, visibility: false});
     58  map.addLayer(signallayer);
    5759
    5860  layerHeatmap3 = new OpenLayers.Layer.OSM.Overlay3("Wireless Leiden Only", {isBaseLayer: false, visibility: true});
     
    6062
    6163  layerHeatmap = new OpenLayers.Layer.OSM.Overlay1("Original Heatmap generator", {isBaseLayer: false, visibility: false});
    62   map.addLayer(layerHeatmap);
     64  //map.addLayer(layerHeatmap);
    6365       
    6466  var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
    6567  map.setCenter (lonLat, zoom);
    6668
    67   signallayer = new OpenLayers.Layer.OSM.Overlay4("signallayer", {isBaseLayer: false, visibility: false});
    68   map.addLayer(signallayer);
    6969
    7070  /**
     
    7373   */
    7474
    75   $("#default").append("<span id=\"" + layerHeatmap.name + "\"><div id='layer_switcher_colour' style='background-color:rgb(" + layerHeatmap.colour + ")' /><input type=checkbox id=togglelayer /><font>" + layerHeatmap.name + " </font><br /></span>");
     75  //$("#default").append("<span id=\"" + layerHeatmap.name + "\"><div id='layer_switcher_colour' style='background-color:rgb(" + layerHeatmap.colour + ")' /><input type=checkbox id=togglelayer /><font>" + layerHeatmap.name + " </font><br /></span>");
    7676
    77   $("#default").append("<span id=\"" + layerHeatmap2.name + "\"><div id='layer_switcher_colour' style='background-color:rgb(" + layerHeatmap2.colour + ")' /><input type=checkbox id=togglelayer /><font>" + layerHeatmap2.name + " </font><br /></span>");
     77  //$("#default").append("<span id=\"" + layerHeatmap2.name + "\"><div id='layer_switcher_colour' style='background-color:rgb(" + layerHeatmap2.colour + ")' /><input type=checkbox id=togglelayer /><font>" + layerHeatmap2.name + " </font><br /></span>");
     78
     79  $("#default").append("<span id=\"" + signallayer.name + "\"><div id='layer_switcher_colour' style='background-color:rgb(" + signallayer.colour + ")' /><input type=checkbox id=togglelayer /><font>Signal strength: 0 - 100</font><br /></span>");
    7880
    7981  $("#default").append("<span id=\"" + layerHeatmap3.name + "\"><div id='layer_switcher_colour' style='background-color:rgb(" + layerHeatmap3.colour + ")' /><input type=checkbox id=togglelayer checked/><font>" + layerHeatmap3.name + " </font><br /></span>");
    8082
    81   $("#default").append("<span id=\"" + signallayer.name + "\"><div id='layer_switcher_colour' style='background-color:rgb(" + signallayer.colour + ")' /><input type=checkbox id=togglelayer /><font>Signal strength: 0 - 100</font><br /></span>");
    8283}
  • src/django_gheat/wlheatmap/static/heatmap_extensions.js

    r9406 r9570  
    5555   * Function set in: 'jquery-ui-1.8.13.custom.min.js'
    5656   */
     57  function update_slider(min,max) {
     58      $("#sig_value").text("Signal strength: " + min + " - " + max);
     59      $("#signallayer font").text("All Signal strength: " + min + " - " + max);
     60  };
     61
    5762  $("#slider").slider({
    5863    range: true,
     
    6267    // while sliding, it changes the text above the slider to show the values realtime
    6368    slide: function(event, sig){
    64       $("#sig_value").text("Signal strength: " + sig.values[0] + " - " + sig.values[1]);
    65       $("#signallayer font").text("Signal strength: " + sig.values[0] + " - " + sig.values[1]);
     69      update_slider(sig.values[0], sig.values[1]);
    6670    },
    6771    // on slider stop, it sets a new URL with updated values and redraws the layer
    6872    stop: function(event, sig){
    6973      signallayer = map.getLayersByName('signallayer');
    70       signallayer[0].setUrl("tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=" + sig.values[0] + "&signaal__lte=" + sig.values[1]);
     74      signallayer[0].setUrl("tile/${z}/${x},${y}.png?colour=90,90,90&signaal__gte=" + sig.values[0] + "&signaal__lte=" + sig.values[1]);
    7175      signallayer[0].redraw();
    7276    },
    7377  });
     78
     79
     80  function init_slider(min, max) {
     81    $("#slider").slider( "option", "values", [min,max] );
     82    signallayer = map.getLayersByName('signallayer');
     83    signallayer[0].setUrl("tile/${z}/${x},${y}.png?colour=90,90,90&signaal__gte=" + min + "&signaal__lte=" + max);
     84    signallayer[0].redraw();
     85    update_slider(min,max);
     86  };
     87
     88
    7489
    7590  /**
     
    349364    $("#custom").append("<span id=\"" + lname + "\"><div id='layer_switcher_colour' style='background-color:rgb(" + colour + ")' /><input type=checkbox id=togglelayer checked /><font>" + lname + " </font><a id=rmvlayer>X</a><br /></span>");
    350365  });
     366  init_heatmap();
     367  init_slider(35,75);
    351368});
  • src/django_gheat/wlheatmap/templates/home.html

    r9544 r9570  
    88  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}heatmap.js"></script>
    99  <script type="text/javascript" language="javascript" src="{{ STATIC_URL }}jquery.chained.js"></script>
    10   <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}heatmap_extensions.js"></script>
    1110  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}colorpicker.js"></script>
    1211  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}jquery-ui-1.8.13.custom.min.js"></script>
     12  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}heatmap_extensions.js"></script>
    1313</head>
    14 <body onload="init()">
     14<body>
    1515  <div id="heatmap"></div>
    1616  <div id="container">
Note: See TracChangeset for help on using the changeset viewer.