我有一些功能只有在用户的视野中时才需要显示,我该如何执行Image of a polygon that needs to be removed if it is off-screen of the user
发布于 2021-07-04 17:11:32
确定要素是否在视口中的步骤
var visibleExtent = map.getView().calculateExtent();
if (feature.getGeometry().intersectsExtent(visibleExtent)) {
// feature is visible to user
}请注意,如果视图旋转,则可能会出现一些误报。可以通过测试旋转的几何和范围来消除它们,如本例https://openlayers.org/en/latest/examples/box-selection.html中所示
https://stackoverflow.com/questions/68237550
复制相似问题