Changeset 29230 in osm for applications/editors/josm/plugins/roadsigns
- Timestamp:
- 2013-02-06T13:52:07+01:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/roadsigns
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/roadsigns/README
r26341 r29230 4 4 Shows a GUI dialog to tag objects by clicking on road sign symbols. 5 5 It tries to generate the corresponding tags for the object. 6 As tagging schemes are under constant development, the definitions7 need to be updated when needed.8 6 9 7 Author: … … 18 16 [1] http://osmtools.de/traffic_signs/ 19 17 20 Pics have been derived from 18 Pics for the German preset have been derived from 21 19 http://de.wikipedia.org/wiki/Bildtafel_der_Verkehrszeichen_in_Deutschland (german street sign SVGs) 20 21 How to install a custom preset 22 ------------------------------ 23 24 Add the following entry in the advanced preferences [1]: 25 26 plugin.roadsigns.sources=/path/to/myroadsignpreset.xml 27 28 (The value can be either "simple" or "list" type) 29 The chosen preset should be loaded automatically after a restart. 30 31 Images can be placed in the same folder as the preset .xml file. Alternatively, you can also specify a path for icons: 32 33 plugin.roadsigns.icon.sources=/path/to/image/folder 34 35 [1] http://josm.openstreetmap.de/wiki/Help/Preferences/Advanced 36 37 Preset Format 38 ------------- 39 40 The first preset was data/roadsignpresetDE.xml, so you might want to look there for examples. 41 42 Some values can contain parameters like $foo, that will be replaced by the value of the parameter named foo. 43 44 sign: 45 ref Short official designation of the sign that can be used for the traffic_sign tag. (accepts parameters) 46 id Unique identifier. (If missing, equals ref. Either id or ref must be present.) 47 icon Icon image name. (If missing, id or ref is used as image name. In this case ':' and '.' characters are converted to underscore '_'.) 48 name Name of the sign. (required) 49 long_name Long (e.g. official) name of the sign. 50 traffic_sign_tag Value that should be used for traffic_sign tag (if different from ref). 51 help Some notes to guide the user. 52 wiki Page in the osm wiki 53 deprecated Set to "yes" if authorities have decided to no longer install signs of this kind. 54 (But old signs may still be there and need to be recorded.) 55 useful (optional) The user can choose to show only a selection of the most useful signs. 56 By default, a sign with <tag> information is treated as useful. This can be overridden 57 by setting this attribute. Possible values: true, false. 58 59 tag: 60 Some tags can be named (ident=*) and modified by other subsequent tags. If this finally results in an 61 empty value (""), then the tag is skipped altogether. Note that the default value of a named tag is 62 only used if there are no appending tags. E.g. access=no becomes access=delivery and not access=no;delivery. 63 64 static tags: 65 key The key text. (accepts parameters) 66 value The value text. (accepts parameters) 67 68 named tags: 69 key The key text. 70 value The default value text. If the final evaluation of the value results in an empty string, the tag is dropped. 71 ident Name a tag so it can later be changed by other tags. 72 73 modifying tags: 74 appending: 75 tag_ref Name of the tag to be changed. 76 append_value Append a string to the value of the tag. The default value of the identified tag is dropped (unless there is no 77 modifying tag appending a value). 78 condition: 79 tag_ref Name of the tag to be changed. 80 condition The condition to add. (K=V becomes K:cond=V.) 81 82 parameter: 83 ident identifier to get the value of this parameter (required) 84 input input type (currently "textfield" and "combo" are possible values) (required) 85 prefix text to put before the input area 86 suffix text to put after the input area 87 field_width for text fields: the width of the field (number of characters) 88 default default value (required) 89 90 supplementary: (list of recommended additional signs) 91 id the id of the supplementary sign 92 22 93 23 94 JavaCC usage: -
applications/editors/josm/plugins/roadsigns/data/roadsignpresetDE.xml
r29228 r29230 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <!-- 3 Preset file for road signs plugin. 4 5 The plugin is in early state of development (05-2010) and the format is likely to change. 6 7 How to customize 8 ================ 9 10 Add the following to your JOSM preference file 11 (or enter it in the advanced preferences tab in JOSM): 12 13 plugin.roadsigns.sources=/path/to/myroadsignpreset.xml 14 plugin.roadsigns.icon.sources=/path/to/image/folder 15 16 (The second one is only needed if you like to display your own icons.) 17 18 19 Preset format 20 ============= 21 22 Some values can contain parameters like $foo, that will be replaced by the value of the parameter named foo. 23 24 sign: 25 ref Short official designation of the sign that can be used for the traffic_sign tag. (accepts parameters) 26 id Unique identifier. (If missing, equals ref. Either id or ref must be present.) 27 icon Icon image name. (If missing, id or ref is used as image name. In this case ':' and '.' characters are converted to underscore '_'.) 28 name Name of the sign. (required) 29 long_name Long (e.g. official) name of the sign. 30 traffic_sign_tag Value that should be used for traffic_sign tag (if different from ref). 31 help Some notes to guide the user. 32 wiki Page in the osm wiki 33 deprecated Set to "yes" if authorities have decided to no longer install signs of this kind. 34 (But old signs may still be there and need to be recorded.) 35 36 tag: 37 Some tags can be named (ident=*) and modified by other subsequent tags. If this finally results in an 38 empty value (""), then the tag is skipped altogether. Note that the default value of a named tag is 39 only used if there are no appending tags. E.g. access=no becomes access=delivery and not access=no;delivery. 40 41 static tags: 42 key The key text. (accepts parameters) 43 value The value text. (accepts parameters) 44 45 named tags: 46 key The key text. 47 value The default value text. If the final evaluation of the value results in an empty string, the tag is dropped. 48 ident Name a tag so it can later be changed by other tags. 49 50 modifying tags: 51 appending: 52 tag_ref Name of the tag to be changed. 53 append_value Append a string to the value of the tag. The default value of the identified tag is dropped (unless there is no 54 modifying tag appending a value). 55 condition: 56 tag_ref Name of the tag to be changed. 57 condition The condition to add. (K=V becomes K:cond=V.) 58 59 parameter: 60 ident identifier to get the value of this parameter (required) 61 input input type (currently "textfield" and "combo" are possible values) (required) 62 prefix text to put before the input area 63 suffix text to put after the input area 64 field_width for text fields: the width of the field (number of characters) 65 default default value (required) 66 67 supplementary: (list of recommended additional signs) 68 id the id of the supplementary sign 69 3 roadsigns plugin preset file for Germany 70 4 --> 71 5 <roadsignpreset country="DE"> -
applications/editors/josm/plugins/roadsigns/data/roadsignpresetPL.xml
r29228 r29230 1349 1349 wiki="Tag:highway%3Dpedestrian" 1350 1350 > 1351 <tag key="highway" value=" pedestrian"/>1351 <tag key="highway" value="living_street"/> 1352 1352 </sign> 1353 1353 -
applications/editors/josm/plugins/roadsigns/data/roadsignpresetSK.xml
r29228 r29230 225 225 </sign> 226 226 <sign icon="B20.png" id="B20" ref="SK:B20" name="zákaz vjazdu vozidiel alebo súprav vozidiel, ktorých dĺžka presahuje vyznačenú hranicu" sk.name="zákaz vjazdu vozidiel alebo súprav vozidiel, ktorých dĺžka presahuje vyznačenú hranicu"> 227 <tag key=" car:distance" value="$val"/>228 <parameter ident="val" input="textfield" suffix="m" default=" 70" field_width="2"/>227 <tag key="maxlength" value="$val"/> 228 <parameter ident="val" input="textfield" suffix="m" default="10" field_width="2"/> 229 229 </sign> 230 230 <sign icon="B21.png" id="B21" ref="SK:B21" name="zákaz vjazdu vozidiel prepravujúcich nebezpečné veci" sk.name="zákaz vjazdu vozidiel prepravujúcich nebezpečné veci"> -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/RoadSignInputDialog.java
r29228 r29230 29 29 import javax.swing.BorderFactory; 30 30 import javax.swing.Box; 31 import javax.swing.ButtonGroup; 31 32 import javax.swing.JButton; 32 33 import javax.swing.JCheckBox; … … 36 37 import javax.swing.JLabel; 37 38 import javax.swing.JPanel; 39 import javax.swing.JRadioButton; 38 40 import javax.swing.JScrollPane; 39 41 import javax.swing.JTabbedPane; … … 694 696 fireTableDataChanged(); 695 697 } 696 697 698 698 } 699 699 … … 814 814 private List<PresetMetaData> presetsData; 815 815 private JComboBox selectionBox; 816 JRadioButton rbAll, rbUseful; 816 817 817 818 public SettingsPanel(boolean standalone, final Action update) { … … 831 832 this.add(selectionBox, GBC.eol().insets(0, 5, 5, 5)); 832 833 if (!standalone) { 834 String snd = "Hide signs that do not have an OSM tag assigned"; 835 836 rbAll = new JRadioButton(tr("Show all signs")); 837 rbUseful = new JRadioButton(tr("Show a selection of the most useful signs")); 838 839 ButtonGroup grp = new ButtonGroup(); 840 grp.add(rbAll); 841 grp.add(rbUseful); 842 843 String filterPref = Main.pref.get("plugin.roadsigns.preset.filter"); 844 if (filterPref.equals("useful")) { 845 rbUseful.setSelected(true); 846 } else { 847 rbAll.setSelected(true); 848 } 849 850 JPanel pnFilter = new JPanel(new GridBagLayout()); 851 pnFilter.setBorder(BorderFactory.createTitledBorder(tr("Filter"))); 852 pnFilter.add(rbAll, GBC.eop()); 853 pnFilter.add(rbUseful, GBC.eop()); 854 855 this.add(pnFilter, GBC.eol().insets(5, 0, 5, 5)); 856 833 857 JButton apply = new JButton(new AbstractAction(tr("Apply")) { 834 858 @Override … … 848 872 849 873 public void apply() throws IOException { 874 String filter = null; 875 if (rbAll != null) { 876 if (rbAll.isSelected()) { 877 filter = "all"; 878 } else if (rbUseful.isSelected()) { 879 filter = "useful"; 880 } 881 } 882 if (filter != null) { 883 Main.pref.put("plugin.roadsigns.preset.filter", filter); 884 } 850 885 RoadSignsPlugin.setSelectedPreset(presetsData.get(selectionBox.getSelectedIndex())); 851 886 } -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/RoadSignsPlugin.java
r29228 r29230 183 183 List<PresetMetaData> presetsData = getAvailablePresetsMetaData(); 184 184 String code = Main.pref.get("plugin.roadsigns.preset.selection", null); 185 if (selectedPreset != null && selectedPreset.code.equals(code)) return;186 185 187 186 for (PresetMetaData data : presetsData) { -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/RoadSignsReader.java
r23192 r29230 22 22 import org.xml.sax.helpers.DefaultHandler; 23 23 24 import org.openstreetmap.josm.Main; 24 25 import org.openstreetmap.josm.io.OsmDataParsingException; 25 26 import org.openstreetmap.josm.plugins.roadsigns.Sign.SignParameter; 26 27 import org.openstreetmap.josm.plugins.roadsigns.Sign.Tag; 27 import org.openstreetmap.josm.tools.LanguageInfo;28 29 28 import org.openstreetmap.josm.plugins.roadsigns.javacc.ParseException; 30 29 import org.openstreetmap.josm.plugins.roadsigns.javacc.TokenMgrError; 30 import org.openstreetmap.josm.tools.LanguageInfo; 31 31 32 32 /** … … 113 113 114 114 curSign.help = getLocalized(atts, "help"); 115 116 String useful = atts.getValue("useful"); 117 if (useful != null) { 118 curSign.useful = Boolean.parseBoolean(useful); 119 } 115 120 116 121 } else if (curSign != null && qname.equals("tag")) { … … 312 317 factory.newSAXParser().parse(inputSource, parser); 313 318 parser.wireSupplements(); 314 return parser.allSigns; 319 String filterPref = Main.pref.get("plugin.roadsigns.preset.filter"); 320 if (filterPref.equals("useful")) { 321 List<Sign> filtered = new ArrayList<Sign>(); 322 for (Sign s : parser.allSigns) { 323 if (s.isUseful()) { 324 filtered.add(s); 325 } 326 } 327 return filtered; 328 } else { 329 return parser.allSigns; 330 } 315 331 } catch (ParserConfigurationException e) { 316 332 e.printStackTrace(); // broken SAXException chaining -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/Sign.java
r27675 r29230 34 34 public String wiki; 35 35 public String help; 36 public Boolean useful; 36 37 37 38 public JLabel label; // FIXME: don't put gui stuff here … … 120 121 } 121 122 123 public boolean isUseful() { 124 if (useful != null) return useful; 125 return !tags.isEmpty(); 126 } 127 122 128 @Override 123 129 public String toString() {
Note:
See TracChangeset
for help on using the changeset viewer.