Skip to content

Commit e358eef

Browse files
committed
Add manul bearing weight setting (only in web UI, not in config yet), which applies to manually entered bearings (Easybearing, oclock, BPI)
1 parent d35cbad commit e358eef

3 files changed

Lines changed: 42 additions & 5 deletions

File tree

chasemapper/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
# Now using Semantic Versioning (https://semver.org/) MAJOR.MINOR.PATCH
1010

11-
__version__ = "1.5.8"
11+
__version__ = "1.5.9"

static/js/bearings.js

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ var bearing_confidence_threshold = 5.0;
2525
var bearing_max_age = 10*60.0;
2626

2727
var bearing_length = 10000;
28-
var bearing_weight = 0.5;
28+
var bearing_weight = 1.0;
29+
var manual_bearing_weight = 5.0; // Should probably add this to a setting
2930
var bearing_color = "#000000";
3031
var bearing_max_opacity = 0.8;
3132
var bearing_min_opacity = 0.1;
3233

34+
// If any of these tags are in the bearing source name, we consider this a 'manual' bearing and make the line thicker.
35+
var manual_bearing_sources = ["BPI", "manual", "EasyBearing"];
36+
3337
var bearing_large_plot = false;
3438

3539
// Store for the latest server timestamp.
@@ -50,6 +54,7 @@ var timeSeqTimes = [0,0,0,0];
5054
function updateBearingSettings(){
5155
// Update bearing settings, but do *not* redraw.
5256
bearing_weight = parseFloat($('#bearingWeight').val());
57+
manual_bearing_weight = parseFloat($('#manualBearingWeight').val());
5358
bearing_length = parseFloat($('#bearingLength').val())*1000;
5459
bearing_confidence_threshold = parseFloat($('#bearingConfidenceThreshold').val());
5560
bearing_max_age = parseFloat($('#bearingMaximumAge').val())*60.0;
@@ -152,11 +157,21 @@ function addBearing(timestamp, bearing, live){
152157

153158
var _opacity = calculateBearingOpacity(timestamp);
154159

160+
var _is_manual_bearing = manual_bearing_sources.some(function (s) {
161+
return bearing.source.toLowerCase().includes(s.toLowerCase());
162+
});
163+
164+
if(_is_manual_bearing){
165+
var _temp_bearing_weight = manual_bearing_weight;
166+
} else {
167+
var _temp_bearing_weight = bearing_weight;
168+
}
169+
155170
// Create the PolyLine
156171
bearing_store[timestamp].line = L.polyline(
157172
[[bearing_store[timestamp].lat, bearing_store[timestamp].lon],_end],{
158173
color: bearing_color,
159-
weight: bearing_weight,
174+
weight: _temp_bearing_weight,
160175
opacity: _opacity
161176
});
162177

@@ -211,10 +226,20 @@ function restyleBearings(){
211226
// Calculate the end position.
212227
var _opacity = calculateBearingOpacity(key);
213228

229+
var _is_manual_bearing = manual_bearing_sources.some(function (s) {
230+
return bearing_store[key].source.toLowerCase().includes(s.toLowerCase());
231+
});
232+
233+
if(_is_manual_bearing){
234+
var _temp_bearing_weight = manual_bearing_weight;
235+
} else {
236+
var _temp_bearing_weight = bearing_weight;
237+
}
238+
214239
// Create the PolyLine
215240
bearing_store[key].line.setStyle({
216241
color: bearing_color,
217-
weight: bearing_weight,
242+
weight: _temp_bearing_weight,
218243
opacity: _opacity
219244
});
220245

@@ -235,12 +260,21 @@ function redrawBearings(){
235260
var _end = calculateDestination(L.latLng([bearing_store[key].lat, bearing_store[key].lon]), bearing_store[key].true_bearing, bearing_length);
236261
var _opacity = calculateBearingOpacity(key);
237262

263+
var _is_manual_bearing = manual_bearing_sources.some(function (s) {
264+
return bearing_store[key].source.toLowerCase().includes(s.toLowerCase());
265+
});
266+
267+
if(_is_manual_bearing){
268+
var _temp_bearing_weight = manual_bearing_weight;
269+
} else {
270+
var _temp_bearing_weight = bearing_weight;
271+
}
238272

239273
// Create the PolyLine
240274
bearing_store[key].line = L.polyline(
241275
[[bearing_store[key].lat, bearing_store[key].lon],_end],{
242276
color: bearing_color,
243-
weight: bearing_weight,
277+
weight: _temp_bearing_weight,
244278
opacity: _opacity
245279
});
246280

templates/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,9 @@ <h3>Bearing Style</h3>
10031003
<div class="paramRow">
10041004
<b>Bearing Weight (px)</b><input type="text" class="paramEntry" id="bearingWeight" value="1.0"><br/>
10051005
</div>
1006+
<div class="paramRow">
1007+
<b>Manual Bearing Weight (px)</b><input type="text" class="paramEntry" id="manualBearingWeight" value="4.0"><br/>
1008+
</div>
10061009
<div class="paramRow">
10071010
<b>Bearing Min Opacity</b><input type="text" class="paramEntry" id="bearingMinOpacity" value="0.1"><br/>
10081011
</div>

0 commit comments

Comments
 (0)