Changeset 7613 in josm


Ignore:
Timestamp:
2014-10-13T22:25:59+02:00 (10 years ago)
Author:
Don-vip
Message:

see #8995, fix #10630 - change keyvalue match meaning to "neutral otherwise", add new keyvalue! match mode by default with the old meaning (negative otherwise)

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/data/defaultpresets.xml

    r7607 r7613  
    4646  key: key to set
    4747  value: value to set
    48   match: none/key/key!/keyvalue (default is "keyvalue", see below for more information)
     48  match: none/key/key!/keyvalue/keyvalue! (default is "keyvalue!", see below for more information)
    4949
    5050text: text box
     
    5959                  happens if the user selects it. default is no auto-increment;
    6060                  mutually exclusive with use_last_as_default.
    61   match: none/key/key!/keyvalue (default is "none", see below for more information)
     61  match: none/key/key!/keyvalue/keyvalue! (default is "none", see below for more information)
    6262  length: length of input box (number of characters allowed)
    6363  alternative_autocomplete_keys: comma separated list of alternative keys to use for autocompletion
     
    8383  use_last_as_default: true/false/force (default is "false")
    8484  editable: allow to add other values as text (default is "true")
    85   match: none/key/key!/keyvalue (default is none, see below for more information)
     85  match: none/key/key!/keyvalue/keyvalue! (default is none, see below for more information)
    8686  values_searchable: true/false (whether to search in combo (display_)values when searching for presets)
    8787  length: length of input box (number of characters allowed)
     
    108108  default: default string to display (defaults to "")
    109109  use_last_as_default: true/false/force (default is "false")
    110   match: none/key/key!/keyvalue (default is "none", see below for more information)
     110  match: none/key/key!/keyvalue/keyvalue! (default is "none", see below for more information)
    111111  values_searchable: true/false (whether to search in multiselect (display_)values when searching for presets)
    112112
     
    121121  value_off: the value to set when unchecked (default is "no")
    122122  disable_off: whether the off value is disabled in the dialog, i.e., only unset or yes are provided
    123   match: none/key/key!/keyvalue (default is "none", see below for more information)
     123  match: none/key/key!/keyvalue/keyvalue! (default is "none", see below for more information)
    124124
    125125role: type to specify possible roles in relations
     
    162162 - key: positive if key matches, neutral otherwise
    163163 - key!: positive if key matches, negative otherwise
    164  - keyvalue: positive if key and value matches, negative otherwise
     164 - keyvalue: positive if key and value matches, neutral otherwise
     165 - keyvalue!: positive if key and value matches, negative otherwise
    165166Note that for a match, at least one positive and no negative is required.
    166167-->
     
    27312732            <space />
    27322733            <key key="type" value="route" />
    2733             <combo key="route" text="Route type" values="train,subway,monorail,tram,light_rail,bus,trolleybus,aerialway,ferry" values_searchable="true" match="keyvalue" />
     2734            <combo key="route" text="Route type" values="train,subway,monorail,tram,light_rail,bus,trolleybus,aerialway,ferry" values_searchable="true" match="keyvalue!" />
    27342735            <key key="public_transport:version" value="2" /> <!-- only validate marked relations in order to avoid false positives -->
    27352736            <reference ref="name_ref" />
     
    28902891        <item name="Public transport route (Legacy)" icon="presets/path.png" type="relation" preset_name_label="true">
    28912892            <key key="type" value="route" />
    2892             <combo key="route" text="Route type" values="train,subway,monorail,tram,bus,trolleybus,aerialway,ferry" values_searchable="true" match="keyvalue" />
     2893            <combo key="route" text="Route type" values="train,subway,monorail,tram,bus,trolleybus,aerialway,ferry" values_searchable="true" match="keyvalue!" />
    28932894            <key key="public_transport:version" value="1" /> <!-- only validate marked relations in order to avoid false positives -->
    28942895            <reference ref="name_ref" />
     
    39603961            <key key="amenity" value="place_of_worship" />
    39613962            <text key="name" text="Name" />
    3962             <combo key="religion" text="Religion" values="bahai,jain,sikh,spiritualist,taoist,unitarian,zoroastrian" match="keyvalue" values_searchable="true" />
     3963            <combo key="religion" text="Religion" values="bahai,jain,sikh,spiritualist,taoist,unitarian,zoroastrian" match="keyvalue!" values_searchable="true" />
    39633964            <reference ref="service_times" />
    39643965            <reference ref="oh" />
     
    50185019                  uk.href="http://wiki.openstreetmap.org/wiki/Uk:Key:building" />
    50195020            <space />
    5020             <combo key="building" text="Building" values="yes,roof,garage,garages,industrial,school,hangar,commercial,farm,transportation,greenhouse,office,university,hospital,warehouse,retail,shed,cowshed,construction" values_context="building" default="yes" match="keyvalue" values_searchable="true" />
     5021            <combo key="building" text="Building" values="yes,roof,garage,garages,industrial,school,hangar,commercial,farm,transportation,greenhouse,office,university,hospital,warehouse,retail,shed,cowshed,construction" values_context="building" default="yes" match="keyvalue!" values_searchable="true" />
    50215022            <text key="name" text="Name" />
    50225023        </item> <!-- Building -->
     
    50365037                  uk.href="http://wiki.openstreetmap.org/wiki/Uk:Key:building" />
    50375038            <space />
    5038             <combo key="building" text="Building" values="residential,apartments,house,hut,dormitory,terrace,detached,roof" default="residential" match="keyvalue" values_context="building" values_searchable="true" />
     5039            <combo key="building" text="Building" values="residential,apartments,house,hut,dormitory,terrace,detached,roof" default="residential" match="keyvalue!" values_context="building" values_searchable="true" />
    50395040            <text key="name" text="Name" />
    50405041        </item> <!-- Residential Building -->
     
    53585359                  zh_TW.href="http://wiki.openstreetmap.org/wiki/Zh-hant:Key:bridge" />
    53595360            <space />
    5360             <combo key="bridge" text="Bridge" values="yes,aqueduct,boardwalk,cantilever,covered,low_water_crossing,trestle,viaduct" match="keyvalue" default="yes" />
     5361            <combo key="bridge" text="Bridge" values="yes,aqueduct,boardwalk,cantilever,covered,low_water_crossing,trestle,viaduct" match="keyvalue!" default="yes" />
    53615362            <combo key="bridge:structure" text="Structure" values="arch,beam,truss,floating,suspension,cable-stayed,simple-suspension,humpback" match="key" />
    53625363            <reference ref="optional_bridge" />
     
    57295730                  ru.href="http://wiki.openstreetmap.org/wiki/RU:Tag:power=line" />
    57305731            <space />
    5731             <combo key="power" text="Line type" values="line,minor_line" default="line" match="keyvalue" />
     5732            <combo key="power" text="Line type" values="line,minor_line" default="line" match="keyvalue!" />
    57325733            <reference ref="voltage_frequency" />
    57335734            <reference ref="ref_operator_branch" />
     
    77317732                <key key="type" value="route"/>
    77327733                <key key="route" value="bicycle"/>
    7733                 <combo key="network" text="Network" values="icn,ncn,rcn,lcn" match="keyvalue" />
     7734                <combo key="network" text="Network" values="icn,ncn,rcn,lcn" match="keyvalue!" />
    77347735                <reference ref="name_ref_operator"/>
    77357736                <optional>
     
    77717772                <key key="type" value="route"/>
    77727773                <key key="route" value="hiking"/>
    7773                 <combo key="network" text="Network" values="iwn,nwn,rwn,lwn" match="keyvalue" />
     7774                <combo key="network" text="Network" values="iwn,nwn,rwn,lwn" match="keyvalue!" />
    77747775                <reference ref="name_ref_operator"/>
    77757776                <optional>
     
    77887789                <key key="type" value="route"/>
    77897790                <key key="route" value="piste"/>
    7790                 <combo key="piste:type" text="Piste type" values="downhill,nordic,skitour,snow_park" match="keyvalue" />
     7791                <combo key="piste:type" text="Piste type" values="downhill,nordic,skitour,snow_park" match="keyvalue!" />
    77917792                <reference ref="name_ref_operator"/>
    77927793                <optional>
     
    78097810                <key key="type" value="route"/>
    78107811                <key key="route" value="piste"/>
    7811                 <combo key="piste:type" text="Piste type" values="nordic,alpine" match="keyvalue" />
     7812                <combo key="piste:type" text="Piste type" values="nordic,alpine" match="keyvalue!" />
    78127813                <reference ref="name_ref_operator"/>
    78137814                <optional>
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java

    r7589 r7613  
    254254        /** Positive if key matches, negative otherwise. */
    255255        KEY_REQUIRED("key!"),
     256        /** Positive if key and value matches, neutral otherwise. */
     257        KEY_VALUE("keyvalue"),
    256258        /** Positive if key and value matches, negative otherwise. */
    257         KEY_VALUE("keyvalue");
     259        KEY_VALUE_REQUIRED("keyvalue!");
    258260
    259261        private final String value;
     
    550552                return tags.containsKey(key);
    551553            case KEY_VALUE:
    552                 return tags.containsKey(key) && (getValues().contains(tags.get(key)));
     554                return tags.containsKey(key) && getValues().contains(tags.get(key)) ? true : null;
     555            case KEY_VALUE_REQUIRED:
     556                return tags.containsKey(key) && getValues().contains(tags.get(key));
    553557            default:
    554558                throw new IllegalStateException();
     
    584588        @Override
    585589        public MatchType getDefaultMatch() {
    586             return MatchType.KEY_VALUE;
     590            return MatchType.KEY_VALUE_REQUIRED;
    587591        }
    588592
Note: See TracChangeset for help on using the changeset viewer.