getFeaturesAtPixel()包括杂乱的(隐藏的)功能 [英] getFeaturesAtPixel() to include decluttered (hidden) features

查看:583
本文介绍了getFeaturesAtPixel()包括杂乱的(隐藏的)功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何方法可以将一层的所有要素都包含在一个特定像素中,包括由于杂乱而隐藏的要素?当前,在调用Map.getFeaturesAtPixel()(或Map.forEachFeatureAtPixel())时,这些功能会被忽略.

Is there any way to get all the features in one layer at one specific pixel, including the hidden ones due to decluttering? Currently, when calling Map.getFeaturesAtPixel() (or Map.forEachFeatureAtPixel()) those features are omitted.

推荐答案

为后人.我认为在大多数情况下,由于杂乱,您不需要结果包含隐藏的功能,因为这可能导致光标位于空白区域的非空结果.

For the posterity. I think in most cases you don’t need the result to include the hidden features due to decluttering, because that could lead to a non-empty result where the cursor is in an empty area.

最后要做的是在不打开杂波的情况下创建一个附加层.首先,我在其中添加了所有不带标签的功能,并将它们隐藏起来只是不设置填充样式(将图层不透明度设置为零也可以).当原始的杂乱特征与其他特征重叠但在空白区域仍然产生误报时,这给了我很好的结果.

What finally did was to create an additional layer without decluttering turned on. Firstly I added there all the features without labels, and hid them simply not setting the fill style (setting the layer opacity to zero would also work). That was giving me great results when an original decluttered feature was overlapping others, but still giving false positives in empty areas.

因此,最后我决定在杂乱的图层后面也显示此新图层,该样式具有不同的样式且没有标签.这样,您可以直观地看到所有功能和杂乱无章的标签都显示在顶部,从UX角度来看也很好用.

So finally I decided to show also this new layer behind the decluttered one, with different styling and without labels. This way, visually you can see all the features and decluttered with labels are shown on top, which works perfectly fine also from an UX perspective.

这篇关于getFeaturesAtPixel()包括杂乱的(隐藏的)功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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