var map = null; var linkinfo; var geocoder = null; var reloadcon = null; var countboxText = null; var overlays = new Array(); overlays["new"] = null; overlays["ruler"] = new Array(); overlays["locations"] = new Array(); overlays["links"] = new Array(); var locations = new Array(); var links = new Array(); debug = function (log_txt) { if (typeof window.console != 'undefined') { console.log(log_txt); } } function initialize(lat, lng, res) { $('#visibox').hide(); $('#southeastcontainer').hide(); debug("Initializing Funkfeuer Graz Map"); google.maps.visualRefresh=true; var mapOptions = { center: new google.maps.LatLng(lat, lng), zoom: res, streetViewControl: false, mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControlOptions: { mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.HYBRID , google.maps.MapTypeId.SATELLITE , google.maps.MapTypeId.TERRAIN ], style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR, } }; map = new google.maps.Map(document.getElementById("map"), mapOptions); //##// deaktiviert 2013112 goole maps api v3 incompatibel //##// map.disableDoubleClickZoom(); //##// map.enableScrollWheelZoom(); //##// map.addControl(new RulerControl()); //##// reloadcon = new reloadcontrol(); //##// map.addcontrol(reloadcon); //##// map.addControl(new GSmallMapControl(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(10,20))); //##// map.addControl(new GMapTypeControl(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50,10))); google.maps.event.addListener(map, "addoverlay", onAddOverlay); google.maps.event.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" //##// geocoder = new google.maps.Geocoder(); var countbox = document.getElementById("countbox"); countboxText = document.createTextNode("Aktiv: 0"); countbox.appendChild(countboxText); //##// reloadcon.started(); $.get( "data.php",onData); } function onAddOverlay(overlay) { debug("onAddOverlay called!"); switch(overlay.overlaytype) { case "location": overlays["locations"].push(overlay); break; case "link": overlays["links"].push(overlay); break; case "new": { if(overlays["newmarker"]) { map.removeOverlay(overlays["newmarker"]); } overlays["newmarker"] = overlay; break; } case "ruler": { if(overlays["ruler"][overlay.overlaysubtype]) { map.removeOverlay(overlays["ruler"][overlay.overlaysubtype]); } overlays["ruler"][overlay.overlaysubtype] = overlay; break; } } } function onMapClick(mouse_event) { map.setCenter(mouse_event.latLng); setNewMarker(mouse_event.latLng); } //##//function onData(data, responseCode) { //##// if (responseCode < 200 || responseCode > 299) { //##// reloadcon.finished(); //##// return alert("Fehler: Konnte die Daten nicht laden!\n(Server Antwort-Code: " + responseCode + ")"); //##// } //##// reloadcon.loaded(); function onData(data) { //##// xmlData = GXml.parse(data); //##//alert("Data Loaded: " +data.slice( 0, 100 )); //##//xmlData = $.parseXML(data.responseText); xmlData = data; for(var loc in overlays["locations"]) { map.removeOverlay(overlays["locations"][loc]); } overlays["locations"] = []; locations = []; if (xmlData) { drawLocations(xmlData); } for(var link in overlays["links"]) { map.removeOverlay(overlays["links"][link]); } overlays["links"] = []; links = []; if (xmlData) { drawLinks(xmlData); } if (xmlData) { var element = xmlData.getElementsByTagName("count"); var count = element[0].getAttribute("number"); countboxText.data = "Aktiv: " + count; } //##// reloadcon.finished(); } function drawLocations(xmlData) { var element = xmlData.getElementsByTagName("node"); for (var i = 0; i< element.length; i++) { var id = parseInt(element[i].getAttribute("id")); locations[id] = new Location(element[i]); var marker = new google.maps.Marker({position: locations[id].point, icon: makeIcon(locations[id].state)}); marker.overlaytype = "location"; marker.locid = id; google.maps.event.addListener(marker, "click", onLocationClick); //##// map.addOverlay(marker); marker.setMap(map); } if(document.visibleform.elements["offline"].checked) { toggleVisible("offline"); } if(document.visibleform.elements["online"].checked) { toggleVisible("online"); } } function Location(element) { var location = new Object(); location.name = element.getAttribute("name"); var lat = parseFloat(element.getAttribute("lat")); var lng = parseFloat(element.getAttribute("lng")); location.point = new google.maps.LatLng(lat, lng); location.pixel_x = parseInt(element.getAttribute("pixel_x")); 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; } function onLocationClick(latlng) { var html = '
'; html += '' + locations[this.locid].name + ''; html += ''; html += ''; html += ''; html += ''; html += ''; if(locations[this.locid].gallery_link) { html += ''; } else { 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()) + '
' + locations[this.locid].point.lat().toFixed(6) + '
Längengrad: ' + convertCoords(locations[this.locid].point.lng()) + '
' + locations[this.locid].point.lng().toFixed(6) + '
Datenbank: Link-Database
Smokeping: Link-Smokeping
Galerie: Link-Galerie/Knoten
Galerie: Link-Galerie
Router: '+dnsname[i]+'
'; html += '
'; var infowindow = new google.maps.InfoWindow({content: html}); infowindow.open(map,this); } function onLineClick(line,latlng) { // var html ='