可以吗? GMap API V2中的clearOverlays()到Google Maps API V3? [英] Is it OK? clearOverlays() in GMap API V2 to Google Maps API V3?

查看:151
本文介绍了可以吗? GMap API V2中的clearOverlays()到Google Maps API V3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Google Maps API V3。



我迁移我的网站GMap API V2 - > V3。
但由于我使用clearOverlays()方法在V2中立即删除了一个现有对象,并且它在V3中已被废除的对象中单独删除了一个对象。

V2

map.clearOverlays();

V3

< pre class =lang-js prettyprint-override> map.set_visible(false);
popup.close();

可以吗?
或其他解决方案?

解决方案

我无法在 V3参考资料,它将明确清除地图上创建的叠加层,并且找不到任何代码示例这也是做到这一点的。



我认为指出V3 API是一个非常早期的开发者版本是很重要的,它只包含一个非常基本的一组功能。他们很可能还没有完成这项功能。如果您正在开发一个实时系统,我建议您坚持使用V2,直到V3更成熟为止。



开发人员组中有一个帖子提出了关于如何该API应与V3产品经理的非常有用的答案一起使用:

关于v3选项的误解

编辑:

好的,API为了保持轻量级而缺少API的功能。您应该自己跟踪自己的覆盖对象并调用:

object.set_map(null);

将其移除。


I use Google Maps API V3.

I migrate My site GMap API V2 -> V3. but coped because I used the clearOverlays() method to delete an existing object at once in the V2 , and it deleted an object in what had been abolished in V3 individually.

V2

map.clearOverlays();

V3

map.set_visible(false);
popup.close();

is it OK? or other solutions?

解决方案

I couldn't find anything in the V3 reference which will explicitly clear the overlays created on the map and I could't find any code samples which do this either.

I think that it is important to point out the V3 API is a very early developer release and contains only a very basic set of features. It is quite possible that they simply haven't got to this functionality yet. If you are working on a live system, I suggest you stick with V2 until V3 is more mature.

There is a post on the developer group which asks the question about how the API should be used with a very useful answer from the V3 product manager:

Misconception about v3 Options

EDIT:

OK, it seems like this functionality is missing from the API deliberately in order to keep it lightweight. You should keep track of your overlay objects yourself and call:

object.set_map(null);

to remove them.

这篇关于可以吗? GMap API V2中的clearOverlays()到Google Maps API V3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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