From 131d6f2e303060d6dd0c092eeac9d238d28a3fa5 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Fri, 10 Aug 2018 12:59:41 -0400 Subject: [PATCH] map: Slightly simplify digipeater point creation --- src/map.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/map.js b/src/map.js index 72cc755..c21b4ca 100644 --- a/src/map.js +++ b/src/map.js @@ -148,7 +148,13 @@ function plotPacketPaths(packets) { let digi_layer = new VectorLayer({ title: "Digipeater Labels", 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 => { digi_style.setText(new Text({ text: feature.get('callsign'), @@ -159,15 +165,6 @@ function plotPacketPaths(packets) { }); 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 layers_map = new Map(); map.addLayer(packet_path_layers);