Changeset 32895 in osm for applications/editors/josm/plugins/pt_assistant/src/org
- Timestamp:
- 2016-09-02T00:46:23+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/data/PTRouteDataManager.java
r32823 r32895 4 4 import java.util.HashSet; 5 5 import java.util.List; 6 import java.util.Set; 6 7 7 8 import org.openstreetmap.josm.data.coor.LatLon; … … 34 35 * expected in the model for public_transport version 2 35 36 */ 36 private List<RelationMember> failedMembers = new ArrayList<>();37 private Set<RelationMember> failedMembers = new HashSet<>(); 37 38 38 39 public PTRouteDataManager(Relation relation) throws IllegalArgumentException { … … 45 46 46 47 PTStop prev = null; // stores the last created PTStop 47 48 48 49 for (RelationMember member : this.relation.getMembers()) { 49 50 … … 64 65 stopExists = true; 65 66 } 66 67 67 68 } else { 68 69 … … 88 89 } else { 89 90 // this PTStop does not exist yet, so create it: 90 PTStop ptstop = new PTStop(member); 91 ptstops.add(ptstop); 92 prev = ptstop; 91 92 try { 93 PTStop ptstop = new PTStop(member); 94 ptstops.add(ptstop); 95 prev = ptstop; 96 } catch (IllegalArgumentException ex) { 97 if (ex.getMessage().equals( 98 "The RelationMember type does not match its role " + member.getMember().getName())) { 99 if (!failedMembers.contains(member)) { 100 failedMembers.add(member); 101 } 102 } else { 103 throw ex; 104 } 105 } 106 93 107 } 94 108 … … 99 113 100 114 } else { 101 102 this.failedMembers.add(member); 103 115 if (!failedMembers.contains(member)) { 116 failedMembers.add(member); 117 } 118 104 119 } 105 120 … … 183 198 } 184 199 185 public List<RelationMember> getFailedMembers() {200 public Set<RelationMember> getFailedMembers() { 186 201 return this.failedMembers; 187 202 } … … 399 414 return null; 400 415 } 401 416 402 417 /** 403 418 * Returns the last way of this route 419 * 404 420 * @return 405 421 */ 406 422 public Way getLastWay() { 407 PTWay lastPTWay = this.ptways.get(ptways.size() -1);423 PTWay lastPTWay = this.ptways.get(ptways.size() - 1); 408 424 if (lastPTWay == null) { 409 425 return null; 410 426 } 411 return lastPTWay.getWays().get(lastPTWay.getWays().size() -1);427 return lastPTWay.getWays().get(lastPTWay.getWays().size() - 1); 412 428 } 413 429 -
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/gui/PTAssistantPaintVisitor.java
r32874 r32895 303 303 g.setColor(Color.BLUE); 304 304 305 if (primitive.hasTag("public_transport", "stop_position") ) {305 if (primitive.hasTag("public_transport", "stop_position") && p != null) { 306 306 g.fillOval(p.x - 8, p.y - 8, 16, 16); 307 307 } else { -
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/utils/RouteUtils.java
r32874 r32895 62 62 public static boolean isPTStop(RelationMember rm) { 63 63 64 // if (rm.hasRole("stop") || rm.hasRole("stop_entry_only") ||65 // rm.hasRole("stop_exit_only")66 // || rm.hasRole("platform") || rm.hasRole("platform_entry_only") ||67 // rm.hasRole("platform_exit_only")) {68 64 69 65 if (rm.getType().equals(OsmPrimitiveType.NODE)) { 70 71 if (rm.getNode().hasTag("public_transport", "stop_position") || rm.getNode().hasTag("highway", "bus_stop")72 || rm.getNode().hasTag("public_transport", "platform") || rm.getNode().hasTag("highway", "platform")73 || rm.getNode().hasTag("railway", "platform")) {74 66 return true; 75 76 }77 67 } 78 68 … … 83 73 } 84 74 } 85 // }86 75 87 76 return false; -
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/PTAssistantValidatorTest.java
r32871 r32895 308 308 private int showProceedDialog(long id, int numberOfDirectionErrors, int numberOfRoadTypeErrors) { 309 309 310 if (numberOfDirectionErrors == 0 && numberOf DirectionErrors == 0) {310 if (numberOfDirectionErrors == 0 && numberOfRoadTypeErrors == 0) { 311 311 return 2; 312 312 } … … 395 395 segmentChecker.findFixes(); 396 396 } 397 398 this.errors.addAll(segmentChecker.getErrors()); 397 398 for (TestError error: segmentChecker.getErrors()) { 399 if (error.getCode() != PTAssistantValidatorTest.ERROR_CODE_RELAITON_MEMBER_ROLES) { 400 this.errors.add(error); 401 } 402 } 399 403 } 400 404
Note:
See TracChangeset
for help on using the changeset viewer.