Fix line bugs in the map
parent
bdb9c59815
commit
385d5a091d
|
@ -36,8 +36,8 @@ var sat = L.icon({
|
|||
|
||||
var station = L.icon({
|
||||
iconUrl: 'static/station-marker.png',
|
||||
iconSize: [5, 5],
|
||||
iconAnchor: [2, 2],
|
||||
iconSize: [10, 10],
|
||||
iconAnchor: [5, 5],
|
||||
popupAnchor: [0, 0],
|
||||
|
||||
});
|
||||
|
@ -88,8 +88,9 @@ $.get("/api/satstationpairs", function(data, status){
|
|||
firstpolyline = new L.Polyline([[stationList[entry[0]]._latlng.lat,stationList[entry[0]]._latlng.lng],[sats[entry[1]]._latlng.lat,sats[entry[1]]._latlng.lng]], {color: 'red',weight: 3,opacity: 1,smoothFactor: 1});
|
||||
firstpolyline.addTo(mymap)
|
||||
firstpolyline.bringToFront()
|
||||
links[entry[1]] = firstpolyline
|
||||
links[entry[0]] = firstpolyline
|
||||
stationList[entry[0]].setIcon(active_station)
|
||||
stationList[entry[0]].setZIndexOffset(500)
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -100,10 +101,10 @@ setInterval(function(){
|
|||
links[key].setStyle({opacity:0})
|
||||
links[key].removeFrom(mymap)
|
||||
|
||||
delete links[key]
|
||||
})
|
||||
|
||||
links = {}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -128,18 +129,20 @@ setInterval(function(){
|
|||
var usedStations = []
|
||||
Object.keys(stationList).forEach(function(key){
|
||||
stationList[key].setIcon(station)
|
||||
stationList[key].setZIndexOffset(-1000)
|
||||
|
||||
})
|
||||
data.forEach(function(entry){
|
||||
firstpolyline = new L.Polyline([[stationList[entry[0]]._latlng.lat,stationList[entry[0]]._latlng.lng],[sats[entry[1]]._latlng.lat,sats[entry[1]]._latlng.lng]], {color: 'red',weight:3,opacity:1,smoothFactor: 1});
|
||||
firstpolyline.addTo(mymap)
|
||||
links[entry[1]] = firstpolyline
|
||||
links[entry[0]] = firstpolyline
|
||||
stationList[entry[0]].setIcon(active_station)
|
||||
stationList[entry[0]].setZIndexOffset(500)
|
||||
});
|
||||
|
||||
});
|
||||
console.log(links)
|
||||
|
||||
}, 10000);
|
||||
}, 20000);
|
||||
|
||||
</script>
|
Loading…
Reference in New Issue