多重注释(IOS)最简单的方法 [英] Multiple Annotations (IOS) Easiest way

查看:28
本文介绍了多重注释(IOS)最简单的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 IOS 中使用 Annotations 来显示伦敦地铁站,但我正在查看数字,大约有 280 个.什么是最简单的方法来做到这一点?单独使用还是有其他选择?

Im using Annotations in IOS to display London Tube stations, but im looking at numbers and there are 280 or so. Whats the easiest way to do this? Individually or is there another option?

为所有建议干杯

大卫

推荐答案

280 注释性能好,外观不行.当用户缩小时,您必须将它们分组.

The performance is good with 280 annotations, the appearance is not. You have to group them into clusters when the user zooms out.

一种方法是:

  • 决定要显示多少个集群注释.
  • 将屏幕分成 x*y 块,所以大致 x*y =~ numClustersx/y=480/320=1.5
  • 为每个图块添加一个集群注释(这是一个普通集群,数组包含 0 个或多个注释).
  • 运行 k-means 算法:
    • 迭代所有注释并将每个注释添加到最近的集群中.
    • 为每个集群计算一个新中心,这将是其所有成员中心的平均值.
    • 清空每个集群.
    • 重复直到不再有集群移动.
    • 删除空簇(如果有).

    您最终会得到根据注释密度定位的 numClusters 个簇.

    You end up with numClusters clusters positioned according to the annotation density.

    如果它们远离集群,您也可以自己留下一些正常的注释.取决于您希望它的外观.

    You can also leave a number of normal annotations on their own if they are away from the clusters. Depends on how you want it to look.

    这篇关于多重注释(IOS)最简单的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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