Changeset 32743 in osm for applications/editors/josm/plugins/pt_assistant/src
- Timestamp:
- 2016-07-30T00:31:27+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/validation/SegmentChecker.java
r32741 r32743 241 241 for (int i = 1; i < manager.getPTStopCount(); i++) { 242 242 243 this.firstNodeOfRouteSegmentInDirectionOfTravel = null;243 // this.firstNodeOfRouteSegmentInDirectionOfTravel = null; 244 244 245 245 PTStop startStop = manager.getPTStops().get(i - 1); … … 249 249 Way endWay = assigner.get(endStop); 250 250 if (startWay == null || endWay == null) { 251 this.firstNodeOfRouteSegmentInDirectionOfTravel = null;252 251 continue; 253 252 } … … 255 254 List<PTWay> segmentWays = manager.getPTWaysBetween(startWay, endWay); 256 255 257 if (this.firstNodeOfRouteSegmentInDirectionOfTravel == null) { 258 // if we are at the beginning of the route or after a gap / 259 // error: 260 261 this.firstNodeOfRouteSegmentInDirectionOfTravel = findFirstNodeOfRouteSegmentInDirectionOfTravel( 262 segmentWays.get(0)); 263 if (this.firstNodeOfRouteSegmentInDirectionOfTravel == null) { 264 // check if this error has just been reported: 265 TestError previousError = this.errors.get(this.errors.size() - 1); 266 if (previousError.getHighlighted().size() == 1 267 && previousError.getHighlighted().iterator().next() == startWay) { 268 // do nothing, this error has already been reported in 269 // the previous step 270 } else { 271 List<Relation> primitives = new ArrayList<>(1); 272 primitives.add(relation); 273 List<OsmPrimitive> highlighted = new ArrayList<>(); 274 highlighted.add(startWay); 275 TestError e = new TestError(this.test, Severity.WARNING, tr("PT: Problem in the route segment"), 276 PTAssistantValidatorTest.ERROR_CODE_STOP_BY_STOP, primitives, highlighted); 277 this.errors.add(e); 278 PTRouteSegment routeSegment = new PTRouteSegment(startStop, endStop, segmentWays); 279 wrongSegments.put(e, routeSegment); 280 } 281 continue; 282 } 256 Node testNode = findFirstNodeOfRouteSegmentInDirectionOfTravel( 257 segmentWays.get(0)); 258 if (testNode == null) { 259 // check if this error has just been reported: 260 if (!this.errors.isEmpty() && this.errors.get(this.errors.size() - 1).getHighlighted().size() == 1 261 && this.errors.get(this.errors.size() - 1).getHighlighted().iterator().next() == startWay) { 262 // do nothing, this error has already been reported in 263 // the previous route segment 264 } else { 265 List<Relation> primitives = new ArrayList<>(1); 266 primitives.add(relation); 267 List<OsmPrimitive> highlighted = new ArrayList<>(); 268 highlighted.add(startWay); 269 TestError e = new TestError(this.test, Severity.WARNING, tr("PT: Problem in the route segment"), 270 PTAssistantValidatorTest.ERROR_CODE_STOP_BY_STOP, primitives, highlighted); 271 this.errors.add(e); 272 PTRouteSegment routeSegment = new PTRouteSegment(startStop, endStop, segmentWays); 273 wrongSegments.put(e, routeSegment); 274 } 275 continue; 283 276 } 284 277 285 278 boolean sortingCorrect = existingWaySortingIsCorrect(segmentWays.get(0), 286 t his.firstNodeOfRouteSegmentInDirectionOfTravel, segmentWays.get(segmentWays.size() - 1));279 testNode, segmentWays.get(segmentWays.size() - 1)); 287 280 if (sortingCorrect) { 288 281 PTRouteSegment routeSegment = new PTRouteSegment(startStop, endStop, segmentWays); … … 413 406 if (start == end) { 414 407 // if both PTStops are on the same PTWay 415 this.firstNodeOfRouteSegmentInDirectionOfTravel = null;416 408 return true; 417 409 } 418 410 419 411 PTWay current = start; 412 Node currentNode = startWayPreviousNodeInDirectionOfTravel; 420 413 421 414 while (!current.equals(end)) { … … 428 421 // if current contains an unsplit roundabout: 429 422 if (current.containsUnsplitRoundabout()) { 430 firstNodeOfRouteSegmentInDirectionOfTravel = manager.getCommonNode(current, 431 nextPTWayAccortingToExistingSorting); 432 if (firstNodeOfRouteSegmentInDirectionOfTravel == null) { 423 currentNode = manager.getCommonNode(current, nextPTWayAccortingToExistingSorting); 424 if (currentNode == null) { 433 425 List<Relation> primitives = new ArrayList<>(1); 434 426 primitives.add(relation); … … 445 437 // find the next node in direction of travel (which is part of 446 438 // the PTWay start): 447 firstNodeOfRouteSegmentInDirectionOfTravel = getOppositeEndNode(current, 448 firstNodeOfRouteSegmentInDirectionOfTravel); 439 currentNode = getOppositeEndNode(current, currentNode); 449 440 450 441 List<PTWay> nextWaysInDirectionOfTravel = this.findNextPTWaysInDirectionOfTravel(current, 451 firstNodeOfRouteSegmentInDirectionOfTravel);442 currentNode); 452 443 453 444 if (!nextWaysInDirectionOfTravel.contains(nextPTWayAccortingToExistingSorting)) { … … 457 448 458 449 highlighted.addAll(current.getWays()); 459 highlighted.add( firstNodeOfRouteSegmentInDirectionOfTravel);450 highlighted.add(currentNode); 460 451 461 452 TestError e = new TestError(this.test, Severity.WARNING, tr("PT: Problem in the route segment"), 462 453 PTAssistantValidatorTest.ERROR_CODE_STOP_BY_STOP, primitives, highlighted); 463 454 this.errors.add(e); 464 this.firstNodeOfRouteSegmentInDirectionOfTravel = null;465 455 return false; 466 456
Note:
See TracChangeset
for help on using the changeset viewer.