Skip to content

Commit 0674009

Browse files
Reenable map always
1 parent 7ceb8bd commit 0674009

File tree

5 files changed

+25
-15
lines changed

5 files changed

+25
-15
lines changed

console_backend/src/cli_options.rs

-4
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ pub struct CliOptions {
109109
#[clap(long)]
110110
pub show_file_connection: bool,
111111

112-
/// Enable map.
113-
#[clap(long)]
114-
pub enable_map: bool,
115-
116112
/// Enable ntrip client
117113
#[clap(long)]
118114
pub enable_ntrip: bool,

resources/Constants/Globals.qml

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ QtObject {
3333
property int initialSubTabIndex: 0 // Signals
3434
property bool showCsvLog: false
3535
property bool showFileio: false
36-
property bool enableMap: false
3736
property int height: 600
3837
property int minimumHeight: 600
3938
property int width: 1000

resources/SolutionTab.qml

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import "SolutionTabComponents" as SolutionTabComponents
3030
MainTab {
3131
id: solutionTab
3232

33-
subTabNames: Globals.enableMap ? ["Position", "Velocity", "Map"] : ["Position", "Velocity"]
33+
subTabNames: ["Position", "Velocity", "Map"]
3434
curSubTabIndex: 0
3535

3636
SplitView {
@@ -58,7 +58,6 @@ MainTab {
5858
}
5959

6060
SolutionTabComponents.SolutionMapTab {
61-
visible: Globals.enableMap
6261
}
6362
}
6463
}

resources/web/map/js/trajectory_raw.js

+24-5
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,21 @@ import mapboxGlStyleSwitcher from 'https://cdn.skypack.dev/mapbox-gl-style-switc
22

33
const lines = ["#FF0000", "#FF00FF", "#00FFFF", "#0000FF", "#00FF00", "#000000"];
44
const LNG_KM = 111.320, LAT_KM = 110.574;
5+
const mapContainer = 'map';
6+
const mapStyle = "mapbox://styles/mapbox/light-v11?optimize=true";
7+
const mapCenter = [-122.486052, 37.830348]; // Initial focus coordinate
8+
const mapZoom = 16;
9+
const mapPerformanceMetricsCollection = false;
510

611
function decode(r){var n=r,t=[0,10,13,34,38,92],e=new Uint8Array(1.75*n.length|0),f=0,o=0,a=0;function i(r){o|=(r<<=1)>>>a,8<=(a+=7)&&(e[f++]=o,o=r<<7-(a-=8)&255)}for(var u=0;u<n.length;u++){var c,d=n.charCodeAt(u);127<d?(7!=(c=d>>>8&7)&&i(t[c]),i(127&d)):i(d)}r=new Uint8Array(e,0,f);var s=new TextDecoder().decode(r);while (s.slice(-1)=="\x00") s=s.slice(0,-1); return s;}
712

813
mapboxgl.accessToken = decode("@ACCESS_TOKEN@");
914
var map = new mapboxgl.Map({
10-
container: 'map',
11-
style: "mapbox://styles/mapbox/light-v11?optimize=true",
12-
center: [-122.486052, 37.830348], // Initial focus coordinate
13-
zoom: 16,
14-
performanceMetricsCollection: false,
15+
container: mapContainer,
16+
style: mapStyle,
17+
center: mapCenter,
18+
zoom: mapZoom,
19+
performanceMetricsCollection: mapPerformanceMetricsCollection,
1520
});
1621

1722
var focusCurrent = false;
@@ -243,3 +248,17 @@ map.on('load', () => {
243248
console.log("loaded");
244249
setupLayers();
245250
});
251+
map.on('error', () => {
252+
if (mapboxgl.accessToken != "@ACCESS_TOKEN@") {
253+
console.log("Attempting to use local environment variable MAPBOX_TOKEN");
254+
mapboxgl.accessToken = "@ACCESS_TOKEN@";
255+
map.remove();
256+
map = new mapboxgl.Map({
257+
container: mapContainer,
258+
style: mapStyle,
259+
center: mapCenter,
260+
zoom: mapZoom,
261+
performanceMetricsCollection: mapPerformanceMetricsCollection,
262+
});
263+
}
264+
});

swiftnav_console/main.py

-3
Original file line numberDiff line numberDiff line change
@@ -667,8 +667,6 @@ def handle_cli_arguments(args: argparse.Namespace, globals_: QObject):
667667
globals_.setProperty("width", args.width) # type: ignore
668668
if args.show_file_connection:
669669
globals_.setProperty("showFileConnection", True) # type: ignore
670-
if args.enable_map:
671-
globals_.setProperty("enableMap", True) # type: ignore
672670
if args.enable_ntrip:
673671
globals_.setProperty("enableNtrip", True) # type: ignore
674672
try:
@@ -729,7 +727,6 @@ def main(passed_args: Optional[Tuple[str, ...]] = None) -> int:
729727
parser.add_argument("--record-capnp-recording", action="store_true")
730728
parser.add_argument("--debug-with-no-backend", action="store_true")
731729
parser.add_argument("--show-fileio", action="store_true")
732-
parser.add_argument("--enable-map", action="store_true")
733730
parser.add_argument("--show-file-connection", action="store_true")
734731
parser.add_argument("--no-prompts", action="store_true")
735732
parser.add_argument("--use-opengl", action="store_true")

0 commit comments

Comments
 (0)