summaryrefslogtreecommitdiff
path: root/map.js
diff options
context:
space:
mode:
authorChristian Pointner <equinox@ffgraz.net>2008-12-06 21:53:22 +0000
committerChristian Pointner <equinox@ffgraz.net>2008-12-06 21:53:22 +0000
commitce3487743a231579722fded89ede17c514ec59fe (patch)
treebfbda2d27c90de58c2600023358a00f5785fc581 /map.js
parentd585ae96c39abe04572f7b7e9ac2c4ce264f93e5 (diff)
offline locations can now be hidden
Diffstat (limited to 'map.js')
-rw-r--r--map.js33
1 files changed, 29 insertions, 4 deletions
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});