Ticket #5933: building-presets.2.patch
| File building-presets.2.patch, 3.6 KB (added by , 15 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
1034 1034 public static class Key extends Item { 1035 1035 public String key; 1036 1036 public String value; 1037 public boolean match_only_key = false; 1037 1038 1038 1039 @Override public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel) { return false; } 1039 1040 @Override public void addCommands(List<Tag> changedTags) { -
src/org/openstreetmap/josm/gui/dialogs/properties/PresetListPanel.java
100 100 if(i instanceof TaggingPreset.Key) { 101 101 String val = ((TaggingPreset.Key)i).value; 102 102 String key = ((TaggingPreset.Key)i).key; 103 boolean match_only_key = ((TaggingPreset.Key)i).match_only_key; 103 104 // we subtract 100 if not found and add 1 if found 104 105 found -= 100; 105 106 if(key == null || !valueCount.containsKey(key)) { … … 107 108 } 108 109 109 110 Map<String, Integer> v = valueCount.get(key); 110 if(v.size() == 1 && val != null && v.containsKey(val) && v.get(val) == total) { 111 if (match_only_key) { 112 int sum = 0; 113 for (Integer vi : v.values()) sum+=vi; 114 if (total == sum) { 115 found += 101; 116 } 117 } else if(v.size() == 1 && val != null && v.containsKey(val) && v.get(val) == total) { 111 118 found += 101; 112 119 } 113 120 } else { -
data/defaultpresets.xml
24 24 key: fixed key/value pair to be set 25 25 key: key to set 26 26 value: value to set 27 match_only_key: if true, only key would be considered when looking for matching preset to show in panel 27 28 28 29 text: text box 29 30 key: key to set … … 2906 2907 <group name="Man Made" icon="presets/works.png"> 2907 2908 <group name="Man Made" icon="presets/works.png"> 2908 2909 <item name="Building" icon="styles/standard/misc/landmark/building.png" type="node,closedway,relation"> 2909 <key key="building" value="yes" /> 2910 <link href="http://wiki.openstreetmap.org/wiki/Proposed_features/Building_attributes" /> 2911 <key key="building" value="yes" match_only_key="true" /> 2912 <combo key="building" text="Type of building" values="train_station,hangar,yes" default="yes" use_last_as_default="true"/> 2913 <label text="Value 'yes' means that no type is specified" /> 2914 <optional> 2915 <label text="Building size" /> 2916 <text key="height" text="Height (meters) from ground to roof" delete_if_empty="true" /> 2917 <text key="building:levels" text="Number of stories, including the ground floor" delete_if_empty="true" /> 2918 </optional> 2910 2919 </item> 2911 2920 <item name="Tower" icon="presets/tower.png" type="node,closedway"> 2912 2921 <label text="Edit Tower" />
