[英]OpenLayers select modify feature
I try to add a select box to my modify feature control in openlayers. 我尝试在我的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)
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.