summaryrefslogtreecommitdiff
path: root/map.js
diff options
context:
space:
mode:
authorChristian Pointner <equinox@ffgraz.net>2008-12-05 22:58:42 +0000
committerChristian Pointner <equinox@ffgraz.net>2008-12-05 22:58:42 +0000
commit14ada9839a41358c68ad979f94cc056d7e1415df (patch)
treeab0d5f7646e338d931c5257393a5f588b7998144 /map.js
parent2ad233be830b0d6381e5c9019560733f57893b9d (diff)
added reload control
Diffstat (limited to 'map.js')
-rw-r--r--map.js73
1 files changed, 50 insertions, 23 deletions
diff --git a/map.js b/map.js
index b580b84..e264429 100644
--- a/map.js
+++ b/map.js
@@ -26,6 +26,7 @@ function initialize(lat, lng, res) {
map.setZoom(res);
}
map.addControl(new RulerControl());
+ map.addControl(new ReloadControl());
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)));
@@ -160,6 +161,32 @@ 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() {
+ GDownloadUrl("data.php", onData);
+ });
+
+ map.getContainer().appendChild(container);
+ return container;
+}
+
+ReloadControl.prototype.getDefaultPosition = function() {
+ return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
+}
+
+
function RulerControl() {
}
@@ -204,31 +231,31 @@ RulerControl.prototype.initialize = function(map) {
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;
+ 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(); });
- });
+ 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");