Ignore:
Timestamp:
Jun 21, 2011, 12:25:42 PM (13 years ago)
Author:
dennisw
Message:

Able to show, hide and delete layers.

File:
1 edited

Legend:

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

    r9270 r9272  
    4040    dateFormat: "dd/mm/yy",
    4141  });
    42   var testname = new Array();
     42
    4343  // add slider for signal strength filter
    4444  $("#slider").slider({
     
    7373  });
    7474
    75   $("#filter_text").append("<a id=remove>test</a>");
     75  var testarray = new Array();
     76  $("#filter_text").append("<a id=remove>Get layers</a><br />");
    7677  $("#remove").click(function(){
    77     map.removeLayer(signallayer);
     78    testarray = map.getLayersByClass("OpenLayers.Layer.Overlay");
     79    $.each(testarray, function(v, value){
     80      $("#filter_text").append("<span id=\"" + value.name + "\"><input type=checkbox id=togglelayer />" + value.name + " <a style='color:#FF0000' id=rmvlayer name=\"" + value.name + "\">X</a><br /></span>");
     81    });
     82  });
     83
     84  $("#togglelayer").live("click", function(){
     85    status = $(this).attr("checked");
     86    layername = $(this).parents('span').attr('id');
     87    layer = map.getLayersByName(layername);
     88    layer[0].setVisibility(status);
     89  });
     90
     91
     92  $("#rmvlayer").live("click", function(){
     93    $("#filter_text").append("<br />Removed " + this.name);
     94    layer = map.getLayersByName(this.name);
     95    console.log(rmvlayer);
     96    map.removeLayer(layer[0]);
     97    $(this).parents('span').remove();
    7898  });
    7999
     
    81101  $("#menu_filter").click(function(){
    82102    $("#filter").slideToggle("fast");
    83     $("#info").slideUp("fast"); 
     103    $("#info").slideUp("fast");
    84104  });
    85105  $("#menu_info").click(function(){
Note: See TracChangeset for help on using the changeset viewer.