百度地图 鼠标绘制,获取矩形,多边形的顶点经纬度
做个记录
http://developer.baidu.com/map/jsdemo.htm#h0_3
百度之给了线,圆的经纬度点获取,没给多边形
有个p.getPath().length
所以对于 多边形和矩形 是个点的轨迹数组
drawingManager.addEventListener('polygoncomplete', function(e,p){
debugger
var point = p.getPath();
var str1="";
for(var i = 0;i<point.length;i++){
str1 += "("+point[i].lng+","+point[i].lat+"),";
}
countOverlays++;
alert("该覆盖物是多边形,"+str1);
});
drawingManager.addEventListener('rectanglecomplete', function(e,p){
debugger
var point = p.getPath();
var str="";
for(var i = 0;i<point.length;i++){
str += "("+point[i].lng+","+point[i].lat+"),";
}
countOverlays++;
alert("该覆盖物是矩形,"+str);
});