Changeset 9264 for src/django_gheat/website
- Timestamp:
- Jun 16, 2011, 5:02:02 PM (13 years ago)
- Location:
- src/django_gheat/website
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/website/static/heatmap.js
r9263 r9264 2 2 function init(){ 3 3 4 var projection_wgs = new OpenLayers.Projection("EPSG:4326"); // WGS 1984 4 var lat = 52.14068; 5 var lon = 4.48319; 6 var zoom = 16; 7 var projection_wgs = new OpenLayers.Projection("EPSG:4326"); // WGS 1984 5 8 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 9 map = new OpenLayers.Map('heatmap', { 10 controls: [ 11 new OpenLayers.Control.Navigation(), 12 //new OpenLayers.Control.PanZoomBar(), 13 //new OpenLayers.Control.ScaleLine(), 14 new OpenLayers.Control.Permalink(), 15 new OpenLayers.Control.LayerSwitcher(), 16 new OpenLayers.Control.MousePosition({ 'displayProjection' : projection_wgs }), 17 ], 18 maxExtent: new OpenLayers.Bounds(-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892), 19 numZoomLevels:16, 20 maxResolution:156543.0339, 21 units:'m', 22 projection: "EPSG:900913", 23 displayProjection: new OpenLayers.Projection("EPSG:4326") 24 }); 22 25 23 24 25 26 27 28 29 26 map.events.register('click', map, GetMousePos); 27 function GetMousePos(pos) { 28 var pix = map.getLonLatFromPixel(new OpenLayers.Pixel(pos.xy.x,pos.xy.y)); 29 var mousepos = OpenLayers.Layer.SphericalMercator.inverseMercator(pix.lon, pix.lat); 30 var zoomlevel = map.getZoom(); 31 getNodeList(zoom, mousepos); 32 } 30 33 31 32 34 layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik"); 35 map.addLayer(layerMapnik); 33 36 34 35 37 layerHeatmap2 = new OpenLayers.Layer.OSM.Overlay2("All Access points", {isBaseLayer: false, visibility: true}); 38 map.addLayer(layerHeatmap2); 36 39 37 38 40 layerHeatmap3 = new OpenLayers.Layer.OSM.Overlay3("Wireless Leiden Only", {isBaseLayer: false, visibility: true}); 41 map.addLayer(layerHeatmap3); 39 42 40 41 43 layerHeatmap = new OpenLayers.Layer.OSM.Overlay1("Original Heatmap generator", {isBaseLayer: false, visibility: false}); 44 map.addLayer(layerHeatmap); 42 45 43 var lon = 4.48319; 44 var lat = 52.14068; 45 var zoom = 16; 46 47 var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()); 48 map.setCenter (lonLat, zoom); 46 var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()); 47 map.setCenter (lonLat, zoom); 49 48 } -
src/django_gheat/website/static/heatmap_extensions.js
r9263 r9264 43 43 // add filter per user 44 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" 45 if(this.value=='Add userfilter'){ 46 $.each(userlist, function(u, user){ 47 colour = '&colour='+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256); 48 OpenLayers.Layer.OSM.Overlay = OpenLayers.Class(OpenLayers.Layer.OSM, { 49 initialize: function(name, options) { 50 var url = [ 51 "/website/tile/${z}/${x},${y}.png?" + colour + "&meetrondje__gebruiker__naam=" + user 52 ]; 53 document.getElementById('filter_text').innerHTML+="<br />Added: " + url; 54 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); 55 var newArguments = [name, url, options]; 56 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments); 57 }, 58 CLASS_NAME: "OpenLayers.Layer.Overlay" 59 }); 60 filterlayer = new OpenLayers.Layer.OSM.Overlay("User: "+ user, {isBaseLayer: false, visibility: true}); 61 map.addLayer(filterlayer); 58 62 }); 59 filterlayer = new OpenLayers.Layer.OSM.Overlay("User: "+ user, {isBaseLayer: false, visibility: true}); 60 map.addLayer(filterlayer); 61 }); 63 $(this).attr('value', 'Del userfilter'); 64 } 65 else{ 66 $(this).attr('value', 'Add userfilter'); 67 $.each(userlist, function(u, user){ 68 layer = map.getLayersByName('User: ' + user); 69 map.removeLayer(layer[0]); 70 }); 71 } 62 72 }); 63 73 64 74 // add filter per node 65 75 $('#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" 76 if(this.value=='Add nodefilter'){ 77 $.each(nodelist, function(n, node){ 78 colour = '&colour='+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256); 79 OpenLayers.Layer.OSM.Overlay = OpenLayers.Class(OpenLayers.Layer.OSM, { 80 initialize: function(name, options) { 81 var url = [ 82 "/website/tile/${z}/${x},${y}.png?" + colour + "&accespoint__ssid=" + node 83 ]; 84 document.getElementById('filter_text').innerHTML+="<br />Added: " + url; 85 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); 86 var newArguments = [name, url, options]; 87 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments); 88 }, 89 CLASS_NAME: "OpenLayers.Layer.Overlay" 90 }); 91 nodefilterlayer = new OpenLayers.Layer.OSM.Overlay("Node: "+ node, {isBaseLayer: false, visibility: true}); 92 map.addLayer(nodefilterlayer); 79 93 }); 80 filterlayer = new OpenLayers.Layer.OSM.Overlay("Node: "+ node, {isBaseLayer: false, visibility: true}); 81 map.addLayer(filterlayer); 82 }); 94 $(this).attr('value', 'Del nodefilter'); 95 } 96 else{ 97 $(this).attr('value', 'Add nodefilter'); 98 $.each(nodelist, function(n, node){ 99 layer = map.getLayersByName('Node: ' + node); 100 map.removeLayer(layer[0]); 101 }); 102 } 83 103 }); 84 104 -
src/django_gheat/website/templates/home.html
r9263 r9264 65 65 <input type="text" id="colour" name="colour"/> Colour<br /><br /> 66 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 <input type="button" id="user_filter" value="Add userfilter"/><br /> 68 <input type="button" id="node_filter" value="Add nodefilter"/><br /> 69 69 </form> 70 70 </div>
Note:
See TracChangeset
for help on using the changeset viewer.