map: Slightly simplify digipeater point creation

This commit is contained in:
Adam Goldsmith 2018-08-10 12:59:41 -04:00
parent 6b9aaef2ad
commit 131d6f2e30

View File

@ -148,7 +148,13 @@ function plotPacketPaths(packets) {
let digi_layer = new VectorLayer({ let digi_layer = new VectorLayer({
title: "Digipeater Labels", title: "Digipeater Labels",
zIndex: 1, // TODO: probably not the best way to do this zIndex: 1, // TODO: probably not the best way to do this
source: new VectorSource(), source: new VectorSource({
features: Array.from(digiPos.keys()).map(callsign =>
new Feature({
geometry: transformGeometry(new Point(digiPos.get(callsign))),
callsign: callsign
})
)}),
style: feature => { style: feature => {
digi_style.setText(new Text({ digi_style.setText(new Text({
text: feature.get('callsign'), text: feature.get('callsign'),
@ -159,15 +165,6 @@ function plotPacketPaths(packets) {
}); });
map.addLayer(digi_layer); map.addLayer(digi_layer);
digiPos.forEach((position, callsign) => {
let feature = new Feature({
geometry: transformGeometry(new Point(position)),
callsign: callsign
});
digi_layer.getSource().addFeature(feature);
});
let packet_path_layers = new LayerGroup({title: "Packet Paths"}); let packet_path_layers = new LayerGroup({title: "Packet Paths"});
let layers_map = new Map(); let layers_map = new Map();
map.addLayer(packet_path_layers); map.addLayer(packet_path_layers);