Changeset 6425 in josm


Ignore:
Timestamp:
2013-11-29T20:46:07+01:00 (6 years ago)
Author:
simon04
Message:

see #9309 - presets: make selected combo/multiselect values searchable/findable via F3

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/data/defaultpresets.xml

    r6402 r6425  
    699699            <label text="Transport mode restrictions" />
    700700            <space />
    701             <combo key="access" text="General Access" values="yes,destination,delivery,permissive,private,customers,agricultural,forestry,no" match="key" />
     701            <combo key="access" text="General Access" values="yes,destination,delivery,permissive,private,customers,agricultural,forestry,no" match="key" values_searchable="true" />
    702702            <combo key="foot" text="Foot" values="yes,official,designated,permissive,destination,delivery,private,no" match="key" />
    703703            <combo key="horse" text="Horse" values="yes,official,designated,permissive,destination,delivery,private,no" match="key" />
     
    855855                <combo key="incline" text="Incline" values="10%,-10%,10°,-10°,up,down" />
    856856                <check key="lit" text="Lit" default="off" />
    857                 <combo key="sac_scale" text="SAC Scale">
     857                <combo key="sac_scale" text="SAC Scale" values_searchable="true">
    858858                    <list_entry value="hiking" display_value="T1 - hiking trail" short_description="Trail well cleared. Area flat or slightly sloped, no fall hazard" />
    859859                    <list_entry value="mountain_hiking" display_value="T2 - mountain hiking trail" short_description="Trail with continuous line and balanced ascent. Terrain partially steep, fall hazard possible" />
     
    11431143            <key key="highway" value="crossing" />
    11441144            <combo key="crossing" text="Pedestrian crossing type" values="uncontrolled,traffic_signals,island,unmarked,no,unknown" />
    1145             <combo key="crossing_ref" text="Crossing type name (UK)" values="zebra,pelican,toucan,puffin,pegasus,tiger" />
     1145            <combo key="crossing_ref" text="Crossing type name (UK)" values="zebra,pelican,toucan,puffin,pegasus,tiger" values_searchable="true" />
    11461146            <check key="supervised" text="Crossing attendant" default="off" />
    11471147            <check key="bicycle" text="Cross by bicycle" default="off" />
     
    11601160            <label text="Edit Traffic Calming" />
    11611161            <space />
    1162             <combo key="traffic_calming" text="Type" values="yes,bump,chicane,choker,cushion,hump,island,rumble_strip,table" match="key" />
     1162            <combo key="traffic_calming" text="Type" values="yes,bump,chicane,choker,cushion,hump,island,rumble_strip,table" match="key" values_searchable="true" />
    11631163        </item>
    11641164        <item name="Passing Place" icon="presets/passingplace.png" type="node">
     
    18891889            <key key="natural" value="water" />
    18901890            <text key="name" text="Name" />
    1891             <combo key="water" text="Water Body" values="lake,lagoon,pond,reservoir" match="key" />
     1891            <combo key="water" text="Water Body" values="lake,lagoon,pond,reservoir" match="key" values_searchable="true" />
    18921892        </item>
    18931893        <item name="Land" icon="presets/landuse.png" type="node,closedway,relation">
     
    19361936            <key key="natural" value="wetland" />
    19371937            <text key="name" text="Name" />
    1938             <combo key="wetland" text="Type" values="swamp,bog,marsh,reedbed,saltmarsh,tidalflat,mangrove" />
     1938            <combo key="wetland" text="Type" values="swamp,bog,marsh,reedbed,saltmarsh,tidalflat,mangrove" values_searchable="true" />
    19391939        </item>
    19401940        <item name="Mud" icon="presets/mud.png" type="node,closedway,relation">
     
    25282528            <space />
    25292529            <key key="amenity" value="fuel" />
    2530             <combo key="brand" text="Brand" values="Agip,Aral,Avia,BP,Chevron,Citgo,Esso,Exxon,Gulf,Mobil,OMV,Petro-Canada,Pioneer,Q8,Repsol,Shell,Sunoco,Statoil,Tamoil,Texaco,Total,Independent" />
     2530            <combo key="brand" text="Brand" values="Agip,Aral,Avia,BP,Chevron,Citgo,Esso,Exxon,Gulf,Mobil,OMV,Petro-Canada,Pioneer,Q8,Repsol,Shell,Sunoco,Statoil,Tamoil,Texaco,Total,Independent" values_searchable="true" />
    25312531            <optional>
    25322532                <text key="name" text="Name" />
     
    27652765            <space />
    27662766            <key key="type" value="route" />
    2767             <combo key="route" text="Route type" values="train,subway,monorail,tram,bus,trolleybus,aerialway,ferry" />
     2767            <combo key="route" text="Route type" values="train,subway,monorail,tram,bus,trolleybus,aerialway,ferry" values_searchable="true" />
    27682768            <text key="name" text="Name" />
    27692769            <text key="ref" text="Reference" />
     
    33473347            <text key="name" text="Name" />
    33483348            <text key="operator" text="Operator" />
    3349             <multiselect key="cuisine" text="Cuisine" values="italian;chinese;pizza;burger;greek;german;indian;regional;kebab;turkish;asian;thai;mexican;japanese;french;sandwich;sushi" />
     3349            <multiselect key="cuisine" text="Cuisine" values="italian;chinese;pizza;burger;greek;german;indian;regional;kebab;turkish;asian;thai;mexican;japanese;french;sandwich;sushi" values_searchable="true" />
    33503350            <check key="microbrewery" text="Microbrewery" default="off" />
    33513351            <combo key="opening_hours" text="Opening Hours" delimiter="|" values="24/7|08:30-12:30,15:30-20:00|Sa-Su 00:00-24:00|Mo-Fr 08:30-20:00; Sa,Su 08:00-15:00; PH off|Mo-Fr 08:30-20:00,Tu-Su 08:00-15:00; Sa 08:00-12:00|Mo-Su 08:00-18:00; Apr 10-15 off; Jun 08:00-14:00; Aug off; Dec 25 off|sunrise-sunset|Su 10:00+|week 1-53/2 Fr 09:00-12:00; week 2-52/2 We 09:00-12:00" />
     
    39753975            <key key="amenity" value="place_of_worship" />
    39763976            <text key="name" text="Name" />
    3977             <combo key="building" text="Building type" values="cathedral,chapel,church,mosque,synagogue,temple" match="keyvalue" />
    3978             <combo key="religion" text="Religion" values="bahai,buddhist,christian,hindu,jain,jewish,muslim,sikh,spiritualist,taoist,unitarian,zoroastrian" match="key" />
    3979             <combo key="denomination" text="Denomination" values="anglican,baptist,catholic,evangelical,jehovahs_witness,lutheran,methodist,mormon,orthodox,pentecostal,presbyterian,protestant,quaker,roman_catholic,shia,sunni" match="key" />
     3977            <combo key="building" text="Building type" values="cathedral,chapel,church,mosque,synagogue,temple" match="keyvalue" values_searchable="true" />
     3978            <combo key="religion" text="Religion" values="bahai,buddhist,christian,hindu,jain,jewish,muslim,sikh,spiritualist,taoist,unitarian,zoroastrian" match="key" values_searchable="true" />
     3979            <combo key="denomination" text="Denomination" values="anglican,baptist,catholic,evangelical,jehovahs_witness,lutheran,methodist,mormon,orthodox,pentecostal,presbyterian,protestant,quaker,roman_catholic,shia,sunni" match="key" values_searchable="true" />
    39803980            <combo key="service_times" text="Service Times" delimiter="|" values="18:00|sunset,sunrise|Su 9:30,11:00|Sa,Su,PH 9:00|Sa 18:00; Su 10:45|Fr 08:00-18:00; Apr 10-15 off; Jun 07:00-20:00; Aug off; Dec 24 08:00-24:00|Sa 10:00+|week 1-53/2 Fr 09:00-12:00; week 2-52/2 We 09:00-12:00" />
    39813981            <combo key="opening_hours" text="Opening Hours" delimiter="|" values="24/7|08:30-12:30,15:30-20:00|Sa-Su 00:00-24:00|Mo-Fr 08:30-20:00; Sa,Su 08:00-15:00; PH off|Mo-Fr 08:30-20:00,Tu-Su 08:00-15:00; Sa 08:00-12:00|Mo-Su 08:00-18:00; Apr 10-15 off; Jun 08:00-14:00; Aug off; Dec 25 off|sunrise-sunset|Su 10:00+|week 1-53/2 Fr 09:00-12:00; week 2-52/2 We 09:00-12:00" />
     
    44984498            <text key="name" text="Name" />
    44994499            <check key="fireplace" text="Fireplace" default="off" />
    4500             <combo key="shelter_type" text="Type of shelter" values="weather_shelter,public_transport,picnic_shelter,wildlife_hide" values_context="shelter" />
     4500            <combo key="shelter_type" text="Type of shelter" values="weather_shelter,public_transport,picnic_shelter,wildlife_hide" values_context="shelter" values_searchable="true" />
    45014501        </item>
    45024502        <item name="Hunting Stand" icon="presets/hunting_stand.png" type="node">
     
    47294729            <key key="sport" value="swimming" />
    47304730            <text key="name" text="Name" />
    4731             <combo key="leisure" text="Type" values="sports_centre,stadium,swimming_pool,water_park" default="swimming_pool" />
     4731            <combo key="leisure" text="Type" values="sports_centre,stadium,swimming_pool,water_park" default="swimming_pool" values_searchable="true" />
    47324732        </item>
    47334733        <item name="Skiing" icon="presets/skiing_downhill.png" type="node,way,closedway">
     
    47384738            <text key="name" text="Name" />
    47394739            <combo key="piste:type" text="Piste type" values="downhill,nordic,skitour,snow_park" />
    4740             <combo key="piste:difficulty" text="Difficulty" values="novice,easy,intermediate,advanced,expert,freeride" values_context="piste:difficulty" />
     4740            <combo key="piste:difficulty" text="Difficulty" values="novice,easy,intermediate,advanced,expert,freeride" values_context="piste:difficulty" values_searchable="true" />
    47414741            <combo key="piste:grooming" text="Grooming" values="classic,mogul,skating,classic;skating,scooter,backcountry" values_context="piste:grooming" />
    47424742        </item>
     
    50135013            <label text="Edit Building" />
    50145014            <space />
    5015             <combo key="building" text="Building" values="yes,roof,garage,garages,industrial,school,hangar,commercial,farm,transportation,greenhouse,office,university,hospital,warehouse,retail,shed" values_context="building" default="yes" match="keyvalue" />
     5015            <combo key="building" text="Building" values="yes,roof,garage,garages,industrial,school,hangar,commercial,farm,transportation,greenhouse,office,university,hospital,warehouse,retail,shed" values_context="building" default="yes" match="keyvalue" values_searchable="true" />
    50165016            <text key="name" text="Name" />
    50175017        </item>
     
    50285028            <label text="Edit Residential Building" />
    50295029            <space />
    5030             <combo key="building" text="Building" values="residential,apartments,house,hut,dormitory,terrace,detached,roof" default="residential" match="keyvalue" values_context="building" />
     5030            <combo key="building" text="Building" values="residential,apartments,house,hut,dormitory,terrace,detached,roof" default="residential" match="keyvalue" values_context="building" values_searchable="true" />
    50315031            <text key="name" text="Name" />
    50325032        </item>
     
    53425342            <text key="ref" text="Reference" />
    53435343            <text key="start_date" text="Start date" />
    5344             <combo key="generator:source" text="Source">
     5344            <combo key="generator:source" text="Source" values_searchable="true">
    53455345                <list_entry value="biofuel" icon="http://wiki.openstreetmap.org/w/images/6/6b/Bahnpirat-power_source-biofuel.svg" />
    53465346                <list_entry value="biogas" icon="http://wiki.openstreetmap.org/w/images/6/6b/Bahnpirat-power_source-biofuel.svg" />
     
    53615361                <list_entry value="wind" icon="http://wiki.openstreetmap.org/w/images/0/03/2020_stBN_powergensource_wind.svg" />
    53625362            </combo>
    5363             <combo key="generator:method" text="Method" values_context="generator method">
     5363            <combo key="generator:method" text="Method" values_context="generator method" values_searchable="true">
    53645364                <list_entry value="anaerobic_digestion" short_description="" /> <!-- Recheck -->
    53655365                <list_entry value="barrage" short_description="tidal" />
     
    53765376                <list_entry value="water-storage" short_description="hydro" />
    53775377            </combo>
    5378             <combo key="generator:type" text="Generator Type">
     5378            <combo key="generator:type" text="Generator Type" values_searchable="true">
    53795379                <list_entry value="combined_cycle" short_description="gas combustion" />
    53805380                <list_entry value="francis_turbine" short_description="hydro" />
     
    63456345        <space />           
    63466346        <key key="amenity" value="vending_machine" />
    6347         <multiselect key="vending" text="Vending products" values="animal_food;bicycle_tube;cigarettes;condoms;drinks;excrement_bags;food;news_papers;parking_tickets;photos;public_transport_plans;public_transport_tickets;SIM-cards;stamps;sweets;tampons;telephone_vouchers;toys;vouchers" />
     6347        <multiselect key="vending" text="Vending products" values="animal_food;bicycle_tube;cigarettes;condoms;drinks;excrement_bags;food;news_papers;parking_tickets;photos;public_transport_plans;public_transport_tickets;SIM-cards;stamps;sweets;tampons;telephone_vouchers;toys;vouchers" values_searchable="true" />
    63486348        <text key="operator" text="Operator" />
    63496349        <text key="ref" text="Reference number" />
     
    70517051            <text key="name" text="Name" />
    70527052            <optional>
    7053                 <combo key="boundary" text="Boundary type" values="administrative,national,civil,political" />
     7053                <combo key="boundary" text="Boundary type" values="administrative,national,civil,political" values_searchable="true" />
    70547054                <combo key="admin_level" text="Administrative level" values="1,2,3,4,5,6,7,8,9,10" />
    70557055            </optional>
     
    70897089            <space />
    70907090            <key key="type" value="restriction" />
    7091             <combo key="restriction" text="Restriction" values="no_left_turn,no_right_turn,no_straight_on,no_u_turn,only_right_turn,only_left_turn,only_straight_on" />
     7091            <combo key="restriction" text="Restriction" values="no_left_turn,no_right_turn,no_straight_on,no_u_turn,only_right_turn,only_left_turn,only_straight_on" values_searchable="true" />
    70927092            <optional>
    70937093                <text key="name" text="Name" />
     
    71337133            <space />
    71347134            <key key="type" value="route" />
    7135             <combo key="route" text="Route type" values="bicycle,bus,road,ferry,ski,foot,hiking,tram,detour,railway,subway" values_context="route type" />
     7135            <combo key="route" text="Route type" values="bicycle,bus,road,ferry,ski,foot,hiking,tram,detour,railway,subway" values_context="route type" values_searchable="true" />
    71367136            <text key="name" text="Name" />
    71377137            <text key="ref" text="Reference" />
     
    72317231            <space />
    72327232            <key key="type" value="waterway" />
    7233             <combo key="waterway" text="Subtype of waterway (largest one of members)" values="river,stream,canal,drain,ditch" />
     7233            <combo key="waterway" text="Subtype of waterway (largest one of members)" values="river,stream,canal,drain,ditch" values_searchable="true" />
    72347234            <text key="name" text="Name" />
    72357235            <optional>
  • trunk/data/tagging-preset.xsd

    r6308 r6425  
    99
    1010        <element name="annotations" type="tns:root" />
    11         <element name="presets" type="tns:root" />
     11        <element name="presets" type="tns:root">
     12                <unique name="chunk_id">
     13                        <selector xpath=".//tns:chunk"/>
     14                        <field xpath="@id"/>
     15                </unique>
     16                <keyref name="chunk_ref" refer="tns:chunk_id">
     17                        <selector xpath=".//tns:reference"/>
     18                        <field xpath="@ref"/>
     19                </keyref>
     20        </element>
    1221
    1322        <complexType name="root">
     
    2837                <sequence>
    2938                        <choice minOccurs="1" maxOccurs="unbounded">
     39                                <element name="chunk" type="tns:chunk"/>
    3040                                <element name="group" type="tns:group" />
    3141                                <element name="item" type="tns:item" />
     
    7484                <attribute name="text_context" type="string" />
    7585        </complexType>
     86
     87    <complexType name="chunk">
     88        <sequence>
     89            <choice minOccurs="1" maxOccurs="unbounded">
     90                <group ref="tns:optional_elements" />
     91                <element name="key" type="tns:key" />
     92                <element name="optional" type="tns:optional" minOccurs="0" />
     93            </choice>
     94        </sequence>
     95        <attribute name="id" type="ID" use="required" />
     96    </complexType>
     97
     98    <complexType name="reference">
     99        <attribute name="ref" type="IDREF" use="required" />
     100    </complexType>
    76101
    77102        <group name="optional_elements">
     
    86111                        <element name="check" type="tns:check" />
    87112                        <element name="item_separator" type="tns:separator" />
     113                        <element name="reference" type="tns:reference" />
    88114                </choice>
    89115        </group>
     
    154180                <attribute name="values_context" type="string" />
    155181                <attribute name="display_values" type="string" />
     182                <attribute name="values_searchable" type="boolean" />
    156183                <attribute name="default" type="string" />
    157184                <attribute name="use_last_as_default" type="tns:last_default" />
     
    181208                <attribute name="values_context" type="string" />
    182209                <attribute name="display_values" type="string" />
     210        <attribute name="values_searchable" type="boolean" />
    183211                <attribute name="default" type="string" />
    184212                <attribute name="use_last_as_default" type="tns:last_default" />
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java

    r6340 r6425  
    865865        public String delimiter = ";";
    866866        public String use_last_as_default = "false";
     867        /** whether to use values for search via {@link TaggingPresetSelector} */
     868        public String values_searchable = "false";
    867869
    868870        protected JComponent component;
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetSelector.java

    r6078 r6425  
    123123            TaggingPreset group = preset.group;
    124124            while (group != null) {
    125                 for (String word: group.getLocaleName().toLowerCase().split("\\s")) {
    126                     groups.add(word);
    127                 }
     125                Collections.addAll(groups, group.getLocaleName().toLowerCase().split("\\s"));
    128126                group = group.group;
    129127            }
    130             for (String word: preset.getLocaleName().toLowerCase().split("\\s")) {
    131                 names.add(word);
    132             }
     128            Collections.addAll(names, preset.getLocaleName().toLowerCase().split("\\s"));
    133129            for (TaggingPresetItem item: preset.data) {
    134130                if (item instanceof KeyedItem) {
    135131                    tags.add(((KeyedItem) item).key);
    136                     // Should combo values also be added?
     132                    if (item instanceof TaggingPresetItems.ComboMultiSelect) {
     133                        final TaggingPresetItems.ComboMultiSelect cms = (TaggingPresetItems.ComboMultiSelect) item;
     134                        if (Boolean.parseBoolean(cms.values_searchable)) {
     135                            tags.addAll(cms.getDisplayValues());
     136                        }
     137                    }
    137138                    if (item instanceof Key && ((Key) item).value != null) {
    138139                        tags.add(((Key) item).value);
     
    152153                boolean foundFirst = false;
    153154                for (String value: values) {
    154                     int index = value.indexOf(word);
     155                    int index = value.toLowerCase().indexOf(word);
    155156                    if (index == 0) {
    156157                        foundFirst = true;
Note: See TracChangeset for help on using the changeset viewer.