Changeset 33513 in osm
- Timestamp:
- 2017-08-22T11:52:57+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/utils/RouteUtils.java
r33469 r33513 20 20 21 21 private static final String PT_VERSION_TAG = "public_transport:version"; 22 p rivatestatic final String TAG_ROUTE = "route";22 public static final String TAG_ROUTE = "route"; 23 23 private RouteUtils() { 24 24 // private constructor for util classes -
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/WayChecker.java
r33505 r33513 42 42 protected void performRoadTypeTest() { 43 43 44 if (!relation.hasTag( "route", "bus") && !relation.hasTag("route", "trolleybus")45 && !relation.hasTag( "route", "share_taxi")) {44 if (!relation.hasTag(RouteUtils.TAG_ROUTE, "bus") && !relation.hasTag(RouteUtils.TAG_ROUTE, "trolleybus") 45 && !relation.hasTag(RouteUtils.TAG_ROUTE, "share_taxi")) { 46 46 return; 47 47 } … … 59 59 isUnderConstruction = true; 60 60 } 61 if (relation.hasTag( "route", "bus") || relation.hasTag("route", "share_taxi")) {61 if (relation.hasTag(RouteUtils.TAG_ROUTE, "bus") || relation.hasTag(RouteUtils.TAG_ROUTE, "share_taxi")) { 62 62 if (!RouteUtils.isWaySuitableForBuses(way)) { 63 63 isCorrectRoadType = false; … … 66 66 isUnderConstruction = true; 67 67 } 68 } else if (relation.hasTag( "route", "trolleybus")) {68 } else if (relation.hasTag(RouteUtils.TAG_ROUTE, "trolleybus")) { 69 69 if (!(RouteUtils.isWaySuitableForBuses(way) && way.hasTag("trolley_wire", "yes"))) { 70 70 isCorrectRoadType = false; … … 73 73 isUnderConstruction = true; 74 74 } 75 } else if (relation.hasTag( "route", "tram")) {75 } else if (relation.hasTag(RouteUtils.TAG_ROUTE, "tram")) { 76 76 if (!way.hasTag("railway", "tram")) { 77 77 isCorrectRoadType = false; … … 80 80 isUnderConstruction = true; 81 81 } 82 } else if (relation.hasTag( "route", "subway", "light_rail")) {82 } else if (relation.hasTag(RouteUtils.TAG_ROUTE, "subway", "light_rail")) { 83 83 if (!way.hasTag("railway", "subway")) { 84 84 isCorrectRoadType = false; … … 87 87 isUnderConstruction = true; 88 88 } 89 } else if (relation.hasTag( "route", "light_rail")) {89 } else if (relation.hasTag(RouteUtils.TAG_ROUTE, "light_rail")) { 90 90 if (!way.hasTag("railway", "light_rail")) { 91 91 isCorrectRoadType = false; … … 94 94 isUnderConstruction = true; 95 95 } 96 } else if (relation.hasTag( "route", "train")) {96 } else if (relation.hasTag(RouteUtils.TAG_ROUTE, "train")) { 97 97 if (!way.hasTag("railway", "rail", "narrow_gauge")) { 98 98 isCorrectRoadType = false; … … 240 240 } 241 241 242 if (prev != null) { 243 244 if (RouteUtils.waysTouch(curr, prev)) { 245 Node nodeInQuestion; 246 if (RouteUtils.isOnewayForPublicTransport(curr) == 1) { 247 nodeInQuestion = curr.firstNode(); 248 } else { 249 nodeInQuestion = curr.lastNode(); 250 } 251 252 List<Way> nb = findNeighborWays(curr, nodeInQuestion); 253 254 if (nb.size() < 2 && nodeInQuestion != prev.firstNode() && nodeInQuestion != prev.lastNode()) { 255 return false; 256 } 257 } 258 } 259 260 if (next != null) { 261 262 if (RouteUtils.waysTouch(curr, next)) { 263 Node nodeInQuestion; 264 if (RouteUtils.isOnewayForPublicTransport(curr) == 1) { 265 nodeInQuestion = curr.lastNode(); 266 } else { 267 nodeInQuestion = curr.firstNode(); 268 } 269 270 List<Way> nb = findNeighborWays(curr, nodeInQuestion); 271 272 if (nb.size() < 2 && nodeInQuestion != next.firstNode() && nodeInQuestion != next.lastNode()) { 273 return false; 274 } 242 if (prev != null && RouteUtils.waysTouch(curr, prev)) { 243 Node nodeInQuestion; 244 if (RouteUtils.isOnewayForPublicTransport(curr) == 1) { 245 nodeInQuestion = curr.firstNode(); 246 } else { 247 nodeInQuestion = curr.lastNode(); 248 } 249 250 List<Way> nb = findNeighborWays(curr, nodeInQuestion); 251 252 if (nb.size() < 2 && nodeInQuestion != prev.firstNode() && nodeInQuestion != prev.lastNode()) { 253 return false; 254 } 255 } 256 257 if (next != null && RouteUtils.waysTouch(curr, next)) { 258 Node nodeInQuestion; 259 if (RouteUtils.isOnewayForPublicTransport(curr) == 1) { 260 nodeInQuestion = curr.lastNode(); 261 } else { 262 nodeInQuestion = curr.firstNode(); 263 } 264 265 List<Way> nb = findNeighborWays(curr, nodeInQuestion); 266 267 if (nb.size() < 2 && nodeInQuestion != next.firstNode() && nodeInQuestion != next.lastNode()) { 268 return false; 275 269 } 276 270 } … … 288 282 289 283 if (RouteUtils.isOnewayForPublicTransport(curr) == 0) { 290 return null;284 return resultSet; 291 285 } 292 286 … … 310 304 } 311 305 312 if (RouteUtils.isOnewayForPublicTransport(nb) == 1 && nb.firstNode() == firstNodeInRouteDirection) { 313 Set<Way> newSet = this.checkAdjacentWays(nb, resultSet); 306 int oneway = RouteUtils.isOnewayForPublicTransport(nb); 307 if ((oneway == 1 && nb.firstNode() == firstNodeInRouteDirection) || 308 (oneway == -1 && nb.lastNode() == firstNodeInRouteDirection)) { 309 Set<Way> newSet = checkAdjacentWays(nb, resultSet); 314 310 resultSet.addAll(newSet); 315 316 } else if (RouteUtils.isOnewayForPublicTransport(nb) == -1 && nb.lastNode() == firstNodeInRouteDirection) {317 Set<Way> newSet = this.checkAdjacentWays(nb, resultSet);318 resultSet.addAll(newSet);319 320 311 } 321 312 } … … 327 318 } 328 319 329 if (RouteUtils.isOnewayForPublicTransport(nb) == 1 && nb.lastNode() == lastNodeInRouteDirection) { 330 Set<Way> newSet = this.checkAdjacentWays(nb, resultSet); 320 int oneway = RouteUtils.isOnewayForPublicTransport(nb); 321 if ((oneway == 1 && nb.lastNode() == lastNodeInRouteDirection) || 322 (oneway == -1 && nb.firstNode() == lastNodeInRouteDirection)) { 323 Set<Way> newSet = checkAdjacentWays(nb, resultSet); 331 324 resultSet.addAll(newSet); 332 } else if (RouteUtils.isOnewayForPublicTransport(nb) == -1 && nb.firstNode() == lastNodeInRouteDirection) { 333 Set<Way> newSet = this.checkAdjacentWays(nb, resultSet); 334 resultSet.addAll(newSet); 335 } 336 325 } 337 326 } 338 327 339 328 return resultSet; 340 341 329 } 342 330 … … 443 431 modifiedRelation.setMembers(modifiedRelationMembers); 444 432 445 ChangeCommand changeCommand = new ChangeCommand(originalRelation, modifiedRelation); 446 447 return changeCommand; 433 return new ChangeCommand(originalRelation, modifiedRelation); 448 434 } 449 435
Note:
See TracChangeset
for help on using the changeset viewer.