diff --git a/console_backend/src/cli_options.rs b/console_backend/src/cli_options.rs index b332a06cd..922086177 100644 --- a/console_backend/src/cli_options.rs +++ b/console_backend/src/cli_options.rs @@ -109,10 +109,6 @@ pub struct CliOptions { #[clap(long)] pub show_file_connection: bool, - /// Enable map. - #[clap(long)] - pub enable_map: bool, - /// Enable ntrip client #[clap(long)] pub enable_ntrip: bool, diff --git a/resources/Constants/Globals.qml b/resources/Constants/Globals.qml index 012777154..1db2d579e 100644 --- a/resources/Constants/Globals.qml +++ b/resources/Constants/Globals.qml @@ -33,7 +33,6 @@ QtObject { property int initialSubTabIndex: 0 // Signals property bool showCsvLog: false property bool showFileio: false - property bool enableMap: false property int height: 600 property int minimumHeight: 600 property int width: 1000 diff --git a/resources/SolutionTab.qml b/resources/SolutionTab.qml index 46efa2a23..c6949212f 100644 --- a/resources/SolutionTab.qml +++ b/resources/SolutionTab.qml @@ -30,7 +30,7 @@ import "SolutionTabComponents" as SolutionTabComponents MainTab { id: solutionTab - subTabNames: Globals.enableMap ? ["Position", "Velocity", "Map"] : ["Position", "Velocity"] + subTabNames: ["Position", "Velocity", "Map"] curSubTabIndex: 0 SplitView { @@ -58,7 +58,6 @@ MainTab { } SolutionTabComponents.SolutionMapTab { - visible: Globals.enableMap } } } diff --git a/resources/web/map/js/trajectory_raw.js b/resources/web/map/js/trajectory_raw.js index ffc805773..29e39cc47 100644 --- a/resources/web/map/js/trajectory_raw.js +++ b/resources/web/map/js/trajectory_raw.js @@ -2,16 +2,21 @@ import mapboxGlStyleSwitcher from 'https://cdn.skypack.dev/mapbox-gl-style-switc const lines = ["#FF0000", "#FF00FF", "#00FFFF", "#0000FF", "#00FF00", "#000000"]; const LNG_KM = 111.320, LAT_KM = 110.574; +const mapContainer = 'map'; +const mapStyle = "mapbox://styles/mapbox/light-v11?optimize=true"; +const mapCenter = [-122.486052, 37.830348]; // Initial focus coordinate +const mapZoom = 16; +const mapPerformanceMetricsCollection = false; 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>>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;} mapboxgl.accessToken = decode("@ACCESS_TOKEN@"); var map = new mapboxgl.Map({ - container: 'map', - style: "mapbox://styles/mapbox/light-v11?optimize=true", - center: [-122.486052, 37.830348], // Initial focus coordinate - zoom: 16, - performanceMetricsCollection: false, + container: mapContainer, + style: mapStyle, + center: mapCenter, + zoom: mapZoom, + performanceMetricsCollection: mapPerformanceMetricsCollection, }); var focusCurrent = false; @@ -243,3 +248,18 @@ map.on('load', () => { console.log("loaded"); setupLayers(); }); + +map.on('error', () => { + if (mapboxgl.accessToken != "@ACCESS_TOKEN@") { + console.log("Attempting to use local environment variable MAPBOX_TOKEN"); + mapboxgl.accessToken = "@ACCESS_TOKEN@"; + map.remove(); + map = new mapboxgl.Map({ + container: mapContainer, + style: mapStyle, + center: mapCenter, + zoom: mapZoom, + performanceMetricsCollection: mapPerformanceMetricsCollection, + }); + } +}); diff --git a/swiftnav_console/main.py b/swiftnav_console/main.py index 3bf120525..c9ccc9243 100644 --- a/swiftnav_console/main.py +++ b/swiftnav_console/main.py @@ -667,8 +667,6 @@ def handle_cli_arguments(args: argparse.Namespace, globals_: QObject): globals_.setProperty("width", args.width) # type: ignore if args.show_file_connection: globals_.setProperty("showFileConnection", True) # type: ignore - if args.enable_map: - globals_.setProperty("enableMap", True) # type: ignore if args.enable_ntrip: globals_.setProperty("enableNtrip", True) # type: ignore try: @@ -729,7 +727,6 @@ def main(passed_args: Optional[Tuple[str, ...]] = None) -> int: parser.add_argument("--record-capnp-recording", action="store_true") parser.add_argument("--debug-with-no-backend", action="store_true") parser.add_argument("--show-fileio", action="store_true") - parser.add_argument("--enable-map", action="store_true") parser.add_argument("--show-file-connection", action="store_true") parser.add_argument("--no-prompts", action="store_true") parser.add_argument("--use-opengl", action="store_true")