1

我目前正在使用angular-Leaflet-directive +传单markercluster插件进行项目。有没有办法返回当前不在群集组中的所有标记的列表?

我想要做的是,在某个事件(例如,+/-缩放级别或群集组更改时)我想要一个函数运行,它返回当前不是所有标记集群。

之所以这样做,这是因为我想有所有可见的标记周围有一个圆圈路径(20海里,但是这真的不是很重要)..

没有任何人有任何想法,如果这有可能吗?

感谢您的帮助。请让我知道您可能需要的其他信息,我会尽我所能为您提供帮助。

干杯!

回答

0

创建markerClusterGroup后,你可以做这样的事情:

// Let's assume you have a global map variable that refers to the Leaflet Map 
MyClusterGroup.eachLayer(function(feature) { 
    // the cluster group holds all the features 
    // but only the ones not clustered are added to the map 
    if (map.hasLayer(feature)) { 
     feature.setStyle({ // Only feature not clustered will have their style re-render 
      fillColor : "red" 
     }); 
     // Do whatever your want with this feature, you have full access to it 
    } 
}); 

这可能不是在性能方面做的最好的东西,但我想这将正常工作为你的情况。否则,您应该潜入标记插件代码并直接修改/扩展它以满足您的需求。

相关问题