Changeset 9274 for src/django_gheat/website/static/heatmap_extensions.js
- Timestamp:
- Jun 21, 2011, 8:02:44 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/website/static/heatmap_extensions.js
r9273 r9274 65 65 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments); 66 66 }, 67 SWITCHER_CLASS: "signal",68 67 CLASS_NAME: "OpenLayers.Layer.Overlay" 69 68 }); … … 74 73 }); 75 74 76 var testarray = new Array(); 77 $("#filter_text").append("<a id=remove>Get layers</a><br />"); 78 $("#remove").click(function(){ 79 testarray = map.getLayersByClass("OpenLayers.Layer.Overlay"); 80 $.each(testarray, function(v, value){ 81 colour = value.SWITCHER_COLOUR; 82 $("#filter_text").append("<span id=\"" + value.name + "\"><input type=checkbox id=togglelayer /><font style='color:rgb(" + colour + ")'>" + value.name + " </font><a id=rmvlayer>X</a><br /></span>"); 83 }); 84 }); 85 75 // toggle layer visibility 86 76 $("#togglelayer").live("click", function(){ 87 77 status = $(this).attr("checked"); … … 91 81 }); 92 82 83 // remove layer 93 84 $("#rmvlayer").live("click", function(){ 94 layername = $(this). parents('span').attr('id');85 layername = $(this).closest('span').attr('id'); 95 86 layer = map.getLayersByName(layername); 96 $("#filter_text").append("<br />Removed " + layername);97 87 map.removeLayer(layer[0]); 98 $(this). parents('span').remove();88 $(this).closest('span').remove(); 99 89 }); 100 90 … … 107 97 $("#filter").slideUp("fast"); 108 98 $("#info").slideToggle("fast"); 99 }); 100 101 // switcher toggle 102 $("#layer_switcher_toggle").click(function(){ 103 $("#layer_switcher").toggle(); 104 if($(this).text() == '+'){ 105 $(this).html('-'); 106 } 107 else{ 108 $(this).html('+'); 109 } 109 110 }); 110 111 … … 145 146 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments); 146 147 }, 147 SWITCHER_COLOUR: colour,148 SWITCHER_CLASS: "user",149 148 CLASS_NAME: "OpenLayers.Layer.Overlay" 150 149 }); 151 filterlayer = new OpenLayers.Layer.OSM.Overlay( "User: "+user, {isBaseLayer: false, visibility: true});150 filterlayer = new OpenLayers.Layer.OSM.Overlay(user, {isBaseLayer: false, visibility: true}); 152 151 map.addLayer(filterlayer); 152 $("#user").append("<span id=\"" + user + "\"><input type=checkbox id=togglelayer checked /><font style='color:rgb(" + colour + ")'>" + user + " </font><a id=rmvlayer>X</a><br /></span>"); 153 153 }); 154 154 $(this).attr('value', 'Del userfilter'); … … 157 157 $(this).attr('value', 'Add userfilter'); 158 158 $.each(userlist, function(u, user){ 159 layer = map.getLayersByName( 'User: ' +user);159 layer = map.getLayersByName(user); 160 160 map.removeLayer(layer[0]); 161 161 }); … … 177 177 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments); 178 178 }, 179 SWITCHER_COLOUR: colour,180 SWITCHER_CLASS: "node",181 179 CLASS_NAME: "OpenLayers.Layer.Overlay" 182 180 }); 183 nodefilterlayer = new OpenLayers.Layer.OSM.Overlay( "Node: "+node, {isBaseLayer: false, visibility: true});181 nodefilterlayer = new OpenLayers.Layer.OSM.Overlay(node, {isBaseLayer: false, visibility: true}); 184 182 map.addLayer(nodefilterlayer); 185 183 console.log(nodefilterlayer); 184 $("#node").append("<span id=\"" + node + "\"><input type=checkbox id=togglelayer checked /><font style='color:rgb(" + colour + ")'>" + node + " </font><a id=rmvlayer>X</a><br /></span>"); 186 185 }); 187 186 $(this).attr('value', 'Del nodefilter'); … … 190 189 $(this).attr('value', 'Add nodefilter'); 191 190 $.each(nodelist, function(n, node){ 192 layer = map.getLayersByName( 'Node: ' +node);191 layer = map.getLayersByName(node); 193 192 map.removeLayer(layer[0]); 194 193 }); … … 256 255 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments); 257 256 }, 258 SWITCHER_COLOURL: colour, 259 SWITCHER_CLASS: "custom", 257 260 258 CLASS_NAME: "OpenLayers.Layer.Overlay" 261 259 }); … … 264 262 filterlayer = new OpenLayers.Layer.OSM.Overlay(lname, {isBaseLayer: false, visibility: true}); 265 263 map.addLayer(filterlayer); 264 265 $("#custom").append("<span id=\"" + lname + "\"><input type=checkbox id=togglelayer checked /><font style='color:rgb(" + colour + ")'>" + lname + " </font><a id=rmvlayer>X</a><br /></span>"); 266 266 }); 267 267 });
Note:
See TracChangeset
for help on using the changeset viewer.