Preset support of alternative preset items

Simon Poole simon at poole.ch
Mon Aug 17 14:29:02 UTC 2020


Some of the recent patches to JOSMs default preset have included
<preset_link /> elements for what are essentially presets for "similar"
objects.

Example:

     5211             <item name="Antenna" icon="presets/tower/antenna.svg" type="node,closedway" preset_name_label="true">
     5212                <link wiki="Tag:man_made=antenna" />
     5213                <space />
     5214                <key key="man_made" value="antenna" />
     5215                <optional>
     5216                    <reference ref="name_ref_operator" />
     5217                    <text key="height" text="Height (meters)" length="7" />
     5218                    <text key="ele" text="Elevation (meters)" length="10" />
     5219                    <combo key="material" text="Material" values="adobe,brick,concrete,glass,masonry,metal,plastic,reinforced_concrete,steel,stone,wood" />
     5220                    <reference ref="communication" />
     5221                </optional>
     5222                <preset_link preset_name="Mast" text="Similar but different tags:" />
     5223                <preset_link preset_name="Tower" text="Similar but different tags:" />
     5224                <preset_link preset_name="Big Communication Tower" text="Similar but different tags:" />
     5225                <preset_link preset_name="Telescope" text="Similar but different tags:" />
     5226            </item> <!-- Antenna -->

This would seem to be to me quite interesting information to capture,
however the specific unstructured way of handling this would seem to be
a bit sub-optimal. In particular this makes it difficult to present this
in a reasonable fashion without restoring to ad hoc hacks.

In the hope (though very very very small) that JOSM might some time in
the future adapt an extension to support this better, before I implement
this (see http://vespucci.io/tutorials/presets/#extensions for other
extensions), I'm soliciting input on the preferred way to do this:

- add an attribute to the preset_link element, example

    	<preset_link preset_name="Mast" alternative="true" />

- introduce a new element, example

        <alternative preset_name="Mast" />

- introduce a new element as a container, example

        <alternatives>
	   <preset_link preset_name="Mast" />
           <preset_link preset_name="Tower" />
     	   <preset_link preset_name="Big Communication Tower" />
           <preset_link preset_name="Telescope" />
        </alternatives>

In any case I will add this to the xslt transforms to re-create a JOSM
compatible variant of
https://github.com/simonpoole/beautified-JOSM-preset as I currently do,
so this wouldn't create an incompatibility with use in JOSM.

Simon

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openstreetmap.org/pipermail/josm-dev/attachments/20200817/7b3d601f/attachment.sig>


More information about the josm-dev mailing list