Openlayers 3 Select 来自同一位置两个不同层的两个特征
Openlayers 3 Select two features from two different layers at same position
我有一个带有标记的图层和一个带有折线的图层。标记位于折线的末端。我喜欢拖动与折线末端(重叠)同步的任何标记。
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);});
});
我有一个带有标记的图层和一个带有折线的图层。标记位于折线的末端。我喜欢拖动与折线末端(重叠)同步的任何标记。
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);});
});