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);});
});