diff --git a/sw/ground_segment/cockpit/gcs.glade b/sw/ground_segment/cockpit/gcs.glade index 7f00cf86ed..1bc9bebfe5 100644 --- a/sw/ground_segment/cockpit/gcs.glade +++ b/sw/ground_segment/cockpit/gcs.glade @@ -171,7 +171,7 @@ True - Above Ground Level (m), climb indicator, vertical speed (m/s) + Above Ground Level from SRTM if available, ground reference otherwise (m), climb indicator, vertical speed (m/s) True diff --git a/sw/lib/ocaml/mapCanvas.ml b/sw/lib/ocaml/mapCanvas.ml index 5e380f07e2..9077564795 100644 --- a/sw/lib/ocaml/mapCanvas.ml +++ b/sw/lib/ocaml/mapCanvas.ml @@ -645,7 +645,7 @@ object (self) class widget = fun ?(height=800) ?(srtm=false) ?width ?projection ?georef () -> - let srtm = GMenu.check_menu_item ~label:"SRTM" ~active:srtm () in + let srtm = GMenu.check_menu_item ~label:"display SRTM alt" ~active:srtm () in let lbl_xy = GMisc.label () and lbl_geo = GMisc.label () and lbl_alt = GMisc.label () @@ -676,6 +676,7 @@ class widget = fun ?(height=800) ?(srtm=false) ?width ?projection ?georef () -> let bg_menu = my_check_menu_item "Background" ~active:true ~callback:self#switch_background ~packing:self#file_menu#append () in let tooltips = GData.tooltips () in + tooltips#set_tip srtm#coerce ~text:"Display SRTM alt at pointer position (will request for download if not available)"; let b = GButton.button ~packing:toolbar#add () in ignore (b#connect#clicked (fun _ -> bg_menu#activate ())); @@ -777,7 +778,9 @@ class widget = fun ?(height=800) ?(srtm=false) ?width ?projection ?georef () -> method display_alt = fun wgs84 -> if srtm#active then - lbl_alt#set_text (sprintf " SRTM:%dm"(self#altitude wgs84)) + lbl_alt#set_text (sprintf " SRTM:%dm"(self#altitude wgs84)) + else if not (Srtm.available wgs84) then + lbl_alt#set_text (sprintf " SRTM: N/A") method display_group = fun s -> lbl_group#set_text s diff --git a/sw/lib/ocaml/srtm.ml b/sw/lib/ocaml/srtm.ml index 672744f070..22d3b7a1ae 100644 --- a/sw/lib/ocaml/srtm.ml +++ b/sw/lib/ocaml/srtm.ml @@ -79,6 +79,9 @@ let of_wgs84 = fun geo -> let of_utm = fun utm -> of_wgs84 (Latlong.of_utm WGS84 utm) +let available = fun geo -> + try ignore(of_wgs84 geo); true with _ -> false + let area_of_tile = fun tile -> let area = open_compressed "srtm.data.bz2" in let rec _area_of_tile = fun () -> diff --git a/sw/lib/ocaml/srtm.mli b/sw/lib/ocaml/srtm.mli index c3742b41bf..8c0a9becc7 100644 --- a/sw/lib/ocaml/srtm.mli +++ b/sw/lib/ocaml/srtm.mli @@ -33,11 +33,14 @@ exception Tile_not_found of error val error : error -> string +val available : Latlong.geographic -> bool +(** [available wgs84_pos] Returns true if srtm tile is available *) + val of_utm : Latlong.utm -> int (** [of_utm utm_pos] Returns the altitude of the given UTM position *) val of_wgs84 : Latlong.geographic -> int -(** [of_utm utm_pos] Returns the altitude of the given geographic position *) +(** [of_wgs84 wgs84_pos] Returns the altitude of the given geographic position *) val area_of_tile : string -> string