summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@ffgraz.net>2013-12-29 20:14:35 +0000
committerChristian Pointner <equinox@ffgraz.net>2013-12-29 20:14:35 +0000
commite08c7b0ed46f4f88ec570926b6400704a5863a06 (patch)
treebe3d0de6152217b4ef2c11b239d914e3aaeb0131
parent686d8323826bb3fd72cbba08e52fa383e3f404ca (diff)
overlay arrays redone
-rw-r--r--map.css5
-rw-r--r--map3.js114
2 files changed, 54 insertions, 65 deletions
diff --git a/map.css b/map.css
index fcc97f0..90ec25c 100644
--- a/map.css
+++ b/map.css
@@ -27,7 +27,6 @@ div.box {
}
#northeastcontainer {
-
position: absolute;
right: 10px;
top: 5ex;
@@ -113,12 +112,12 @@ div.btn {
*.locinfo,table {
font-size: 8pt;
- color: black;
+ color: black;
}
*.linkinfo,table {
font-size: 8pt;
- color: black;
+ color: black;
}
table.legend {
margin-top: 3px;
diff --git a/map3.js b/map3.js
index 33b1d95..e5f81db 100644
--- a/map3.js
+++ b/map3.js
@@ -47,7 +47,6 @@ function initialize(lat, lng, res) {
//##// 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");
@@ -68,21 +67,17 @@ function initialize(lat, lng, res) {
$.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 "ruler": {
- if(overlays["ruler"][overlay.overlaysubtype]) {
- map.removeOverlay(overlays["ruler"][overlay.overlaysubtype]);
- }
- overlays["ruler"][overlay.overlaysubtype] = overlay;
- break;
- }
- }
-}
+// function onAddOverlay(overlay) {
+// switch(overlay.overlaytype) {
+// case "ruler": {
+// if(overlays["ruler"][overlay.overlaysubtype]) {
+// map.removeOverlay(overlays["ruler"][overlay.overlaysubtype]);
+// }
+// overlays["ruler"][overlay.overlaysubtype] = overlay;
+// break;
+// }
+// }
+// }
function onMapClick(mouse_event)
{
@@ -96,14 +91,9 @@ function onMapClick(mouse_event)
//##// 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;
-
+function onData(xmlData) {
for(var loc in overlays["locations"]) {
- map.removeOverlay(overlays["locations"][loc]);
+ overlays["locations"][loc].setMap(null);
}
overlays["locations"] = [];
locations = [];
@@ -112,7 +102,7 @@ function onData(data) {
}
for(var link in overlays["links"]) {
- map.removeOverlay(overlays["links"][link]);
+ overlays["links"][link].setMap(null);
}
overlays["links"] = [];
links = [];
@@ -139,8 +129,8 @@ function drawLocations(xmlData) {
marker.overlaytype = "location";
marker.locid = id;
google.maps.event.addListener(marker, "click", onLocationClick);
-//##// map.addOverlay(marker);
marker.setMap(map);
+ overlays["locations"].push(marker);
}
if(document.visibleform.elements["offline"].checked) {
toggleVisible("offline");
@@ -167,7 +157,7 @@ function Location(element) {
function onLocationClick(latlng) {
var html = '<div class="locinfo">';
- html += '<b>' + locations[this.locid].name + '</b>';
+ html += '<strong>' + locations[this.locid].name + '</strong>';
html += '<table class="locinfo">';
html += '<tr><td>Breitengrad:</td><td>&nbsp;</td><td><strong>' + convertCoords(locations[this.locid].point.lat()) + '</strong><br />' + locations[this.locid].point.lat().toFixed(6) + '</td></tr>';
html += '<tr><td>Längengrad:</td><td>&nbsp;</td><td><strong>' + convertCoords(locations[this.locid].point.lng()) + '</strong><br />' + locations[this.locid].point.lng().toFixed(6) + '</td></tr>';
@@ -197,39 +187,6 @@ function onLocationClick(latlng) {
infowindow.open(map,this);
}
-function onLineClick(line,latlng) {
-// var html ='<div id="linkbox" class="box">';
- var html ='<div class="locinfo">';
- html += '<b>'+line.name+'</b>';
- html += '<table class="linkinfo">';
- if (line.dnsfrom){
- var dnsfrom = line.dnsfrom.split(";");
- for (var i = 0;i < dnsfrom.length; ++i){
- if(dnsfrom[i].indexOf(" (")>=0) {
- link=dnsfrom[i].substring(0,dnsfrom[i].indexOf(" ("));
- } else {
- link=dnsfrom[i];
- }
- html += '<tr><td> Router:</td><td>&nbsp;</td><td><a href="http://' + link+ '.ext.graz.funkfeuer.at/" target="_blank">'+dnsfrom[i]+'</td></tr>';
- }
- }
-
- if(line.dnsto){
- var dnsto = line.dnsto.split(";");
- for (var i = 0;i < dnsto.length; ++i){
- if(dnsto[i].indexOf(" (")>=0) {
- link=dnsto[i].substring(0,dnsto[i].indexOf(" ("));
- } else {
- link=dnsto[i];
- }
- html += '<tr><td> Router:</td><td>&nbsp;</td><td><a href="http://' + link+ '.ext.graz.funkfeuer.at/" target="_blank">'+dnsto[i]+'</td></tr>';
- }
- }
- html += '</table>';
- html += '</div>';
- map.openInfoWindowHtml(latlng,html);
-}
-
function convertCoords(x) {
var deg = Math.floor(x);
var min = (x - deg) * 60;
@@ -260,10 +217,11 @@ function drawLinks(xmlData) {
line.Routerto = element[i].getAttribute("to");
google.maps.event.addListener(line, "mouseout", function() { lineinfo.style.visibility = "hidden"; });
// google.maps.event.addListener(line, "mouseover", function(point) { showLinkInfo(this, point)});
- google.maps.event.addListener(line, "click", function(point){onLineClick(this,point)});
+ google.maps.event.addListener(line, "click", function(point){onLinkClick(this,point)});
// google.maps.event.addListener(line, "click", function(latlng){map.openInfoWindowHtml(latlng, message)});
line.setMap(map);
+ overlays["links"].push(line);
}
// if(document.visibleform.elements["defaultroute"].checked) {
// toggleVisible("defaultroute");
@@ -378,6 +336,38 @@ function Link(element) {
return link;
}
+function onLinkClick(line,latlng) {
+ var html ='<div class="locinfo">';
+ html += '<strong>'+line.name+'</strong>';
+ html += '<table class="linkinfo">';
+ if (line.dnsfrom){
+ var dnsfrom = line.dnsfrom.split(";");
+ for (var i = 0;i < dnsfrom.length; ++i){
+ if(dnsfrom[i].indexOf(" (")>=0) {
+ link=dnsfrom[i].substring(0,dnsfrom[i].indexOf(" ("));
+ } else {
+ link=dnsfrom[i];
+ }
+ html += '<tr><td> Router:</td><td>&nbsp;</td><td><a href="http://' + link+ '.ext.graz.funkfeuer.at/" target="_blank">'+dnsfrom[i]+'</td></tr>';
+ }
+ }
+
+ if(line.dnsto){
+ var dnsto = line.dnsto.split(";");
+ for (var i = 0;i < dnsto.length; ++i){
+ if(dnsto[i].indexOf(" (")>=0) {
+ link=dnsto[i].substring(0,dnsto[i].indexOf(" ("));
+ } else {
+ link=dnsto[i];
+ }
+ html += '<tr><td> Router:</td><td>&nbsp;</td><td><a href="http://' + link+ '.ext.graz.funkfeuer.at/" target="_blank">'+dnsto[i]+'</td></tr>';
+ }
+ }
+ html += '</table>';
+ html += '</div>';
+ map.openInfoWindowHtml(latlng,html);
+}
+
function makeColor(value) {
switch(value) {
case -1: return '#0000FF';
@@ -519,7 +509,7 @@ function addNewNodeText(point) {
link += 'z_x=' + Math.floor(pixel_x % 100) + '&z_y=' + Math.floor(pixel_y % 100);
link += '&c=' + Math.floor(pixel_x / 100) + '&r=' + Math.floor(pixel_y / 100);
- var html = '<b>Neuen Knoten eintragen<br />Nutzen sie den Zoombereich aus!</b><br /><br />';
+ var html = '<strong>Neuen Knoten eintragen<br />Nutzen sie den Zoombereich aus!</strong><br /><br />';
html += '<table width="100%">';
html += '<tr><td>Breitengrad:</td><td>&nbsp;</td><td><strong>' + convertCoords(point.lat()) + '</strong><br />' + point.lat().toFixed(6) + '</td><td>&nbsp;</td>';
html += '<td><form action="#" onsubmit="return false"><input type="button" value="hineinzoomen" ';
@@ -611,7 +601,7 @@ function onFFLogout(data, responseCode) {
function showFFLogout(username) {
var html = '<form action="#" onsubmit="fflogout(); return false">';
html += 'Sie sind eingeloggt als:</br >';
- html += '<b>'+username+'</b>&nbsp;&nbsp;&nbsp;'
+ html += '<strong>'+username+'</strong>&nbsp;&nbsp;&nbsp;'
html += '<input name="login" type="submit" id="logout" value="Ausloggen"></form>';
document.getElementById("loginbox").innerHTML = html;