Difference between revisions of "OSD"

From Navit's Wiki
Jump to: navigation, search
(Icon source setting for OSD)
(Examples)
Line 56: Line 56:
 
       <osd enabled="yes" type="gps_status" x="735" y="0" w="65" h="30" align="0" background_color="#a60c0fee" font_size="300" />
 
       <osd enabled="yes" type="gps_status" x="735" y="0" w="65" h="30" align="0" background_color="#a60c0fee" font_size="300" />
 
        
 
        
       <osd enabled="yes" type="text" label="ETA:${navigation.item.destination_time[arrival]}" x="0" y="-25" w="160" h="25" align="4" background_color="#a60c0fee" font_size="350" />
+
       <osd enabled="yes" type="text" label="ETA:${navigation.item.destination_time[arrival]}" x="0"
       <osd enabled="yes" type="text" label="TL:${navigation.item.destination_time[remaining]}" x="160" y="-25" w="160" h="25"align="4" background_color="#a60c0fee" font_size="350" />
+
          y="-25" w="160" h="25" align="4" background_color="#a60c0fee" font_size="350" />
       <osd enabled="yes" type="text" label="Dist:${navigation.item.destination_length[named]}" x="320" y="-25" w="170" h="25" align="4" background_color="#a60c0fee" font_size="350" />
+
       <osd enabled="yes" type="text" label="TL:${navigation.item.destination_time[remaining]}" x="160"
       <osd enabled="yes" type="text" label="${vehicle.position_speed} / ${tracking.item.route_speed}" x="490" y="-25" w="150" h="25" align="4" background_color="#a60c0fee" font_size="280"/>
+
          y="-25" w="160" h="25"align="4" background_color="#a60c0fee" font_size="350" />
       <osd enabled="yes" type="text" label="${navigation.item[1].length[named]}" x="640" y="-30" w="160" h="30" background_color="#a60c0fee" font_size="500"/>
+
       <osd enabled="yes" type="text" label="Dist:${navigation.item.destination_length[named]}" x="320"
       <osd enabled="yes" type="navigation_next_turn" x="640" y="-80"  w="160" h="50" background_color="#a60c0fee" />  
+
          y="-25" w="170" h="25" align="4" background_color="#a60c0fee" font_size="350" />
 +
       <osd enabled="yes" type="text" label="${vehicle.position_speed} / ${tracking.item.route_speed}"
 +
          x="490" y="-25" w="150" h="25" align="4" background_color="#a60c0fee" font_size="280"/>
 +
       <osd enabled="yes" type="text" label="${navigation.item[1].length[named]}" x="640" y="-30" w="160"  
 +
          h="30" background_color="#a60c0fee" font_size="500"/>
 +
       <osd enabled="yes" type="navigation_next_turn" x="640" y="-80"  w="160" h="50"  
 +
          background_color="#a60c0fee" />  
 
        
 
        
 
                
 
                

Revision as of 05:01, 14 February 2009

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="yes" type="text" label="Currently On ${navigation.item.street_name} ${navigation.item[1].street_name_systematic}" x="0" y="0" w="735" h="30" align="0" background_color="#a60c0fee" font_size="300" />
      <osd enabled="yes" type="gps_status" x="735" y="0" w="65" h="30" align="0" background_color="#a60c0fee" font_size="300" />
      
      <osd enabled="yes" type="text" label="ETA:${navigation.item.destination_time[arrival]}" x="0"
         y="-25" w="160" h="25" align="4" background_color="#a60c0fee" font_size="350" />
      <osd enabled="yes" type="text" label="TL:${navigation.item.destination_time[remaining]}" x="160"
         y="-25" w="160" h="25"align="4" background_color="#a60c0fee" font_size="350" />
      <osd enabled="yes" type="text" label="Dist:${navigation.item.destination_length[named]}" x="320"
         y="-25" w="170" h="25" align="4" background_color="#a60c0fee" font_size="350" />
      <osd enabled="yes" type="text" label="${vehicle.position_speed} / ${tracking.item.route_speed}"
         x="490" y="-25" w="150" h="25" align="4" background_color="#a60c0fee" font_size="280"/>
      <osd enabled="yes" type="text" label="${navigation.item[1].length[named]}" x="640" y="-30" w="160" 
         h="30" background_color="#a60c0fee" font_size="500"/>
      <osd enabled="yes" type="navigation_next_turn" x="640" y="-80"  w="160" h="50" 
         background_color="#a60c0fee" /> 
      
             
      <osd enabled="yes"  type="button" x="5" y="30" command="gui.fullscreen()" src="gui_fullscreen.svg"/> 
      <osd enabled="no"  type="button" x="300" y="100" command="gui.menu()" src="menu.xpm"/>
      <osd enabled="yes"  type="button" x="5" y="475" command="zoom_in()" src="gui_zoom_in.svg"/>
      <osd enabled="yes"  type="button" x="590" y="475" command="zoom_out()" src="gui_zoom_out.svg"/>

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.