从启动自定义按钮绘制多边形 [英] Initiate polygon drawing from custom button

查看:136
本文介绍了从启动自定义按钮绘制多边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢新的多边形画图选项,并一直在玩他们一两天。

I love the new polygon drawing options and have been playing with them for a couple of days.

在正式文件我看到,有可能通过点击外部的地图上按钮来启动一个多边形的图形。是否有人知道如何做到这一点?
<一href=\"http://$c$c.google.com/apis/maps/documentation/javascript/overlays.html#updating_the_drawing_tools_control\">http://$c$c.google.com/apis/maps/documentation/javascript/overlays.html#updating_the_drawing_tools_control

On the official documentation I see that it is possible to initiate the drawing of a polygon by clicking on a button external to the map. Does anybody know how to do this? http://code.google.com/apis/maps/documentation/javascript/overlays.html#updating_the_drawing_tools_control

在换句话说,我希望能够创建一个类似于一个按钮,在删除所选形状,但是这反而会启动多边形的图:
<一href=\"http://googlegeodevelopers.blogspot.com/2011/11/make-your-map-interactive-with-shape.html\">http://googlegeodevelopers.blogspot.com/2011/11/make-your-map-interactive-with-shape.html

In other words I would like to be able to create a button similar to the "Delete selected shape", but which will instead start the drawing of the polygon: http://googlegeodevelopers.blogspot.com/2011/11/make-your-map-interactive-with-shape.html

推荐答案

使用 setDrawingMode()功能 google.maps.drawing.DrawingManager 对象。

在按钮单击事件处理,请致电:

In the button click event handler, call:

drawingManager.setDrawingMode(google.maps.drawing.OverlayType.POLYGON);

要退出绘制模式,请致电:

To quit the drawing mode, call:

drawingManager.setDrawingMode(null);

这篇关于从启动自定义按钮绘制多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆