Openlayers 3 从DragBox选择的图层-openlayers 3
有没有办法从DragBox选择创建新图层 以下是我的DragBox交互:Openlayers 3 从DragBox选择的图层-openlayers 3,openlayers-3,Openlayers 3,有没有办法从DragBox选择创建新图层 以下是我的DragBox交互: /* create drag box */ this.dragBox = new ol.interaction.DragBox({ /* dragbox interaction is active only if alt key is pressed */ condition: ol.events.condition.altKeyOnly, /* style the box */ style
/* create drag box */
this.dragBox = new ol.interaction.DragBox({
/* dragbox interaction is active only if alt key is pressed */
condition: ol.events.condition.altKeyOnly,
/* style the box */
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: [0, 0, 255, 1]
})
})
});
/* add the DragBox interaction to the map */
this.map.addInteraction(this.dragBox);
在boxend事件中,我想使用边界框中的数据创建一个新层。我怎样才能做到这一点?我认为这是一个相当简单的方法
var extent = this.dragBox.getGeometry().getExtent(); // you can use this inside the boxend event
var isIntersect=feature.getGeometry().intersectsExtent(extent);