如何取消选择功能

时间:2016-10-03 14:36:49

标签: 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-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);
});

2 个答案:

答案 0 :(得分:3)

SELECT Sn,sDayDate, GROUP_CONCAT(string SEPARATOR ' ') FROM table GROUP BY Sn; 互动带有一系列功能:

Select

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

clear()

答案 1 :(得分:0)

Well, I would rather choose a way of removing interaction and assigning it again, like it is here.