Vespucci Preset System

Documentation for Vespucci 11.1

As explained in the help documentation Vespucci uses JOSM compatible presets, currently any preset used in JOSM should simply work with Vespucci, however there can be differences. Particularly with the new preset driven tagging interface presets have become even more important and if you are writing presets yourself and want them to work well in Vespucci please keep on reading.

Preset-Driven Tag-Editing in Vespucci

For the preset based editing to work Vespucci has to match the existing tags, including incomplete, key-only ones with the available presets. This is done in an iterative fashion: the best matching preset is found (weighting presets with fixed key-value tuples higher than such with variable values), then all tags that can be found in linked presets are added (no separate header displayed) and this process is repeated until their are either no tags left or no preset match can be found.

Supported JOSM Preset Elements and Attributes

Note: this is loosely based on what JOSM claims to works, this may, and actually likely is, different from the actual implementation. Language specific attributes are ignored (see Translation). "supported" doesn't necessarily imply the same behaviour as JOSM, simply that Vespucci will do something useful with the value. Icons currently must be in PNG format.

Element Attributes Support Notes
<presets>
author ignored
version ignored
description ignored
shortdescription ignored
link ignored
icon ignored
baselanguage ignored
object_keys extension comma separated list of top-level keys
<!-- comment --> ignored
<group> supported
name supported required
name_context supported
icon supported you really should add one for Vespucci
<item> supported
name supported required
name_context supported
icon supported you really should add one for Vespucci
type supported
name_template ignored
preset_name_label ignored
deprecated extension only use the preset for matching and map icon display
<chunk> supported
id supported required
<reference> supported
ref supported required
<key> supported
value supported required
match partial "none" is supported
text extension Something to display
values_context extension Translation context
<text> supported
key supported required
text supported
match partial only the "key", "key!" and "none" values are supported, all other values are ignored
default supported
use_last_as_default ignored
auto_increment ignored
length ignored
alternative_autocomplete_keys ignored
javascript extension if value is not set, execute the JS script
i18n extension if set to true this tag has i18n variants
value_type extension indicate the kind of value this tag should have
<combo> supported
key supported required
text supported
text_context supported
values supported
values_sort supported
delimiter supported
default supported
match supported
display_values supported
short_descriptions partial will only be used if display_values is not present
values_context supported
editable supported default is "false"
use_last_as_default ignored
values_searchable supported subtype values are added regardless of the setting
length ignored
values_no_i18n ignored
values_from supported extension: if the target method supports a String argument the current key will be passed
<multiselect> supported
key supported required
text supported
text_context supported
values supported
values_sort supported
delimiter supported
default supported
match supported
display_values supported
short_descriptions partial will only be used if display_values is not present
values_context supported
editable supported default is "false"
use_last_as_default ignored
values_searchable supported subtype values are added regardless of the setting
length ignored
values_no_i18n ignored
values_from supported extension: if the target method supports a String argument the current key will be passed
rows ignored
<list_entry> supported
value supported required
display_value supported
short_description supported
icon supported
icon_size ignored
<checkgroup> supported
columns ignored
text extension
text_context extension
<check> supported
key supported required
text supported
text_context supported
value_on supported
value_off supported
disable_off supported
default supported
match supported
<label> ignored
<space/> ignored
<optional> supported doesn't display anything
text ignored
<separator/> supported starts a new row in the preset selection display
<item_separator/> ignored
<link> supported
href supported including language specific variants
<roles> ignored but not the included elements
<role> supported
key supported required
text supported
text_context supported
requisite ignored
count ignored
type supported
member_expression ignored

Translation

While the preset specification includes language specific text by prefixing the keys with the two letter ISO code, for example de.text, in practical terms this doesn't really work. Particularly if lots of languages are in use, the preset file itself would explode in size, become essentially illegible and force the application to parse many 100's if not 1000's of attributes for languages it is not interested in.

For Vespucci I've chosen a different approach based on GNU gettext format files, the simple Preset2Pot utility will generate a .pot file from a preset which you can use with one of the translation services to produce GNU gettext compatible translations of all the strings in the preset (excluding the actual key and value strings).

Extensions

this avoids having to hardcode such properties in applications, see the https://github.com/simonpoole/xmas-preset for an example.