日期:2014-05-17 浏览次数:20366 次
function searchByArea(cps, cpa, cpn, areaMapAddress) {
var companys = cps;
var companysaddress = cpa;
var companyname = cpn;
var map = new BMap.Map("milkMap"); // 创建地图实例
var point = new BMap.Point(areaMapAddress.split(",")[0].toString(), areaMapAddress.split(",")[1].toString()); // 创建点坐标
map.centerAndZoom(point, 13); // 初始化地图,设置中心点坐标和地图级别
//map.addControl(new BMap.OverviewMapControl({ isOpen: 1, anchor: BMAP_ANCHOR_TOP_RIGHT })); //为地图添加鹰眼
map.addControl(new BMap.NavigationControl(opts)); //为地图添加鱼骨
//给地图添加自定义的控件;
ZoomControl.prototype.initialize = initSearch(map);
var myZoomCtrl = new ZoomControl();
map.addControl(myZoomCtrl);
map.enableScrollWheelZoom(); //启动鼠标滚轮缩放地图
map.enableKeyboard(); //启动键盘操作地图
if (companys != "") {
var c = companys.split("|");
var caddress = companysaddress.split("|");
var cname = companyname.split("|");
if (c.length > 0) {
for (var i = 0; i < c.length; i++) {
var cc = c[i].split(",");
//------------开始标注一个地点----------
var pointMarker = new BMap.Point(cc[0], cc[1]); // 创建标注的坐标
var marker = new BMap.Marker(pointMarker); // 创建标注
map.addOverlay(marker); // 将标注添加到地图中
var infowindow = new BMap.InfoWindow(cname[i].toString() +
"<br />