Fix line bugs in the map
parent
bdb9c59815
commit
385d5a091d
|
@ -36,8 +36,8 @@ var sat = L.icon({
|
||||||
|
|
||||||
var station = L.icon({
|
var station = L.icon({
|
||||||
iconUrl: 'static/station-marker.png',
|
iconUrl: 'static/station-marker.png',
|
||||||
iconSize: [5, 5],
|
iconSize: [10, 10],
|
||||||
iconAnchor: [2, 2],
|
iconAnchor: [5, 5],
|
||||||
popupAnchor: [0, 0],
|
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 = 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.addTo(mymap)
|
||||||
firstpolyline.bringToFront()
|
firstpolyline.bringToFront()
|
||||||
links[entry[1]] = firstpolyline
|
links[entry[0]] = firstpolyline
|
||||||
stationList[entry[0]].setIcon(active_station)
|
stationList[entry[0]].setIcon(active_station)
|
||||||
|
stationList[entry[0]].setZIndexOffset(500)
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -100,10 +101,10 @@ setInterval(function(){
|
||||||
links[key].setStyle({opacity:0})
|
links[key].setStyle({opacity:0})
|
||||||
links[key].removeFrom(mymap)
|
links[key].removeFrom(mymap)
|
||||||
|
|
||||||
delete links[key]
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
links = {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,18 +129,20 @@ setInterval(function(){
|
||||||
var usedStations = []
|
var usedStations = []
|
||||||
Object.keys(stationList).forEach(function(key){
|
Object.keys(stationList).forEach(function(key){
|
||||||
stationList[key].setIcon(station)
|
stationList[key].setIcon(station)
|
||||||
|
stationList[key].setZIndexOffset(-1000)
|
||||||
|
|
||||||
})
|
})
|
||||||
data.forEach(function(entry){
|
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 = 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.addTo(mymap)
|
||||||
links[entry[1]] = firstpolyline
|
links[entry[0]] = firstpolyline
|
||||||
stationList[entry[0]].setIcon(active_station)
|
stationList[entry[0]].setIcon(active_station)
|
||||||
|
stationList[entry[0]].setZIndexOffset(500)
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
console.log(links)
|
console.log(links)
|
||||||
|
|
||||||
}, 10000);
|
}, 20000);
|
||||||
|
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue