使用谷歌API V3折线的可见性切换 [英] Toggle visibility of polyline using Google API V3

查看:135
本文介绍了使用谷歌API V3折线的可见性切换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道你可以切换使用谷歌API标志的知名度,但有可能使用HTML复选框来切换折线的知名度?

I know you can toggle visibility of markers using google api, but is it possible to toggle the visibility of a polyline using an html checkbox?

基本上,我有一个折线,如果复选框被选中,我想要的折线可见,如果未被选中,我想它隐藏起来。这可能吗?

Basically, I have a polyline and if the checkbox is checked, I want the polyline visible, and if it is unchecked, I want it hidden. Is this possible?

推荐答案

您切换折线的知名度你做一个标记以同样的方式。

You toggle the visibility of a polyline the same way you do a marker.

setMap(null)

要再次显示,请呼叫setMap方法,您google.maps.Map对象的引用。

To display it again, call the setMap method with a reference to your google.maps.Map object.

文档

的setMap(图:图) - 呈现指定地图上的这个形状。如果地图设置为null,形状将被删除。

setMap(map:Map) - Renders this shape on the specified map. If map is set to null, the shape will be removed.

这篇关于使用谷歌API V3折线的可见性切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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