Changeset 33406 in osm
- Timestamp:
- 2017-06-21T22:49:23+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/utils/RouteUtils.java
r33055 r33406 41 41 return false; 42 42 } 43 if (r.hasTag("route", "bus") || r.hasTag("route", "trolleybus") || r.hasTag("route", "share_taxi") 44 || r.hasTag("route", "tram") || r.hasTag("route", "light_rail") || r.hasTag("route", "subway") 45 || r.hasTag("route", "train")) { 46 47 if (!r.hasTag("bus", "on_demand")) { 48 return true; 49 } 50 51 } 52 return false; 43 44 String [] acceptedRouteTags = new String[] { 45 "bus", "trolleybus", "share_taxi", 46 "tram", "light_rail", "subway", "train"}; 47 48 return r.hasTag("route", acceptedRouteTags) 49 && !r.hasTag("bus", "on_demand"); 53 50 } 54 51 … … 63 60 public static boolean isPTStop(RelationMember rm) { 64 61 65 66 62 if (rm.getType().equals(OsmPrimitiveType.NODE)) { 67 63 return true; 68 64 } 69 65 70 if (rm.getType().equals(OsmPrimitiveType.WAY)) { 71 if (rm.getWay().hasTag("public_transport", "platform") || rm.getWay().hasTag("highway", "platform") 72 || rm.getWay().hasTag("railway", "platform")) { 73 return true; 74 } 75 } 76 77 return false; 78 66 return (rm.getType().equals(OsmPrimitiveType.WAY)) 67 && (rm.getWay().hasTag("public_transport", "platform") 68 || rm.getWay().hasTag("highway", "platform") 69 || rm.getWay().hasTag("railway", "platform")); 79 70 } 80 71 … … 96 87 97 88 if (rm.getType().equals(OsmPrimitiveType.WAY)) { 98 if (rm.getWay().hasTag("public_transport", "platform") || rm.getWay().hasTag("highway", "platform") 99 || rm.getWay().hasTag("railway", "platform")) { 100 return false; 101 } 102 return true; 89 return !(rm.getWay().hasTag("public_transport", "platform") 90 || rm.getWay().hasTag("highway", "platform") 91 || rm.getWay().hasTag("railway", "platform")); 103 92 } 104 93 … … 125 114 public static int isOnewayForPublicTransport(Way way) { 126 115 127 if (OsmUtils.isTrue(way.get("oneway")) || OsmUtils.isReversed(way.get("oneway")) 128 || way.hasTag("junction", "roundabout") || way.hasTag("highway", "motorway")) { 129 130 if (!way.hasTag("busway", "lane") && !way.hasTag("busway:left", "lane") 131 && !way.hasTag("busway:right", "lane") && !way.hasTag("oneway:bus", "no") 132 && !way.hasTag("busway", "opposite_lane") && !way.hasTag("oneway:psv", "no") 116 if (OsmUtils.isTrue(way.get("oneway")) 117 || OsmUtils.isReversed(way.get("oneway")) 118 || way.hasTag("junction", "roundabout") 119 || way.hasTag("highway", "motorway")) { 120 121 if (!way.hasTag("busway", "lane") 122 && !way.hasTag("busway", "opposite_lane") 123 && !way.hasTag("busway:left", "lane") 124 && !way.hasTag("busway:right", "lane") 125 && !way.hasTag("oneway:bus", "no") 126 && !way.hasTag("oneway:psv", "no") 133 127 && !way.hasTag("trolley_wire", "backward")) { 134 128 … … 136 130 return -1; 137 131 } 138 139 132 return 1; 140 141 133 } 142 143 } 144 134 } 145 135 return 0; 146 136 } … … 164 154 Node w2LastNode = w2.lastNode(); 165 155 166 if (w1FirstNode == w2FirstNode || w1FirstNode == w2LastNode || w1LastNode == w2FirstNode 167 || w1LastNode == w2LastNode) { 168 return true; 169 } 170 171 return false; 156 return w1FirstNode == w2FirstNode 157 || w1FirstNode == w2LastNode 158 || w1LastNode == w2FirstNode 159 || w1LastNode == w2LastNode; 172 160 } 173 161 … … 206 194 */ 207 195 public static boolean isWaySuitableForBuses(Way way) { 208 if (way.hasTag("highway", "motorway") || way.hasTag("highway", "trunk") || way.hasTag("highway", "primary") 209 || way.hasTag("highway", "secondary") || way.hasTag("highway", "tertiary") 210 || way.hasTag("highway", "unclassified") || way.hasTag("highway", "road") 211 || way.hasTag("highway", "residential") || way.hasTag("highway", "service") 212 || way.hasTag("highway", "motorway_link") || way.hasTag("highway", "trunk_link") 213 || way.hasTag("highway", "primary_link") || way.hasTag("highway", "secondary_link") 214 || way.hasTag("highway", "tertiary_link") || way.hasTag("highway", "living_street") 215 || way.hasTag("highway", "bus_guideway") || way.hasTag("highway", "road") 216 || way.hasTag("cycleway", "share_busway") || way.hasTag("cycleway", "shared_lane")) { 196 197 String [] acceptedHighwayTags = new String [] { 198 "motorway", "trunk", "primary", "secondary", "tertiary", 199 "unclassified" , "road", "residential", "service", 200 "motorway_link", "trunk_link", "primary_link", "secondary_link", 201 "tertiary_link", "living_street", "bus_guideway", "road"}; 202 203 if(way.hasTag("highway", acceptedHighwayTags) 204 || way.hasTag("cycleway", "share_busway") 205 || way.hasTag("cycleway", "shared_lane")) { 217 206 return true; 218 207 } 219 208 220 if (way.hasTag("highway", "pedestrian") && (way.hasTag("bus", "yes") || way.hasTag("psv", "yes") 221 || way.hasTag("bus", "designated") || way.hasTag("psv", "designated"))) { 209 if (way.hasTag("highway", "pedestrian") 210 && (way.hasTag("bus", "yes") 211 || way.hasTag("psv", "yes") 212 || way.hasTag("bus", "designated") 213 || way.hasTag("psv", "designated"))) { 222 214 return true; 223 215 } … … 233 225 public static boolean isWaySuitableForPublicTransport(Way way) { 234 226 235 if (isWaySuitableForBuses(way) || way.hasTag("railway", "tram") || way.hasTag("railway", "subway") 236 || way.hasTag("railway", "subway") || way.hasTag("railway", "light_rail") 237 || way.hasTag("railway", "rail")) { 238 return true; 239 } 240 241 return false; 242 243 } 244 227 String [] acceptedRailwayTags = new String [] { 228 "tram", "subway", "light_rail", "rail"}; 229 230 return isWaySuitableForBuses(way) 231 || way.hasTag("railway", acceptedRailwayTags); 232 } 245 233 }
Note:
See TracChangeset
for help on using the changeset viewer.