From Navit's Wiki
Revision as of 22:05, 21 June 2009 by Mineque (talk | contribs) (Cleaning page after creating OSD_Layout page)
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"
  • "position_speed"
  • "position_coord_geo"
  • "position_direction"
  • "position_height"
  • "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.


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.



Icon source setting for OSD

The N8x0 platform (and possibly others) is not very supportive of .svg image files. Navit on the other hand relies heavily on svg. The result is often missing images from your display. In the examples above you may need to replace the .svg with .png. The solution for Next Turn is to use the following config addition:

<osd enabled="yes" type="navigation_next_turn" x="325" y="-135" w="150" h="100" align="15"
   background_color="#a60c0f00" icon_src="$NAVIT_SHAREDIR/xpm/%s_wh_48_48.png" />

Note the icon_src parameter specifies the template for the image file names. This should work for all OSD items.

If you don't have the .png files already, you can create them this way:

$ for f in *wh.svg; do convert -background none -resize 48x48 $f `basename $f .svg`_48_48.png; done