diff --git a/data/defaultpresets.xml b/data/defaultpresets.xml
index 57d4539..6376227 100644
|
a
|
b
|
check: checkbox
|
| 117 | 117 | default: ticked on/off (default is "off") |
| 118 | 118 | value_on: the value to set when checked (default is "yes") |
| 119 | 119 | value_off: the value to set when unchecked (default is "no") |
| | 120 | disable_off: whether the off value is disabled in the dialog, i.e., only unset or yes are provided |
| 120 | 121 | match: none/key/key!/keyvalue (default is "none", see below for more information) |
| 121 | 122 | |
| 122 | 123 | role: type to specify possible roles in relations |
| … |
… |
Note that for a match, at least one positive and no negative is required.
|
| 171 | 172 | <reference ref="surface" /> |
| 172 | 173 | </chunk> |
| 173 | 174 | <chunk id="highway_yesno_incline"> |
| 174 | | <check key="bridge" text="Bridge" /> |
| 175 | | <check key="tunnel" text="Tunnel" /> |
| 176 | | <check key="cutting" text="Cutting" /> |
| 177 | | <check key="embankment" text="Embankment" /> |
| | 175 | <check key="bridge" text="Bridge" disable_off="true" /> |
| | 176 | <check key="tunnel" text="Tunnel" disable_off="true" /> |
| | 177 | <check key="cutting" text="Cutting" disable_off="true" /> |
| | 178 | <check key="embankment" text="Embankment" disable_off="true" /> |
| 178 | 179 | <combo key="incline" text="Incline" values="10%,-10%,10°,-10°,up,down"/> |
| 179 | 180 | </chunk> |
| 180 | 181 | <chunk id="highway_yesno_incline_oneway"> |
| … |
… |
Note that for a match, at least one positive and no negative is required.
|
| 379 | 380 | <reference ref="highway_base" /> |
| 380 | 381 | <checkgroup columns="4"> |
| 381 | 382 | <check key="oneway" text="Oneway" default="on" /> |
| 382 | | <check key="bridge" text="Bridge" /> |
| 383 | | <check key="tunnel" text="Tunnel" /> |
| 384 | | <check key="cutting" text="Cutting" /> |
| 385 | | <check key="embankment" text="Embankment" /> |
| | 383 | <check key="bridge" text="Bridge" disable_off="true" /> |
| | 384 | <check key="tunnel" text="Tunnel" disable_off="true" /> |
| | 385 | <check key="cutting" text="Cutting" disable_off="true" /> |
| | 386 | <check key="embankment" text="Embankment" disable_off="true" /> |
| 386 | 387 | <check key="lit" text="Lit" /> |
| 387 | 388 | <check key="toll" text="Toll" /> |
| 388 | 389 | </checkgroup> |
| … |
… |
Note that for a match, at least one positive and no negative is required.
|
| 403 | 404 | <reference ref="highway_base" /> |
| 404 | 405 | <checkgroup columns="4"> |
| 405 | 406 | <check key="oneway" text="Oneway" default="on" /> |
| 406 | | <check key="bridge" text="Bridge" /> |
| 407 | | <check key="tunnel" text="Tunnel" /> |
| 408 | | <check key="cutting" text="Cutting" /> |
| 409 | | <check key="embankment" text="Embankment" /> |
| | 407 | <check key="bridge" text="Bridge" disable_off="true" /> |
| | 408 | <check key="tunnel" text="Tunnel" disable_off="true" /> |
| | 409 | <check key="cutting" text="Cutting" disable_off="true" /> |
| | 410 | <check key="embankment" text="Embankment" disable_off="true" /> |
| 410 | 411 | <check key="lit" text="Lit" /> |
| 411 | 412 | <check key="toll" text="Toll" /> |
| 412 | 413 | </checkgroup> |
| … |
… |
Note that for a match, at least one positive and no negative is required.
|
| 431 | 432 | <checkgroup columns="4"> |
| 432 | 433 | <check key="oneway" text="Oneway" default="on" /> |
| 433 | 434 | <check key="motorroad" text="Motorroad" default="on" /> |
| 434 | | <check key="bridge" text="Bridge" /> |
| 435 | | <check key="tunnel" text="Tunnel" /> |
| 436 | | <check key="cutting" text="Cutting" /> |
| 437 | | <check key="embankment" text="Embankment" /> |
| | 435 | <check key="bridge" text="Bridge" disable_off="true" /> |
| | 436 | <check key="tunnel" text="Tunnel" disable_off="true" /> |
| | 437 | <check key="cutting" text="Cutting" disable_off="true" /> |
| | 438 | <check key="embankment" text="Embankment" disable_off="true" /> |
| 438 | 439 | <check key="lit" text="Lit" /> |
| 439 | 440 | <check key="toll" text="Toll" /> |
| 440 | 441 | </checkgroup> |
| … |
… |
Note that for a match, at least one positive and no negative is required.
|
| 455 | 456 | <reference ref="highway_base" /> |
| 456 | 457 | <checkgroup columns="4"> |
| 457 | 458 | <check key="oneway" text="Oneway" default="on" /> |
| 458 | | <check key="motorroad" text="Motorroad" default="on" /> |
| 459 | | <check key="bridge" text="Bridge" /> |
| 460 | | <check key="tunnel" text="Tunnel" /> |
| 461 | | <check key="cutting" text="Cutting" /> |
| 462 | | <check key="embankment" text="Embankment" /> |
| | 459 | <check key="bridge" text="Bridge" disable_off="true" /> |
| | 460 | <check key="tunnel" text="Tunnel" disable_off="true" /> |
| | 461 | <check key="cutting" text="Cutting" disable_off="true" /> |
| | 462 | <check key="embankment" text="Embankment" disable_off="true" /> |
| 463 | 463 | <check key="lit" text="Lit" /> |
| 464 | 464 | <check key="toll" text="Toll" /> |
| 465 | 465 | </checkgroup> |
| … |
… |
Note that for a match, at least one positive and no negative is required.
|
| 2629 | 2629 | <space /> |
| 2630 | 2630 | <key key="public_transport" value="station" /> |
| 2631 | 2631 | <text key="name" text="Name" /> |
| 2632 | | <check key="area" text="Area" /> |
| 2633 | | <check key="building" text="Building" /> |
| | 2632 | <check key="area" text="Area" disable_off="true" /> |
| | 2633 | <check key="building" text="Building" disable_off="true" /> |
| 2634 | 2634 | <text key="operator" text="Operator" /> |
| 2635 | 2635 | <text key="network" text="Network" /> |
| 2636 | 2636 | </item> |
diff --git a/data/tagging-preset.xsd b/data/tagging-preset.xsd
index 2ab4de5..df890d4 100644
|
a
|
b
|
|
| 246 | 246 | <attribute name="default" type="tns:check_default" /> |
| 247 | 247 | <attribute name="value_on" type="string" /> |
| 248 | 248 | <attribute name="value_off" type="string" /> |
| | 249 | <attribute name="disable_off" type="boolean" /> |
| 249 | 250 | <attribute name="match" type="tns:match" /> |
| 250 | 251 | |
| 251 | 252 | <attribute name="name" use="prohibited" /> |
diff --git a/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java b/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java
index d08f784..9a2c6af 100644
|
a
|
b
|
public final class TaggingPresetItems {
|
| 798 | 798 | public String locale_text; |
| 799 | 799 | public String value_on = OsmUtils.trueval; |
| 800 | 800 | public String value_off = OsmUtils.falseval; |
| | 801 | public boolean disable_off = false; |
| 801 | 802 | public boolean default_ = false; // only used for tagless objects |
| 802 | 803 | |
| 803 | 804 | private QuadStateCheckBox check; |
| … |
… |
public final class TaggingPresetItems {
|
| 807 | 808 | @Override public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) { |
| 808 | 809 | |
| 809 | 810 | // find out if our key is already used in the selection. |
| 810 | | Usage usage = determineBooleanUsage(sel, key); |
| | 811 | final Usage usage = determineBooleanUsage(sel, key); |
| | 812 | final String oneValue = usage.values.isEmpty() ? null : usage.values.last(); |
| 811 | 813 | def = default_; |
| 812 | 814 | |
| 813 | 815 | if(locale_text == null) { |
| … |
… |
public final class TaggingPresetItems {
|
| 818 | 820 | } |
| 819 | 821 | } |
| 820 | 822 | |
| 821 | | String oneValue = null; |
| 822 | | for (String s : usage.values) { |
| 823 | | oneValue = s; |
| 824 | | } |
| 825 | 823 | if (usage.values.size() < 2 && (oneValue == null || value_on.equals(oneValue) || value_off.equals(oneValue))) { |
| 826 | 824 | if (def && !PROP_FILL_DEFAULT.get()) { |
| 827 | 825 | // default is set and filling default values feature is disabled - check if all primitives are untagged |
| … |
… |
public final class TaggingPresetItems {
|
| 833 | 831 | |
| 834 | 832 | // all selected objects share the same value which is either true or false or unset, |
| 835 | 833 | // we can display a standard check box. |
| 836 | | initialState = value_on.equals(oneValue) ? |
| 837 | | QuadStateCheckBox.State.SELECTED : |
| 838 | | value_off.equals(oneValue) ? |
| 839 | | QuadStateCheckBox.State.NOT_SELECTED : |
| 840 | | def ? QuadStateCheckBox.State.SELECTED |
| 841 | | : QuadStateCheckBox.State.UNSET; |
| 842 | | check = new QuadStateCheckBox(locale_text, initialState, |
| 843 | | new QuadStateCheckBox.State[] { |
| 844 | | QuadStateCheckBox.State.SELECTED, |
| 845 | | QuadStateCheckBox.State.NOT_SELECTED, |
| 846 | | QuadStateCheckBox.State.UNSET }); |
| | 834 | initialState = value_on.equals(oneValue) |
| | 835 | ? QuadStateCheckBox.State.SELECTED |
| | 836 | : value_off.equals(oneValue) |
| | 837 | ? QuadStateCheckBox.State.NOT_SELECTED |
| | 838 | : def |
| | 839 | ? QuadStateCheckBox.State.SELECTED |
| | 840 | : QuadStateCheckBox.State.UNSET; |
| 847 | 841 | } else { |
| 848 | 842 | def = false; |
| 849 | 843 | // the objects have different values, or one or more objects have something |
| 850 | 844 | // else than true/false. we display a quad-state check box |
| 851 | 845 | // in "partial" state. |
| 852 | 846 | initialState = QuadStateCheckBox.State.PARTIAL; |
| 853 | | check = new QuadStateCheckBox(locale_text, QuadStateCheckBox.State.PARTIAL, |
| 854 | | new QuadStateCheckBox.State[] { |
| 855 | | QuadStateCheckBox.State.PARTIAL, |
| 856 | | QuadStateCheckBox.State.SELECTED, |
| 857 | | QuadStateCheckBox.State.NOT_SELECTED, |
| 858 | | QuadStateCheckBox.State.UNSET }); |
| 859 | 847 | } |
| | 848 | |
| | 849 | final List<QuadStateCheckBox.State> allowedStates = new ArrayList<>(4); |
| | 850 | if (QuadStateCheckBox.State.PARTIAL.equals(initialState)) |
| | 851 | allowedStates.add(QuadStateCheckBox.State.PARTIAL); |
| | 852 | allowedStates.add(QuadStateCheckBox.State.SELECTED); |
| | 853 | if (!disable_off || value_off.equals(oneValue)) |
| | 854 | allowedStates.add(QuadStateCheckBox.State.NOT_SELECTED); |
| | 855 | allowedStates.add(QuadStateCheckBox.State.UNSET); |
| | 856 | check = new QuadStateCheckBox(locale_text, initialState, |
| | 857 | allowedStates.toArray(new QuadStateCheckBox.State[allowedStates.size()])); |
| | 858 | |
| 860 | 859 | p.add(check, GBC.eol().fill(GBC.HORIZONTAL)); |
| 861 | 860 | return true; |
| 862 | 861 | } |
| … |
… |
public final class TaggingPresetItems {
|
| 880 | 879 | |
| 881 | 880 | @Override |
| 882 | 881 | public Collection<String> getValues() { |
| 883 | | return Arrays.asList(value_on, value_off); |
| | 882 | return disable_off ? Arrays.asList(value_on) : Arrays.asList(value_on, value_off); |
| 884 | 883 | } |
| 885 | 884 | |
| 886 | 885 | @Override |