<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Overlay_Polygon_Sample.aspx.cs"
Inherits="Samples.Overlays.Overlay_Polygon_Sample" %>
<!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 runat="server">
<title>多边形</title>
<style type="text/css">
#maps
{
height: 450px;
}
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=zh-CN"></script>
<script language="javascript" type="text/javascript">
//地图初始化函数
function initialize() {
var LatLng = new google.maps.LatLng(24.886436490787712, -70.2685546875);
var Options = {
zoom: 5, center: LatLng, mapTypeId: google.maps.MapTypeId.TERRAIN
};
var bermudaTriangle; //申明百莫大三角对象
var map = new google.maps.Map(document.getElementById("maps"), Options);
//多边形数据对象数组
var triangleCoords = [new google.maps.LatLng(25.774252, -80.190262),
new google.maps.LatLng(18.466465, -66.118292),
new google.maps.LatLng(32.321384, -64.75737),
new google.maps.LatLng(25.774252, -80.190262)];
//创建百莫大三角对象实例
bermudaTriangle = new google.maps.Polygon(
{
paths: triangleCoords, strokeColor: "#FF0000", strokeOpacity: 0.8, strokeWeight: 2, fillColor: "#FF0000", fillOpacity: 0.35
}
);
//将百莫大三角对象设置到地图上
bermudaTriangle.setMap(map);
}
//将地图初始化函数绑定到window的load事件
google.maps.event.addDomListener(window, "load", initialize);
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="maps">
</div>
</form>
</body>
</html>