开发者

Find if an overlay exists on a google map

开发者 https://www.devze.com 2023-04-10 09:00 出处:网络
Is there any way to know if an overlay already exist on a map, before we addOverlay to a map. The 开发者_如何学Cthing what I want is, I have an application which gets LatLng points from google server

Is there any way to know if an overlay already exist on a map, before we addOverlay to a map.

The 开发者_如何学Cthing what I want is, I have an application which gets LatLng points from google server Asynchronously, using these points I create Markers and add them to the map. So is there any way to check if that point has been added already to the map.

By the way I am using GWT-RPC and Maps. Any help will be appreciated.


What you can do is before adding the marker to the google map, add the markers in the List, and then iterate through the List to check if the two markers have same latlng point, but before that you need to overwrite the isequals() method as LatLng.isequals does what equals() ought to do, but constrained by the JS overlay rules.

Also the following link might help you: How to avoid Java.util.IllegalStateException in the following code?

0

精彩评论

暂无评论...
验证码 换一张
取 消