关于从丛集管理者移除项目的问题 [英] Issue on removing item from clustermanager
问题描述
在我的Android应用程序中,我必须在我的GoogleMap中删除并重新添加一个集群项目,它代表我的当前位置。但是当我运行这段代码时:
In my Android application, I have to delete and re-add a cluster item in my GoogleMap, that represents my current location. But when I run this code:
clusterMng.remove(myitem);
我得到以下例外情况:
java.lang.UnsupportedOperationException: NonHierarchicalDistanceBasedAlgorithm.remove
not implemented.
有人可以向我解释这是什么意思吗?
是否必须重写外部库中的某些ClusterManager.java方法?或者我可以简单地改变我的算法?
Can someone explain to me what this means? Do I have to rewrite some methods of ClusterManager.java in the external library? Or can I simply change my algorithm?
推荐答案
默认情况下 ClusterManager NonHierarchicalDistanceBasedAlgorithm
尝试使用 GridBasedAlgorithm 代替(它支持删除元素):
Try to use GridBasedAlgorithm instead (it supports elements remove):
clusterMng.setAlgorithm(new GridBasedAlgorithm<MyClusterItem>());
或者,为了获得更好的性能,请使用PreCachingAlgorithmDecorator 默认情况下:
Or, for better performance, wrap it with PreCachingAlgorithmDecorator, as ClusterManager does by default:
clusterMng.setAlgorithm(new PreCachingAlgorithmDecorator<MyClusterItem>(new GridBasedAlgorithm<MyClusterItem>()));
这篇关于关于从丛集管理者移除项目的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!