Changeset 18272 in josm for trunk/src/org
- Timestamp:
- 2021-10-13T11:04:07+02:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
r17927 r18272 112 112 static final int UNCONNECTED_RAILWAYS = 1321; 113 113 /** 114 115 114 * Constructs a new {@code UnconnectedRailways} test. 115 */ 116 116 public UnconnectedRailways() { 117 117 super(tr("Unconnected railways"), UNCONNECTED_RAILWAYS, false); … … 120 120 @Override 121 121 protected boolean isCandidate(OsmPrimitive p) { 122 return p.hasTagDifferent(RAILWAY, "abandoned", "platform", "razed"); 122 if (p.hasTag(RAILWAY, "construction") && p.hasKey("construction")) 123 return p.hasTagDifferent("construction", "platform", "platform_edge", "service_station", "station"); 124 return p.hasTagDifferent(RAILWAY, "proposed", "planned", "abandoned", "razed", "disused", "no", 125 "platform", "platform_edge", "service_station", "station"); 123 126 } 124 127 125 128 @Override 126 129 protected boolean ignoreUnconnectedEndNode(Node n) { 127 return n.hasTag(RAILWAY, "buffer_stop") 128 || n.isKeyTrue("noexit"); 130 if (n.hasTag(RAILWAY, "buffer_stop") || n.isKeyTrue("noexit")) 131 return true; 132 // See #21038. Check also if next node to end node is a buffer stop. 133 Way parent = getWantedParentWay(n); 134 if (parent != null && parent.getNodesCount() > 1) { 135 Node next = null; 136 if (n == parent.firstNode()) 137 next = parent.getNode(1); 138 else if (n == parent.lastNode()) { 139 next = parent.getNode(parent.getNodesCount() - 2); 140 } 141 if (next != null) 142 return next.hasTag(RAILWAY, "buffer_stop"); 143 } 144 return false; 145 129 146 } 130 147 } … … 239 256 othernodes = new HashSet<>(); 240 257 mindist = Config.getPref().getDouble(PREFIX + ".node_way_distance", 10.0); 258 if (this instanceof UnconnectedRailways) 259 mindist = Config.getPref().getDouble(PREFIX + ".node_way_distance_railway", 1.0); 241 260 minmiddledist = Config.getPref().getDouble(PREFIX + ".way_way_distance", 0.0); 242 261 ds = OsmDataManager.getInstance().getActiveDataSet(); … … 322 341 * @return the wanted way 323 342 */ 324 pr ivateWay getWantedParentWay(Node endnode) {343 protected Way getWantedParentWay(Node endnode) { 325 344 for (Way w : endnode.getParentWays()) { 326 345 if (isWantedWay(w))
Note:
See TracChangeset
for help on using the changeset viewer.