繁体   English   中英

OpenLayers选择修改功能

[英]OpenLayers select modify feature

我尝试在我的openlayers修改功能控件中添加一个选择框。 实际上,我使用带有“修改特征”按钮的控制面板,当我单击它时,我可以单击特征并修改这些顶点。

使用“选择”控件,可以添加一个框来选择要素。.但是我将此控件用于其他任务。

是否有一种简单的方法可以将选择框添加到“修改特征”控件? (用于选择路径)

我不认为有可能一次修改多个功能,但是如果您想一次选择多个功能,可以使用如下所示的边框,

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM