|
Last change
on this file since 31694 was 30841, checked in by bastik, 11 years ago |
|
applied #josm10682 - Added features to sorting route relation of public_transport version 2 scheme (patch by freeExec)
|
-
Property svn:eol-style
set to
native
|
|
File size:
1.4 KB
|
| Line | |
|---|
| 1 | package relcontext;
|
|---|
| 2 |
|
|---|
| 3 | import org.openstreetmap.josm.data.osm.INode;
|
|---|
| 4 | import org.openstreetmap.josm.data.osm.IRelation;
|
|---|
| 5 | import org.openstreetmap.josm.data.osm.IWay;
|
|---|
| 6 | import org.openstreetmap.josm.gui.NameFormatterHook;
|
|---|
| 7 |
|
|---|
| 8 | /**
|
|---|
| 9 | * Formatter hook for some tags that Dirk does not want to support.
|
|---|
| 10 | *
|
|---|
| 11 | * @author Zverik
|
|---|
| 12 | */
|
|---|
| 13 | public class ExtraNameFormatHook implements NameFormatterHook {
|
|---|
| 14 |
|
|---|
| 15 | public String checkRelationTypeName( IRelation relation, String defaultName ) {
|
|---|
| 16 | return null;
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | public String checkFormat( INode node, String defaultName ) {
|
|---|
| 20 | return null;
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 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;
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 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+'"');
|
|---|
| 40 | }
|
|---|
| 41 | }
|
|---|
| 42 | return null;
|
|---|
| 43 | }
|
|---|
| 44 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.