Bing 地图 API - 删除图钉
我有一个选择框,允许用户在用点填充 bing 地图的各种列表之间切换。
然而,当他们从列表中选择不同的位置时,我需要在绘制新的引脚之前删除旧的引脚。
有什么想法吗,API 文档似乎没有涵盖它?
I've got a select box which allows the user to toggle between various lists which populate a bing map with points.
However when they select a different location from the list I need to remove the old pins before plotting the new ones.
Any ideas, the API docs don't seem to cover it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要从地图中删除单个图钉(或任何其他类型的实体),您需要调用包含该图钉的实体集合的remove() 方法:http://msdn.microsoft.com/en-us/library/gg427616.aspx。
或者,如果您想通过索引引用实体,请改用removeAt()。
要清除集合中的所有实体,请改为调用clear()方法。
To remove a single pushpin (or any other kind of entity) from the map, you need to call the remove() method of the entitycollection that contains the pin: http://msdn.microsoft.com/en-us/library/gg427616.aspx.
Or, if you want to reference the entity by index, use removeAt() instead.
To clear all entities from a collection, call the clear() method instead.
只是为了把事情说清楚。让我花点时间来弄清楚。
在 JavaScipt 中创建图钉:
要删除图钉,您仍然必须让指针 thisPin 指向该特定图钉。
该方法在示例中没有得到很好的记录。
Just to make things clear. Cause it to me a while to figure it out.
Create a push pin in JavaScipt:
To remove the pin, you must still have the pointer thisPin pointing to that specific pin.
This method is not well documented in the samples.
javascript中的deleteAllShapes()会做到这一点,我现在正在做同样的事情并且它有效,
the deleteAllShapes() in the javascript will do this, i am working on the same thing now and it works,