[8468] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
---|
| 2 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
---|
[8474] | 3 | <!--
|
---|
| 4 | Author: Rick van der Zwet <info@rickvanderzwet.nl>
|
---|
| 5 | License: BSDLike - http://svn.wirelessleiden.nl/svn/LICENSE.txt
|
---|
| 6 | -->
|
---|
[8468] | 7 | <html xmlns="http://www.w3.org/1999/xhtml">
|
---|
[8280] | 8 | <head>
|
---|
[8468] | 9 | <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
---|
| 10 | <title>Wireless Leiden Nodemap using OpenLayers.org and OpenSteetmap.org</title>
|
---|
| 11 | <style type="text/css">
|
---|
[8280] | 12 | html, body, #basicMap {
|
---|
| 13 | width: 100%;
|
---|
| 14 | height: 100%;
|
---|
| 15 | margin: 0;
|
---|
| 16 | }
|
---|
[8468] | 17 | </style>
|
---|
[8469] | 18 | <script
|
---|
| 19 | src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAKRiFs2kXKhTkKZkE_ms9rhTdBXm62xfhQU7Dk6ZBFSzYdmSteRQWjLqZhwX8afHvGpd4N3iKql6w8g" type="text/javascript"> </script>
|
---|
| 20 | <script src="http://openlayers.org/dev/OpenLayers.js" type="text/javascript"> </script>
|
---|
[8468] | 21 | <script type="text/javascript">
|
---|
[8469] | 22 | // <![CDATA[
|
---|
[8304] | 23 | var url_pal3 = "http://maps.google.com/mapfiles/kml/pal3/";
|
---|
| 24 | var map, rulerControl, clickControl;
|
---|
[8303] | 25 | var mapnik, wms;
|
---|
[8474] | 26 | var svnVersion = '$Id: nodemap.html 8475 2010-09-19 16:03:33Z rick $';
|
---|
| 27 | var version = '0.10';
|
---|
[8283] | 28 | var projection_wgs = new OpenLayers.Projection("EPSG:4326"); // WGS 1984
|
---|
| 29 | var projection_smp = new OpenLayers.Projection("EPSG:900913"); // Spherical Mercator Projection
|
---|
[8468] | 30 |
|
---|
[8303] | 31 | var current_opacity = 0.5;
|
---|
| 32 | var max_opacity = 0.9;
|
---|
| 33 | var min_opacity = 0.1;
|
---|
[8468] | 34 |
|
---|
[8469] | 35 | var nodeStatusImg = [];
|
---|
| 36 | nodeStatusImg.up = 'http://www.google.com/mapfiles/kml/paddle/grn-stars-lv.png';
|
---|
| 37 | nodeStatusImg.down = 'http://www.google.com/mapfiles/kml/paddle/red-stars-lv.png';
|
---|
| 38 | nodeStatusImg.planned = 'http://www.google.com/mapfiles/kml/paddle/wht-stars-lv.png';
|
---|
| 39 | nodeStatusImg.unknown = 'http://www.google.com/mapfiles/kml/paddle/wht-stars-lv.png';
|
---|
[8468] | 40 |
|
---|
[8457] | 41 | function log(message) {
|
---|
| 42 | /* Determine whether Firebug is actually installed and activated before trying to log
|
---|
| 43 | * Taken from http://code.google.com/p/fbug/source/browse/branches/firebug1.5/lite/firebugx.js
|
---|
| 44 | */
|
---|
| 45 | if (window.console && console.firebug) {
|
---|
| 46 | console.log(message);
|
---|
| 47 | }
|
---|
| 48 | }
|
---|
[8468] | 49 |
|
---|
[8456] | 50 | function isInterlink(feature) {
|
---|
| 51 | return (feature.attributes.name.indexOf('Interlink') != -1);
|
---|
| 52 | }
|
---|
[8469] | 53 |
|
---|
| 54 | function coordConvert(lam, phi) {
|
---|
| 55 | var lam_deg = Math.floor(lam);
|
---|
| 56 | var t = (lam - lam_deg) * 60;
|
---|
| 57 | var lam_min = Math.floor(t);
|
---|
| 58 | var lam_sec = (t - lam_min) * 60;
|
---|
[8468] | 59 |
|
---|
[8469] | 60 | var phi_deg = Math.floor(phi);
|
---|
| 61 | t = (phi - phi_deg) * 60;
|
---|
| 62 | var phi_min = Math.floor(t);
|
---|
| 63 | var phi_sec = (t - phi_min) * 60;
|
---|
| 64 |
|
---|
| 65 | var url = "http://www.rdnap.nl/cgi-bin/rdetrs.pl?func=etrs2rd&h=0" +
|
---|
| 66 | "&lam_deg=" + lam_deg +
|
---|
| 67 | "&lam_min=" + lam_min +
|
---|
| 68 | "&lam_sec=" + lam_sec +
|
---|
| 69 | "&phi_deg=" + phi_deg +
|
---|
| 70 | "&phi_min=" + phi_min +
|
---|
| 71 | "&phi_sec=" + phi_sec
|
---|
| 72 | ;
|
---|
| 73 | return(url);
|
---|
| 74 | }
|
---|
| 75 |
|
---|
[8471] | 76 | OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
|
---|
[8304] | 77 | defaultHandlerOptions: {
|
---|
| 78 | 'single': true,
|
---|
| 79 | 'double': false,
|
---|
| 80 | 'pixelTolerance': 0,
|
---|
| 81 | 'stopSingle': false,
|
---|
| 82 | 'stopDouble': false
|
---|
| 83 | },
|
---|
[8468] | 84 |
|
---|
[8304] | 85 | initialize: function(options) {
|
---|
| 86 | this.handlerOptions = OpenLayers.Util.extend(
|
---|
| 87 | {}, this.defaultHandlerOptions
|
---|
| 88 | );
|
---|
| 89 | OpenLayers.Control.prototype.initialize.apply(
|
---|
| 90 | this, arguments
|
---|
| 91 | );
|
---|
| 92 | this.handler = new OpenLayers.Handler.Click(
|
---|
| 93 | this, {
|
---|
| 94 | 'click': this.trigger
|
---|
| 95 | }, this.handlerOptions
|
---|
| 96 | );
|
---|
| 97 | },
|
---|
[8468] | 98 |
|
---|
[8304] | 99 | trigger: function(e) {
|
---|
| 100 | var lonlat = map.getLonLatFromViewPortPx(e.xy);
|
---|
| 101 | lonlat = lonlat.transform( projection_smp, projection_wgs);
|
---|
| 102 | var url = coordConvert(lonlat.lon, lonlat.lat);
|
---|
[8471] | 103 | document.getElementById('coordOutput').href = url;
|
---|
| 104 | document.getElementById('coordOutput').innerHTML = Math.round(lonlat.lon * 1000) / 1000 + " N, " + Math.round(lonlat.lat * 1000) / 1000 + " E";
|
---|
[8304] | 105 | }
|
---|
[8468] | 106 |
|
---|
[8304] | 107 | });
|
---|
[8468] | 108 |
|
---|
| 109 |
|
---|
[8303] | 110 | function setOpacity(new_opacity) {
|
---|
| 111 | current_opacity = new_opacity;
|
---|
| 112 | mapnik.setOpacity(new_opacity);
|
---|
| 113 | wms.setOpacity(new_opacity);
|
---|
| 114 | }
|
---|
[8468] | 115 |
|
---|
[8303] | 116 | function changeOpacity(by_opacity) {
|
---|
| 117 | var new_opacity = current_opacity + by_opacity;
|
---|
| 118 | new_opacity = Math.min(max_opacity, Math.max(min_opacity, new_opacity));
|
---|
| 119 | setOpacity(new_opacity);
|
---|
| 120 | }
|
---|
[8468] | 121 |
|
---|
[8474] | 122 | function initMap() {
|
---|
[8280] | 123 | map = new OpenLayers.Map("basicMap");
|
---|
[8468] | 124 |
|
---|
[8283] | 125 | var world_bound = new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
|
---|
[8303] | 126 | // Development focus maps
|
---|
| 127 | mapnik = new OpenLayers.Layer.OSM("OpenStreetMap");
|
---|
| 128 | wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
---|
| 129 | "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
|
---|
[8468] | 130 |
|
---|
[8303] | 131 | // Added extra's
|
---|
[8283] | 132 | var google_sat = new OpenLayers.Layer.Google("Google Satellite" ,
|
---|
| 133 | { type: G_SATELLITE_MAP,
|
---|
| 134 | sphericalMercator: true,
|
---|
| 135 | maxExtent: world_bound,
|
---|
[8469] | 136 | wrapDateLine: false
|
---|
[8303] | 137 | });
|
---|
[8283] | 138 | var google_normal = new OpenLayers.Layer.Google("Google Normal" ,
|
---|
| 139 | { type: G_NORMAL_MAP,
|
---|
| 140 | sphericalMercator: true,
|
---|
| 141 | maxExtent: world_bound,
|
---|
[8303] | 142 | wrapDateLine: false
|
---|
| 143 | });
|
---|
[8468] | 144 |
|
---|
[8303] | 145 |
|
---|
| 146 | map.addLayers([mapnik, wms, google_sat, google_normal]);
|
---|
| 147 | setOpacity(0.5);
|
---|
[8283] | 148 | defaultFocus();
|
---|
[8468] | 149 |
|
---|
| 150 |
|
---|
[8282] | 151 | //var pois = new OpenLayers.Layer.Text( "My Points",
|
---|
| 152 | // { location:"./textfile.txt",
|
---|
| 153 | // projection: map.displayProjection
|
---|
| 154 | // });
|
---|
| 155 | //map.addLayer(pois);
|
---|
[8468] | 156 |
|
---|
[8283] | 157 | //function parseKML(req) {
|
---|
| 158 | // alert(req.responseText);
|
---|
| 159 | //};
|
---|
| 160 | //alert(OpenLayers.loadURL("./kmlfile.kml", "", null, parseKML));
|
---|
[8468] | 161 |
|
---|
| 162 |
|
---|
[8453] | 163 | function ignoreInterlink(cluster, feature) {
|
---|
[8456] | 164 | if (isInterlink(feature)) {
|
---|
[8469] | 165 | return(false);
|
---|
[8453] | 166 | } else {
|
---|
| 167 | return strategy.shouldClusterOrig(cluster, feature); }
|
---|
[8469] | 168 | }
|
---|
[8468] | 169 |
|
---|
[8447] | 170 | strategy = new OpenLayers.Strategy.Cluster();
|
---|
[8453] | 171 | strategy.shouldClusterOrig = strategy.shouldCluster;
|
---|
| 172 | strategy.shouldCluster = ignoreInterlink;
|
---|
| 173 | strategy.distance = 10;
|
---|
| 174 | strategy.threshold = 2;
|
---|
[8468] | 175 |
|
---|
[8454] | 176 | //OpenLayers.Feature.Vector.style["default"]);
|
---|
[8468] | 177 |
|
---|
[8454] | 178 | var symbolizer = new OpenLayers.Style({
|
---|
| 179 | externalGraphic: "${icon}",
|
---|
| 180 | pointRadius: "${radius}",
|
---|
[8469] | 181 | fillOpacity: 1
|
---|
[8454] | 182 | }, { context : {
|
---|
| 183 | icon : function(feature) {
|
---|
[8469] | 184 | var iconStatus = "DEADCODE";
|
---|
[8454] | 185 | if(feature.cluster) {
|
---|
| 186 | for (var i = 0; i < feature.cluster.length; i++) {
|
---|
| 187 | var nodeStatus = feature.cluster[i].attributes.styleUrl.split('_')[2];
|
---|
| 188 | iconStatus = nodeStatus;
|
---|
| 189 | // If one if having issues, update the overview icon to reflect this
|
---|
| 190 | if (nodeStatus == 'unknown' || nodeStatus == 'planned' || nodeStatus == 'down') { break; }
|
---|
| 191 | }
|
---|
| 192 | } else {
|
---|
| 193 | iconStatus = feature.attributes.styleUrl.split('_')[2];
|
---|
| 194 | }
|
---|
| 195 | return nodeStatusImg[iconStatus];
|
---|
| 196 | },
|
---|
| 197 | radius : function(feature) {
|
---|
| 198 | var pix = 8;
|
---|
| 199 | if(feature.cluster) {
|
---|
| 200 | pix = pix + feature.attributes.count;
|
---|
| 201 | for (var i = 0; i < feature.cluster.length; i++) {
|
---|
| 202 | var node = feature.cluster[i];
|
---|
[8457] | 203 | log(node.attributes.styleUrl);
|
---|
[8454] | 204 | }
|
---|
| 205 | }
|
---|
| 206 | return pix;
|
---|
| 207 | }
|
---|
| 208 | }
|
---|
| 209 | });
|
---|
[8468] | 210 |
|
---|
[8453] | 211 | var styleMap = new OpenLayers.StyleMap({"default": symbolizer, "select": {pointRadius: 16,fillOpacity: 1}});
|
---|
[8468] | 212 |
|
---|
[8307] | 213 | // Hack to get around all kind of caching fails
|
---|
| 214 | var epoch = new Date().getTime();
|
---|
| 215 | var kml = new OpenLayers.Layer.GML("KML", "./kmlfile.kml?time=" + epoch,
|
---|
[8447] | 216 | { strategies: [strategy],
|
---|
[8453] | 217 | styleMap: styleMap,
|
---|
[8447] | 218 | format: OpenLayers.Format.KML,
|
---|
[8282] | 219 | formatOptions: {
|
---|
| 220 | extractStyles: true,
|
---|
| 221 | extractAttributes: true,
|
---|
[8285] | 222 | maxDepth: 5
|
---|
[8282] | 223 | }
|
---|
| 224 | });
|
---|
| 225 | map.addLayer(kml);
|
---|
[8469] | 226 |
|
---|
| 227 | function onPopupClose(evt) {
|
---|
| 228 | select.unselectAll();
|
---|
| 229 | }
|
---|
| 230 |
|
---|
| 231 | function onKMLFeatureSelect(event) {
|
---|
| 232 | var feature = event.feature;
|
---|
| 233 | var content = "";
|
---|
| 234 | if (feature.cluster) {
|
---|
| 235 | for (var i = 0; i < feature.cluster.length; i++) {
|
---|
| 236 | var node = feature.cluster[i];
|
---|
| 237 | iconStatus = node.attributes.styleUrl.split('_')[2];
|
---|
| 238 | iconImg = nodeStatusImg[iconStatus];
|
---|
| 239 | content = content + "<h4><img src='" + iconImg + "' />" + node.attributes.name + "</h4>" + node.attributes.description + "<br />";
|
---|
| 240 | }
|
---|
| 241 | } else {
|
---|
| 242 | if (isInterlink(feature)) {
|
---|
| 243 | content = "<h4>" + feature.attributes.name + "</h4>" + "<br />" + "<em>Link information: " + feature.attributes.description + "</em>";
|
---|
| 244 | } else {
|
---|
[8472] | 245 | var nagiosRoot = 'http://sunfire.wirelessleiden.nl/nagios';
|
---|
[8469] | 246 | var nodeName = feature.attributes.name.split(' ')[1];
|
---|
[8472] | 247 | var nagiosUrl = nagiosRoot + "/cgi-bin/status.cgi?host=" + nodeName + "&servicestatustypes=28&hoststatustypes=15&noheader=true";
|
---|
| 248 |
|
---|
| 249 | content = "Status provided by <a href='" + nagiosRoot +
|
---|
| 250 | "/'>Nagios monitoring system</a><br />" +
|
---|
| 251 | "<iframe frameborder='0' height='300px' width='700px'" +
|
---|
| 252 | "src='" + nagiosUrl + "'></iframe>" +
|
---|
| 253 | "<br />" +
|
---|
| 254 | "<em>Locatie: " + feature.attributes.description + "</em>";
|
---|
[8469] | 255 | }
|
---|
| 256 | }
|
---|
| 257 | popup = new OpenLayers.Popup.FramedCloud("chicken",
|
---|
| 258 | feature.geometry.getBounds().getCenterLonLat(),
|
---|
| 259 | new OpenLayers.Size(100,100),
|
---|
| 260 | content,
|
---|
| 261 | null, true, onPopupClose);
|
---|
| 262 | feature.popup = popup;
|
---|
| 263 | map.addPopup(popup);
|
---|
| 264 | }
|
---|
[8468] | 265 |
|
---|
[8469] | 266 | function onKMLFeatureUnselect(event) {
|
---|
| 267 | var feature = event.feature;
|
---|
| 268 | if(feature.popup) {
|
---|
| 269 | map.removePopup(feature.popup);
|
---|
| 270 | feature.popup.destroy();
|
---|
| 271 | delete feature.popup;
|
---|
| 272 | }
|
---|
| 273 | }
|
---|
| 274 |
|
---|
| 275 | function handleMeasurements(event) {
|
---|
| 276 | // For some reason 'delayed' events get posted even though the object
|
---|
| 277 | // is deactivated
|
---|
| 278 | if (!rulerControl.active) {
|
---|
| 279 | return;
|
---|
| 280 | }
|
---|
| 281 | var units = event.units;
|
---|
| 282 | var order = event.order;
|
---|
| 283 | var measure = event.measure;
|
---|
| 284 | var element = document.getElementById('output');
|
---|
| 285 | out = measure.toFixed(3) + " " + units;
|
---|
| 286 | if(order == 2) {
|
---|
| 287 | out += "<sup>2</" + "sup>";
|
---|
| 288 | } else {
|
---|
| 289 | }
|
---|
| 290 | element.innerHTML = out;
|
---|
| 291 | }
|
---|
| 292 |
|
---|
[8285] | 293 | select = new OpenLayers.Control.SelectFeature(kml);
|
---|
| 294 | kml.events.on( {
|
---|
| 295 | "featureselected": onKMLFeatureSelect,
|
---|
| 296 | "featureunselected": onKMLFeatureUnselect
|
---|
| 297 | });
|
---|
| 298 | map.addControl(select);
|
---|
| 299 | select.activate();
|
---|
[8468] | 300 |
|
---|
[8304] | 301 | clickControl = new OpenLayers.Control.Click();
|
---|
| 302 | map.addControl(clickControl);
|
---|
| 303 | clickControl.deactivate();
|
---|
[8468] | 304 |
|
---|
| 305 |
|
---|
[8471] | 306 | // XXX: Enable if we found some use for it somewhere
|
---|
| 307 | // var vectors = new OpenLayers.Layer.Vector("Vector Layer");
|
---|
| 308 | // map.addLayer(vectors);
|
---|
| 309 | // map.addControl(new OpenLayers.Control.EditingToolbar(vectors));
|
---|
| 310 |
|
---|
[8283] | 311 | map.addControl(new OpenLayers.Control.MousePosition({ 'displayProjection' : projection_wgs }));
|
---|
| 312 | map.addControl(new OpenLayers.Control.LayerSwitcher());
|
---|
| 313 | map.addControl(new OpenLayers.Control.OverviewMap());
|
---|
| 314 | map.addControl(new OpenLayers.Control.Permalink());
|
---|
| 315 | map.addControl(new OpenLayers.Control.ScaleLine());
|
---|
| 316 | map.addControl(new OpenLayers.Control.KeyboardDefaults());
|
---|
[8285] | 317 | map.addControl(new OpenLayers.Control.ZoomBox());
|
---|
[8468] | 318 |
|
---|
| 319 |
|
---|
[8282] | 320 | //var in_options = {
|
---|
| 321 | // 'internalProjection': map.baseLayer.projection,
|
---|
| 322 | // 'externalProjection': new OpenLayers.Projection("EPSG:4326")
|
---|
| 323 | //};
|
---|
| 324 | //var wkt = new OpenLayers.Format.WKT(in_options);
|
---|
| 325 | //var txtFile = new XMLHttpRequest();
|
---|
| 326 | //txtFile.open("GET", "./wktfile.txt", false);
|
---|
| 327 | //// txtFile.onreadystatechange = function() {
|
---|
| 328 | //// if(txtFile.readyState == 4) {
|
---|
| 329 | //// alert(txtFile.responseText);
|
---|
| 330 | //// }
|
---|
| 331 | //// }
|
---|
| 332 | //txtFile.send(null);
|
---|
[8468] | 333 |
|
---|
[8282] | 334 | //var features = wkt.read(txtFile.responseText.replace(/\n/g,''));
|
---|
| 335 | //var bounds;
|
---|
| 336 | //
|
---|
| 337 | //if (features) {
|
---|
| 338 | // if(features.constructor != Array) {
|
---|
| 339 | // features = [features];
|
---|
| 340 | // }
|
---|
| 341 | // for(var i=0; i<features.length; ++i) {
|
---|
| 342 | // if (!bounds) {
|
---|
| 343 | // bounds = features[i].geometry.getBounds();
|
---|
| 344 | // }
|
---|
| 345 | // bounds.extend(features[i].geometry.getBounds());
|
---|
| 346 | // }
|
---|
| 347 | // vectors.addFeatures(features);
|
---|
| 348 | // map.zoomToExtent(bounds);
|
---|
| 349 | //} else {
|
---|
| 350 | // alert("ERROR in WTK");
|
---|
| 351 | //}
|
---|
[8468] | 352 |
|
---|
| 353 |
|
---|
[8283] | 354 | // style the sketch fancy
|
---|
| 355 | var sketchSymbolizers = {
|
---|
| 356 | "Point": {
|
---|
| 357 | pointRadius: 4,
|
---|
| 358 | graphicName: "square",
|
---|
| 359 | fillColor: "white",
|
---|
| 360 | fillOpacity: 1,
|
---|
| 361 | strokeWidth: 1,
|
---|
| 362 | strokeOpacity: 1,
|
---|
| 363 | strokeColor: "#333333"
|
---|
| 364 | },
|
---|
| 365 | "Line": {
|
---|
| 366 | strokeWidth: 3,
|
---|
| 367 | strokeOpacity: 1,
|
---|
| 368 | strokeColor: "#666666",
|
---|
| 369 | strokeDashstyle: "dash"
|
---|
| 370 | },
|
---|
| 371 | "Polygon": {
|
---|
| 372 | strokeWidth: 2,
|
---|
| 373 | strokeOpacity: 1,
|
---|
| 374 | strokeColor: "#666666",
|
---|
| 375 | fillColor: "white",
|
---|
| 376 | fillOpacity: 0.3
|
---|
| 377 | }
|
---|
| 378 | };
|
---|
| 379 | var style = new OpenLayers.Style();
|
---|
| 380 | style.addRules([
|
---|
| 381 | new OpenLayers.Rule({symbolizer: sketchSymbolizers})
|
---|
| 382 | ]);
|
---|
[8469] | 383 | var rulerStyleMap = new OpenLayers.StyleMap({"default": style});
|
---|
[8283] | 384 |
|
---|
| 385 | rulerControl = new OpenLayers.Control.Measure(
|
---|
| 386 | OpenLayers.Handler.Path, {
|
---|
| 387 | persist: true,
|
---|
| 388 | handlerOptions: {
|
---|
[8469] | 389 | layerOptions: {styleMap: rulerStyleMap}
|
---|
[8283] | 390 | }
|
---|
| 391 | }
|
---|
[8280] | 392 | );
|
---|
[8468] | 393 |
|
---|
[8283] | 394 | rulerControl.events.on({
|
---|
| 395 | "measure": handleMeasurements,
|
---|
| 396 | "measurepartial": handleMeasurements
|
---|
| 397 | });
|
---|
| 398 | map.addControl(rulerControl);
|
---|
[8474] | 399 | } // end of init
|
---|
| 400 |
|
---|
| 401 |
|
---|
| 402 |
|
---|
[8283] | 403 | function resize() {
|
---|
| 404 | size = new OpenLayers.Size(size.w + 10, size.h + 10);
|
---|
| 405 | icon.setSize(size);
|
---|
| 406 | }
|
---|
[8474] | 407 |
|
---|
| 408 |
|
---|
| 409 |
|
---|
[8471] | 410 | function toggleFieldById(field) {
|
---|
| 411 | var e = document.getElementById(field);
|
---|
| 412 | if (e.style.visibility == "hidden") {
|
---|
| 413 | e.style.visibility = "visible";
|
---|
| 414 | } else {
|
---|
| 415 | e.style.visibility = "hidden";
|
---|
| 416 | }
|
---|
| 417 | }
|
---|
[8474] | 418 |
|
---|
| 419 |
|
---|
| 420 |
|
---|
[8304] | 421 | function toggleClickControl() {
|
---|
[8471] | 422 | toggleFieldById('coordField');
|
---|
[8304] | 423 | if (!clickControl.active) {
|
---|
| 424 | clickControl.activate();
|
---|
| 425 | document.getElementById('click').src = url_pal3 + "icon32.png";
|
---|
| 426 | } else {
|
---|
| 427 | clickControl.deactivate();
|
---|
| 428 | document.getElementById('click').src = url_pal3 + "icon28.png";
|
---|
| 429 | }
|
---|
| 430 | }
|
---|
[8471] | 431 |
|
---|
[8474] | 432 |
|
---|
[8283] | 433 | function toggleRulerControl() {
|
---|
| 434 | if (!rulerControl.active) {
|
---|
| 435 | rulerControl.activate();
|
---|
| 436 | document.getElementById('ruler').src = "ruler_on.png";
|
---|
| 437 | } else {
|
---|
| 438 | rulerControl.deactivate();
|
---|
| 439 | document.getElementById('ruler').src = "ruler_off.png";
|
---|
[8305] | 440 | document.getElementById('output').innerHTML = "";
|
---|
[8283] | 441 | }
|
---|
| 442 | }
|
---|
[8474] | 443 |
|
---|
| 444 |
|
---|
| 445 |
|
---|
[8283] | 446 | function defaultFocus() {
|
---|
[8475] | 447 | //XXX: Make me dynamic based on the entries in the KML file
|
---|
| 448 | map.setCenter(new OpenLayers.LonLat(4.65,52.186).transform( projection_wgs, projection_smp), 12);
|
---|
[8283] | 449 | }
|
---|
[8474] | 450 |
|
---|
| 451 |
|
---|
| 452 |
|
---|
| 453 | function init() {
|
---|
| 454 | initMap();
|
---|
| 455 | document.getElementById('version').innerHTML = version;
|
---|
| 456 | document.getElementById('svnVersion').innerHTML = svnVersion;
|
---|
| 457 | }
|
---|
[8469] | 458 | // ]]>
|
---|
[8304] | 459 |
|
---|
[8468] | 460 | </script>
|
---|
[8304] | 461 |
|
---|
[8280] | 462 | </head>
|
---|
[8469] | 463 | <body onload="init()">
|
---|
[8283] | 464 | <div id="basicMap">
|
---|
[8285] | 465 | <div id="controller" style="position: absolute; top: 10px; left : 80px; z-index:1004">
|
---|
[8471] | 466 | <img id="ruler" src="ruler_off.png"
|
---|
| 467 | onclick="toggleRulerControl()" alt="ruler" title="Measure distance between points"/>
|
---|
[8468] | 468 | <img height="22" src="http://maps.google.com/mapfiles/kml/pal3/icon23.png" title="Reset focus" onclick="defaultFocus()" alt="Focus reset" />
|
---|
| 469 | <img height="22"
|
---|
| 470 | src="http://maps.google.com/mapfiles/kml/pal3/icon36.png"
|
---|
[8471] | 471 | title="Information" onclick="toggleFieldById('infoField')" alt="information" />
|
---|
[8468] | 472 | <img id="click" height="22"
|
---|
| 473 | src="http://maps.google.com/mapfiles/kml/pal3/icon28.png"
|
---|
[8471] | 474 | title="Get RD coordinates for use in Genesis" onclick="toggleClickControl()"
|
---|
[8468] | 475 | alt="coordinate converter"/>
|
---|
[8285] | 476 | <div id="output"></div>
|
---|
| 477 | </div>
|
---|
[8471] | 478 | <div id="infoField" style="position: absolute; bottom: 40px; left : 10px; z-index:1004; background-color: red; visibility: hidden">
|
---|
[8285] | 479 | <ul>
|
---|
| 480 | <li>holding down shift, whilst dragging the mouse to do box zooming</li>
|
---|
| 481 | <li>Keyboard Navigation is enabled</li>
|
---|
[8303] | 482 | <li>Contrast of background: <a title="decrease opacity" href="javascript: changeOpacity(-0.1);">Decrease</a> or <a title="increase opacity" href="javascript: changeOpacity(0.1);">Increase</a></li>
|
---|
[8285] | 483 | </ul>
|
---|
[8474] | 484 | <p>Validated by:
|
---|
[8469] | 485 | <a href="http://validator.w3.org/check?uri=referer"><img
|
---|
| 486 | src="http://www.w3.org/Icons/valid-xhtml10" title="Valid XHTML 1.0 Strict"
|
---|
[8474] | 487 | alt="Valid XHTML 1.0 Strict" height="17" />
|
---|
[8469] | 488 | <a href="http://jslint.com"><img src="http://www.jslint.com/jslintpill.gif" title="Valid JavaScript code" alt="Valid JavaScript code" /></a>
|
---|
[8474] | 489 | <br />
|
---|
| 490 | Version: <em id='version'></em> - <em id='svnVersion'></em>
|
---|
| 491 | <p />
|
---|
| 492 | <small>
|
---|
| 493 | Written by Rick van der Zwet - <info@rickvanderzwet.nl><br />
|
---|
| 494 | Licence: <a href="http://svn.wirelessleiden.nl/svn/LICENSE.txt">BSDlike</a>
|
---|
| 495 | </small>
|
---|
[8469] | 496 | </p>
|
---|
[8285] | 497 | </div>
|
---|
[8471] | 498 | <div id="coordField" style="position: absolute; bottom: 40px; left : 10px; z-index:1005; background-color: green; visibility: hidden">
|
---|
| 499 | Click on a location on the map to receive a link to calculate the RD coordinates: <br />
|
---|
| 500 | <a id="coordOutput" href="#" target="_blank">Click on MAP first</a>
|
---|
| 501 | </div>
|
---|
[8283] | 502 | </div>
|
---|
[8280] | 503 | </body>
|
---|
| 504 | </html>
|
---|