Changeset 33475 in osm for applications/editors
- Timestamp:
- 2017-07-27T18:55:55+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/RouteChecker.java
r33467 r33475 8 8 import java.util.Collection; 9 9 import java.util.List; 10 import java.util.Map.Entry; 10 11 11 12 import org.openstreetmap.josm.command.ChangeCommand; … … 102 103 protected boolean performFromToTagsTest() { 103 104 104 String from = relation.get("from") ;105 String to = relation.get("to") ;105 String from = relation.get("from").toLowerCase(); 106 String to = relation.get("to").toLowerCase(); 106 107 if (from == null || to == null || manager.getPTStopCount() == 0) { 107 108 return false; … … 180 181 //given a PTStop and a name, check whether one of its primitives have a 181 182 //different name from the one passed. if so, it returns the primitive. 183 //it compares not only the name tag but all the name:* names 182 184 //it returns null if the names match 183 185 private OsmPrimitive checkPTStopName(PTStop stop, String name) { 184 186 OsmPrimitive primitive = null; 185 String toCheck = null;187 List<String> toCheck = new ArrayList<>(); 186 188 if (stop.getPlatform() != null) { 187 toCheck = stop.getPlatform().getName();188 189 primitive = stop.getPlatform(); 189 }190 if (toCheck == null && stop.getStopPosition() != null) {191 toCheck = stop.getStopPosition().getName();190 toCheck.addAll(getPrimitiveNameTags(primitive)); 191 } 192 if (toCheck.isEmpty() && stop.getStopPosition() != null) { 192 193 primitive = stop.getStopPosition(); 193 } 194 195 if (toCheck != null && !toCheck.equals(name)) 196 return primitive; 194 toCheck.addAll(getPrimitiveNameTags(primitive)); 195 } 196 197 for (String value : toCheck) { 198 if (value.equals(name)) { 199 return primitive; 200 } 201 } 197 202 198 203 return null; 204 } 205 206 private List<String> getPrimitiveNameTags(OsmPrimitive primitive) { 207 List<String> ret = new ArrayList<>(); 208 for (Entry<String, String> entry : primitive.getInterestingTags().entrySet()) { 209 if ("name".equals(entry.getKey()) 210 || entry.getKey().contains("name:")) { 211 ret.add(entry.getValue().toLowerCase()); 212 } 213 } 214 return ret; 199 215 } 200 216
Note:
See TracChangeset
for help on using the changeset viewer.