简体   繁体   English

Openlayers修改交互

[英]Openlayers Modify interaction

I am having trouble with the Openlayers Modify interaction. 我在Openlayers Modify交互方面遇到了麻烦。

I have some features on a map and want to be able to modify the points of some of them based on a locked key. 我在地图上有一些功能,希望能够根据locked密钥修改其中一些功能。

The following works to let me modify all features on a source: 以下工作允许我修改源上的所有功能:

this.modify = new ol.interaction.Modify({
  source
});

The following doesn't allow me modify any of the features, where modifiableFeaturesCollection is a collection of features: 以下内容不允许我修改任何功能,其中modifiableFeaturesCollection是一组功能:

this.modify = new ol.interaction.Modify({
  features: modifiableFeaturesCollection
});

Here is a link to a jsfiddle I have created illustrateing the problem: https://jsfiddle.net/mcneela86/jhye21pm/ 这是一个链接到我创建的jsfiddle说明问题: https ://jsfiddle.net/mcneela86/jhye21pm/

For some reason, I am unsure why making the following change makes this work. 出于某种原因,我不确定为什么进行以下更改会使其工作。

this.modify = new ol.interaction.Modify({
  features: new ol.Collection(features)
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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