<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Frm_ShowAttendanceMap.aspx.cs" Inherits="AndroidSevice.Web.WLTGL.Frm_ShowAttendanceMap" %>
<!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 id="Head1" runat="server">
    <title>百度地图定位显示</title>
            <%--多人多点统计--%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=8cb299725cff45869425b1bbdae988aa"></script>
    <style type="text/css">
        body, html, #allmap
        {
            width: 100%;
            height: 100%;
            overflow: hidden;
            margin: 0;
        }
        #l-map
        {
            height: 100%;
            width: 78%;
            float: left;
            border-right: 2px solid #bcbcbc;
        }
        #r-result
        {
            height: 100%;
            width: 20%;
            float: left;
        }
    </style>
</head>
<body>

    <div  id="allmap">
    
    </div>
</body>
</html>
<script type="text/javascript">
    // 百度地图API功能
    var map = new BMap.Map("allmap");
    map.centerAndZoom(new BMap.Point(116.404, 39.915), 12);
    map.addControl(new BMap.MapTypeControl());   //添加地图类型控件

    map.setCurrentCity("北京");          // 设置地图显示的城市 此项是必须设置的
    // 添加带有定位的导航控件
    var navigationControl = new BMap.NavigationControl({
        // 靠左上角位置
        anchor: BMAP_ANCHOR_BOTTOM_RIGHT,
        // LARGE类型
        type: BMAP_NAVIGATION_CONTROL_LARGE,
        // 启用显示定位
        enableGeolocation: true
    });
    map.addControl(navigationControl);
    map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放
    var index = 0;
    var myGeo = new BMap.Geocoder();
    var adds;
    var AddressaLL = "<%=arrall %>";
    var i = bdGEO(AddressaLL);
    function bdGEO(AddressaLL) {
        if (AddressaLL == '')
        { return; }
        var addd = AddressaLL;
        adds = addd.split('|');
        for (var i = 0; i < adds.length; i++) {

            var add = adds[index];
            geocodeSearch(add);
            index++;
        }
    }

    function geocodeSearch(add) {
        var cc = add.split(",");
        myGeo.getPoint(cc[0], function (point) {
            if (point) {
                var address = new BMap.Point(point.lng, point.lat);
                addMarker(address, new BMap.Label("" + cc[1], { offset: new BMap.Size(20, -10) }));
            }
        }, "");
    }
    // 编写自定义函数,创建标注
    function addMarker(point, label) {
        var marker = new BMap.Marker(point);
        map.addOverlay(marker);
        marker.setLabel(label);
    }

    function myFun(result) {
        var cityName = result.name;
        map.setCenter(cityName);

    }
    var myCity = new BMap.LocalCity();
    myCity.get(myFun);
</script>
