diff options
author | Christian Pointner <equinox@ffgraz.net> | 2008-12-06 21:53:22 +0000 |
---|---|---|
committer | Christian Pointner <equinox@ffgraz.net> | 2008-12-06 21:53:22 +0000 |
commit | ce3487743a231579722fded89ede17c514ec59fe (patch) | |
tree | bfbda2d27c90de58c2600023358a00f5785fc581 /map.js | |
parent | d585ae96c39abe04572f7b7e9ac2c4ce264f93e5 (diff) |
offline locations can now be hidden
Diffstat (limited to 'map.js')
-rw-r--r-- | map.js | 33 |
1 files changed, 29 insertions, 4 deletions
@@ -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}); |