Ticket #6022: fixcrossways.patch
File fixcrossways.patch, 3.2 KB (added by , 13 years ago) |
---|
-
src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
66 66 if(!w.isUsable()) 67 67 return; 68 68 69 String coastline1 = w.get("natural"); 70 boolean isCoastline1 = "water".equals(coastline1) || "coastline".equals(coastline1); 69 String natural1 = w.get("natural"); 70 String landuse1 = w.get("landuse"); 71 boolean isCoastline1 = "water".equals(natural1) || "coastline".equals(natural1) || "reservoir".equals(landuse1); 71 72 String railway1 = w.get("railway"); 72 73 boolean isSubway1 = "subway".equals(railway1); 73 74 boolean isTram1 = "tram".equals(railway1); … … 79 80 return; 80 81 81 82 String layer1 = w.get("layer"); 83 if ("0".equals(layer1)) layer1 = null; //0 is default value 82 84 83 85 int nodesSize = w.getNodesCount(); 84 86 for (int i = 0; i < nodesSize - 1; i++) { 85 87 WaySegment ws = new WaySegment(w, i); 86 ExtendedSegment es1 = new ExtendedSegment(ws, layer1, railway1, coastline1);88 ExtendedSegment es1 = new ExtendedSegment(ws, layer1, railway1, isCoastline1); 87 89 List<List<ExtendedSegment>> cellSegments = getSegments(es1.n1, es1.n2); 88 90 for (List<ExtendedSegment> segments : cellSegments) { 89 91 for (ExtendedSegment es2 : segments) { … … 95 97 96 98 String layer2 = es2.layer; 97 99 String railway2 = es2.railway; 98 String coastline2 = es2.coastline;100 boolean isCoastline2 = es2.coastline; 99 101 if (layer1 == null ? layer2 != null : !layer1.equals(layer2)) 100 102 continue; 101 103 … … 103 105 if (isSubway1 && "subway".equals(railway2)) continue; 104 106 if (isTram1 && "tram".equals(railway2)) continue; 105 107 106 boolean isCoastline2 = coastline2 != null && (coastline2.equals("water") || coastline2.equals("coastline"));107 108 if (isCoastline1 != isCoastline2) continue; 108 109 109 110 if ((es1.railway != null && es1.railway.equals("abandoned")) … … 169 170 public String railway; 170 171 171 172 /** The coastline type */ 172 public Stringcoastline;173 public boolean coastline; 173 174 174 175 /** 175 176 * Constructor 176 177 * @param ws The way segment 177 178 * @param layer The layer of the way this segment is in 178 179 * @param railway The railway type of the way this segment is in 179 * @param coastline The coastline typoof the way the segment is in180 * @param coastline The coastline flag of the way the segment is in 180 181 */ 181 public ExtendedSegment(WaySegment ws, String layer, String railway, Stringcoastline) {182 public ExtendedSegment(WaySegment ws, String layer, String railway, boolean coastline) { 182 183 this.ws = ws; 183 184 this.n1 = ws.way.getNodes().get(ws.lowerIndex); 184 185 this.n2 = ws.way.getNodes().get(ws.lowerIndex + 1);