如何从iOS中的Google Maps clustermanager获取所有项目

问题描述 投票:5回答:1

在Android版本的Google Maps集群管理器中,可以从中获取标记的集合(请参见Google Maps Utility: how to get all markers from ClusterManager<?>?)。我尝试在iOS下执行相同的操作,但是不起作用。 algoritm类不会公开items数组。

还有其他获取物品的方法吗?还是我应该执行以下一项操作:

  • 通过编辑算法类公开项目数组。
  • 对算法类进行分类,并覆盖addItemclearItems等方法,因此我可以维护items数组的卷影副本。
  • 以其他方式维护卷影副本。
ios google-maps markerclusterer
1个回答
0
投票

从逻辑上讲,这是将所有项目带入群集的算法。但是根据缩放值调用项目时出现错误。

let clusters = clusterManager.algorithm.clusters(atZoom: 21.0 //self.googleMap.maxZoom)
for c in clusters {

    for i in c.items {

        if let m = i as? POIItem {
            //some code
        }
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.