平面是图层中的图像矢量元素。如果飞机的轨迹是隐藏的,我想设置轨迹线以使其在选择时显示。如果显示了飞机的轨迹,我想设置轨迹线以使其在选择时显示,但是我将选定的交互添加到地图上,但它不起作用,并且在获取轨迹线时如何确定是否是正常还是空?
我将所选的互动添加到地图上,然后对所选事件进行操作:
let selectSingleClick = new ol.interaction.Select({});
map.addInteraction(selectSingleClick);
selectSingleClick.on('select', event => {
let feature = event.selected[0];
if (feature == undefined || feature == null) {
return;
}else {
let trackLine = feature.getId() + "line";
if( ?){
trackLine.setStyle(styleLineNormal);
} else {
trackLine.setStyle(null);
}
}
})