From 7d918adff0beb712738f918ef96a53e81aec0206 Mon Sep 17 00:00:00 2001 From: wgaylord Date: Sat, 22 Dec 2018 02:09:23 -0600 Subject: [PATCH] Fixed lines --- templates/map.html | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/templates/map.html b/templates/map.html index d2910bf..2ba5f59 100644 --- a/templates/map.html +++ b/templates/map.html @@ -13,6 +13,12 @@
@@ -105,7 +111,7 @@ function UpdateMap(e) { e.data[4].forEach(function(x){ //console.log(x + " "+norad) - popupText = popupText + '
'+x[0]+"

" + popupText = popupText + '
'+x[0]+"
" }) Sats[norad].bindPopup(popupText) Sats[norad]._popup.setContent(popupText) @@ -116,20 +122,22 @@ function UpdateMap(e) { }) e.data[3].forEach(function(x){ - if (Object.keys(Lines[norad]).includes(Number(x[0]))){ + if (Object.keys(Lines[norad]).includes(String(x[0]))){ Object.keys(Lines[norad]).forEach(function(y){ - if (temp.includes(Number(y))){ - Lines[norad][y]._latlngs[1]= {"lat":satPos[0],"lng":satPos[1]} - }else{ - Lines[norad][y].removeFrom(mymap) - delete Lines[norad][y] - } + Lines[norad][y]._latlngs[1]= {"lat":satPos[0],"lng":satPos[1]} })}else{Lines[norad][x[0]] = new L.Polyline([[Stations[x[0]]._latlng.lat,Stations[x[0]]._latlng.lng],[satPos[0],satPos[1]]], {color: x[1],weight: 3,opacity: 1,smoothFactor: 1}); Lines[norad][x[0]].addTo(mymap)}; }) - - + Object.keys(Lines[norad]).forEach(function(x){ + if (temp.includes(Number(x))){ + + }else{ + Lines[norad][x].removeFrom(mymap) + delete Lines[norad][x] + } + }) + } @@ -173,7 +181,7 @@ $.get("/occuring_sats", function(data, status){ }else{ Workers[x].terminate() delete Workers[x] - UpdateMap({"data":[x,"",[0,0],[]]}) + UpdateMap({"data":[x,"",[0,0],[],[]]}) Sats[x].removeFrom(mymap) delete Sats[x] delete Lines[x]