Google Maps 学习笔记(三)

时间:2023-03-09 00:50:49
Google Maps 学习笔记(三)

1.GPolyline折线对象和GPolygon多边形对象

html标签中必须包含v="urn:schemas-microsoft--com:vml"的命名空间

<html xmlns:v="urn:schemas-microsoft--com:vml">

new GPolyline(points,color?,weight?,opacity?)

new GPolygon(points,strokeColor,strokeWeight,strokeOpacity,fillColor,fillOpacity)

2.GPolyline折线对象和GPolygon多边形对象的工厂方法fromEncoded()

GPolyline.fromEncoded(color,weight,opacity,points,zoomFactor,levels,numLevels)//points编码后的数据,

GPolygon.fromEncoded(polylins,fill,color,opacity,outline)//polylins一组经过编码的折线数据;fill是否以color参数指定的颜色填充多边形;opacity和outline参数表示是否以指定的透明度绘制边线。

3.如何简单快速的将经纬度信息转化为编码:

(1)对于静态、不需要修改的数据: http://www.google.com/apis/maps/documentation/polylineutility.html

编码算法: http://www.google.com/apis/maps/documentation/polylinealgorithm.html

4.其他类方法

getVertexCount()和getVertex()

GPolyline.getVertexCount()或GPolygon.getVertexCount()   //返回值为该折线或多边形所有顶点的个数

GPolygon.getVertex()或GPolyline.getVertex() //index表示指定折线或多边形顶点所代表的序号,返回值为序号,为该参数的GLatLng()对象