Changeset 32791 in osm
- Timestamp:
- 2016-08-09T20:58:07+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/utils/StopUtils.java
r32783 r32791 1 1 package org.openstreetmap.josm.plugins.pt_assistant.utils; 2 2 3 import static org.openstreetmap.josm.tools.I18n.tr;4 5 import java.util.ArrayList;6 import java.util.Collection;7 import java.util.List;8 9 import org.openstreetmap.josm.data.osm.Node;10 3 import org.openstreetmap.josm.data.osm.OsmPrimitive; 11 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;12 import org.openstreetmap.josm.data.osm.OsmUtils;13 4 import org.openstreetmap.josm.data.osm.Relation; 14 import org.openstreetmap.josm.data.osm.RelationMember;15 import org.openstreetmap.josm.data.osm.Way;16 import org.openstreetmap.josm.data.validation.TestError;17 import org.openstreetmap.josm.plugins.pt_assistant.data.PTRouteDataManager;18 import org.openstreetmap.josm.plugins.pt_assistant.validation.PTAssistantValidatorTest;19 5 20 6 /** -
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/NodeChecker.java
r32783 r32791 5 5 import java.lang.reflect.InvocationTargetException; 6 6 import java.util.ArrayList; 7 import java.util.HashMap; 7 8 import java.util.List; 8 import java.util.Set;9 import java.util.LinkedList;10 import java.util.Collection;11 import java.util.HashMap;12 import java.util.Collections;13 9 14 10 import javax.swing.JOptionPane; … … 22 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 23 19 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 24 import org.openstreetmap.josm.data.osm.Way;25 20 import org.openstreetmap.josm.data.osm.Relation; 26 21 import org.openstreetmap.josm.data.osm.RelationMember; 22 import org.openstreetmap.josm.data.osm.Way; 27 23 import org.openstreetmap.josm.data.validation.Severity; 28 24 import org.openstreetmap.josm.data.validation.Test; … … 89 85 } 90 86 } 91 87 92 88 /** 93 89 * Checks if the given stop_position node belongs to any stop_area relation … … 96 92 */ 97 93 protected void performNodePartOfStopAreaTest() { 98 94 99 95 if (!StopUtils.verifyIfMemberOfStopArea(node)) { 100 96 101 97 List<OsmPrimitive> primitives = new ArrayList<>(1); 102 98 primitives.add(node); 103 TestError e = new TestError(this.test, Severity.WARNING, tr("PT: Stop position or platform is not part of a stop area relation"), 99 TestError e = new TestError(this.test, Severity.WARNING, 100 tr("PT: Stop position or platform is not part of a stop area relation"), 104 101 PTAssistantValidatorTest.ERROR_CODE_NODE_PART_OF_STOP_AREA, primitives); 105 102 errors.add(e); 106 103 } 107 104 } 108 109 /** 110 * Checks if the given stop_position belongs to the same route relations as it's related platform(s). * 105 106 /** 107 * Checks if the given stop_position belongs to the same route relations as 108 * its related platform(s). * 109 * 111 110 * @param n 112 111 */ … … 123 122 stopPositionRelationIds.put(referrer.getId(), referrer.getId()); 124 123 } 125 124 126 125 // Create list of relations the related platform(s) belongs to 127 126 else if (referrer.get("public_transport") == "stop_area") { 128 127 for (RelationMember stopAreaMember : referrer.getMembers()) { 129 Node stopAreaMemberFoo = stopAreaMember.getNode(); 130 if (stopAreaMemberFoo.get("public_transport") == "platform") { 131 for (Relation stopAreaMemberReferrer : OsmPrimitive.getFilteredList(stopAreaMemberFoo.getReferrers(), Relation.class)) { 132 if (stopAreaMemberReferrer.get("type") == "route") { 133 platformRelationIds.put(stopAreaMemberReferrer.getId(), stopAreaMemberReferrer.getId()); 128 if (stopAreaMember.isNode()) { 129 Node stopAreaMemberFoo = stopAreaMember.getNode(); 130 if (stopAreaMemberFoo.get("public_transport") == "platform") { 131 for (Relation stopAreaMemberReferrer : OsmPrimitive 132 .getFilteredList(stopAreaMemberFoo.getReferrers(), Relation.class)) { 133 if (stopAreaMemberReferrer.get("type") == "route") { 134 platformRelationIds.put(stopAreaMemberReferrer.getId(), 135 stopAreaMemberReferrer.getId()); 136 } 134 137 } 135 138 } … … 143 146 return; 144 147 } 145 148 146 149 List<OsmPrimitive> primitives = new ArrayList<>(1); 147 150 primitives.add(node); 148 TestError e = new TestError(this.test, Severity.WARNING, tr("PT: Stop position and it's related platform(s) have different route relations"), 151 TestError e = new TestError(this.test, Severity.WARNING, 152 tr("PT: Stop position and its related platform(s) have different route relations"), 149 153 PTAssistantValidatorTest.ERROR_CODE_STOP_POSITION_COMPARE_RELATIONS, primitives); 150 154 errors.add(e); 151 155 } 152 153 156 154 157 /** -
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/PTAssistantValidatorTest.java
r32783 r32791 5 5 import java.lang.reflect.InvocationTargetException; 6 6 import java.util.ArrayList; 7 import java.util.Collection;8 import java.util.LinkedList;9 7 import java.util.List; 10 import java.util.Set;11 8 12 9 import javax.swing.JOptionPane; … … 17 14 import org.openstreetmap.josm.data.osm.DataSet; 18 15 import org.openstreetmap.josm.data.osm.Node; 19 import org.openstreetmap.josm.data.osm.OsmPrimitive;20 16 import org.openstreetmap.josm.data.osm.Relation; 21 17 import org.openstreetmap.josm.data.osm.Way; … … 33 29 import org.openstreetmap.josm.plugins.pt_assistant.gui.ProceedDialog; 34 30 import org.openstreetmap.josm.plugins.pt_assistant.utils.RouteUtils; 31 import org.openstreetmap.josm.plugins.pt_assistant.utils.StopToWayAssigner; 35 32 import org.openstreetmap.josm.plugins.pt_assistant.utils.StopUtils; 36 import org.openstreetmap.josm.plugins.pt_assistant.utils.StopToWayAssigner;37 33 38 34 public class PTAssistantValidatorTest extends Test { … … 111 107 public void visit(Relation r) { 112 108 109 System.out.println("starting: visit relation id=" + r.getId() + ", ref: " + r.get("ref") + ", " + r.getMembersCount() + " members"); 110 113 111 // Do some testing on stop area relations 114 112 if (StopUtils.isStopArea(r)) { … … 133 131 134 132 if (!RouteUtils.isTwoDirectionRoute(r)) { 133 System.out.println("return: not two-direction route"); 135 134 return; 136 135 } … … 142 141 boolean downloadSuccessful = this.downloadIncompleteMembers(); 143 142 if (!downloadSuccessful) { 143 System.out.println("return: download not successful"); 144 144 return; 145 145 } … … 147 147 148 148 if (r.hasIncompleteMembers()) { 149 System.out.println("return: has incomplete members"); 149 150 return; 150 151 } … … 164 165 this.proceedAfterWayCheckerErrors(r); 165 166 } 167 168 System.out.println("ending: visit relation id=" + r.getId() + ", ref: " + r.get("ref") + ", " + r.getMembersCount() + " members"); 166 169 167 170 } -
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/StopChecker.java
r32783 r32791 4 4 5 5 import java.util.ArrayList; 6 import java.util.Collection;7 6 import java.util.List; 8 7 import java.util.Set; 9 import java.util.HashMap;10 8 11 12 import org.openstreetmap.josm.command.ChangeCommand;13 import org.openstreetmap.josm.command.Command;14 9 import org.openstreetmap.josm.data.osm.OsmPrimitive; 15 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;16 10 import org.openstreetmap.josm.data.osm.Relation; 17 import org.openstreetmap.josm.data.osm.RelationMember;18 import org.openstreetmap.josm.data.osm.Way;19 11 import org.openstreetmap.josm.data.validation.Severity; 20 12 import org.openstreetmap.josm.data.validation.Test;
Note:
See TracChangeset
for help on using the changeset viewer.