Difference between revisions of "Configuration/Layout Options"

From Navit's Wiki
Jump to: navigation, search
(Describing how to specify a default layout)
(General layout options)
 
(2 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
A layout defines how to '''render a map'''.  Layouts are fully customisable, from the road colours and widths to size and type of icons to display for specific POIs. The layout is also where the '''cursor''' (i.e. the shape which shows where you are) is defined.<br>
 
A layout defines how to '''render a map'''.  Layouts are fully customisable, from the road colours and widths to size and type of icons to display for specific POIs. The layout is also where the '''cursor''' (i.e. the shape which shows where you are) is defined.<br>
 
A number of user-generated layouts and cursor definitions are available at [[Layout]].
 
A number of user-generated layouts and cursor definitions are available at [[Layout]].
 +
 +
 +
=== General layout options ===
 +
The layout tag accepts the following options:<BR>
 +
'''name''' - Name of this layout. Will be displayed in GUI.<BR>
 +
'''nightlayout''' -  Name of layout to switch to for night time.<BR>
 +
'''color''' -  Default background color of the map for areas where nothing is drawn at all.<BR>
 +
'''font'''  - Default font for this layout. Used if no other font is given to text items.<BR>
 +
'''icon_w'''  - Default width of on map icons if no other size is provided.<BR>
 +
'''icon_h'''  - Default height of on map icons if no other size is provided.<BR>
 +
'''underground_alpha''' - Alpha (transparency) value to use for underground roads and ways, typically tunnels. Valid from 0 (fully transparent) to 255 or 0xFF (solid).<BR>
  
 
===Defining layers===
 
===Defining layers===
Line 35: Line 46:
 
Copying the default '''navit.xml''' file to the user-specific location will still use the default shipped layout files, but copying one or several layout files as well to the user-specific location (and modifying them) allow to override these specific layouts.
 
Copying the default '''navit.xml''' file to the user-specific location will still use the default shipped layout files, but copying one or several layout files as well to the user-specific location (and modifying them) allow to override these specific layouts.
  
===Default layout used by navit===
+
===Note on the default layout used by navit===
When no layout has been specifically selected by the user (for example at first startup), navit will use the default layout specified in the '''default_layout''' attribute of the <navit> tag in the XML configuration file.
+
When no layout has been specifically selected by the user (for example at first startup), navit will use the default layout specified (see [[Configuration/General_Options#Default_layout|the related section to know how to configure this]]).
The content of this default_layout attribute value should match the value of the name attribute of the layout to be used as default.
 
Here is a sample configuration file to use the layout "Car" as default:
 
 
 
<source lang="xml">
 
<navit default_layout="Car">
 
</source>
 
 
 
Of course, this implies that there is somewhere a layout like:
 
<source lang="xml">
 
<layer name="Car">
 
</source>
 
 
 
Once the user selects a layout, this default layout attribute will be discarded.
 
  
 
===Using a layer in multiple layouts===
 
===Using a layer in multiple layouts===

Latest revision as of 22:13, 26 September 2019

Layout Options[edit]

Layouts[edit]

A layout defines how to render a map. Layouts are fully customisable, from the road colours and widths to size and type of icons to display for specific POIs. The layout is also where the cursor (i.e. the shape which shows where you are) is defined.
A number of user-generated layouts and cursor definitions are available at Layout.


General layout options[edit]

The layout tag accepts the following options:
name - Name of this layout. Will be displayed in GUI.
nightlayout - Name of layout to switch to for night time.
color - Default background color of the map for areas where nothing is drawn at all.
font - Default font for this layout. Used if no other font is given to text items.
icon_w - Default width of on map icons if no other size is provided.
icon_h - Default height of on map icons if no other size is provided.
underground_alpha - Alpha (transparency) value to use for underground roads and ways, typically tunnels. Valid from 0 (fully transparent) to 255 or 0xFF (solid).

Defining layers[edit]

A layout consist of one cursor and one or more layers which are each a set of rules on how and when to draw certain items. Those rules are called itemgra. The layers are rendered one by one in the order they appear in the XML config file, as are the items in each layer. If you can't see an item make sure there is not another one hiding it. If your item is hidden, you can move your item further down in the layout section of the file.

 <layout name="Demo layout" color="#ffefb7" font="Liberation Sans" active="1">
	<cursor w="26" h="26">
	<layer name="layer_1">
		<itemgra item_types="water_poly" order="0-">
			<polygon color="#82c8ea" />
		 	<polyline color="#5096b8" />
		 </itemgra>
	</layer>
 <layout>


Here the available options:

  • item_types: Comma separated list of items (see navit/item.h for definitions)
  • order: Range for zoom levels.
  • speed_range: Range for vehicle speed, useful for cursors.
  • angle_range: Range for pitch angle.
  • sequence_range: Useful for animated cursors.

For infos about map icons, see Icons

Overriding default (shipped) layouts[edit]

When the XML config file is parsed, layouts are taken in the order they come, and a layout with an already existing name overrides a previous definition. The default (shipped) navit.xml includes first system-wide navit_layout_*.xml files then the user-specific navit_layout_*.xml files, so the system-wide navit_layout_*.xml files can be overriden by adding a user-specific navit-layout_*.xml containing the same name attribute.

Copying the default navit.xml file to the user-specific location will still use the default shipped layout files, but copying one or several layout files as well to the user-specific location (and modifying them) allow to override these specific layouts.

Note on the default layout used by navit[edit]

When no layout has been specifically selected by the user (for example at first startup), navit will use the default layout specified (see the related section to know how to configure this).

Using a layer in multiple layouts[edit]

Sometimes, multiple layouts can use the same layer. For example, a reduced layout for a cleaner map may use the same layers as the regular layout, just not all of them.

To use a layer in multiple layouts, it can be referenced using the ref attribute. In place of the regular layer definition, use an empty tag with only the attributes name and ref:

<layer name="Found items" order="0-">
    <itemgra item_types="found_item">
        <circle color="#008080" radius="24" width="2" text_size="12"/>
    </itemgra>
</layer>
[...]
<layout name="Demo layout">
    [...]
    <layer name="Found items for demo layout" ref="Found items" />
    [...]
</layout>
<layout name="Demo layout reduced">
    [...]
    <layer name="Found items" ref="Found items" />
    [...]
</layout>

Note that the layer you want to reuse must be placed outside the layout. Layers defined inside a layout cannot be reused in this way.