Changeset 32395 in osm for applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/PublicTransportHelper.java
- Timestamp:
- 2016-06-24T09:10:57+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/PublicTransportHelper.java
r30841 r32395 1 // License: GPL. For details, see LICENSE file. 1 2 package relcontext.actions; 2 3 3 import org.openstreetmap.josm.data.osm.Node;4 4 import org.openstreetmap.josm.data.osm.OsmPrimitive; 5 5 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 6 6 import org.openstreetmap.josm.data.osm.RelationMember; 7 import org.openstreetmap.josm.data.osm.Way;8 7 9 8 /** … … 26 25 public final static String BUS_STOP = "bus_stop"; 27 26 public final static String RAILWAY_HALT = "halt"; 28 public final static String RAILWAY_STATION = "station"; 29 27 public final static String RAILWAY_STATION = "station"; 28 30 29 private PublicTransportHelper() { 31 30 // Hide default constructor for utils classes 32 } 33 31 } 32 34 33 public static String getRoleByMember(RelationMember m) { 35 34 if (isMemberStop(m)) return STOP; … … 37 36 return null; 38 37 } 39 38 40 39 public static boolean isMemberStop(RelationMember m) { 41 40 return isNodeStop(m); // stop is only node 42 41 } 43 42 44 43 public static boolean isMemberPlatform(RelationMember m) { 45 44 return isNodePlatform(m) || isWayPlatform(m); 46 45 } 47 46 48 47 public static boolean isNodeStop(RelationMember m) { 49 48 return isNodeStop(m.getMember()); 50 49 } 51 50 52 51 public static boolean isNodeStop(OsmPrimitive p) { 53 52 if (p.getType() == OsmPrimitiveType.NODE && !p.isIncomplete()) { … … 63 62 return false; 64 63 } 65 64 66 65 public static boolean isNodePlatform(RelationMember m) { 67 66 return isNodePlatform(m.getMember()); 68 67 } 69 68 70 69 public static boolean isNodePlatform(OsmPrimitive p) { 71 70 if (p.getType() == OsmPrimitiveType.NODE && !p.isIncomplete()) { … … 87 86 return isWayPlatform(m.getMember()); 88 87 } 89 88 90 89 public static boolean isWayPlatform(OsmPrimitive p) { 91 90 if (p.getType() == OsmPrimitiveType.WAY && !p.isIncomplete()) { … … 103 102 return false; 104 103 } 105 104 106 105 public static boolean isMemberRouteway(RelationMember m) { 107 106 return isWayRouteway(m.getMember()); 108 107 } 109 108 110 109 public static boolean isWayRouteway(OsmPrimitive p) { 111 if (p.getType() == OsmPrimitiveType.WAY && !p.isIncomplete()) {110 if (p.getType() == OsmPrimitiveType.WAY && !p.isIncomplete()) 112 111 return p.hasKey(HIGHWAY) || p.hasKey(RAILWAY); 113 }114 112 return false; 115 113 } 116 114 117 115 public static String getNameViaStoparea(RelationMember m) { 118 116 return getNameViaStoparea(m.getMember()); 119 117 } 120 118 121 119 public static String getNameViaStoparea(OsmPrimitive prim) { 122 120 String result = prim.getName(); … … 125 123 for (OsmPrimitive refOp : prim.getReferrers()) 126 124 if (refOp.getType() == OsmPrimitiveType.RELATION 127 && refOp.hasTag(PUBLIC_TRANSPORT, STOP_AREA)) {125 && refOp.hasTag(PUBLIC_TRANSPORT, STOP_AREA)) { 128 126 result = refOp.getName(); 129 127 if (result != null) return result; 130 128 } 131 129 return result; 132 } 130 } 133 131 }
Note:
See TracChangeset
for help on using the changeset viewer.
