Skip to content

Commit

Permalink
Reenable map always
Browse files Browse the repository at this point in the history
  • Loading branch information
john-michaelburke committed Jul 31, 2024
1 parent 7ceb8bd commit fb18a58
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
4 changes: 0 additions & 4 deletions console_backend/src/cli_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion resources/Constants/Globals.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions resources/SolutionTab.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -58,7 +58,6 @@ MainTab {
}

SolutionTabComponents.SolutionMapTab {
visible: Globals.enableMap
}
}
}
Expand Down
30 changes: 25 additions & 5 deletions resources/web/map/js/trajectory_raw.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<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;}

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;
Expand Down Expand Up @@ -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,
});
}
});
3 changes: 0 additions & 3 deletions swiftnav_console/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit fb18a58

Please sign in to comment.