Openlayers 3 如何取消选择功能

Openlayers 3 如何取消选择功能,openlayers-3,Openlayers 3,我正在执行maplayer切换功能,但切换图层时,选定的要素不会取消选中。我可以知道如何在openlayer 3中取消选择功能吗 $("#show-field-map").click(function(event) { map.removeLayer(subbasinJsonp); map.addLayer(fieldJsonp); $('#show-subbasin-map').attr("disabled", false); $('#show-field-ma

我正在执行maplayer切换功能,但切换图层时,选定的要素不会取消选中。我可以知道如何在openlayer 3中取消选择功能吗

$("#show-field-map").click(function(event) {
    map.removeLayer(subbasinJsonp);
    map.addLayer(fieldJsonp);
    $('#show-subbasin-map').attr("disabled", false);
    $('#show-field-map').attr("disabled", true);
});

$("#show-subbasin-map").click(function(event) {
    map.removeLayer(fieldJsonp);
    map.addLayer(subbasinJsonp);
    $('#show-field-map').attr("disabled", false);
    $('#show-subbasin-map').attr("disabled", true);
});

Select
交互包含以下功能的集合:

var select = new ol.interation.Select();
var features = selectInteraction.getFeatures();
features.clear();
您可以对该选择调用
clear()
,取消选择所有功能:

var select = new ol.interation.Select();
var features = selectInteraction.getFeatures();
features.clear();

好吧,我宁愿选择一种方式来删除交互并重新分配它,就像这样。

现在提供的链接已断开。最好在参考链接之外提供更多信息。