Mar*_*ven 7 google-maps google-maps-api-3 google-polyline
我正在寻找一种通过谷歌地图v3绘制折线的方法.完成后,可以编辑折线,然后继续绘制相同的折线.
我已经阅读了很多关于DrawingManager(在3.7中介绍)的内容,并阅读了这里发现的V3的大部分API:
https://developers.google.com/maps/documentation/javascript/overlays#drawing_tools
这显示了这样的例子:
https://google-developers.appspot.com/maps/documentation/javascript/examples/drawing-tools
developers.google示例非常棒,允许用户通过单击最后一个顶点来绘制和完成折线.但是一旦完成,我似乎无法找到如何继续绘制相同的折线.这可能吗?
我知道Google Maps API最高版本为10(冻结版).我甚至看过他们的发布和实验版本,但那里没有谈论它.
我愿意接受任何建议.
小智 1
DrawingManagerOptions 中的 PolylineOptions 忽略路径属性。因此,您可以做的是在绘制时(在 polylinecomplete 事件上)在 las 折线的末端和新折线的开头之间绘制一条新的折线。
google.maps.event.addListener(drawingManager, 'polylinecomplete', function(event) {
if (event.type == google.maps.drawing.OverlayType.POLYLINE) {
//save last point
//draw a new polyline to join last final point and this first point if this isn't the first polyline
}
});
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你
| 归档时间: |
|
| 查看次数: |
5741 次 |
| 最近记录: |