summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@ffgraz.net>2013-12-29 18:49:08 +0000
committerChristian Pointner <equinox@ffgraz.net>2013-12-29 18:49:08 +0000
commit52fc2fb088d075a1c54433f517c7ee1a34a89a89 (patch)
tree05b0d3c1da742a1784a5bc20df625885236302ce
parent0835c58d60d13f61d7b134cc690cf1a46d310278 (diff)
fixed add location marker
-rw-r--r--map3.js55
1 files changed, 14 insertions, 41 deletions
diff --git a/map3.js b/map3.js
index 2f40e11..30a3158 100644
--- a/map3.js
+++ b/map3.js
@@ -507,7 +507,8 @@ function showElements(elements) {
}
function centerAndZoom(lat, lng) {
- map.setCenter(new google.maps.LatLng(lat, lng), 17);
+ map.setCenter(new google.maps.LatLng(lat, lng));
+ map.setZoom(20);
}
function addNewNodeText(point) {
@@ -518,8 +519,8 @@ function addNewNodeText(point) {
var lat_startpoint = 47.07177327969;
var dy_dlat = 75505.521;
- 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 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);
@@ -527,10 +528,10 @@ function addNewNodeText(point) {
var html = '<b>Neuen Knoten eintragen<br />Nutzen sie den Zoombereich aus!</b><br /><br />';
html += '<table width="100%">';
- html += '<tr><td>Breitengrad:</td><td>&nbsp;</td><td>' + convertCoords(point.lat) + '</td><td>&nbsp;</td>';
+ html += '<tr><td>Breitengrad:</td><td>&nbsp;</td><td>' + convertCoords(point.lat()) + '</td><td>&nbsp;</td>';
html += '<td><form action="#" onsubmit="return false"><input type="button" value="hineinzoomen" ';
- html += 'onclick="javascript:centerAndZoom(' + point.lat + ',' + point.lng + ')" /></form></td></tr>';
- html += '<tr><td>Längengrad:</b></td><td>&nbsp;</td><td>' + convertCoords(point.lat)+ '</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>' + convertCoords(point.lng())+ '</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>';
@@ -538,41 +539,13 @@ function addNewNodeText(point) {
}
function setNewMarker(point) {
-/*
- var marker = new GMarker(point,{icon: makeIcon('newnode'), draggable: true});
- google.maps.event.addListener(marker, "dragstart",
- function() {
- this.autoclosed = true;
- this.closeInfoWindow();
- });
-
- google.maps.event.addListener(marker, "dragend",
- function(point) {
- this.openInfoWindowHtml(addNewNodeText(point));
- });
-
- google.maps.event.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 google.maps.Marker({position: point, icon: makeIcon('newnode')});
- // google.maps.event.addListener(marker,"infowindowclose",function () {
- // map.removeOverlay(marker);
- // });
- marker.setMap(map);
- marker.openInfoWindowHtml(addNewNodeText(point));
+// TODO: if a new new marker is set: remove the old one
+// 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);
}
function fflogin(username, password) {