- Timestamp:
- Jun 15, 2011, 2:46:41 PM (13 years ago)
- Location:
- src/django_gheat/website
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/website/static/OpenStreetMap.js
r9189 r9263 156 156 initialize: function(name, options) { 157 157 var url = [ 158 "/website/tile/${z}/${x},${y}.png?colour= 255,0,0"158 "/website/tile/${z}/${x},${y}.png?colour=90,90,90" 159 159 ]; 160 160 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); … … 169 169 initialize: function(name, options) { 170 170 var url = [ 171 "/website/tile/${z}/${x},${y}.png?colour= 0,0,255&accespoint__ssid__icontains=WirelessLeiden"171 "/website/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden" 172 172 ]; 173 173 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); -
src/django_gheat/website/static/heatmap.js
r9210 r9263 9 9 //new OpenLayers.Control.PanZoomBar(), 10 10 //new OpenLayers.Control.ScaleLine(), 11 new OpenLayers.Control.Permalink(), 11 12 new OpenLayers.Control.LayerSwitcher(), 12 13 new OpenLayers.Control.MousePosition({ 'displayProjection' : projection_wgs }), -
src/django_gheat/website/static/heatmap_extensions.js
r9253 r9263 13 13 } 14 14 15 // set filter values16 15 $(document).ready(function() { 16 var userlist = new Array(); 17 var nodelist = new Array(); 17 18 18 19 // Fastest?: http://stackoverflow.com/questions/170986/what-is-the-best-way-to-add-options-to-a-select-from-an-array-with-jquery … … 21 22 $.each(json, function(i,json){ 22 23 $("#select_user").append($("<option/>").attr("value",json.gebruiker).text(json.gebruiker)); 24 userlist.push(json.gebruiker); 25 document.getElementById('filter_text').innerHTML+=("<br />User added to array: " + json.gebruiker); 23 26 $.each(json.meetrondje, function(m, meetrondje){ 24 27 $("#select_dataset").append($("<option/>").attr({"class":json.gebruiker, "value":meetrondje.naam}).text(meetrondje.naam)); 25 28 $.each(meetrondje.nodes, function(n, nodes){ 26 29 $("#select_node").append($("<option/>").attr({"class":meetrondje.naam, "value":nodes}).text(nodes)); 30 if(jQuery.inArray(nodes, nodelist)<0){ 31 document.getElementById('filter_text').innerHTML+=("<br />Node added to array: " + nodes); 32 nodelist.push(nodes); 33 } 27 34 }); 28 35 }); … … 33 40 } 34 41 ); 35 });36 42 37 // add filter 38 $(function(){ 43 // add filter per user 44 $('#user_filter').click(function(){ 45 $.each(userlist, function(u, user){ 46 colour = '&colour='+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256); 47 OpenLayers.Layer.OSM.Overlay = OpenLayers.Class(OpenLayers.Layer.OSM, { 48 initialize: function(name, options) { 49 var url = [ 50 "/website/tile/${z}/${x},${y}.png?" + colour + "&meetrondje__gebruiker__naam=" + user 51 ]; 52 document.getElementById('filter_text').innerHTML+="<br />Added: " + url; 53 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); 54 var newArguments = [name, url, options]; 55 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments); 56 }, 57 CLASS_NAME: "OpenLayers.Layer.Overlay" 58 }); 59 filterlayer = new OpenLayers.Layer.OSM.Overlay("User: "+ user, {isBaseLayer: false, visibility: true}); 60 map.addLayer(filterlayer); 61 }); 62 }); 63 64 // add filter per node 65 $('#node_filter').click(function(){ 66 $.each(nodelist, function(n, node){ 67 colour = '&colour='+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256); 68 OpenLayers.Layer.OSM.Overlay = OpenLayers.Class(OpenLayers.Layer.OSM, { 69 initialize: function(name, options) { 70 var url = [ 71 "/website/tile/${z}/${x},${y}.png?" + colour + "&accespoint__ssid=" + node 72 ]; 73 document.getElementById('filter_text').innerHTML+="<br />Added: " + url; 74 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); 75 var newArguments = [name, url, options]; 76 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments); 77 }, 78 CLASS_NAME: "OpenLayers.Layer.Overlay" 79 }); 80 filterlayer = new OpenLayers.Layer.OSM.Overlay("Node: "+ node, {isBaseLayer: false, visibility: true}); 81 map.addLayer(filterlayer); 82 }); 83 }); 84 85 // add custom filter 39 86 $('#add_filter').click(function(){ 40 87 //get values from elements 41 88 user = $('#select_user option:selected').text(); 42 89 dataset = $('#select_dataset option:selected').text(); … … 51 98 colour = parseInt((colour.substr(3, 2)),16) + ',' + parseInt((colour.substr(5, 2)),16) + ',' + parseInt((colour.substr(7, 2)),16); 52 99 100 // some checks if values are correct, and adding them to parts of the link 53 101 if (user != ''){user='&meetrondje__gebruiker__naam='+user;} 54 102 if (dataset != ''){dataset='&meetrondje__naam='+dataset;} … … 80 128 end_date='&meetrondje__datum__lte=' + ed_y +'-'+ ed_m +'-'+ ed_d; 81 129 } 82 83 84 130 if (colour != 'NaN,NaN,NaN'){colour='colour='+colour;} 85 131 else {colour = '&colour='+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256);} … … 87 133 else {lname = 'Custom Filter';} 88 134 89 var baseurl = "/website/tile/${z}/${x},${y}.png?"; 90 135 // setting layer 91 136 OpenLayers.Layer.OSM.Overlay = OpenLayers.Class(OpenLayers.Layer.OSM, { 92 137 initialize: function(name, options) { 93 138 var url = [ 94 baseurl + colour + user + dataset + wlnode + start_date + end_date /* + enc */139 "/website/tile/${z}/${x},${y}.png?" + colour + user + dataset + wlnode + start_date + end_date 95 140 ]; 96 141 document.getElementById('filter_text').innerHTML+="<br />Added: " + url; … … 102 147 }); 103 148 149 // adding layer 104 150 filterlayer = new OpenLayers.Layer.OSM.Overlay(lname, {isBaseLayer: false, visibility: true}); 105 151 map.addLayer(filterlayer); -
src/django_gheat/website/templates/home.html
r9253 r9263 62 62 <select id="select_dataset" style="width:104px"></select> Dataset<br /> 63 63 <select id="select_node" style="width:104px"></select> Node<br /> 64 <input type="text" id="lname" name="lname" size="10"/> Layername<br /><br />64 <input type="text" id="lname" name="lname" size="10"/> Filtername<br /><br /> 65 65 <input type="text" id="colour" name="colour"/> Colour<br /><br /> 66 <input type="button" id="add_filter" value="Add filter"/> 66 <input type="button" id="add_filter" value="Add filter"/><br /> 67 <input type="button" id="user_filter" value="Userfilter"/> 68 <input type="button" id="node_filter" value="Nodefilter"/> 67 69 </form> 68 70 </div>
Note:
See TracChangeset
for help on using the changeset viewer.