kopia lustrzana https://github.com/projecthorus/chasemapper
Add ability to disable bearings from map.
rodzic
c321d27405
commit
223bf03ac5
|
@ -157,6 +157,11 @@ class Bearings(object):
|
|||
else:
|
||||
_confidence = 100.0
|
||||
|
||||
if 'power' in bearing:
|
||||
_power = bearing['power']
|
||||
else:
|
||||
_power = -1
|
||||
|
||||
if 'source' in bearing:
|
||||
_source = bearing['source']
|
||||
else:
|
||||
|
@ -166,6 +171,10 @@ class Bearings(object):
|
|||
if bearing['bearing_type'] == 'relative':
|
||||
# Relative bearing - we need to fuse this with the current car position.
|
||||
|
||||
# Temporary hack for KerberosSDR bearings, which are reflected across N/S
|
||||
if _source == 'kerberos-sdr':
|
||||
bearing['bearing'] = 360.0 - bearing['bearing']
|
||||
|
||||
_new_bearing = {
|
||||
'timestamp': _arrival_time,
|
||||
'src_timestamp': _src_timestamp,
|
||||
|
@ -180,6 +189,7 @@ class Bearings(object):
|
|||
'source': _source
|
||||
}
|
||||
|
||||
|
||||
elif bearing['bearing_type'] == 'absolute':
|
||||
# Absolute bearing - use the provided data as-is
|
||||
|
||||
|
|
|
@ -103,11 +103,11 @@ function addBearing(timestamp, bearing, live){
|
|||
});
|
||||
|
||||
|
||||
if (bearingValid(bearing_store[timestamp]) == true){
|
||||
if ( (bearingValid(bearing_store[timestamp]) == true) && (document.getElementById("bearingsEnabled").checked == true) ){
|
||||
bearing_store[timestamp].line.addTo(map);
|
||||
}
|
||||
|
||||
if (live == true){
|
||||
if ( (live == true) && (document.getElementById("bearingsEnabled").checked == true) ){
|
||||
$("#bearing_table").tabulator("setData", [{id:1, bearing: bearing_store[timestamp].raw_bearing.toFixed(0), confidence: bearing_store[timestamp].confidence.toFixed(0)}]);
|
||||
$("#bearing_table").show();
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ function redrawBearings(){
|
|||
opacity: _opacity
|
||||
});
|
||||
|
||||
if (bearingValid(bearing_store[key]) == true){
|
||||
if ( (bearingValid(bearing_store[key]) == true) && (document.getElementById("bearingsEnabled").checked == true)){
|
||||
bearing_store[key].line.addTo(map);
|
||||
}
|
||||
|
||||
|
@ -208,6 +208,33 @@ function bearingUpdate(data){
|
|||
}
|
||||
|
||||
|
||||
function toggleBearingsEnabled(){
|
||||
// Enable-disable bearing only mode, which hides the summary and telemetry displays
|
||||
|
||||
// Grab the bearing-only-mode settings.
|
||||
var _bearings_enabled = document.getElementById("bearingsEnabled").checked;
|
||||
|
||||
|
||||
if ((_bearings_enabled == true) && (bearings_on == false)){
|
||||
// Show all bearings.
|
||||
redrawBearings();
|
||||
bearings_on = true;
|
||||
|
||||
|
||||
} else if ((_bearings_enabled == false) && (bearings_on == true)){
|
||||
// Hide all bearings, which we can do by re-drawing them - as the bearingsEnabled
|
||||
// button is not checked, re-drawing will remove all bearing lines from the map, and not re-add them.
|
||||
redrawBearings();
|
||||
|
||||
// Hide the bearing table
|
||||
$("#bearing_table").hide();
|
||||
|
||||
bearings_on = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toggleBearingsOnlyMode(){
|
||||
// Enable-disable bearing only mode, which hides the summary and telemetry displays
|
||||
|
||||
|
|
|
@ -717,7 +717,7 @@
|
|||
</h1>
|
||||
|
||||
<div class="paramRow">
|
||||
<b>Enable Bearings</b> <input type="checkbox" class="paramSelector" id="bearingsEnabled" checked>
|
||||
<b>Enable Bearings</b> <input type="checkbox" class="paramSelector" id="bearingsEnabled" checked onclick='toggleBearingsEnabled();'>
|
||||
</div>
|
||||
|
||||
<div class="paramRow">
|
||||
|
|
Ładowanie…
Reference in New Issue