From a47c4eecff79c1d57650b46c437b628d873705b2 Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Tue, 12 Nov 2013 18:24:00 +0000 Subject: bisher uncommitete aenderungen am www.ffgraz.net (nicht von mir) --- map.js | 264 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 246 insertions(+), 18 deletions(-) (limited to 'map.js') diff --git a/map.js b/map.js index 3ac9685..e51aea5 100644 --- a/map.js +++ b/map.js @@ -1,10 +1,11 @@ var map = null; +var linkinfo; var physicalMaxLevel; var geocoder = null; var reloadcon = null; var countboxText = null; var overlays = new Array(); -overlays["newmarker"] = null; +overlays["new"] = null; overlays["ruler"] = new Array(); overlays["locations"] = new Array(); overlays["links"] = new Array(); @@ -21,10 +22,25 @@ function initialize(lat, lng, res) { map.disableDoubleClickZoom(); map.enableScrollWheelZoom(); - map.removeMapType(G_HYBRID_MAP); - map.removeMapType(G_SATELLITE_MAP); +// map.removeMapType(G_HYBRID_MAP); +// map.removeMapType(G_SATELLITE_MAP); map.addMapType(G_PHYSICAL_MAP); - map.setMapType(G_PHYSICAL_MAP); +// map.setMapType(G_HYBRID_MAP); + + // openStreetMap + var copyOSM = new GCopyrightCollection("OpenStreetMap"); + var copyOGDGraz = new GCopyrightCollection("Open Government Data Graz"); + copyOSM.addCopyright(new GCopyright(1, new GLatLngBounds(new GLatLng(-90,-180), new GLatLng(90,180)), 0, " ")); + var tilesOsmarender = new GTileLayer(copyOSM, 1, 17, {tileUrlTemplate: 'http://tah.openstreetmap.org/Tiles/tile/{Z}/{X}/{Y}.png'}); + var mapOsmarender = new GMapType([tilesOsmarender], G_NORMAL_MAP.getProjection(), "openSM", {urlArg: 'y'}); + map.addMapType(mapOsmarender); + var tilesMapnik = new GTileLayer(copyOSM, 1, 17, {tileUrlTemplate: 'http://tile.openstreetmap.org/{Z}/{X}/{Y}.png'}); + var mapMapnik = new GMapType([tilesMapnik], G_NORMAL_MAP.getProjection(), "Mapnik", {urlArg: 'x'}); + map.addMapType(mapMapnik); +// var tilesOpenGeoServer = new GTileLayer(copyOGDGraz, 1, 17, {tileUrlTemplate: 'http://services.opengeoserver.org/tiles/1.0.0/globe.aerial_EPSG3857/${Z}/${X}/${Y}.png?origin=nw'}); +// var mapOpenGeoServer = new GMapType([tilesOpenGeoServer], G_NORMAL_MAP.getProjection(), "OpenGeoServer"); +// map.addMapType(mapOpenGeoServer); + physicalMaxLevel = map.getCurrentMapType().getMaximumResolution(); if(res > physicalMaxLevel) { map.setMapType(G_NORMAL_MAP); @@ -39,11 +55,19 @@ function initialize(lat, lng, res) { GEvent.addListener(map, "addoverlay", onAddOverlay); GEvent.addListener(map, "zoomend", onZoom); GEvent.addListener(map, "click", onMapClick); - + + lineinfo = document.createElement("div"); + document.getElementById("map").appendChild(lineinfo); + lineinfo.style.visibility = "hidden" + + dnsinfo = document.createElement("div"); + document.getElementById("map").appendChild(dnsinfo); + dnsinfo.style.visibility = "hidden" + var mt = map.getMapTypes(); for (var i=0; i physicalMaxLevel) { - map.setMapType(G_NORMAL_MAP); + // map.setMapType(G_SATELLITE_MAP); } } function onMapClick(overlay, point) { if(!overlay) { + map.setCenter(point); setNewMarker(point); } } @@ -162,6 +187,7 @@ function Location(element) { location.pixel_y = parseInt(element.getAttribute("pixel_y")); location.state = element.getAttribute("state"); location.gallery_link = element.getAttribute("gallery_link"); + location.dnsnames = element.getAttribute("router_links"); return location; } @@ -172,18 +198,64 @@ function onLocationClick(latlng) { html += ''; html += ''; html += ''; - html += ''; - html += ''; + html += ''; + html += ''; if(locations[this.locid].gallery_link) { - html += ''; + html += ''; } else { - html += ''; - } + html += ''; + } + if (locations[this.locid].dnsnames){ + var dnsname = locations[this.locid].dnsnames.split(";"); + for (var i = 0;i < dnsname.length; ++i){ + if (dnsname[i]!==""){ + if(dnsname[i].indexOf(" (")>=0) { + link=dnsname[i].substring(0,dnsname[i].indexOf(" (")); + } else { + link=dnsname[i]; + } + html += ''; + } + } + } html += '
Breitengrad: ' + convertCoords(locations[this.locid].point.lat()) + '
Längengrad: ' + convertCoords(locations[this.locid].point.lng()) + '
Datenbank: Link
Smokeping: Link
Datenbank: Link-Database
Smokeping: Link-Smokeping
Galerie: Link
Galerie: Link-Galerie/Knoten
Galerie: Link
Galerie: Link-Galerie
Router: '+dnsname[i]+'
'; html += ''; this.openInfoWindowHtml(html); } +function onLineClick(line,latlng) { +// var html ='