Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Openlayers 3 Openlayers 3从同一位置的两个不同层中选择两个特征_Openlayers 3 - Fatal编程技术网

Openlayers 3 Openlayers 3从同一位置的两个不同层中选择两个特征

Openlayers 3 Openlayers 3从同一位置的两个不同层中选择两个特征,openlayers-3,Openlayers 3,我有一个带标记的图层和一个带多段线的图层。标记位于多段线的末端。我喜欢拖动与多段线的端点(过度映射)同步的任何标记 var features = new ol.Collection(); var featureOverlay = new ol.layer.Vector({source: new ol.source.Vector({features: features}),style:styles}); featureOverlay.setMap(map); var markers = new

我有一个带标记的图层和一个带多段线的图层。标记位于多段线的末端。我喜欢拖动与多段线的端点(过度映射)同步的任何标记

var features = new ol.Collection();
var featureOverlay = new ol.layer.Vector({source: new ol.source.Vector({features: features}),style:styles});
featureOverlay.setMap(map);

var markers = new ol.Collection();
var markerOverlay = new ol.layer.Vector({source: new ol.source.Vector({features: markers}),style:styles});
markerOverlay.setMap(map);

var modify = new ol.interaction.Modify({features: features});
map.addInteraction(modify);


var modifyn = new ol.interaction.Modify({features: markers});
map.addInteraction(modifyn);
它不能同步工作。我必须将多段线的端点和标记分开拖动

如何同时拖动这两个对象

谢谢你的帮助! 安德烈亚斯。

我明白了

我在鼠标位置实时收集所有功能,并将它们保存在一个集合中。此集合是“修改”中的功能

干杯

var allFeaturesAtPixel = new ol.Collection();
var modify = new ol.interaction.Modify({features: allFeaturesAtPixel});
map.addInteraction(modify);

map.on('pointermove', function (evt) 
{
 allFeaturesAtPixel.clear();
 map.forEachFeatureAtPixel(evt.pixel, function (feature) {allFeaturesAtPixel.push(feature);});
});