From GamingWiki
Jump to: navigation, search
Line 1: Line 1:
<includeonly>
 
</includeonly>
 
 
<html>
 
<html>
 
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
 
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
Line 77: Line 75:
 
});
 
});
 
}
 
}
 +
}
 +
 +
/**
 +
* Add a marker that is actually a zone
 +
*/
 +
function addZone(lat, lng, corners, title, id) {
 +
var descId = 'desc'+id;
 +
// Draw zone
 +
var zone = new google.maps.Polygon({
 +
paths:        corners,
 +
strokeColor:  "#FF0000",
 +
strokeOpacity: 0.8,
 +
strokeWeight:  2,   
 +
fillColor:    "#FF0000",
 +
fillOpacity:  0.35,
 +
title:        title
 +
});
 +
zone.setMap(map);
 +
//var marker = new google.maps.Marker({position:latlng, map: map, title:title});
 +
google.maps.event.addListener(zone, "click", function() {
 +
infowindow.setContent(document.getElementById(descId).innerHTML);
 +
infowindow.open(map,zone);
 +
});
 +
GMarkers[id] = zone;
 +
// Also add a marker?
 +
//addMarkerByLatLng(lat,lng,title,id);
 
}
 
}
  
Line 85: Line 109:
 
for ( i = 0; i < markers.length; i++ ) {
 
for ( i = 0; i < markers.length; i++ ) {
 
marker = markers[i];
 
marker = markers[i];
if (typeof marker['lat'] === 'undefined' || marker['lat'] == ''  
+
// Figure out what sort of information we have here.
 +
if (typeof marker['corners'] !== 'undefined) {
 +
// this is a zone
 +
} elseif (typeof marker['lat'] === 'undefined' || marker['lat'] == ''  
 
|| typeof marker['lng'] === 'undefined' || marker['lng'] == '') {
 
|| typeof marker['lng'] === 'undefined' || marker['lng'] == '') {
 +
// Missing lat/lng information; add by address.
 
addMarkerByAddress(marker['address'], marker['name'], marker['id']);
 
addMarkerByAddress(marker['address'], marker['name'], marker['id']);
 
} else {
 
} else {
 +
// Add a marker by latlng.
 
addMarkerByLatLng(marker['lat'], marker['lng'], marker['name'], marker['id']);
 
addMarkerByLatLng(marker['lat'], marker['lng'], marker['name'], marker['id']);
 
}
 
}

Revision as of 20:29, 16 May 2011