Ignore:
Timestamp:
Aug 28, 2011, 4:02:40 PM (13 years ago)
Author:
rick
Message:

Cleanup calling into proper function.

File:
1 edited

Legend:

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

    r9596 r9599  
    5757  map.addLayer(layerMapnik);
    5858
    59   layerHeatmap2 = new OpenLayers.Layer.OSM.Overlay2("All Access points", {isBaseLayer: false, visibility: false});
    60   //map.addLayer(layerHeatmap2);
    61 
    62   signallayer = new OpenLayers.Layer.OSM.Overlay4("signallayer", {isBaseLayer: false, visibility: false});
    63   map.addLayer(signallayer);
    64 
    65   layerHeatmap3 = new OpenLayers.Layer.OSM.Overlay3("Wireless Leiden Coverage", {isBaseLayer: false, visibility: true});
    66   map.addLayer(layerHeatmap3);
    67 
    68   layerHeatmap = new OpenLayers.Layer.OSM.Overlay1("Original Heatmap generator", {isBaseLayer: false, visibility: false});
    69   //map.addLayer(layerHeatmap);
    70 
    71   var nodesLayer = new OpenLayers.Layer.GML.NodesOverlay("Node Locations", "feature/nodes.json", {isBaseLayer: false, visibility: true});
    72   map.addLayer(nodesLayer);
    73 
    7459  var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
    7560  map.setCenter (lonLat, zoom);
     
    7762
    7863  /**
    79    * Layers above are put in switcher, category 'default', with code below.
    80    * TODO: Make process for putting layers into layerswitcher dynamic instead of putting every layer there manually.
     64   * Layers are created and put in switcher
    8165   */
     66  function add_item(category, layer) {
     67    map.addLayer(layer);
     68    var checked = '';
     69    if (layer.getVisibility()) { checked = "checked='checked'"; };
     70    $("#" + category).append("<span id=\"" + layer.name + "\">" +
     71     " <div id='layer_switcher_colour' style='background-color:rgb(" + layer.colour + ")' />" +
     72     "<input type='checkbox' id='togglelayer' " + checked + " /><font>" + layer.name + " </font><br /></span>"
     73     );
     74  }
    8275
    83   //$("#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>");
     76  var signallayer = new OpenLayers.Layer.OSM.Overlay4("signallayer", {isBaseLayer: false, visibility: false});
     77  var wlsignalLayer = new OpenLayers.Layer.OSM.Overlay3("Wireless Leiden Coverage", {isBaseLayer: false, visibility: true});
     78  var nodesLayer = new OpenLayers.Layer.GML.NodesOverlay("Node Locations", {isBaseLayer: false, visibility: false});
    8479
    85   //$("#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>");
    86 
    87   $("#default").append("<span id=\"" + signallayer.name + "\"><div id='layer_switcher_colour' style='background-color:rgb(" + signallayer.colour + ")' /><input type=checkbox id=togglelayer /><font>Replaced during init</font><br /></span>");
    88 
    89   $("#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>");
    90 
    91   $("#features").append("<span id=\"" + nodesLayer.name + "\"><div id='layer_switcher_colour' style='background-color:rgb(" + nodesLayer.colour + ")' /><input type=checkbox id=togglelayer checked/><font>" + nodesLayer.name + " </font><br /></span>");
    92 
     80  add_item('default', signallayer);
     81  add_item('default', wlsignalLayer);
     82  add_item('features', nodesLayer);
    9383}
Note: See TracChangeset for help on using the changeset viewer.