I try to add a select box to my modify feature control in openlayers. Actually, I use a control panel with a button "modify feature", when i click on it, I can click on a feature and modify those vertices.
With the "select" control, it's possible to add a box to select features.. But I'm using this controls for other tasks.
Is there a simple way to add a selection box to the modify feature control ? (it's for select path)
I don't believe it's possible to modify many multiple features as once if that is what you are asking, but if you want to select multiple features at once you could use a bounding box like below,
boundingBox = new ol.interaction.DragBox({
condition: ol.events.condition.altKeyOnly,
style : new ol.style.Style({
fill : new ol.style.Fill({
color : 'rgba(0, 0, 0, 0.1)'
}),
stroke : new ol.style.Stroke({
color : '#00FF00',
width : 2
}),
})
});
//Add bounding box interaction
map.addInteraction(boundingBox);
//Add Event Listener for end of bounding box drag.Each feature, featureForPass, will be passed to callBackFunction
boundingBox.on('boxend', function(e){
var bbBoxExtent = boundingBox.getGeometry().getExtent() ;
yourLayer.getSource().forEachFeatureInExtent(bbBoxExtent,callBackFunction,featureForPass)
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.