Changeset 22420 in osm for applications/editors/josm
- Timestamp:
- 2010-07-22T14:00:54+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/roadsigns
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/roadsigns/build.xml
r22202 r22420 31 31 32 32 <!-- enter the SVN commit message --> 33 <property name="commit.message" value=" fix message/i18n" />33 <property name="commit.message" value="added support for traffic_sign tag" /> 34 34 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 35 35 <property name="plugin.main.version" value="3338" /> -
applications/editors/josm/plugins/roadsigns/data/defaultroadsignpreset.xml
r21995 r22420 11 11 (or enter it in the advanced preferences tab in JOSM): 12 12 13 plugin.roadsign .sources=/path/to/myroadsignpreset.xml14 plugin.roadsign .icon.sources=/path/to/image/folder13 plugin.roadsigns.sources=/path/to/myroadsignpreset.xml 14 plugin.roadsigns.icon.sources=/path/to/image/folder 15 15 16 16 (The second one is only needed if you like to display your own icons.) … … 23 23 24 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 help Some notes to guide the user. 31 wiki Page in the osm wiki 32 deprecated Set to "yes" if authorities have decided to no longer install signs of this kind. 33 (But old signs may still be there and need to be recorded.) 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.) 34 35 35 36 tag: … … 69 70 --> 70 71 <roadsignpreset country="DE"> 71 <sign ref="DE:1 10" name="Incline" de.name="Steigung"72 <sign ref="DE:108/DE:110" icon="DE_110" traffic_sign_tag="" name="Incline" de.name="Steigung" 72 73 help="Applies for the road section with steep incline. (Split the way at the ends of the steep section.) 73 74 Positive values indicate movement upward in the direction of the (osm) way and negative values indicate movement downwards in the direction of the way." … … 76 77 wiki="Key:incline" 77 78 de.wiki="DE:Key:incline"> 79 <!--Suppress the traffic_sign tag, because it would be incorrect to add 80 traffic_sign=DE:110, when in reality it is DE:108. 81 Both are essentially equal, so in this tool only the incline symbol 82 should be present.--> 78 83 <tag key="incline" value="$val%"/> 79 84 <parameter input="textfield" name="max. incline" de.name="Maximale Steigung" type="int" ident="val" default="12" suffix="%" field_width="3"/> -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/ParametrizedString.java
r21967 r22420 1 // License: GPL (v2 or later)1 // License: GPL (v2 or later) 2 2 package org.openstreetmap.josm.plugins.roadsigns; 3 3 -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/RoadSignInputDialog.java
r21995 r22420 11 11 import java.awt.Rectangle; 12 12 import java.awt.event.ActionEvent; 13 import java.awt.event.ActionListener; 13 14 import java.awt.event.MouseAdapter; 14 15 import java.awt.event.MouseEvent; … … 24 25 25 26 import javax.swing.BorderFactory; 27 import javax.swing.JCheckBox; 26 28 import javax.swing.JComponent; 27 29 import javax.swing.JEditorPane; … … 52 54 import org.openstreetmap.josm.plugins.roadsigns.Sign.SignParameter; 53 55 import org.openstreetmap.josm.plugins.roadsigns.Sign.Tag; 56 import org.openstreetmap.josm.tools.GBC; 54 57 import org.openstreetmap.josm.tools.OpenBrowser; 55 58 import org.openstreetmap.josm.tools.Pair; … … 69 72 */ 70 73 class RoadSignInputDialog extends ExtendedDialog { 71 private final SignSelection sel; 72 private final List<Sign> signs; 73 private JTable previewTable; 74 75 private PreviewTableModel previewModel; 76 private JPanel pnlSignSelection; 77 private JPanel pnlPossibleSigns; 78 private JPanel pnlPossibleSupplements; 79 private JEditorPane info; 80 private JScrollPane scrollInfo; 74 protected final SignSelection sel; 75 protected final List<Sign> signs; 76 protected JTable previewTable; 77 protected JCheckBox addTrafficSignTag; 78 79 protected PreviewTableModel previewModel; 80 protected JPanel pnlSignSelection; 81 protected JPanel pnlPossibleSigns; 82 protected JPanel pnlPossibleSupplements; 83 protected JEditorPane info; 84 protected JScrollPane scrollInfo; 81 85 82 86 public RoadSignInputDialog(List<Sign> signs) { … … 93 97 Collection<OsmPrimitive> selPrim = Main.main.getCurrentDataSet().getSelected(); 94 98 if (selPrim.size() != 0) { 99 Main.pref.put("plugin.roadsigns.addTrafficSignTag", addTrafficSignTag.isSelected()); 100 95 101 Command cmd = createCommand(selPrim); 96 102 if (cmd != null) { … … 464 470 465 471 public JComponent buildPreviewPanel() { 472 JPanel previewPanel = new JPanel(new GridBagLayout()); 473 466 474 String[] columnNames = {tr("Key"), tr("Value")}; 467 475 String[][] data = {{}}; 468 previewTable = new JTable(data, columnNames); 476 previewTable = new JTable(data, columnNames) { 477 public String getToolTipText(MouseEvent e) { 478 int rowIndex = rowAtPoint(e.getPoint()); 479 int colIndex = columnAtPoint(e.getPoint()); 480 if (rowIndex == -1 || colIndex == -1) 481 return null; 482 int realColumnIndex = convertColumnIndexToModel(colIndex); 483 return (String) getValueAt(rowIndex, colIndex); 484 } 485 }; 469 486 previewTable.setFillsViewportHeight(true); 470 487 previewTable.setRowSelectionAllowed(false); … … 475 492 476 493 JScrollPane scroll = new JScrollPane(previewTable); 477 Dimension dim = new Dimension( 236, 10);494 Dimension dim = new Dimension(336, 10); 478 495 scroll.setPreferredSize(dim); 479 496 scroll.setMinimumSize(dim); /* minimum size is relevant for multisplit layout */ 480 return scroll; 497 498 addTrafficSignTag = new JCheckBox(tr("{0} tag", "traffic_sign")); 499 addTrafficSignTag.setSelected(Main.pref.getBoolean("plugin.roadsigns.addTrafficSignTag")); 500 addTrafficSignTag.addActionListener(new ActionListener() { 501 public void actionPerformed(ActionEvent e) { 502 previewModel.update(); 503 } 504 }); 505 506 previewPanel.add(scroll, GBC.eol().fill()); 507 previewPanel.add(addTrafficSignTag, GBC.eol()); 508 return previewPanel; 481 509 } 482 510 … … 515 543 public void update() { 516 544 final TreeMap<String, String> map= new TreeMap<String, String>(); 545 String traffic_sign = ""; 546 517 547 for (SignCombination sc : sel.combos) { 518 548 final Map<String, String> env = new HashMap<String, String>(); 549 String combo_traffic_sign = ""; 519 550 520 551 /** … … 573 604 if (sw.sign.ref != null) { 574 605 sw.signRef = sw.sign.ref.evaluate(env); 606 if (combo_traffic_sign.length() != 0) { 607 combo_traffic_sign += ","; 608 } 609 if (sw.sign.traffic_sign_tag != null) { 610 combo_traffic_sign += sw.sign.traffic_sign_tag.evaluate(env); 611 } else { 612 combo_traffic_sign += sw.signRef; 613 } 575 614 } 576 615 for (Tag t : sw.sign.tags) { … … 615 654 map.putAll(result); 616 655 } 656 657 if (combo_traffic_sign.length() != 0) { 658 if (traffic_sign.length() != 0) { 659 traffic_sign += ";"; 660 } 661 traffic_sign += combo_traffic_sign; 662 } 663 } 664 if (addTrafficSignTag.isSelected()) { 665 map.put("traffic_sign", traffic_sign); 617 666 } 618 667 -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/RoadSignsPlugin.java
r21995 r22420 68 68 presetsLoaded=true; 69 69 List<String> files = new ArrayList<String>( 70 Main.pref.getCollection("plugin.roadsign .sources",70 Main.pref.getCollection("plugin.roadsigns.sources", 71 71 Collections.<String>singletonList("resource://data/defaultroadsignpreset.xml"))); 72 72 iconDirs = new ArrayList<String>( 73 Main.pref.getCollection("plugin.roadsign .icon.sources", Collections.<String>emptySet()));73 Main.pref.getCollection("plugin.roadsigns.icon.sources", Collections.<String>emptySet())); 74 74 75 if (Main.pref.getBoolean("plugin.roadsign .use_default_icon_source", true)) {75 if (Main.pref.getBoolean("plugin.roadsigns.use_default_icon_source", true)) { 76 76 iconDirs.add("resource://images/"); 77 77 } -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/RoadSignsReader.java
r21995 r22420 77 77 try { 78 78 curSign.ref = ParametrizedString.create(atts.getValue("ref")); 79 curSign.traffic_sign_tag = ParametrizedString.create(atts.getValue("traffic_sign_tag")); 79 80 } catch (ParseException ex) { 80 81 throw new SAXException(ex); … … 107 108 curSign.isSupplementing = true; 108 109 } 109 110 110 111 curSign.wiki = atts.getValue("wiki"); 111 112 curSign.loc_wiki = getLocalized(atts, "wiki"); -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/Sign.java
r21995 r22420 21 21 public String id; 22 22 public ParametrizedString ref; 23 public ParametrizedString traffic_sign_tag; 23 24 public String iconURL; 24 25 public ImageIcon icon; … … 99 100 r = r.replaceAll("\\[.*\\]", ""); 100 101 if (r.startsWith("DE:")) { 101 r=r.replace First("DE:", "");102 r=r.replaceAll("DE:", ""); 102 103 /* normal sign: starts with 3 digits, then a non-digit */ 103 104 {
Note:
See TracChangeset
for help on using the changeset viewer.