From ce3487743a231579722fded89ede17c514ec59fe Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 6 Dec 2008 21:53:22 +0000 Subject: offline locations can now be hidden --- index.php | 20 ++++++++++++++++++-- map.css | 14 ++++++++++++-- map.js | 33 +++++++++++++++++++++++++++++---- 3 files changed, 59 insertions(+), 8 deletions(-) diff --git a/index.php b/index.php index a89e8b6..1fa8e6a 100644 --- a/index.php +++ b/index.php @@ -11,7 +11,7 @@ else if(empty($lat)) $lat=47.07102; if(empty($lng)) $lng=15.440; if(empty($res)) $res=15; -if(!isset($marker)) $marker="online"; +if(empty($marker)) $marker="online"; ?> @@ -35,7 +35,23 @@ if(!isset($marker)) $marker="online";
Legende: - + + + + + + + + +
 Online
 Offline
 Tunnel
 Gut
 Mittel
 Schlecht
 Tunnel
+
+
+ Elemente ausblenden +
+ + +
> Offline
+
Adresse suchen: diff --git a/map.css b/map.css index 2067598..a197481 100644 --- a/map.css +++ b/map.css @@ -10,7 +10,7 @@ body { padding: 0; } -div { +div,table { color: black; } @@ -53,6 +53,12 @@ div.box { text-align: center; } +#visibox { + position: absolute; + top: 20em; + right: 10px; +} + div.btn { color: #0000cc; background-color: white; @@ -73,7 +79,11 @@ div.btn { width: 10em; } -*.locinfo { +*.locinfo,table { font-size: 8pt; color: black; } + +table.legend { + margin-top: 3px; +} diff --git a/map.js b/map.js index c43552e..553ba9e 100644 --- a/map.js +++ b/map.js @@ -118,6 +118,9 @@ function drawLocations(xmlData) { GEvent.addListener(marker, "click", onLocationClick); map.addOverlay(marker); } + if(document.visibleform.elements["offline"].checked) { + toggleVisible("offline"); + } } function Location(element) { @@ -153,10 +156,10 @@ function onLocationClick(latlng) { } function convertCoords(x) { - var deg = Math.floor(x); - var min = (x - deg) * 60; - var sec = (min - Math.floor(min)) * 60; - return deg + "° " + Math.floor(min) + "' " + sec.toFixed(0) + "\""; + var deg = Math.floor(x); + var min = (x - deg) * 60; + var sec = (min - Math.floor(min)) * 60; + return deg + "° " + Math.floor(min) + "' " + sec.toFixed(0) + "\""; } function addNewNodeText(point) { @@ -180,6 +183,28 @@ function makeIcon(type) { return icon } +function toggleVisible(element) { + var elements = Object(); + switch(element) { + case 'offline': elements.overlays = overlays["locations"]; elements.select = new Function("id", "return (locations[overlays['locations'][id].locid].state == 'offline');"); break; + } + + if(document.visibleform.elements[element].checked) { + hideElements(elements); + } else { + showElements(elements); + } +} + +function hideElements(elements) { + for(var o in elements.overlays) + if(elements.select(o)) elements.overlays[o].hide(); +} + +function showElements(elements) { + for(var o in elements.overlays) + if(elements.select(o)) elements.overlays[o].show(); +} function setNewMarker(point) { var marker = new GMarker(point,{icon: makeIcon('newnode'), draggable: true}); -- cgit v1.2.1