如何在 Openlayers 3 ol.interaction.Select 上手动引发 'select' 事件?

How do I manually cause a 'select' event on an Openlayers 3 ol.interaction.Select?

我想在用户单击与该功能相关的按钮时将 ol.interaction.Select obj 设置为 'select' 该功能。我希望能够在用户单击某个功能时重用我已经使用的事件处理代码。

有没有办法通过 Select 交互来做到这一点?

<!-- UPDATE -->

也许当这个 PR 合并时我们可以调度 select 事件。关于重用代码,我想你可以解决这个问题,把它包装在一个函数上,当把一个特性推送到集合时,用那个特性调用你的函数。

<!-- End of update -->

根据需要获取 ol.interaction.Select collectionpushpop:

var select = new ol.interaction.Select({
    //some options
});
map.addInteraction(select);

var collection = select.getFeatures();
collection.push(some_feature);

//or push an array of features
collection.extend(some_array_features);