Changeset 32219 in osm for applications/editors/josm/plugins/pt_assistant
- Timestamp:
- 2016-06-04T12:28:57+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/pt_assistant
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/utils/RouteUtils.java
r32216 r32219 1 1 package org.openstreetmap.josm.plugins.pt_assistant.utils; 2 2 3 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 3 4 import org.openstreetmap.josm.data.osm.Relation; 5 import org.openstreetmap.josm.data.osm.RelationMember; 6 import org.openstreetmap.josm.data.osm.Way; 4 7 5 8 /** … … 36 39 } 37 40 41 /** 42 * Checks if the relation member refers to a stop in a public transport 43 * route. Some stops can be modeled with ways. 44 * 45 * @param rm 46 * relation member to be checked 47 * @return true if the relation member refers to a stop, false otherwise 48 */ 49 public static boolean isPTStop(RelationMember rm) { 50 51 return !isPTWay(rm); 52 53 } 54 55 /** 56 * Checks if the relation member refers to a way in a public transport 57 * route. Some OsmPrimitiveType.WAY have to be excluded because platforms 58 * can be modeled with ways. 59 * 60 * @param rm relation member to be checked 61 * @return true if the relation member refers to a way in a public transport route, false otherwise. 62 */ 63 public static boolean isPTWay(RelationMember rm) { 64 65 if (rm.hasRole("") && OsmPrimitiveType.WAY.equals(rm.getType())) { 66 Way way = rm.getWay(); 67 if (!way.hasTag("public_transport", "platform") && !way.hasTag("highway", "platform") 68 && !way.hasTag("railway", "platform")) { 69 return true; 70 } 71 } 72 73 return false; 74 } 75 38 76 } -
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/GapTest.java
r32217 r32219 41 41 final List<RelationMember> waysToCheck = new ArrayList<>(); 42 42 for (RelationMember member : members) { 43 if (member.hasRole("") && OsmPrimitiveType.WAY.equals(member.getType())) { 44 Way way = member.getWay(); 45 if (!way.hasTag("public_transport", "platform") && !way.hasTag("highway", "platform") 46 && !way.hasTag("railway", "platform")) { 47 waysToCheck.add(member); 48 } 43 44 if (RouteUtils.isPTWay(member)) { 45 waysToCheck.add(member); 49 46 } 50 47 } … … 213 210 // if the error is a single overshoot: 214 211 if (testError.getCode() == ERROR_CODE_OVERSHOOT) { 215 // commands.add(testError.getFix()); 212 216 213 for (OsmPrimitive primitive : testError.getPrimitives()) { 217 214 Relation originalRelation = (Relation) primitive; 218 215 Relation modifiedRelation = new Relation(originalRelation); 219 216 List<RelationMember> modifiedMembers = new ArrayList<>(); 217 // add stops of a public transport route first: 220 218 for (RelationMember rm : originalRelation.getMembers()) { 221 if (rm.getType().equals(OsmPrimitiveType.WAY) && !overshootList.contains(rm)) { 219 if (RouteUtils.isPTStop(rm)) { 220 modifiedMembers.add(rm); 221 } 222 223 } 224 // add ways of a public transport route (if they are not overshoots): 225 for (RelationMember rm: originalRelation.getMembers()) { 226 if (RouteUtils.isPTWay(rm) && !overshootList.contains(rm)) { 222 227 modifiedMembers.add(rm); 223 228 }
Note:
See TracChangeset
for help on using the changeset viewer.