Changeset 21995 in osm
- Timestamp:
- 2010-06-24T22:08:15+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/roadsigns
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/roadsigns/data/defaultroadsignpreset.xml
r21967 r21995 3 3 Preset file for road signs plugin. 4 4 5 Plugin is in early state of development (05-2010) and it is likely, the preset format will be changing. 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.roadsign.sources=/path/to/myroadsignpreset.xml 14 plugin.roadsign.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 6 22 Some values can contain parameters like $foo, that will be replaced by the value of the parameter named foo. 7 23 … … 9 25 ref Short official designation of the sign that can be used for the traffic_sign tag. (accepts parameters) 10 26 id Unique identifier. (If missing, equals ref. Either id or ref must be present.) 11 icon Icon path. (If missing, id or ref is used as icon path. In this case ':' and '.' characters are converted to underscore '_'.)27 icon Icon image name. (If missing, id or ref is used as image name. In this case ':' and '.' characters are converted to underscore '_'.) 12 28 name Name of the sign. (required) 13 long_name Official name of the sign. (optional)29 long_name Long (e.g. official) name of the sign. 14 30 help Some notes to guide the user. 15 31 wiki Page in the osm wiki 16 deprecated Set to "yes" if authorities have decided to no longer install signs of this kind. 32 deprecated Set to "yes" if authorities have decided to no longer install signs of this kind. 17 33 (But old signs may still be there and need to be recorded.) 18 34 19 35 tag: 36 Some tags can be named (ident=*) and modified by other subsequent tags. If this finally results in an 37 empty value (""), then the tag is skipped altogether. Note that the default value of a named tag is 38 only used if there are no appending tags. E.g. access=no becomes access=delivery and not access=no;delivery. 39 20 40 static tags: 21 41 key The key text. (accepts parameters) 22 42 value The value text. (accepts parameters) 23 24 identified tags:43 44 named tags: 25 45 key The key text. 26 46 value The default value text. If the final evaluation of the value results in an empty string, the tag is dropped. 27 47 ident Name a tag so it can later be changed by other tags. 28 48 29 49 modifying tags: 30 tag_ref Name of the tag to be changed. 31 append_value Append a string to the value of the tag. The default value of the identified tag is dropped (unless there is no 32 modifying tag appending a value). 33 50 appending: 51 tag_ref Name of the tag to be changed. 52 append_value Append a string to the value of the tag. The default value of the identified tag is dropped (unless there is no 53 modifying tag appending a value). 54 condition: 55 tag_ref Name of the tag to be changed. 56 condition The condition to add. (K=V becomes K:cond=V.) 57 34 58 parameter: 35 59 ident identifier to get the value of this parameter (required) … … 39 63 field_width for text fields: the width of the field (number of characters) 40 64 default default value (required) 41 65 42 66 supplementary: (list of recommended additional signs) 43 67 id the id of the supplementary sign … … 46 70 <roadsignpreset country="DE"> 47 71 <sign ref="DE:110" name="Incline" de.name="Steigung" 48 help="Applies for the road section with steep incline. (Split the way at the ends of the steep section.) \72 help="Applies for the road section with steep incline. (Split the way at the ends of the steep section.) 49 73 Positive values indicate movement upward in the direction of the (osm) way and negative values indicate movement downwards in the direction of the way." 50 de.help=" <p>Gilt für das Streckenstück mit hoher Steigung. (Weg am Anfang und Ende des steilen Abschnittes auftrennen.) \51 Positive Werte stehen für einen Anstieg in Richtung des ways und negative Werte für einen Abfall in Richtung des ways. </p>\"52 wiki="Key:incline" 74 de.help="Gilt für das Streckenstück mit hoher Steigung. (Weg am Anfang und Ende des steilen Abschnittes auftrennen.) 75 Positive Werte stehen für einen Anstieg in Richtung des ways und negative Werte für einen Abfall in Richtung des ways." 76 wiki="Key:incline" 53 77 de.wiki="DE:Key:incline"> 54 78 <tag key="incline" value="$val%"/> 55 79 <parameter input="textfield" name="max. incline" de.name="Maximale Steigung" type="int" ident="val" default="12" suffix="%" field_width="3"/> 56 80 </sign> 57 81 58 82 <sign ref="DE:215" name="Roundabout" de.name="Kreisverkehr" 59 83 wiki="Tag:junction=roundabout" 60 de.wiki="DE:Tag:junction=roundabout" 61 help="" 62 de.help=""> 84 de.wiki="DE:Tag:junction=roundabout"> 63 85 <tag key="junction" value="roundabout"/> 64 86 </sign> 65 87 66 88 <sign id="oneway" icon="DE_220;DE_267" name="One-way road" de.name="Einbahnstraße"> <!--ref="DE:220;DE:267"--> 67 89 <tag key="oneway" value="yes"/> … … 69 91 <!-- FIXME: lane->--> 70 92 </sign> 71 93 72 94 <sign ref="DE:237" name="Bicycle path" de.name="Radweg"> 73 95 <tag key="highway" value="path"/> … … 87 109 <supplementary id="DE:1026-38"/> <!-- Land- und forstwirtschaftlicher Verkehr frei --> 88 110 </sign> 89 111 90 112 <sign ref="DE:239" name="Pedestrian path" de.name="Gehweg"> 91 113 <tag key="highway" value="path"/> … … 139 161 <!-- Kraftfahrzeuge frei --> 140 162 </sign> 141 163 142 164 <sign ref="DE:250" name="All vehicles prohibited" de.name="Verbot für Fahrzeuge aller Art"> 143 165 <tag key="vehicle" value="no" ident="mode"/> … … 154 176 <supplementary id="DE:1026-38"/> <!-- Land- und forstwirtschaftlicher Verkehr frei --> 155 177 </sign> 156 178 157 179 <sign ref="DE:251" name="Motorcars prohibited" de.name="Verbot für Kraftwagen" 158 long_name="Motorcars and other multi-track motorized vehicles prohibited" 180 long_name="Motorcars and other multi-track motorized vehicles prohibited" 159 181 de.long_name="Verbot für Kraftwagen und sonstige mehrspurige Kraftfahrzeuge" 160 182 wiki="Key:motorcar" … … 196 218 <supplementary id="DE:1026-35"/> <!-- Lieferverkehr frei --> 197 219 </sign> 198 220 199 221 <sign ref="DE:256" deprecated="yes" name="Mopeds prohibited" de.name="Verbot für Mofas"> 200 222 <tag key="mofa" value="no" ident="mode"/> … … 206 228 <tag key="horse" value="no" ident="mode"/> 207 229 </sign> 208 230 209 231 <sign ref="DE:259" name="Pedestrians prohibited" de.name="Verbot für Fußgänger"> 210 232 <tag key="foot" value="no" ident="mode"/> 211 233 <supplementary id="DE:1020-30"/> <!-- Anlieger frei --> 212 234 </sign> 213 235 214 236 <sign ref="DE:260" name="Motor vehicles prohibited" de.name="Verbot für Kraftfahrzeuge" 215 237 long_name="Motorcycles, also with sidecar, mopeds, mofas as well as motorcars and other multi-track motorized vehicles prohibited" … … 226 248 </sign> 227 249 228 <sign ref="DE:261" name="Hazardous cargo prohibited" de.name="Verbot für kennzeichnungspflichtige Kraftfahrzeuge mit gefährlichen Gütern" wiki="Key:hazmat" de.wiki="DE:Key:hazmat"> 229 <tag key="hazmat" value="no" ident="mode"/> 230 </sign> 231 250 <sign ref="DE:261" name="Hazardous cargo prohibited" de.name="Verbot für kennzeichnungspflichtige Kraftfahrzeuge mit gefährlichen Gütern" 251 wiki="Key:hazmat" 252 de.wiki="DE:Key:hazmat"> 253 <tag key="hazmat" value="no" ident="mode"/> 254 </sign> 255 232 256 <sign ref="DE:262[$val]" icon="DE_262" name="Weight limit" de.name="Tatsächliches Gewicht" wiki="Key:maxweight"> 233 257 <tag key="maxweight" value="$val"/> 234 258 <parameter ident="val" input="textfield" default="5.5" suffix="t" field_width="3"/> 235 259 </sign> 236 260 237 261 <sign ref="DE:263[$val]" icon="DE_263" name="Axle weight limit" de.name="Tatsächliche Achslast" wiki="Key:maxaxleload"> 238 262 <tag key="maxaxleload" value="$val"/> 239 263 <parameter ident="val" input="textfield" default="8" suffix="t" field_width="3"/> 240 264 </sign> 241 265 242 266 <sign ref="DE:264[$val]" icon="DE_264" name="Width limit" de.name="Tatsächliche Breite"> 243 267 <tag key="maxwidth" value="$val"/> 244 268 <parameter ident="val" input="textfield" default="2" suffix="m" field_width="3"/> 245 269 </sign> 246 270 247 271 <sign ref="DE:265[$val]" icon="DE_265" name="Height limit" de.name="Tatsächliche Höhe"> 248 272 <tag key="maxheight" value="$val"/> … … 250 274 </sign> 251 275 252 <sign ref="DE:266[$val]" icon="DE_266" name="Length limit" de.name="Tatsächliche Länge" 276 <sign ref="DE:266[$val]" icon="DE_266" name="Length limit" de.name="Tatsächliche Länge" 253 277 wiki="Key:maxlength"> 254 278 <tag key="maxlength" value="$val"/> 255 279 <parameter ident="val" input="textfield" default="10" suffix="m" field_width="3"/> 256 280 </sign> 257 258 <sign ref="DE:269" name="Water polluting cargo prohibited" de.name="Verbot für Fahrzeuge mit wassergefährdender Ladung" 259 wiki="Key:hazmat" 281 282 <sign ref="DE:269" name="Water polluting cargo prohibited" de.name="Verbot für Fahrzeuge mit wassergefährdender Ladung" 283 wiki="Key:hazmat" 260 284 de.wiki="DE:Key:hazmat"> 261 285 <tag key="hazmat:water" value="no" ident="mode"/> … … 268 292 <supplementary id="DE:1048-12"/> <!-- nur LKW --> 269 293 </sign> 270 294 271 295 <sign ref="DE:274.1[$val]" icon="DE_274_1" name="Speed limit zone" de.name="Zone mit zulässiger Höchstgeschwindigkeit"> 272 296 <tag key="maxspeed" value="$val"/> … … 274 298 <parameter ident="val" type="int" input="combo" editable="yes" text="speed-limit" de.text="Höchstgeschwindigkeit" suffix="km/h" values="20,30" default="30" field_width="2"/> 275 299 </sign> 276 300 277 301 <sign ref="DE:275[$val]" icon="DE_275" name="Minimum speed limit" de.name="Vorgeschriebene Mindestgeschwindigkeit" wiki="Key:minspeed"> 278 302 <tag key="minspeed" value="$val"/> … … 283 307 <tag key="highway" value="living_street"/> 284 308 </sign> 285 309 286 310 <sign ref="DE:327" name="Tunnel" de.name="Tunnel"> 287 311 <tag key="tunnel" value="yes"/> 288 312 </sign> 289 313 290 314 <sign ref="DE:1020-12" supplementary="yes" name="Bicyle and residents allowed" de.name="Radfahrer und Anlieger frei"> <!-- FIXME: bad translation into English --> 291 315 <tag key="bicycle" value="yes"/> … … 331 355 <tag tag_ref="mode" append_value="delivery"/> 332 356 </sign> 333 357 334 358 <sign ref="DE:1026-36" supplementary="yes" name="Agricultural vehicles allowed" de.name="Landwirtschaftlicher Verkehr frei"> 335 359 <tag tag_ref="mode" append_value="agricultural"/> 336 360 </sign> 337 361 338 362 <sign ref="DE:1026-37" supplementary="yes" name="Forestry vehicles allowed" de.name="Forstwirtschaftlicher Verkehr frei"> 339 363 <tag tag_ref="mode" append_value="forestry"/> … … 344 368 <tag tag_ref="mode" append_value="forestry"/> 345 369 </sign> 346 370 347 371 <sign ref="DE:1048-12" supplementary="yes" name="Heavy goods vehicles only" de.name="nur LKW" 348 372 long_name="Vehicles with a permitted gross weight over 3.5 t including their trailers prohibited, except passenger cars and busses, only" 349 de.long_name=" nur Kraftfahrzeuge mit einem zulässigen Gesamtgewicht über 3,5 t, einschl. ihrer Anhänger, und Zugmaschinen, ausgenommen Personenkraftwagen und Kraftomnibusse">373 de.long_name="Nur Kraftfahrzeuge mit einem zulässigen Gesamtgewicht über 3,5 t, einschl. ihrer Anhänger, und Zugmaschinen, ausgenommen Personenkraftwagen und Kraftomnibusse"> 350 374 <tag tag_ref="restriction" condition="hgv"/> 351 375 </sign> -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/RoadSignInputDialog.java
r21967 r21995 33 33 import javax.swing.Scrollable; 34 34 import javax.swing.SwingConstants; 35 import javax.swing.SwingUtilities; 35 36 import javax.swing.border.Border; 36 37 import javax.swing.border.EtchedBorder; 37 38 import javax.swing.event.DocumentEvent; 38 39 import javax.swing.event.DocumentListener; 40 import javax.swing.event.HyperlinkEvent; 41 import javax.swing.event.HyperlinkListener; 39 42 import javax.swing.table.AbstractTableModel; 40 43 … … 49 52 import org.openstreetmap.josm.plugins.roadsigns.Sign.SignParameter; 50 53 import org.openstreetmap.josm.plugins.roadsigns.Sign.Tag; 54 import org.openstreetmap.josm.tools.OpenBrowser; 51 55 import org.openstreetmap.josm.tools.Pair; 52 56 … … 74 78 private JPanel pnlPossibleSupplements; 75 79 private JEditorPane info; 80 private JScrollPane scrollInfo; 76 81 77 82 public RoadSignInputDialog(List<Sign> signs) { … … 126 131 pnlSignSelection.setLayout(fLayout); 127 132 128 129 133 pnlPossibleSigns = new FixedWidthPanel(); 130 134 pnlPossibleSupplements = new FixedWidthPanel(); … … 146 150 info.setEditable(false); 147 151 info.setContentType("text/html"); 148 info.setText(" ");152 info.setText(" "); 149 153 info.setBackground(this.getBackground()); 150 JScrollPane scroll3 = new JScrollPane(info, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 151 multiSplitPane.add(scroll3, "bottom"); 154 info.addHyperlinkListener(new HyperlinkListener() { 155 public void hyperlinkUpdate(HyperlinkEvent e) { 156 if (e == null || e.getURL() == null) 157 return; 158 System.err.println(e.getURL()); 159 if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { 160 OpenBrowser.displayUrl(e.getURL().toString()); 161 } 162 } 163 }); 164 165 scrollInfo = new JScrollPane(info, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 166 multiSplitPane.add(scrollInfo, "bottom"); 152 167 153 168 return multiSplitPane; … … 162 177 for (Sign s : signs) { 163 178 JLabel lbl = new JLabel(s.getIcon()); 179 String tt = "<html>"+s.name; 180 String ref = s.getDefaultRef(); 181 if (ref != null) { 182 tt += " <i><small>("+ref+")</small></i>"; 183 } 184 tt += "</html>"; 185 lbl.setToolTipText(tt); 164 186 s.label = lbl; 165 187 lbl.addMouseListener(new SignClickListener(s)); … … 621 643 @Override 622 644 public void mouseClicked(MouseEvent e) { 645 info.setText(longText()); 646 /* scroll up again */ 647 SwingUtilities.invokeLater(new Runnable(){ 648 public void run() { 649 scrollInfo.getVerticalScrollBar().setValue(0); 650 } 651 }); 623 652 sel.add(sign); 624 653 } 625 654 626 @Override 627 public void mouseEntered(MouseEvent e) { 655 private String longText() { 628 656 StringBuilder txt = new StringBuilder(); 629 txt.append("<p><b><large>"); 630 txt.append(sign.name); 631 txt.append("</large></b>"); 657 txt.append(sign.long_name == null ? sign.name : sign.long_name); 632 658 String ref = sign.getDefaultRef(); 633 659 if (ref != null) { 634 660 txt.append(" <i><small>("+ref+")</small></i>"); 635 661 } 636 txt.append("</p>"); 637 // if (sign.long_name != null) { 638 // txt.append("<i><smaller>("+sign.long_name+")</smaller></i>"); 639 // } 640 info.setText(txt.toString()); 641 } 642 643 @Override 644 public void mouseExited(MouseEvent e) { 645 info.setText(""); 662 663 if (sign.help != null) { 664 txt.append("<p>"); 665 txt.append(sign.help); 666 txt.append("</p>"); 667 } 668 669 if (sign.wiki != null || sign.loc_wiki != null) { 670 String wikiPrefix = "http://wiki.openstreetmap.org/wiki/"; 671 txt.append("<p>"); 672 if (sign.loc_wiki != null) { 673 String link = wikiPrefix+sign.loc_wiki; 674 txt.append("<a href=\""+link+"\">"+link+"</a>"); 675 txt.append("<br>"); 676 } 677 if (sign.wiki != null && ! sign.wiki.equals(sign.loc_wiki)) { 678 String link = wikiPrefix+sign.wiki; 679 txt.append("<a href=\""+link+"\">"+link+"</a>"); 680 } 681 txt.append("</p>"); 682 } 683 return txt.toString(); 646 684 } 647 685 } … … 660 698 @Override 661 699 public void setBounds(int x, int y, int width, int height) { 662 663 700 super.setBounds(x, y, getParent().getWidth(), height); 701 } 664 702 665 703 @Override 666 667 668 669 670 671 672 673 674 704 public Dimension getPreferredSize() { 705 return new Dimension(getWidth(), getPreferredHeight()); 706 } 707 708 public Dimension getPreferredScrollableViewportSize() { 709 return super.getPreferredSize(); 710 } 711 712 public int getScrollableUnitIncrement( Rectangle visibleRect, int orientation, int direction ) { 675 713 final int FRAC = 20; 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 714 int inc = (orientation == SwingConstants.VERTICAL ? getParent().getHeight() : getParent().getWidth()) / FRAC; 715 return Math.max(inc, 1); 716 } 717 718 public int getScrollableBlockIncrement( Rectangle visibleRect, int orientation, int direction ) { 719 return orientation == SwingConstants.VERTICAL ? getParent().getHeight() : getParent().getWidth(); 720 } 721 722 public boolean getScrollableTracksViewportWidth() { 723 return true; 724 } 725 726 public boolean getScrollableTracksViewportHeight() { 727 return false; 728 } 729 730 private int getPreferredHeight() { 731 int prefH = 0; 694 732 int num = getComponentCount(); 695 696 697 698 699 700 } 701 702 703 704 733 for (int i = 0; i < num; ++i) { 734 Rectangle rect = getComponent(i).getBounds(); 735 int h = rect.y + rect.height; 736 if (h > prefH) { 737 prefH = h; 738 } 739 } 740 prefH += ((FlowLayout) getLayout()).getVgap(); 741 return prefH; 742 } 705 743 } 706 744 } -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/RoadSignsPlugin.java
r21967 r21995 31 31 32 32 public class RoadSignsPlugin extends Plugin { 33 34 33 private static boolean presetsLoaded = false; 35 34 public static List<Sign> signs; 35 static List<String> iconDirs; 36 36 37 37 public RoadSignsPlugin(PluginInformation info) { … … 68 68 presetsLoaded=true; 69 69 List<String> files = new ArrayList<String>( 70 Main.pref.getCollection("plugin.roadsign.sources", 71 Collections.<String>singletonList("resource://data/defaultroadsignpreset.xml"))); 70 Main.pref.getCollection("plugin.roadsign.sources", 71 Collections.<String>singletonList("resource://data/defaultroadsignpreset.xml"))); 72 iconDirs = new ArrayList<String>( 73 Main.pref.getCollection("plugin.roadsign.icon.sources", Collections.<String>emptySet())); 74 75 if (Main.pref.getBoolean("plugin.roadsign.use_default_icon_source", true)) { 76 iconDirs.add("resource://images/"); 77 } 78 72 79 for (String source : files) { 73 80 try { -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/RoadSignsReader.java
r21967 r21995 107 107 curSign.isSupplementing = true; 108 108 } 109 110 curSign.wiki = atts.getValue("wiki"); 111 curSign.loc_wiki = getLocalized(atts, "wiki"); 112 113 curSign.help = getLocalized(atts, "help"); 109 114 110 115 } else if (curSign != null && qname.equals("tag")) { -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/Sign.java
r21967 r21995 30 30 public List<SignParameter> params = new ArrayList<SignParameter>(); 31 31 public boolean isSupplementing; 32 public String loc_wiki; 33 public String wiki; 34 public String help; 32 35 33 36 public JLabel label; // FIXME: don't put gui stuff here … … 78 81 public ImageIcon getIcon() { 79 82 if (icon == null) { 80 icon = ImageProvider.get (iconURL);83 icon = ImageProvider.getIfAvailable(RoadSignsPlugin.iconDirs, "plugin.sign."+id, null, iconURL, null); 81 84 } 82 85 return icon;
Note:
See TracChangeset
for help on using the changeset viewer.