Ignore:
Timestamp:
Jun 27, 2011, 4:00:01 PM (13 years ago)
Author:
dennisw
Message:

Added/changed/clarified some comments in code.

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

Legend:

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

    r9275 r9302  
    139139});
    140140
    141 
     141/**
     142 * Gheat layer
     143 */
    142144OpenLayers.Layer.OSM.Overlay1 = OpenLayers.Class(OpenLayers.Layer.OSM, {
    143145    initialize: function(name, options) {
     
    153155});
    154156
     157/**
     158 * All accespoints
     159 */
    155160OpenLayers.Layer.OSM.Overlay2 = OpenLayers.Class(OpenLayers.Layer.OSM, {
    156161    initialize: function(name, options) {
     
    166171});
    167172
     173/**
     174 * Wireless Leiden nodes
     175 */
    168176OpenLayers.Layer.OSM.Overlay3 = OpenLayers.Class(OpenLayers.Layer.OSM, {
    169177    initialize: function(name, options) {
     
    179187});
    180188
     189/**
     190 * Signal strength
     191 */
    181192OpenLayers.Layer.OSM.Overlay4 = OpenLayers.Class(OpenLayers.Layer.OSM, {
    182193  initialize: function(name, options) {
  • src/django_gheat/website/static/heatmap.js

    r9276 r9302  
     1/**
     2 * Var 'map' is set global, used in 'heatmap_extensions.js'.
     3 */
    14var map;
     5
    26function init(){
    37
     
    1620    controls: [
    1721      new OpenLayers.Control.Navigation(),
     22      new OpenLayers.Control.Permalink(),
     23      new OpenLayers.Control.MousePosition({ 'displayProjection' : projection_wgs }),
     24
     25      /**
     26       * Decided to disable these controls.
     27       * The layerswitcher has been replaced with a custom one. If you want the original back,
     28       * make sure to disable the custom one to prevent collision.
     29       */
     30
    1831      //new OpenLayers.Control.PanZoomBar(),
    1932      //new OpenLayers.Control.ScaleLine(),
    20       new OpenLayers.Control.Permalink(),
    2133      //new OpenLayers.Control.LayerSwitcher(),
    22       new OpenLayers.Control.MousePosition({ 'displayProjection' : projection_wgs }),
    2334    ],
    2435    maxExtent: new OpenLayers.Bounds(-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892),
     
    5667  map.addLayer(signallayer);
    5768
     69  /**
     70   * Layers above are put in switcher, category 'default', with code below.
     71   * TODO: Make process for putting layers into layerswitcher dynamic instead of putting every layer there manually.
     72   */
     73
    5874  $("#default").append("<span id=\"" + layerHeatmap.name + "\"><input type=checkbox id=togglelayer /><div id='layer_switcher_colour' style='background-color:rgb(" + layerHeatmap.colour + ")' /><font>" + layerHeatmap.name + " </font><br /></span>");
    5975
  • src/django_gheat/website/static/heatmap_extensions.js

    r9297 r9302  
    1 // Uses zoomlevel and mouseposition to call the nodelist.py view. View returns nodes in json format which is read and printed in document element.
     1/**
     2 * Uses zoomleven and mouseposition to call nodelist.py view.
     3 * View returns nodes in json format, values are printed in doc element.
     4 */
    25function getNodeList(zoomlevel, mousepos){
    36  $.getJSON("/website/nodelist/" + zoomlevel + "," + mousepos.lat + "," + mousepos.lon,
     
    1316}
    1417
    15 // Right way to get url parameters?: http://stackoverflow.com/questions/1403888/get-url-parameter-with-jquery/1404100#1404100
     18/**
     19 * Right way to get url parameters?
     20 * http://stackoverflow.com/questions/1403888/get-url-parameter-with-jquery/1404100#1404100
     21 */
    1622function getURLParameter(name) {
    1723  return decodeURI(
     
    2531  var nodelist = new Array();
    2632
    27   // add colour picker
     33  /**
     34   * Adds colourpicker for layer colour.
     35   * Function set in: 'colourpicker.js'
     36   */
    2837  $("#colour").colorPicker();
    2938
    30   // add date picker for start date
     39  /**
     40   * Adds datepicker for start & end date
     41   * Function set in: 'jquery-ui-1.8.13.custom.min.js'
     42   */
    3143  $("#start_date").datepicker({
    3244    dateFormat: "dd/mm/yy",
     
    3547    }
    3648  });
    37 
    38   // add date picker for end date
    3949  $("#end_date").datepicker({
    4050    dateFormat: "dd/mm/yy",
    4151  });
    4252
    43   // add slider for signal strength filter
     53  /**
     54   * Adds slider for signal strength layer.
     55   * Function set in: 'jquery-ui-1.8.13.custom.min.js'
     56   */
    4457  $("#slider").slider({
    4558    range: true,
     
    6174  });
    6275
    63   // toggle layer visibility
     76  /**
     77   * Toggles layer visibility on checkbox use from layerswitcher.
     78   */
    6479  $("#togglelayer").live('click', function(){
    6580    status = $(this).attr("checked");
     
    6984  });
    7085
    71   // toggle layer visibility per category
     86  /**
     87   * Toggles layer visibility per category on checkbox use from layerswitcher.
     88   */
    7289  $("#togglecat").live("click", function(){
    7390    if($(this).attr("checked")){
     
    87104  });
    88105
    89   // remove layer
     106  /**
     107   * Removes layer from map and layerswitcher.
     108   */
    90109  $("#rmvlayer").live("click", function(){
    91110    layername = $(this).closest('span').attr('id');
     
    95114  });
    96115
    97   // menu toggle
     116  /**
     117   * Toggles text shown on website.
     118   * 'info' shows info text.
     119   * 'filter' page shows text on filters & filter options.
     120   */
    98121  $("#menu_filter").click(function(){
    99122    $("#filter").slideToggle("fast");
     
    105128  });
    106129
    107   // switcher toggle
     130  /**
     131   * Toggles layerswitcher visibility.
     132   * On 'off', toggler shows a '+'.
     133   * On 'on', toggler shows a '-'.
     134   */
    108135  $("#layer_switcher_toggle").click(function(){
    109136    $("#layer_switcher").toggle();
     
    116143  });
    117144
    118   // Fastest?: http://stackoverflow.com/questions/170986/what-is-the-best-way-to-add-options-to-a-select-from-an-array-with-jquery
     145  /**
     146   * Fastest?
     147   * http://stackoverflow.com/questions/170986/what-is-the-best-way-to-add-options-to-a-select-from-an-array-with-jquery
     148   */
    119149  $.getJSON("/website/filters/",
    120150    function(json) {
     
    123153        userlist.push(json.gebruiker);
    124154        $.each(json.meetrondje, function(m, meetrondje){
     155          console.log(meetrondje.datum);
    125156          $("#select_dataset").append($("<option/>").attr({"class":json.gebruiker, "value":meetrondje.naam}).text(meetrondje.naam));
    126157          $.each(meetrondje.nodes, function(n, nodes){
     
    138169  );
    139170
    140   // add filter per user
     171  /**
     172   * Earlier process got all users in JSON and put them in array.
     173   * For each user in array, new layer is added with username as parameter.
     174   * Layercolour is randomized.
     175   * If button is pressed again, layers will be deleted.
     176   */
    141177  $('#user_filter').click(function(){
    142178    if(this.text=='(Add all users)'){
     
    169205  });
    170206
    171   // add filter per node
     207  /**
     208   * Earlier process got all nodes in JSON and put them in array.
     209   * For each node in array, new layer is added with node as parameter.
     210   * Layercolour is randomized.
     211   * If button is pressed again, layers will be deleted.
     212   */
    172213  $('#node_filter').click(function(){
    173214    if(this.text=='(Add all nodes)'){
     
    201242  });
    202243
    203   // add custom filter
     244  /**
     245   * Adds a new layer when clicked.
     246   * Filters set by user are used as layer parameters.
     247   * Colour is either chosen or randomized.
     248   * Blank parameters are ignored.
     249   */
    204250  $('#add_filter').click(function(){
    205     //get values from elements
     251    // get values from elements
    206252    user = $('#select_user option:selected').text();
    207253    dataset = $('#select_dataset option:selected').text();
     
    212258    lname = encodeURIComponent(document.getElementById("lname").value);
    213259
    214     // HEX to RGB: http://stackoverflow.com/questions/5798868/need-some-tips-with-how-to-convert-a-hexadecimal-color-value-to-a-rgb-one/5798900#5798900
    215     // '#' comes out as '%23', so substr() starts at char 3
     260    /**
     261     * On HEX to RGB:
     262     * http://stackoverflow.com/questions/5798868/need-some-tips-with-how-to-convert-a-hexadecimal-color-value-to-a-rgb-one/5798900#5798900
     263     * Note that '#' comes out as '%23', so substr() starts at char 3
     264     */
    216265    colour = parseInt((colour.substr(3, 2)),16) + ',' + parseInt((colour.substr(5, 2)),16) + ',' + parseInt((colour.substr(7, 2)),16);
    217266
  • src/django_gheat/website/static/style.css

    r9297 r9302  
     1/**
     2 * Body
     3 */
     4
    15body,html{
    26  height:100%;
     
    1014}
    1115
     16/**
     17 * Divs
     18 */
     19
    1220#heatmap{
    1321  position:absolute;
     
    156164  width:10px;
    157165}
    158        
     166
     167/**
     168 * Text settings
     169 */
     170
    159171h1{
    160172  color:#C20000;
     
    186198}
    187199
    188 /* Colorpicker */
     200/**
     201 * Colorpicker
     202 */
    189203 
    190204div.color_picker {
Note: See TracChangeset for help on using the changeset viewer.