Changeset 9203


Ignore:
Timestamp:
May 18, 2011, 10:46:53 AM (14 years ago)
Author:
dennisw
Message:

First testfilter added (filters on accespoint_id).

Location:
src/django_gheat/website
Files:
2 edited

Legend:

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

    r9201 r9203  
     1var map;
    12function init(){
    23
     
    1920        });
    2021
    21         map.events.register('mouseover', map, GetMousePos);
     22        map.events.register('click', map, GetMousePos);
    2223        function GetMousePos(pos) {
    2324                var pix = map.getLonLatFromPixel(new OpenLayers.Pixel(pos.xy.x,pos.xy.y));
     
    6566        list += json[i].fields.ssid + '<br>';
    6667      }
    67       document.getElementById('nodelist').innerHTML=list;
     68      document.getElementById('filters').innerHTML=list;
    6869    }
    6970  }
    70 
    7171  nodelist.open("GET","/website/nodelist/" + zoomlevel + "," + mousepos.lat + "," + mousepos.lon,true);
    7272  nodelist.send();
    7373}
     74
     75var apid = 1;
     76
     77function filters(){
     78  var filter;
     79  if (window.XMLHttpRequest){
     80    // code for IE7+, Firefox, Chrome, Opera, Safari
     81    filter=new XMLHttpRequest();
     82  }
     83  else{
     84    // code for IE6, IE5
     85    filter=new ActiveXObject("Microsoft.XMLHTTP");
     86  }
     87
     88  filter.onreadystatechange=function(){
     89    if (filter.readyState==4 && filter.status==200){
     90      map.addLayer(layerHeatmap3);
     91    }
     92  }
     93  var apid = encodeURIComponent(document.getElementById("apid").value);
     94  addFilter(apid);
     95}
     96
     97function addFilter(apid){
     98  OpenLayers.Layer.OSM.Overlay = OpenLayers.Class(OpenLayers.Layer.OSM, {
     99    initialize: function(name, options) {
     100      var url = [
     101        "/website/tile/${z}/${x},${y}.png?colour=0,0,255&accespoint__id=" + apid
     102      ];
     103      options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
     104      var newArguments = [name, url, options];
     105      OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
     106    },
     107  CLASS_NAME: "OpenLayers.Layer.Overlay"
     108  });
     109
     110  testlayer = new OpenLayers.Layer.OSM.Overlay("addFilter layer", {isBaseLayer: false, visibility: true});
     111  map.addLayer(testlayer);
     112}
  • src/django_gheat/website/templates/home.html

    r9191 r9203  
    1717        <h1>Info</h1><br />
    1818        Info
     19        <form method="get" action="">
     20          Accespoint ID: <input type="text" id="apid" name="apid" size="25" /> <br />
     21          <input type="button" value="submit" onClick="filters()" />
     22        </form>
    1923        <div id="nodelist"></div>
    2024      </div>
Note: See TracChangeset for help on using the changeset viewer.