[8966] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
---|
| 2 | <html xmlns="http://www.w3.org/1999/xhtml">
|
---|
| 3 | <head>
|
---|
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
---|
| 5 | <title>Heatmap</title>
|
---|
| 6 | <link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
|
---|
| 7 | <script type='text/javascript' src='http://svn.openlayers.org/sandbox/camptocamp/canvas/openlayers/lib/OpenLayers.js'></script>
|
---|
| 8 | <script src="script/heatmap.js"></script>
|
---|
| 9 | <script src="script/canvas-barrier.js"></script>
|
---|
| 10 |
|
---|
| 11 | <script type="text/javascript">
|
---|
| 12 | var map;
|
---|
| 13 | var vectorLayer;
|
---|
| 14 |
|
---|
| 15 | function init(){
|
---|
| 16 | map = new OpenLayers.Map('heatmap');
|
---|
| 17 |
|
---|
| 18 | var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
---|
| 19 | "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
|
---|
| 20 | map.addLayer(layer);
|
---|
| 21 |
|
---|
| 22 | map.setCenter(new OpenLayers.LonLat(-101, 39), 4);
|
---|
| 23 |
|
---|
| 24 | vectorLayer = new OpenLayers.Layer.Vector.HeatMap("HeatMap", {
|
---|
| 25 | rendererOptions: {
|
---|
| 26 | // a radius of 20px looks good at this zoom-level
|
---|
| 27 | pointSize: 20 ,
|
---|
| 28 | heatMapWebWorkerPath: "../script/heatmap-webworker.js"
|
---|
| 29 |
|
---|
| 30 | }
|
---|
| 31 | });
|
---|
| 32 |
|
---|
| 33 | // create a few random points
|
---|
| 34 | var points = [];
|
---|
| 35 | for (var i = 0; i < 200 ; i++) {
|
---|
| 36 | var point = randomPoint();
|
---|
| 37 | var pointFeature = new OpenLayers.Feature.Vector(point);
|
---|
| 38 | points.push(pointFeature);
|
---|
| 39 | }
|
---|
| 40 | vectorLayer.addFeatures(points);
|
---|
| 41 |
|
---|
| 42 | vectorLayer.events.register("renderProgress", null, function(event) {
|
---|
| 43 | document.getElementById("progressBar").value = event.progress;
|
---|
| 44 | document.getElementById("progressBarFallback").innerHTML = event.progress;
|
---|
| 45 | });
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 | map.addLayer(vectorLayer);
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | function randomPoint() {
|
---|
| 52 | var x = random(20, 480);
|
---|
| 53 | var y = random(15, 240);
|
---|
| 54 | var lonlat = map.getLonLatFromPixel(new OpenLayers.Pixel(x, y));
|
---|
| 55 |
|
---|
| 56 | return new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat);
|
---|
| 57 | };
|
---|
| 58 |
|
---|
| 59 | function random(min, max) {
|
---|
| 60 | var delta = max - min;
|
---|
| 61 | var random = Math.floor(Math.random()*(delta + 1));
|
---|
| 62 |
|
---|
| 63 | return min + random;
|
---|
| 64 | };
|
---|
| 65 |
|
---|
| 66 | function toggleUseWebWorkers() {
|
---|
| 67 | vectorLayer.renderer.renderAsync = document.getElementById("useWebWorkers").checked;
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | </script>
|
---|
| 71 | </head>
|
---|
| 72 |
|
---|
| 73 | <body onload="init()">
|
---|
| 74 | <div id="wrapper">
|
---|
| 75 | <div id="header">
|
---|
| 76 | <a href="index.html"><img src="img/logo.png" border="0" style="float: left;"/></a>
|
---|
| 77 | <font style="font-size:24px; color:white;">Stichting Wireless Leiden</font><br />
|
---|
| 78 | <font style="font-size:46px; color:white;">Heatmap</font>
|
---|
| 79 | </div>
|
---|
| 80 | <div id="content">
|
---|
| 81 | <h1>Info</h1><br />
|
---|
[8967] | 82 | OpenLayers heatmap. Kan traag zijn met laden.
|
---|
| 83 | Werkt misschien niet even goed met elke browser.
|
---|
[8966] | 84 | </div>
|
---|
| 85 | <div id="heatmap">
|
---|
| 86 | </div>
|
---|
| 87 | <div id="footer"> <a href="http://www.wirelessleiden.nl/">wirelessleiden.nl</a> </div>
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 | </body>
|
---|
| 91 | </html>
|
---|