Changeset 9186 for src/django_gheat/website/static
- Timestamp:
- May 12, 2011, 12:56:07 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/website/static/heatmap.js
r9177 r9186 21 21 map.events.register('click', map, GetMousePos); 22 22 function GetMousePos(pos) { 23 var pixel = new OpenLayers.Pixel(pos.xy.x,pos.xy.y); 24 var lonlat = map.getLonLatFromPixel(pixel); 25 var mousepos = OpenLayers.Layer.SphericalMercator.inverseMercator(lonlat.lon, lonlat.lat); 26 loadNodeList(mousepos); 23 var pixbuffer = 100; 24 var sw = map.getLonLatFromPixel(new OpenLayers.Pixel(pos.xy.x+pixbuffer,pos.xy.y-pixbuffer)); 25 var ne = map.getLonLatFromPixel(new OpenLayers.Pixel(pos.xy.x-pixbuffer,pos.xy.y+pixbuffer)); 26 var pointsw = OpenLayers.Layer.SphericalMercator.inverseMercator(sw.lon, sw.lat); 27 var pointne = OpenLayers.Layer.SphericalMercator.inverseMercator(ne.lon, ne.lat); 28 getNodeList(pointsw, pointne); 27 29 } 28 30 … … 46 48 } 47 49 48 function loadNodeList(mousepos){50 function getNodeList(sw, ne){ 49 51 var nodelist; 50 52 if (window.XMLHttpRequest){ … … 59 61 nodelist.onreadystatechange=function(){ 60 62 if (nodelist.readyState==4 && nodelist.status==200){ 61 txt= eval("("+nodelist.responseText+")")63 txt=nodelist.responseText 62 64 document.getElementById('nodelist').innerHTML=txt; 63 65 } 64 66 } 65 67 66 nodelist.open("GET","/website/nodelist/" + mousepos.lat + "," + mousepos.lon,true);68 nodelist.open("GET","/website/nodelist/" + sw.lat + "," + sw.lon + "," + ne.lat + "," + ne.lon,true); 67 69 nodelist.send(); 68 70 }
Note:
See TracChangeset
for help on using the changeset viewer.