gpt4 book ai didi

openlayers-3 - 打开第 3 层 : How to create listener for a modify interaction

转载 作者:行者123 更新时间:2023-12-04 04:13:19 27 4
gpt4 key购买 nike

我设法设置了一个修改交互。

ol.interaction.Modify ( http://ol3js.org/en/master/apidoc/ol.interaction.Modify.html ) 的文档没有提到修改功能时触发的单个事件。

与 ol.interaction.Draw ( http://ol3js.org/en/master/apidoc/ol.interaction.Draw.html ) 不同,它运行良好。

修改要素后,我需要更新数据库中的坐标。

如何设置监听器?

最佳答案

我找到了解决方案。

高级解释在这里:http://boundlessgeo.com/2014/06/openlayers-editing-wfs-t/

基本上你不会听到修改交互中的变化(就像你在绘制交互中所做的那样)。相反,您可以聆听所选功能本身的变化。

这是一个简短的摘录:

// get the features from the select interaction
var selected_features = select_interaction.getFeatures();
// when a feature is selected...
selected_features.on('add', function(event) {
// get the feature
var feature = event.element;
// ...listen for changes on it
feature.on('change', function(event) {
// got it!
});
});

这是一个完整的工作示例: http://codepen.io/barbalex/pen/fBpyb

关于openlayers-3 - 打开第 3 层 : How to create listener for a modify interaction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24726734/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com