summaryrefslogtreecommitdiff
path: root/map.js
diff options
context:
space:
mode:
authorChristian Pointner <equinox@ffgraz.net>2013-12-29 20:38:59 +0000
committerChristian Pointner <equinox@ffgraz.net>2013-12-29 20:38:59 +0000
commit4c98da1ceff06e565a8e85e395c747b28edef19d (patch)
tree0846b5c2adc1129cc756ee7bb638b603406b8882 /map.js
parentc3d442a289a4dee111456918732db7e4b345b2c9 (diff)
moved map3.js to map.js
Diffstat (limited to 'map.js')
-rw-r--r--map.js855
1 files changed, 391 insertions, 464 deletions
diff --git a/map.js b/map.js
index e51aea5..b60b7f0 100644
--- a/map.js
+++ b/map.js
@@ -1,160 +1,107 @@
var map = null;
var linkinfo;
-var physicalMaxLevel;
var geocoder = null;
var reloadcon = null;
var countboxText = null;
var overlays = new Array();
-overlays["new"] = null;
+overlays["newmarker"] = 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) {
- if (!checkBrowser()) {
- return;
- }
-
- map = new GMap2(document.getElementById("map"));
- map.setCenter(new GLatLng(lat, lng), res);
- map.disableDoubleClickZoom();
- map.enableScrollWheelZoom();
-
-// map.removeMapType(G_HYBRID_MAP);
-// map.removeMapType(G_SATELLITE_MAP);
- map.addMapType(G_PHYSICAL_MAP);
-// map.setMapType(G_HYBRID_MAP);
-
- // openStreetMap
- var copyOSM = new GCopyrightCollection("<a href=\"http://www.openstreetmap.org/\">OpenStreetMap</a>");
- 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);
- map.setZoom(res);
- }
- 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)));
-
- GEvent.addListener(map, "addoverlay", onAddOverlay);
- GEvent.addListener(map, "zoomend", onZoom);
- GEvent.addListener(map, "click", onMapClick);
-
+ debug("Initializing Funkfeuer Graz Map");
+ $('#southeastcontainer').hide();
+
+ 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.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, "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<mt.length; i++) {
- mt[i].getMinimumResolution = function() {return 0;}
- mt[i].getMaximumResolution = function() {return 22;}
- }
- geocoder = new GClientGeocoder();
+// geocoder = new google.maps.Geocoder();
var countbox = document.getElementById("countbox");
countboxText = document.createTextNode("Aktiv: 0");
countbox.appendChild(countboxText);
- reloadcon.started();
- GDownloadUrl("data.php", onData);
-}
-
-function checkBrowser() {
- if (GBrowserIsCompatible()) {
- return true;
- } else {
- var html = '<center><h3 style="color:red">Dein Browser ist leider nicht kompatibel mit der Google Maps API!</h3>';
- html += 'Ich würde vorschlagen du surfst auf: '
- html += '<a href="http://www.mozilla.com/firefox/">http://www.mozilla.com/firefox/</a></center>';
- document.getElementById("map").innerHTML = html;
- return false;
- }
-}
-
-function onAddOverlay(overlay) {
- 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 onZoom(oldLevel, newLevel)
-{
- if(newLevel > physicalMaxLevel) {
- // map.setMapType(G_SATELLITE_MAP);
- }
+//##// reloadcon.started();
+ $.get( "data.php",onData);
}
-function onMapClick(overlay, point)
+function onMapClick(mouse_event)
{
- if(!overlay) {
- map.setCenter(point);
- setNewMarker(point);
- }
+ 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();
- xmlData = GXml.parse(data);
-
+//##//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(xmlData) {
for(var loc in overlays["locations"]) {
- map.removeOverlay(overlays["locations"][loc]);
+ overlays["locations"][loc].setMap(null);
}
overlays["locations"] = [];
locations = [];
- drawLocations(xmlData);
+ if (xmlData) {
+ drawLocations(xmlData);
+ }
for(var link in overlays["links"]) {
- map.removeOverlay(overlays["links"][link]);
+ overlays["links"][link].setMap(null);
}
overlays["links"] = [];
links = [];
- drawLinks(xmlData);
+ if (xmlData) {
+ drawLinks(xmlData);
+ }
+
+ if (xmlData) {
+ var element = xmlData.getElementsByTagName("count");
+ var count = element[0].getAttribute("number");
+ countboxText.data = "Aktiv: " + count;
+ }
- var element = xmlData.getElementsByTagName("count");
- var count = element[0].getAttribute("number");
- countboxText.data = "Aktiv: " + count;
-
- reloadcon.finished();
+//##// reloadcon.finished();
}
function drawLocations(xmlData) {
@@ -163,11 +110,12 @@ function drawLocations(xmlData) {
var id = parseInt(element[i].getAttribute("id"));
locations[id] = new Location(element[i]);
- var marker = new GMarker(locations[id].point, {icon: makeIcon(locations[id].state)});
+ var marker = new google.maps.Marker({position: locations[id].point, icon: makeIcon(locations[id].state)});
marker.overlaytype = "location";
marker.locid = id;
- GEvent.addListener(marker, "click", onLocationClick);
- map.addOverlay(marker);
+ google.maps.event.addListener(marker, "click", onLocationClick);
+ marker.setMap(map);
+ overlays["locations"].push(marker);
}
if(document.visibleform.elements["offline"].checked) {
toggleVisible("offline");
@@ -182,7 +130,7 @@ function Location(element) {
location.name = element.getAttribute("name");
var lat = parseFloat(element.getAttribute("lat"));
var lng = parseFloat(element.getAttribute("lng"));
- location.point = new GLatLng(lat, 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");
@@ -194,10 +142,10 @@ 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>' + convertCoords(locations[this.locid].point.lat()) + '</td></tr>';
- html += '<tr><td>Längengrad:</td><td>&nbsp;</td><td>' + convertCoords(locations[this.locid].point.lng()) + '</td></tr>';
+ 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>';
html += '<tr><td>Datenbank:</td><td>&nbsp;</td><td><a href="http://manman.graz.funkfeuer.at/location/show/' + this.locid + '" target="_blank">Link-Database</td></tr>';
html += '<tr><td>Smokeping:</td><td>&nbsp;</td><td><a href="http://stats.graz.funkfeuer.at/smokeping/?target=Funkfeuer.' + locations[this.locid].name + '" target="_blank">Link-Smokeping</td></tr>';
if(locations[this.locid].gallery_link) {
@@ -216,44 +164,12 @@ function onLocationClick(latlng) {
}
html += '<tr><td> Router:</td><td>&nbsp;</td><td><a href="http://' + link+ '.ext.graz.funkfeuer.at/" target="_blank">'+dnsname[i]+'</td></tr>';
}
- }
- }
- html += '</table>';
- html += '</div>';
- this.openInfoWindowHtml(html);
-}
-
-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);
+ var infowindow = new google.maps.InfoWindow({content: html});
+ infowindow.open(map,this);
}
function convertCoords(x) {
@@ -273,8 +189,8 @@ function drawLinks(xmlData) {
state="Unbekannt"
var id = element[i].getAttribute("from") + "-" + element[i].getAttribute("to");
links[id] = new Link(element[i]);
-
- var line = new GPolyline([links[id].frompoint, links[id].topoint], makeColor(Math.floor(links[id].value)), makeWeight(Math.floor(links[id].value)));
+
+ var line = new google.maps.Polyline({path: [links[id].frompoint, links[id].topoint], strokeColor: makeColor(Math.floor(links[id].value)), strokeWeight: makeWeight(Math.floor(links[id].value))});
line.name = id;
line.textcolor = textcolor;
line.state = state;
@@ -284,16 +200,17 @@ function drawLinks(xmlData) {
line.dnsto = element[i].getAttribute("dnsto");
line.Routerfrom = element[i].getAttribute("from");
line.Routerto = element[i].getAttribute("to");
- GEvent.addListener(line, "mouseout", function() { lineinfo.style.visibility = "hidden"; });
- GEvent.addListener(line, "mouseover", function(point) { showLinkInfo(this, point)});
- GEvent.addListener(line, "click", function(point){onLineClick(this,point)});
-// GEvent.addListener(line, "click", function(latlng){map.openInfoWindowHtml(latlng, message)});
-
- map.addOverlay(line);
- }
- if(document.visibleform.elements["defaultroute"].checked) {
- toggleVisible("defaultroute");
+// 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){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");
+ // }
if(document.visibleform.elements["bad"].checked) {
toggleVisible("bad");
}
@@ -306,62 +223,63 @@ function drawLinks(xmlData) {
if(document.visibleform.elements["tunnel"].checked) {
toggleVisible("tunnel");
}
- if(document.visibleform.elements["2.4channel"].checked) {
- toggleVisible("2.4channel");
- }
- if(document.visibleform.elements["channel1"].checked) {
- toggleVisible("channel1");
- }
- if(document.visibleform.elements["channel2"].checked) {
- toggleVisible("channel2");
- }
- if(document.visibleform.elements["channel3"].checked) {
- toggleVisible("channel3");
- }
- if(document.visibleform.elements["channel4"].checked) {
- toggleVisible("channel4");
- }
- if(document.visibleform.elements["channel5"].checked) {
- toggleVisible("channel5");
- }
- if(document.visibleform.elements["channel6"].checked) {
- toggleVisible("channel6");
- }
- if(document.visibleform.elements["channel7"].checked) {
- toggleVisible("channel7");
- }
- if(document.visibleform.elements["channel8"].checked) {
- toggleVisible("channel8");
- }
- if(document.visibleform.elements["channel9"].checked) {
- toggleVisible("channel9");
- }
- if(document.visibleform.elements["channel10"].checked) {
- toggleVisible("channel10");
- }
- if(document.visibleform.elements["channel11"].checked) {
- toggleVisible("channel11");
- }
- if(document.visibleform.elements["channel12"].checked) {
- toggleVisible("channel12");
- }
- if(document.visibleform.elements["channel13"].checked) {
- toggleVisible("channel13");
- }
- if(document.visibleform.elements["5channel"].checked) {
- toggleVisible("5channel");
- }
- if(document.visibleform.elements["undef"].checked) {
- toggleVisible("undef");
- }
+ // if(document.visibleform.elements["2.4channel"].checked) {
+ // toggleVisible("2.4channel");
+ // }
+ // if(document.visibleform.elements["channel1"].checked) {
+ // toggleVisible("channel1");
+ // }
+ // if(document.visibleform.elements["channel2"].checked) {
+ // toggleVisible("channel2");
+ // }
+ // if(document.visibleform.elements["channel3"].checked) {
+ // toggleVisible("channel3");
+ // }
+ // if(document.visibleform.elements["channel4"].checked) {
+ // toggleVisible("channel4");
+ // }
+ // if(document.visibleform.elements["channel5"].checked) {
+ // toggleVisible("channel5");
+ // }
+ // if(document.visibleform.elements["channel6"].checked) {
+ // toggleVisible("channel6");
+ // }
+ // if(document.visibleform.elements["channel7"].checked) {
+ // toggleVisible("channel7");
+ // }
+ // if(document.visibleform.elements["channel8"].checked) {
+ // toggleVisible("channel8");
+ // }
+ // if(document.visibleform.elements["channel9"].checked) {
+ // toggleVisible("channel9");
+ // }
+ // if(document.visibleform.elements["channel10"].checked) {
+ // toggleVisible("channel10");
+ // }
+ // if(document.visibleform.elements["channel11"].checked) {
+ // toggleVisible("channel11");
+ // }
+ // if(document.visibleform.elements["channel12"].checked) {
+ // toggleVisible("channel12");
+ // }
+ // if(document.visibleform.elements["channel13"].checked) {
+ // toggleVisible("channel13");
+ // }
+ // if(document.visibleform.elements["5channel"].checked) {
+ // toggleVisible("5channel");
+ // }
+ // if(document.visibleform.elements["undef"].checked) {
+ // toggleVisible("undef");
+ // }
}
+
function showLinkInfo(link, point) {
var html = '<div id="linkbox" class="box" style="border-color: ' + link.color + '">';
if((links[link.name].frequence !== "undef") && (links[link.name].frequence !== "")){
html += '<strong>Frequenz:</strong> ' + links[link.name].frequence + '<br />';
} else {
html += '<strong>Frequenz:</strong> undef <br />';
- }
+ }
if(links[link.name].channel !== "undef") {
html += '<strong>Kanal:</strong> ' + links[link.name].channel + '<br />';
} else {
@@ -373,12 +291,12 @@ function showLinkInfo(link, point) {
html += '<strong>Mittlerer ETX:</strong> undef <br />';
}
html += '<strong>Name:</strong> ' + link.name + '<br />';
- html += '<strong>Länge:</strong> ' + link.getLength().toFixed(0) + ' m<br />';
+//##// html += '<strong>Länge:</strong> ' + link.getLength().toFixed(0) + ' m<br />';
html += '</div>';
lineinfo.innerHTML = html;
- var pos = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(180, 0));
+//##// var pos = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(180, 0));
- pos.apply(lineinfo);
+//##// pos.apply(lineinfo);
lineinfo.style.visibility = "visible";
}
@@ -388,13 +306,13 @@ function Link(element) {
link.fromid = parseInt(element.getAttribute("fromid"));
var lat = parseFloat(element.getAttribute("latfrom"));
var lng = parseFloat(element.getAttribute("lngfrom"));
- link.frompoint = new GLatLng(lat, lng);
+ link.frompoint = new google.maps.LatLng(lat, lng);
link.to = element.getAttribute("to");
link.toid = parseInt(element.getAttribute("toid"));
lat = parseFloat(element.getAttribute("latto"));
lng = parseFloat(element.getAttribute("lngto"));
- link.topoint = new GLatLng(lat, lng);
+ link.topoint = new google.maps.LatLng(lat, lng);
link.value = parseFloat(element.getAttribute("value"));
link.channel = element.getAttribute("channel");
@@ -403,6 +321,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';
@@ -430,81 +380,81 @@ function makeWeight(value) {
}
function makeIcon(type) {
- var icon = new GIcon();
-
+ var url;
switch(type) {
- case 'ruler': icon.image = "./img/marker_blue.png"; break;
- case 'newnode': icon.image = "./img/marker_darkred.png"; break;
- case 'online': icon.image = "./img/marker_online.png"; break;
- case 'tunnel': icon.image = "./img/marker_tunnel.png"; break;
- case 'offline': icon.image = "./img/marker_offline.png"; break;
- }
- icon.iconSize = new GSize(12,20);
- icon.iconAnchor = new GPoint(6,20);
- icon.infoWindowAnchor = new GPoint(5,1);
- return icon
+ case 'ruler': url = "./img/marker_blue.png"; break;
+ case 'newnode': url = "./img/marker_darkred.png"; break;
+ case 'online': url = "./img/marker_online.png"; break;
+ case 'tunnel': url = "./img/marker_tunnel.png"; break;
+ case 'offline': url = "./img/marker_offline.png"; break;
+ }
+ return {
+ 'url': url,
+ size: new google.maps.Size(12, 20),
+ origin: new google.maps.Point(0,0),
+ anchor: new google.maps.Point(6, 20)
+ };
}
function toggleVisible(element) {
var elements = Object();
- if (element=='bad' || element=='middle' || element=='good'){
- document.visibleform.elements["2.4channel"].checked=false;
- document.visibleform.elements["channel1"].checked=false;
- document.visibleform.elements["channel2"].checked=false;
- document.visibleform.elements["channel3"].checked=false;
- document.visibleform.elements["channel4"].checked=false;
- document.visibleform.elements["channel5"].checked=false;
- document.visibleform.elements["channel6"].checked=false;
- document.visibleform.elements["channel7"].checked=false;
- document.visibleform.elements["channel8"].checked=false;
- document.visibleform.elements["channel9"].checked=false;
- document.visibleform.elements["channel10"].checked=false;
- document.visibleform.elements["channel11"].checked=false;
- document.visibleform.elements["channel12"].checked=false;
- document.visibleform.elements["channel13"].checked=false;
- document.visibleform.elements["5channel"].checked=false;
- document.visibleform.elements["undef"].checked=false;
- }
- if (element=='2.4channel'){
- document.visibleform.elements["channel1"].checked=document.visibleform.elements["2.4channel"].checked;
- document.visibleform.elements["channel2"].checked=document.visibleform.elements["2.4channel"].checked;
- document.visibleform.elements["channel3"].checked=document.visibleform.elements["2.4channel"].checked;
- document.visibleform.elements["channel4"].checked=document.visibleform.elements["2.4channel"].checked;
- document.visibleform.elements["channel5"].checked=document.visibleform.elements["2.4channel"].checked;
- document.visibleform.elements["channel6"].checked=document.visibleform.elements["2.4channel"].checked;
- document.visibleform.elements["channel7"].checked=document.visibleform.elements["2.4channel"].checked;
- document.visibleform.elements["channel8"].checked=document.visibleform.elements["2.4channel"].checked;
- document.visibleform.elements["channel9"].checked=document.visibleform.elements["2.4channel"].checked;
- document.visibleform.elements["channel10"].checked=document.visibleform.elements["2.4channel"].checked;
- document.visibleform.elements["channel11"].checked=document.visibleform.elements["2.4channel"].checked;
- document.visibleform.elements["channel12"].checked=document.visibleform.elements["2.4channel"].checked;
- document.visibleform.elements["channel13"].checked=document.visibleform.elements["2.4channel"].checked;
- }
+ // if (element=='bad' || element=='middle' || element=='good'){
+ // document.visibleform.elements["2.4channel"].checked=false;
+ // document.visibleform.elements["channel1"].checked=false;
+ // document.visibleform.elements["channel2"].checked=false;
+ // document.visibleform.elements["channel3"].checked=false;
+ // document.visibleform.elements["channel4"].checked=false;
+ // document.visibleform.elements["channel5"].checked=false;
+ // document.visibleform.elements["channel6"].checked=false;
+ // document.visibleform.elements["channel7"].checked=false;
+ // document.visibleform.elements["channel8"].checked=false;
+ // document.visibleform.elements["channel9"].checked=false;
+ // document.visibleform.elements["channel10"].checked=false;
+ // document.visibleform.elements["channel11"].checked=false;
+ // document.visibleform.elements["channel12"].checked=false;
+ // document.visibleform.elements["channel13"].checked=false;
+ // document.visibleform.elements["5channel"].checked=false;
+ // document.visibleform.elements["undef"].checked=false;
+ // }
+ // if (element=='2.4channel'){
+ // document.visibleform.elements["channel1"].checked=document.visibleform.elements["2.4channel"].checked;
+ // document.visibleform.elements["channel2"].checked=document.visibleform.elements["2.4channel"].checked;
+ // document.visibleform.elements["channel3"].checked=document.visibleform.elements["2.4channel"].checked;
+ // document.visibleform.elements["channel4"].checked=document.visibleform.elements["2.4channel"].checked;
+ // document.visibleform.elements["channel5"].checked=document.visibleform.elements["2.4channel"].checked;
+ // document.visibleform.elements["channel6"].checked=document.visibleform.elements["2.4channel"].checked;
+ // document.visibleform.elements["channel7"].checked=document.visibleform.elements["2.4channel"].checked;
+ // document.visibleform.elements["channel8"].checked=document.visibleform.elements["2.4channel"].checked;
+ // document.visibleform.elements["channel9"].checked=document.visibleform.elements["2.4channel"].checked;
+ // document.visibleform.elements["channel10"].checked=document.visibleform.elements["2.4channel"].checked;
+ // document.visibleform.elements["channel11"].checked=document.visibleform.elements["2.4channel"].checked;
+ // document.visibleform.elements["channel12"].checked=document.visibleform.elements["2.4channel"].checked;
+ // document.visibleform.elements["channel13"].checked=document.visibleform.elements["2.4channel"].checked;
+ // }
switch(element) {
- case 'defaultroute': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].defaultroute == '0');"); break;
+ // case 'defaultroute': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].defaultroute == '0');"); break;
case 'offline': elements.overlays = overlays["locations"]; elements.select = new Function("id", "return (locations[overlays['locations'][id].locid].state == 'offline');"); break;
case 'online': elements.overlays = overlays["locations"]; elements.select = new Function("id", "return (locations[overlays['locations'][id].locid].state != 'offline');"); break;
case 'bad': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].value >= 6);"); break;
case 'middle': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].value >= 3 && links[overlays['links'][id].linkid].value < 6);"); break;
case 'good': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].value >= 0 && links[overlays['links'][id].linkid].value < 3);"); break;
case 'tunnel': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].value == -1);"); break;
- case 'channel1': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '1');"); break;
- case 'channel2': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '2');"); break;
- case 'channel3': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '3');"); break;
- case 'channel4': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '4');"); break;
- case 'channel5': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '5');"); break;
- case 'channel6': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '6');"); break;
- case 'channel7': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '7');"); break;
- case 'channel8': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '8');"); break;
- case 'channel9': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '9');"); break;
- case 'channel10': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '10');"); break;
- case 'channel11': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '11');"); break;
- case 'channel12': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '12');"); break;
- case 'channel13': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '13');"); break;
- case 'undef': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence == 'undef');"); break;
- case '2.4channel': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence == '2.4');"); break;
- case '5channel': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence !=='2.4' && links[overlays['links'][id].linkid].frequence !=='undef');"); break;
-
+ // case 'channel1': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '1');"); break;
+ // case 'channel2': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '2');"); break;
+ // case 'channel3': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '3');"); break;
+ // case 'channel4': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '4');"); break;
+ // case 'channel5': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '5');"); break;
+ // case 'channel6': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '6');"); break;
+ // case 'channel7': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '7');"); break;
+ // case 'channel8': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '8');"); break;
+ // case 'channel9': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '9');"); break;
+ // case 'channel10': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '10');"); break;
+ // case 'channel11': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '11');"); break;
+ // case 'channel12': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '12');"); break;
+ // case 'channel13': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '13');"); break;
+ // case 'undef': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence == 'undef');"); break;
+ // case '2.4channel': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence == '2.4');"); break;
+ // case '5channel': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence !=='2.4' && links[overlays['links'][id].linkid].frequence !=='undef');"); break;
}
if(document.visibleform.elements[element].checked) {
@@ -516,16 +466,17 @@ function toggleVisible(element) {
function hideElements(elements) {
for(var o in elements.overlays)
- if(elements.select(o)) elements.overlays[o].hide();
+ if(elements.select(o)) elements.overlays[o].setVisible(false);
}
function showElements(elements) {
for(var o in elements.overlays)
- if(elements.select(o)) elements.overlays[o].show();
+ if(elements.select(o)) elements.overlays[o].setVisible(true);
}
function centerAndZoom(lat, lng) {
- map.setCenter(new GLatLng(lat, lng), 17);
+ map.setCenter(new google.maps.LatLng(lat, lng));
+ map.setZoom(20);
}
function addNewNodeText(point) {
@@ -536,65 +487,41 @@ function addNewNodeText(point) {
var lat_startpoint = 47.07177327969;
var dy_dlat = 75505.521;
- var pixel_x = parseInt(Math.floor(x_startpoint + (point.x - lng_startpoint) * dx_dlng));
- var pixel_y = parseInt(Math.floor(y_startpoint - (point.y - lat_startpoint) * dy_dlat));
+ var pixel_x = parseInt(Math.floor(x_startpoint + (point.lng() - lng_startpoint) * dx_dlng));
+ var pixel_y = parseInt(Math.floor(y_startpoint - (point.lat() - lat_startpoint) * dy_dlat));
var link = 'https://manman.graz.funkfeuer.at/location/new?';
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>' + convertCoords(point.y) + '</td><td>&nbsp;</td>';
+ 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" ';
- html += 'onclick="javascript:centerAndZoom(' + point.y + ',' + point.x + ')" /></form></td></tr>';
- html += '<tr><td>Längengrad:</b></td><td>&nbsp;</td><td>' + convertCoords(point.x)+ '</td><td>&nbsp;</td>';
+ html += 'onclick="javascript:centerAndZoom(' + point.lat() + ',' + point.lng() + ')" /></form></td></tr>';
+ html += '<tr><td>Längengrad:</b></td><td>&nbsp;</td><td><strong>' + convertCoords(point.lng()) + '</strong><br />' + point.lng().toFixed(6) + '</td><td>&nbsp;</td>';
html += '<td><form action="#" onsubmit="return false"><input type="button" value="Standort eintragen" ';
html += 'onclick="window.open(\'' + link + '\')" /></form></td></tr>';
html += '</table>';
return html;
}
-function setNewMarker(point) {
-/*
- var marker = new GMarker(point,{icon: makeIcon('newnode'), draggable: true});
- GEvent.addListener(marker, "dragstart",
- function() {
- this.autoclosed = true;
- this.closeInfoWindow();
- });
-
- GEvent.addListener(marker, "dragend",
- function(point) {
- this.openInfoWindowHtml(addNewNodeText(point));
- });
-
- GEvent.addListener(marker, "infowindowclose",
- function () {
- if(this.autoclosed == true) {
- this.autoclosed = false;
- } else {
- map.removeOverlay(overlays["newmarker"]);
- overlays["newmarker"] = null;
- }
- });
-
- marker.overlaytype = "newmarker";
- map.addOverlay(marker);
- marker.openInfoWindowHtml(addNewNodeText(point));
-*/
- var marker = new GMarker(point,makeIcon('newnode'));
- GEvent.addListener(marker,"infowindowclose",function () {
- map.removeOverlay(marker);
- });
-
- map.addOverlay(marker);
- marker.openInfoWindowHtml(addNewNodeText(point));
+function setNewMarker(point) {
+// TODO: make this dragable??
+ var marker = new google.maps.Marker({position: point, icon: makeIcon('newnode')});
+ var infowindow = new google.maps.InfoWindow({ content: addNewNodeText(point) });
+ google.maps.event.addListener(infowindow,"closeclick",function () { marker.setMap(null); });
+ marker.setMap(map);
+ infowindow.open(map,marker);
+ if(overlays["newmarker"]) {
+ overlays["newmarker"].setMap(null);
+ }
+ overlays['newmarker'] = marker;
}
function fflogin(username, password) {
var postbody = "username=" + encodeURIComponent(username) + "&password=" + encodeURIComponent(password) + "&login=Einloggen#";
- GDownloadUrl("login.php", onFFLogin, postbody);
+//##// GDownloadUrl("login.php", onFFLogin, postbody);
}
function onFFLogin(data, responseCode) {
@@ -613,8 +540,8 @@ function onFFLogin(data, responseCode) {
var username = xmlData.getElementsByTagName("username")[0].getAttribute("name");
showFFLogout(username);
- reloadcon.started();
- GDownloadUrl("data.php", onData);
+//##// reloadcon.started();
+ $.get( "data.php",onData);
}
}
}
@@ -635,7 +562,7 @@ function showFFLogin() {
function fflogout() {
var postbody = "logout=Ausloggen#";
- GDownloadUrl("login.php", onFFLogout, postbody);
+//##// GDownloadUrl("login.php", onFFLogout, postbody);
}
function onFFLogout(data, responseCode) {
@@ -651,15 +578,15 @@ function onFFLogout(data, responseCode) {
else {
showFFLogin();
- reloadcon.started();
- GDownloadUrl("data.php", onData);
+//##// reloadcon.started();
+ $.get( "data.php",onData);
}
}
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;
@@ -668,7 +595,7 @@ function showFFLogout(username) {
function showAddress(address) {
if (geocoder) {
// address += ", Graz, Austria";
- geocoder.getLatLng(address,
+ geocoder.getLatLng(address,
function(point) {
if (!point) {
alert(address + " nicht gefunden");
@@ -680,129 +607,129 @@ function showAddress(address) {
}
}
-function ReloadControl() {
-}
-
-ReloadControl.prototype = new GControl();
-
-ReloadControl.prototype.initialize = function(map) {
- var container = document.createElement("div");
- var btnDiv = document.createElement("div");
- btnDiv.className = "btn";
- btnDiv.id = "reloadbtn";
- container.appendChild(btnDiv);
- btnText = document.createTextNode("Daten neu laden");
- btnDiv.appendChild(btnText);
- GEvent.addDomListener(btnDiv, "click", function() {
- reloadcon.started();
- GDownloadUrl("data.php", onData);
- });
-
- map.getContainer().appendChild(container);
- return container;
-}
-
-ReloadControl.prototype.started = function() {
- btnText.data = "wird geladen...";
-}
-
-ReloadControl.prototype.loaded = function() {
- btnText.data = "wird verarbeitet...";
-}
-
-ReloadControl.prototype.finished = function() {
- btnText.data = "Daten neu laden";
-}
-
-ReloadControl.prototype.getDefaultPosition = function() {
- return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
-}
-
-
-function RulerControl() {
-}
-
-RulerControl.prototype = new GControl();
-
-RulerControl.prototype.initialize = function(map) {
- var btnText;
- var distBoxOuter;
- var distBox;
- var distText;
-
- function measure() {
- if(overlays["ruler"]["marker1"] && overlays["ruler"]["marker2"]) {
- var line = [overlays["ruler"]["marker1"].getPoint(), overlays["ruler"]["marker2"].getPoint()];
- var dist = overlays["ruler"]["marker1"].getPoint().distanceFrom(overlays["ruler"]["marker2"].getPoint());
- dist = dist.toFixed(0)+" m";
- if(parseInt(dist) > 10000) {
- dist = (parseInt(dist)/1000).toFixed(1) + " km";
- }
- distText.data = "Entfernung: " + dist;
- var poly = new GPolyline(line,'#FFFF00', 3, 1)
- poly.overlaytype = "ruler";
- poly.overlaysubtype = "line";
- map.addOverlay(poly);
- }
- }
-
- function clr(){
- for(var o in overlays["ruler"]) {
- map.removeOverlay(overlays["ruler"][o]);
- }
- overlays["ruler"] = [];
- distBox.style.visibility = "hidden";
- btnText.data = "Entfernung messen";
- }
-
- var container = document.createElement("div");
- var btnDiv = document.createElement("div");
- btnDiv.className = "btn";
- btnDiv.id = "rulerbtn";
- container.appendChild(btnDiv);
- btnText = document.createTextNode("Entfernung messen");
- btnDiv.appendChild(btnText);
- GEvent.addDomListener(btnDiv, "click", function() {
- for(var o in overlays["ruler"]) {
- if(overlays["ruler"][o]) {
- clr();
- return;
- }
- }
-
- btnText.data = "Messung beenden";
- distText.data = "Entfernung: 0 m";
- distBox.style.visibility = "visible";
-
- var pnt = map.getCenter();
- marker1 = new GMarker(pnt, {icon: makeIcon('ruler'), draggable: true});
- marker1.overlaytype = "ruler";
- marker1.overlaysubtype = "marker1";
- map.addOverlay(marker1);
-
- marker2 = new GMarker(pnt, {icon: makeIcon('ruler'), draggable: true});
- marker2.overlaytype = "ruler";
- marker2.overlaysubtype = "marker2";
- map.addOverlay(marker2);
-
- GEvent.addListener(marker1, "drag", function() { measure(); });
- GEvent.addListener(marker2, "drag", function() { measure(); });
- });
- distBoxOuter = document.createElement("div");
- distBoxOuter.id = "distboxouter";
- distBox = document.createElement("div");
- distBox.className = "box";
- distBox.id = "distbox";
- distBox.style.visibility = "hidden";
- distText = document.createTextNode("Entfernung: ? m");
- distBox.appendChild(distText);
- distBoxOuter.appendChild(distBox);
- document.getElementById("map").appendChild(distBoxOuter);
-
- map.getContainer().appendChild(container);
- return container;
-}
-
-RulerControl.prototype.getDefaultPosition = function() {
- return new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(7, 7));
-}
+//##//function ReloadControl() {
+//##//}
+//##//
+//##//ReloadControl.prototype = new GControl();
+//##//
+//##//ReloadControl.prototype.initialize = function(map) {
+//##// var container = document.createElement("div");
+//##// var btnDiv = document.createElement("div");
+//##// btnDiv.className = "btn";
+//##// btnDiv.id = "reloadbtn";
+//##// container.appendChild(btnDiv);
+//##// btnText = document.createTextNode("Daten neu laden");
+//##// btnDiv.appendChild(btnText);
+//##// google.maps.event.addDomListener(btnDiv, "click", function() {
+//##// reloadcon.started();
+//##// GDownloadUrl("data.php", onData);
+//##// });
+//##//
+//##// map.getContainer().appendChild(container);
+//##// return container;
+//##//}
+//##//
+//##//ReloadControl.prototype.started = function() {
+//##// btnText.data = "wird geladen...";
+//##//}
+//##//
+//##//ReloadControl.prototype.loaded = function() {
+//##// btnText.data = "wird verarbeitet...";
+//##//}
+//##//
+//##//ReloadControl.prototype.finished = function() {
+//##// btnText.data = "Daten neu laden";
+//##//}
+//##//
+//##//ReloadControl.prototype.getDefaultPosition = function() {
+//##// return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
+//##//}
+
+
+//##//function RulerControl() {
+//##//}
+//##//
+//##//RulerControl.prototype = new GControl();
+//##//
+//##//RulerControl.prototype.initialize = function(map) {
+//##// var btnText;
+//##// var distBoxOuter;
+//##// var distBox;
+//##// var distText;
+//##//
+//##// function measure() {
+//##// if(overlays["ruler"]["marker1"] && overlays["ruler"]["marker2"]) {
+//##// var line = [overlays["ruler"]["marker1"].getPoint(), overlays["ruler"]["marker2"].getPoint()];
+//##// var dist = overlays["ruler"]["marker1"].getPoint().distanceFrom(overlays["ruler"]["marker2"].getPoint());
+//##// dist = dist.toFixed(0)+" m";
+//##// if(parseInt(dist) > 10000) {
+//##// dist = (parseInt(dist)/1000).toFixed(1) + " km";
+//##// }
+//##// distText.data = "Entfernung: " + dist;
+//##// var poly = new GPolyline(line,'#FFFF00', 3, 1)
+//##// poly.overlaytype = "ruler";
+//##// poly.overlaysubtype = "line";
+//##// map.addOverlay(poly);
+//##// }
+//##// }
+//##//
+//##// function clr(){
+//##// for(var o in overlays["ruler"]) {
+//##// map.removeOverlay(overlays["ruler"][o]);
+//##// }
+//##// overlays["ruler"] = [];
+//##// distBox.style.visibility = "hidden";
+//##// btnText.data = "Entfernung messen";
+//##// }
+//##//
+//##// var container = document.createElement("div");
+//##// var btnDiv = document.createElement("div");
+//##// btnDiv.className = "btn";
+//##// btnDiv.id = "rulerbtn";
+//##// container.appendChild(btnDiv);
+//##// btnText = document.createTextNode("Entfernung messen");
+//##// btnDiv.appendChild(btnText);
+//##// google.maps.event.addDomListener(btnDiv, "click", function() {
+//##// for(var o in overlays["ruler"]) {
+//##// if(overlays["ruler"][o]) {
+//##// clr();
+//##// return;
+//##// }
+//##// }
+//##//
+//##// btnText.data = "Messung beenden";
+//##// distText.data = "Entfernung: 0 m";
+//##// distBox.style.visibility = "visible";
+//##//
+//##// var pnt = map.getCenter();
+//##// marker1 = new GMarker(pnt, {icon: makeIcon('ruler'), draggable: true});
+//##// marker1.overlaytype = "ruler";
+//##// marker1.overlaysubtype = "marker1";
+//##// map.addOverlay(marker1);
+//##//
+//##// marker2 = new GMarker(pnt, {icon: makeIcon('ruler'), draggable: true});
+//##// marker2.overlaytype = "ruler";
+//##// marker2.overlaysubtype = "marker2";
+//##// map.addOverlay(marker2);
+//##//
+//##// google.maps.event.addListener(marker1, "drag", function() { measure(); });
+//##// google.maps.event.addListener(marker2, "drag", function() { measure(); });
+//##// });
+//##// distBoxOuter = document.createElement("div");
+//##// distBoxOuter.id = "distboxouter";
+//##// distBox = document.createElement("div");
+//##// distBox.className = "box";
+//##// distBox.id = "distbox";
+//##// distBox.style.visibility = "hidden";
+//##// distText = document.createTextNode("Entfernung: ? m");
+//##// distBox.appendChild(distText);
+//##// distBoxOuter.appendChild(distBox);
+//##// document.getElementById("map").appendChild(distBoxOuter);
+//##//
+//##// map.getContainer().appendChild(container);
+//##// return container;
+//##//}
+//##//
+//##//RulerControl.prototype.getDefaultPosition = function() {
+ //##//return new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(7, 7));
+//##//}