| Version 2 (modified by , 10 years ago) ( diff ) |
|---|
Andere talen:
Inhoud
Voorkeuzen voor tags
JOSM ondersteunt gedeelde voorkeuzen voor tags. Dit is een XML configuratiebestand dat een GUI beschrijft voor het invoeren van tags (of eigenschappen, opmerkingen, soms ook wel kaartobjecten genoemd). De XML-bestanden kunnen overal op het web geplaatst worden of op het lokale bestandssysteem van de gebruiker. Voorkeuzen kunnen door gebruikers worden toegevoegd op een centrale plaats pagina Presets.
Installeren van voorkeuzen
Ofwel:
- Klik in het hoofdmenu op Voorkeuzen en klik op "Voorkeuren voor voorkeuzen".
- Open het venster voor de voorkeuren, klik op
Kaartinstellingen en selecteer de derde tab Vooraf ingestelde tags.
Een nieuwe voorkeuze ontwikkelen
De beschrijving van een voorkeuze voor taggen staat in een zeer eenvoudige XML-indeling. Voor details zie hieronder.
Bekijk defaultpresets.xml voor een voorbeeld dat de meeste mogelijkheden behandelt van die welke hieronder vermeld zijn.
Het volledige XSD-schema is beschikbaar op de namespace URI (http://josm.openstreetmap.de/tagging-preset-1.0) en ook in de bron repository.
Bekijk Presets#Createnewpresets om de voorkeuze toe te voegen aan de lijst met beschikbare voorkeuzen.
Voorbeeld:
<presets xmlns="http://josm.openstreetmap.de/tagging-preset-1.0"> <item name="Oneway highway" type="way"> <label text="Invoegen van een één richting highway" /> <combo key="highway" text="Type" values="trunk,motorway" /> <text key="name" text="Name (bijv. Angel Road)" /> <text key="ref" text="Ref (bijv. A406)" /> <!-- Dit is een voorkeuze voor één richting dus maak oneway de standaard --> <check key="oneway" text="Oneway" default="on" /> <!-- Altijd het oppervlak asfalt instellen --> <key key="surface" value="asphalt" /> </item> </presets>
Het gereedschap HOT Visual Tag Chooser stelt de gebruiker in staat een Tagging Preset File te maken of te bewerken door middel van een webinterface.
Beschrijving XML-indeling
Tags
De proloog van het document
- <presets>
-
Moet de hoofdtag van het bestand zijn. Ondersteund de volgende attributen
- xmlns="http://josm.openstreetmap.de/tagging-preset-1.0"
- author - de naam van de auteur van de voorkeuze
- version - het versienummer van het bestand. Voor geautomatiseerde versie-aanpassingen van de voorkeuzen die worden beheerd op deze wiki kunt u twee interne variabelen gebruiken:
[[revision]](het laatste versienummer van de pagina op de wiki) en[[date]](de datum van de laatste bewerking). - description (i18n) - beschrijving van wat het bestand bevat
- shortdescription (i18n) - zeer korte overzichtsbeschrijving d.i. de "naam" van de voorkeuze
- link (i18n) - weblink voor meer details (optioneel)
- icon - informatief pictogram voor de gehele voorkeuze. (Dit is nodig om het pictogram weer te geven in de tabel van Presets.)
- baselanguage - wanneer de basistaal niet Engels is, specificeer die dan hier (gebruiken van niet-Engelse teksten voor voorkeuze voorkomt automatisch vertalen)
(i18n) betekent dat de waarden ook mogen zijn gelokaliseerd (bijv. de.description).
Opmerkingen
- <!-- dit is een voorbeeld opmerking -->
- Het document mag ingebedde opmerkingen bevatten.
Maken van een menu
- <group>
-
Gebruikt om items te groeperen in submenu's.
nameis vereist,iconis een optioneel attribuut. - <item>
-
Elk item is één ingestelde opmerking om uit te selecteren.
nameis vereist,typeenpreset_name_labelworden aanbevolen,iconenname_templatezijn optionele attributen. - <separator/>
- Voegt een scheidingslijn in het menu in.
Lay-out Venster Voorkeuze
- <label>
-
Labels zijn statische teksten om weer te geven.
textis een vereist attribuut,iconenicon_sizezijn optioneel. - <space />
- Voeg enkele spaties in (d.i. een newline).
- <optional>
-
Gebruikt om enkele optionele elementen van een item te groeperen. Het attribuut
textis optioneel. Indien gebruikt zondertextdan is dit equivalent aan <space /><label text="Optionele attributen:"/><space /> - <item_separator />
- Voegt een horizontale scheidingslijn tussen de items in.
- <link>
-
Specificeer een weblink voor dit object of voor iets anders. Het attribuut
hrefis vereist. - <checkgroup>
-
Om testen te groeperen. Het attribuut
columnsis vereist. - <roles>
- Dit wordt vereist rondom <role> en voegt de kop ("Availible roles role count elements") toe aan de tabel die wordt gegenereerd bij verscheidene <role>'s.
- <role>
-
Specificeert mogelijke rollen van leden van de relatie. Het attribuut
keyis vereist,text,requisite,count,typeenmember_expressionzijn optioneel. - <preset_link>
-
Voegt een a link toe naar een andere voorkeuze. Het attribuut
preset_nameis vereist.
Een vast paar sleutel/waarde instellen
- <key>
-
Deze tag zal altijd een sleutel instellen op ene specifieke waarde.
keyis vereist en alsvalueaanwezig is, zal de sleutel worden ingesteld. Indien het attribuutvaluewordt weggelaten, wordt de sleutel verwijderd. Het attribuutmatchis optioneel.
Attribute entry and selection dialog boxes
- <text>
-
A text edit field to enter any arbitrary string from the user.
keyis mandatory,text,default,use_last_as_default,auto_increment,length,alternative_autocomplete_keysandmatchis optional - <combo>
-
Displays a multiple choice combo box.
keyandvaluesare mandatory,text,default,editable,delimiter,values_from,display_values,short_descriptions,use_last_as_default,values_searchable,length,values_no_i18n,values_sortandmatchis optional.
If editable is true (default), combo boxes can be edited as if they were text fields (additional to the drop down menu). Non editable combo boxes can only contain one of the specified values. - <multiselect>
-
Displays a list from which zero or more items can be chosen.
keyandvaluesare mandatory, andtext,default,delimiter,values_from,rows,display_values,short_descriptions,use_last_as_default,values_searchable,values_no_i18n,values_sortandmatchare optional. The selected values will be concatenated with the specified delimiter (default: semicolon) and written to the tag value. If a tag value has already been set when the preset dialog is opened, the multiselect will attempt to mark the appropriate items in the list as select. If the tag value cannot be represented by a combination of choices in the list, then the list will be disabled so that the user cannot accidentally overwrite a custom value. In contrast to the "combo" element, the "multiselect" expects the list of values, descriptions etc. to use the specified delimiter, i.e. by default you will have to use a semicolon. You can specify delimiter="," but then a comma will also be used in the tag value. - <list_entry>
-
Used in <combo> and <multiselect>. More information see
short_descriptions. The attributes arevalue,display_value,short_description,iconandicon_size. - <check>
-
A checkbox which the user can only select or deselect (or set as unset). The
keyattribute is mandatory.text,default,match,value_on,value_offanddisable_offare optional.
Templates
- <chunk>
-
To define a template of elements for later (repeated) use. The
idattribute is mandatory. - <reference>
-
To include an earlier defined template. The
refattribute is mandatory.
Attributes
The attributes of the tags have the following meaning:
- name="a_name"
- Specify a name for an item. This name will be used in the GUI to display the tagging preset.
- name_context="context"
- Translation context for name attribute to separate equals words with different meaning (not required for in-file translations).
- type="data_type"
- When specified, only objects of the given type will work with this tagging preset. Can be "node", "way", "closedway", "multipolygon", "relation" or any comma separated combination of them. Note that "multipolygon" is not included in "relation", so if the preset should apply for multipolygons and other relation types, you need to specify both: "multipolygon,relation". Also used in the <role> tag to specify which object types are allowed for a specific relation member.
- icon="iconname"
- A name or link to an icon. The image will be used as icon to display in the selection list and when adding the preset to the toolbar. Icons can also be used in <item>, <label> and <list_entry>. The icon should be quadratic in size. See Styles#Iconhandling how icons can be specified.
- icon_size="a number"
- The maximal size of an icon in px. If no value is given, default is 16 for <label> and the default icon size for <list_entry /> (in <combo> and <multiselect>).
- key="some_key"
- This specifies the property key that will be modified by the item. In case of <role> it is the role name used in a relation.
- text="Any text"
- The description, that will be displayed before (after in case of <check>) the gui element. Also used for <label> and <optional>.
- text_context="context"
- Translation context for text attribute to separate equals words with different meaning (not required for in-file translations).
- default="default_value"
- The default value for the item. If not specified, the current value of the key is chosen as default (if applicable). In case of <check> whether the checkbox is ticked on or off by default (default is "off"). In case of <text>, <combo> and <multiselct> defaults to "".
- values="entry1,entry2,entry3"
- A list of entries (for the <combo> box and <multiselect>). The list has to be separated by commas (for the combo box) or by the specified delimiter (for the multiselect). If a value contains the delimiter, the delimiter may be escaped with a backslash. If a value contains a backslash, it must also be escaped with a backslash.
- values_from="JAVA code"
- To use instead of "values" if the list of values has to be obtained with a Java method of this form: public static String[] getValues(); The value must be: "full.package.name.ClassName#methodName".
- values_no_i18n="true|false"
- Disables internationalisation for value to avoid mistakes, see #11696. Default is "false". Used in <combo> and <multiselect>. (Useful e.g. for opening hours or brand names.)
- values_sort="false"
-
Values of <combo> and <multiselect> are sorted alphabetic in every language. With this attribute you can disable the alphabetic sorting if the values should keep the given order, see #5509 and #11926. (In the JOSM internal preset this is used for the keys "smoothness" and "trail_visibility".) Default is "true". Users can globaly disable sorting with the preference key
taggingpreset.sortvalues. - values_context="context"
- Translation context for values attribute to separate equals words with different meaning (not required for in-file translations).
- display_values="Entry1,Entry2,Entry3"
-
A list of entries that is displayed to the user. Must be the same number and order of entries as
valuesandeditablemust be false or not specified. For the delimiter character and escaping, see the remarks atvalues. Used in <combo> and <multiselect>. - value="foobar"
- Specify a value to be entered in the <key> tag.
- value_on="foobar"
- Specify the true value to be entered in the <key> tag of a checked <check> (default is "yes").
- value_off="foobar"
- Specify the false value to be entered in the <key> tag of a unchecked <check> (default is "no").
- disable_off="true"
- Whether the off value of a <check> is disabled in the dialog, i.e., only unset or yes are provided.
- editable="false"
- The combo box is readonly, which means that the user can only select an item in the list. Default is "true", which means, the user can add other values as text.
- use_last_as_default="true|false|force"
- For <combo>, <multiselect> or <text> fields the last value is used as default. Using "force" enforces this behaviour also for already tagged objects. Default is "false".
- rows="count"
- Specify the number of rows to display in <multiselect> entry (if not set, it is auto determined by java or the look and feel and results in e.g. 8).
- name_template="template", name_template_filter="search expression"
- Custom name formatter for osm primitives matching this preset. See NameTemplate for details.
- match="none|key|key!|keyvalue|keyvalue!"
-
Allows to change the matching process, i.e., determining whether the tags of an OSM object fit into this preset. If a preset fits then it is linked in the Tags/Membership dialog.
- none: neutral, i.e., do not consider this item for matching
- key: positive if key matches, neutral otherwise
- key!: positive if key matches, negative otherwise
- keyvalue: positive if key and value matches, neutral otherwise
- keyvalue!: positive if key and value matches, negative otherwise
Note that for a match, at least one positive and no negative is required. Default is "keyvalue!" for <key> and "none" for <text>, <combo>, <multiselect> and <check>.
- id="unique_identifier"
- the unique identifier for this chunk
- ref="unique_identifier"
- the unique identifier of the (already defined) template to include
- columns="a number"
- the number of columns of grouped checks
- requisite="optional|required"
- If a relation member is optional or required. Default is "optional".
- count="a number"
- How often can a role occur (if not given unlimited number is assumed)
- member_expression="an expression"
- an expression (cf. search dialog) for objects of this role
- preset_name="exact_name"
- The exact name of the preset to link to.
- preset_name_label="false|true"
- Whether to insert "[preset name]" label in dialog (defaults to "false" for backward-compatibility on external presets).
- length="a number"
- The length of a <text> or <combo> box (number of characters allowed).
- alternative_autocomplete_keys="some_key(s)"
- A comma separated list of alternative keys to use for autocompletion of <text>.
- auto_increment="-2,-1,+1,+2"
-
May contain a comma separated list of integer increments or decrements, e.g. "-2,-1,+1,+2". A button will be shown next to the <text> field for each value, allowing the user to select auto-increment with the given stepping. Auto-increment only happens if the user selects it. There is also a button to deselect auto-increment. Default is no auto-increment. Mutually exclusive with
use_last_as_default. - delimiter="special character"
- The character that separates values. In case of <combo> the default is comma. In case of <multiselect> the default is semicolon and this will also be used to separate selected values in the tag. More information see <multiselect>.
- short_descriptions=""Entry1,Entry2,Entry3"
-
A delimiter-separated list of texts to be displayed below each
display_value. (Only if it is not possible to describe the entry in 2-3 words.) Instead of comma separated list instead using values, display_values and short_descriptions, the following form is also supported: <list_entry value="" display_value="" short_description="" icon="" icon_size="" /> - values_searchable="true|false"
- Whether to search in <combo> or <multiselect> (display_)values when searching for presets.
Deprecated Attributes
The following attributes are deprecated and no longer supported by JOSM:
- delete_if_empty="true"
- was removed in [5155]. You can simply remove this attribute if still used in your preset.
- required="true"
-
replaced by
matchsince [5155]
Translation
To support translations, all textual elements ("name", "text", "display_values") may also be localized. (E.g. "de.name" would represent the name in case German language support is loaded.)
In JOSM internally (internal preset) all "name", "text" and "display_values" are translated when no specific translation has been given in XML file. When no "display_values" are supplied, then "values" will be treated as "display_values" and translated instead. When translations of equal words but different meanings may conflict, a translation context should be specified. Use "name_context", "text_context" or "values_context" for this. The context should be a meaningful short description to help translators. The translation for the internal preset is done at Launchpad (and will probably change to another service in the future, since the Launchpad web interface often produces timeout errors, see #8645).
Icon handling
See Styles.


