OSD

From Navit's Wiki
Revision as of 03:27, 4 February 2009 by Mineque (talk | contribs)
Jump to: navigation, search

The On Screen Display (OSD) provides status information and controls blended directly onto the map.

Current OSD types:

  • "compass"
  • "navigation_next_turn"
  • "text"
  • "speed_warner"
  • "toogle_announcer"
  • "gps_status"
  • "volume"
  • "button" - with possible commands to use:
    • gui.fullscreen()
    • gui.menu()
    • gui.get_data()
    • zoom_in()
    • zoom_out()
    • speech.active


The button type can be used to provide zoom in/zoom out functionality with gui_internal (which does not itself draw any controls onto the map view). Example navit.xml contents:

   <osd type="button" x="48"  y="48"  command="gui.fullscreen()" src="toggle_fullscreen.xpm" />
   <osd type="button" x="-96" y="48"  command="gui.menu()"       src="menu.xpm" />
   <osd type="button" x="-96" y="-96" command="zoom_in()"        src="zoom_in.xpm" />
   <osd type="button" x="48"  y="-96" command="zoom_out()"       src="zoom_out.xpm" />

The x and y coordinates depend on your screen resolution and the size of your bitmaps. The origin is at the upper lefthand corner of the screen. Use negative values to position the buttons relative to the right resp. bottom edge of the screen. Besides zoom, the commands include gui_internal_menu and gui_internal_fullscreen.

You can determine the supported xml options for each OSD type by reading navit/osd/core/osd_core.c, searching for "attr_xxx" inside the osd_xxx_new() functions. Most types have at least an "x" and "y" option that determine the location of their OSD.

Align

It is possible to set item alignment. Align attribute accept several values:

  • "1": Align to the top
  • "2": Align to the bottom
  • "0" or "3": Align to the center (vertical)
  • "4": Align to the left
  • "8": Align to the right
  • "0" or "12": Align to the center (horizontal)

To get combination of alignment you have to sum vertical and horizontal alignment, so align="5" would give top left alignment


The OSD layer is still under development.

Examples

  1. Simple
    Navit-internal-osd-fon.png
  2. Not finished yet but quite clean
    Mineque OSD Layout wip.jpg Mineque OSD Layout 01.jpg
      <osd enabled="no" type="compass" />
      <osd enabled="yes" type="text" background_color="#00000099" font_size="300" label="Currently On ${navigation.item.street_name} {navigation.item[1].street_name_systematic}"
      x="5" y="0" h="30" w="720" />
      <osd enabled="yes" type="text" background_color="#00000099" font_size="300" label="${vehicle.position_sats_signal} | ${vehicle.position_qual}" x="725" y="0" w="65" h="30" />
      
      <osd enabled="yes" type="text" label="ETA:${navigation.item.destination_time[arrival]}" background_color="#00000099" font_size="350" x="-790" y="-25" w="160" h="25" />
      <osd enabled="yes" type="text" label="TL:${navigation.item.destination_time[remaining]}" background_color="#00000099" font_size="350" x="-630" y="-25" w="160" h="25"/>
      <osd enabled="yes" type="text" label="Dist:${navigation.item.destination_length[named]}" background_color="#00000099" font_size="350" x="-470" y="-25" h="25" w="170" />
      <osd enabled="yes" type="text" label="${vehicle.position_speed} / ${tracking.item.route_speed}" background_color="#00000099" font_size="280"  x="-300" y="-25" h="25" w="150" />
      <osd enabled="yes" type="navigation_next_turn" x="-150" y="-80"  w="150" h="50"/> 
      
      <osd enabled="no" type="button" x="0" y="-300" command="gui_internal_fullscreen" src="toggle_fullscreen.xpm"/> 
      <osd enabled="no" type="button" x="-10" y="0" command="gui_internal_menu" src="menu.xpm"/>
      <osd enabled="no" type="button" x="-30" y="35" command="zoom_in" src="zoom_in.xpm"/>
      <osd enabled="no" type="button" x="10" y="35" command="zoom_out" src="zoom_out.xpm"/>