|
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Map.aspx.vb" Inherits="gheatWeb.Map" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title></title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=en&key=<%=googleMapsKey %>"></script>
<script type="text/javascript">
var markers = new Array();
var colorSchemeArray = new Array();
var map;
var initialZoom = 5;
var currentHeatMap;
var mapDataTimeOutID = 0;
var facilityData = new Array();
var currentMarker;
function initialize() {
var myLatlng = new google.maps.LatLng(30.1238660, -92.0706730);
var selectedColorScheme = document.getElementById("colorSchemes").value;
var mapOptions = { scrollwheel: false };
colorSchemeArray[selectedColorScheme] = getHeatMapObject(selectedColorScheme);
//Create a map
map = new google.maps.Map(document.getElementById("map"), mapOptions);
//set the default center
map.setCenter(myLatlng);
//set the default zoom
map.setZoom(initialZoom);
//add the default overlaycc
map.overlayMapTypes.insertAt(0, colorSchemeArray[selectedColorScheme]);
//Set the map type
map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
//map.addControl(new GLargeMapControl());
}
function getHeatMapObject(colorScheme) {
var heatMapOptions = {
getTileUrl: function(tile, zoom) {
return 'Tile.aspx?colorScheme=' + colorScheme + '&zoom=' +
zoom +
'&x=' + tile.x +
'&y=' + tile.y +
//I want to ensure the image is no cached just incase the data changes
'&rand=' + Math.random();
},
tileSize: new google.maps.Size(256, 256),
isPng: true,
releaseTile: function(tile, zoom) {
//Called when a tile is out of view
},
name: colorScheme + "Heat Map"
};
return new google.maps.ImageMapType(heatMapOptions);
}
function changeColorScheme(control) {
//Remove the current one
map.overlayMapTypes.removeAt(0);
if (colorSchemeArray[control.value] == null) {
//Get a new one
colorSchemeArray[control.value] = getHeatMapObject(control.value);
}
//Now set it
map.overlayMapTypes.insertAt(0, colorSchemeArray[control.value]);
}
</script>
</head>
<body onload="javascript:initialize();">
<form id="form1" runat="server">
<div id="map" style="float:left; width:80%; height:500px; border:solid 1px black;"> </div>
<div style="float:right;width:18%; vertical-align:top;">
<div style="float:left;">Color Schemes</div>
<div style="float:right;">
<asp:DropDownList ID="colorSchemes" runat="server" onChange="javascript:changeColorScheme(this);"></asp:DropDownList>
</div>
<div style="clear:both;"></div>
</div>
<div style="clear:both;"></div>
</form>
</body>
</html>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.