Changeset 32395 in osm for applications/editors/josm/plugins/reltoolbox/src/relcontext/ExtraNameFormatHook.java
- Timestamp:
- 2016-06-24T09:10:57+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reltoolbox/src/relcontext/ExtraNameFormatHook.java
r30841 r32395 1 // License: GPL. For details, see LICENSE file. 1 2 package relcontext; 2 3 … … 8 9 /** 9 10 * Formatter hook for some tags that Dirk does not want to support. 10 * 11 * 11 12 * @author Zverik 12 13 */ 13 14 public class ExtraNameFormatHook implements NameFormatterHook { 14 15 15 public String checkRelationTypeName( IRelation relation, String defaultName ) { 16 return null; 16 @Override 17 public String checkRelationTypeName(IRelation relation, String defaultName) { 18 return null; 17 19 } 18 20 19 public String checkFormat( INode node, String defaultName ) { 20 return null; 21 @Override 22 public String checkFormat(INode node, String defaultName) { 23 return null; 21 24 } 22 25 23 public String checkFormat( IWay way, String defaultName ) { 24 if( way.get("place") != null && way.get("name") == null && way.get("place_name") != null ) 25 return way.get("place_name") + " " + defaultName; 26 return null; 26 @Override 27 public String checkFormat(IWay way, String defaultName) { 28 if (way.get("place") != null && way.get("name") == null && way.get("place_name") != null ) 29 return way.get("place_name") + " " + defaultName; 30 return null; 27 31 } 28 32 29 public String checkFormat( IRelation relation, String defaultName ) { 30 String type = relation.get("type"); 31 if( type != null ) { 32 String name = relation.get("destination"); 33 if( type.equals("destination_sign") && name != null ) { 34 if( relation.get("distance") != null ) 35 name += " " + relation.get("distance"); 36 if( defaultName.indexOf('"') < 0 ) 37 return '"' + name + "\" " + defaultName; 38 else 39 return defaultName.replaceFirst("\".?+\"", '"'+name+'"'); 33 @Override 34 public String checkFormat(IRelation relation, String defaultName) { 35 String type = relation.get("type"); 36 if (type != null) { 37 String name = relation.get("destination"); 38 if (type.equals("destination_sign") && name != null) { 39 if (relation.get("distance") != null ) { 40 name += " " + relation.get("distance"); 41 } 42 if (defaultName.indexOf('"') < 0 ) 43 return '"' + name + "\" " + defaultName; 44 else 45 return defaultName.replaceFirst("\".?+\"", '"'+name+'"'); 46 } 40 47 } 41 } 42 return null; 48 return null; 43 49 } 44 50 }
Note:
See TracChangeset
for help on using the changeset viewer.