Changeset 8510 in josm for trunk/src/org/openstreetmap/josm/data/validation
- Timestamp:
- 2015-06-20T23:42:21+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/validation
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r8378 r8510 168 168 pathDir.mkdirs(); 169 169 } 170 } catch (Exception e) {170 } catch (Exception e) { 171 171 Main.error(e); 172 172 } … … 242 242 243 243 private static void applyPrefs(Map<String, Test> tests, boolean beforeUpload) { 244 for (String testName : Main.pref.getCollection(beforeUpload244 for (String testName : Main.pref.getCollection(beforeUpload 245 245 ? ValidatorPreference.PREF_SKIP_TESTS_BEFORE_UPLOAD : ValidatorPreference.PREF_SKIP_TESTS)) { 246 246 Test test = tests.get(testName); -
trunk/src/org/openstreetmap/josm/data/validation/TestError.java
r8435 r8510 317 317 v.visit((WaySegment) o); 318 318 } else if (o instanceof List<?>) { 319 v.visit((List<Node>) o);319 v.visit((List<Node>) o); 320 320 } 321 321 } … … 366 366 367 367 @Override public void primitivesAdded(PrimitivesAddedEvent event) {} 368 368 369 @Override public void tagsChanged(TagsChangedEvent event) {} 370 369 371 @Override public void nodeMoved(NodeMovedEvent event) {} 372 370 373 @Override public void wayNodesChanged(WayNodesChangedEvent event) {} 374 371 375 @Override public void relationMembersChanged(RelationMembersChangedEvent event) {} 376 372 377 @Override public void otherDatasetChange(AbstractDatasetChangedEvent event) {} 378 373 379 @Override public void dataChanged(DataChangedEvent event) {} 374 380 -
trunk/src/org/openstreetmap/josm/data/validation/ValidatorVisitor.java
r8378 r8510 10 10 public interface ValidatorVisitor { 11 11 void visit(TestError error); 12 12 13 void visit(OsmPrimitive p); 14 13 15 void visit(WaySegment ws); 16 14 17 void visit(List<Node> nodes); 15 18 } -
trunk/src/org/openstreetmap/josm/data/validation/routines/DomainValidator.java
r8419 r8510 115 115 */ 116 116 public static DomainValidator getInstance(boolean allowLocal) { 117 if (allowLocal) {117 if (allowLocal) { 118 118 return DOMAIN_VALIDATOR_WITH_LOCAL; 119 119 } … … 138 138 if (groups != null && groups.length > 0) { 139 139 return isValidTld(groups[0]); 140 } else if (allowLocal) {140 } else if (allowLocal) { 141 141 if (hostnameRegex.isValid(domain)) { 142 142 return true; … … 154 154 */ 155 155 public boolean isValidTld(String tld) { 156 if (allowLocal && isValidLocalTld(tld)) {156 if (allowLocal && isValidLocalTld(tld)) { 157 157 return true; 158 158 } -
trunk/src/org/openstreetmap/josm/data/validation/routines/EmailValidator.java
r7937 r8510 88 88 */ 89 89 public static EmailValidator getInstance(boolean allowLocal) { 90 if (allowLocal) {90 if (allowLocal) { 91 91 return EMAIL_VALIDATOR_WITH_LOCAL; 92 92 } -
trunk/src/org/openstreetmap/josm/data/validation/routines/InetAddressValidator.java
r8461 r8510 82 82 try { 83 83 iIpSegment = Integer.parseInt(ipSegment); 84 } catch (NumberFormatException e) {84 } catch (NumberFormatException e) { 85 85 return false; 86 86 } -
trunk/src/org/openstreetmap/josm/data/validation/routines/RegexValidator.java
r8394 r8510 107 107 } 108 108 patterns = new Pattern[regexs.length]; 109 int flags = caseSensitive ? 0 : Pattern.CASE_INSENSITIVE;109 int flags = caseSensitive ? 0 : Pattern.CASE_INSENSITIVE; 110 110 for (int i = 0; i < regexs.length; i++) { 111 111 if (regexs[i] == null || regexs[i].isEmpty()) { -
trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java
r8509 r8510 405 405 406 406 String extra = authorityMatcher.group(PARSE_AUTHORITY_EXTRA); 407 if (extra != null && !extra.trim().isEmpty()) {407 if (extra != null && !extra.trim().isEmpty()) { 408 408 return false; 409 409 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java
r8419 r8510 55 55 this(code, Collections.singleton(p), message); 56 56 } 57 57 58 public AddressError(int code, Collection<OsmPrimitive> collection, String message) { 58 59 this(code, collection, message, null, null); 59 60 } 61 60 62 public AddressError(int code, Collection<OsmPrimitive> collection, String message, String description, String englishDescription) { 61 63 this(code, Severity.WARNING, collection, message, description, englishDescription); 62 64 } 65 63 66 public AddressError(int code, Severity severity, Collection<OsmPrimitive> collection, String message, String description, 64 67 String englishDescription) { … … 207 210 centroid = ((Node) house).getEastNorth(); 208 211 } else if (house instanceof Way) { 209 List<Node> nodes = ((Way) house).getNodes();212 List<Node> nodes = ((Way) house).getNodes(); 210 213 if (house.hasKey(ADDR_INTERPOLATION)) { 211 214 for (Node n : nodes) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
r8378 r8510 40 40 41 41 /** All way segments, grouped by cells */ 42 private Map<Point2D, List<WaySegment>> cellSegments;42 private Map<Point2D, List<WaySegment>> cellSegments; 43 43 /** The already detected errors */ 44 44 private Set<WaySegment> errorSegments; … … 181 181 */ 182 182 public CrossingWays(String title) { 183 super(title, tr("This test checks if two roads, railways, waterways or buildings crosses in the same layer, but are not connected by a node.")); 183 super(title, tr("This test checks if two roads, railways, waterways or buildings crosses in the same layer, " + 184 "but are not connected by a node.")); 184 185 } 185 186 -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
r8393 r8510 121 121 } 122 122 123 124 123 @SuppressWarnings("unchecked") 125 124 @Override … … 163 162 List<TestError> errors = new ArrayList<>(); 164 163 165 MultiMap<Map<String, String>, OsmPrimitive> mm = new MultiMap<>();164 MultiMap<Map<String, String>, OsmPrimitive> mm = new MultiMap<>(); 166 165 for (Node n: nodes) { 167 166 mm.put(n.getKeys(), n); 168 167 } 169 168 170 Map<String, Boolean> typeMap=new HashMap<>();169 Map<String, Boolean> typeMap = new HashMap<>(); 171 170 String[] types = {"none", "highway", "railway", "waterway", "boundary", "power", "natural", "landuse", "building"}; 172 171 173 174 // check whether we have multiple nodes at the same position with 175 // the same tag set 176 // 177 for (Iterator<Map<String,String>> it = mm.keySet().iterator(); it.hasNext();) { 178 Map<String,String> tagSet = it.next(); 172 // check whether we have multiple nodes at the same position with the same tag set 173 for (Iterator<Map<String, String>> it = mm.keySet().iterator(); it.hasNext();) { 174 Map<String, String> tagSet = it.next(); 179 175 if (mm.get(tagSet).size() > 1) { 180 176 … … 184 180 185 181 for (OsmPrimitive p : mm.get(tagSet)) { 186 if (p.getType() ==OsmPrimitiveType.NODE) {182 if (p.getType() == OsmPrimitiveType.NODE) { 187 183 Node n = (Node) p; 188 List<OsmPrimitive> lp =n.getReferrers();184 List<OsmPrimitive> lp = n.getReferrers(); 189 185 for (OsmPrimitive sp: lp) { 190 if (sp.getType() ==OsmPrimitiveType.WAY) {186 if (sp.getType() == OsmPrimitiveType.WAY) { 191 187 boolean typed = false; 192 Way w =(Way) sp;188 Way w = (Way) sp; 193 189 Map<String, String> keys = w.getKeys(); 194 190 for (String type: typeMap.keySet()) { 195 191 if (keys.containsKey(type)) { 196 192 typeMap.put(type, true); 197 typed =true;193 typed = true; 198 194 } 199 195 } … … 207 203 } 208 204 209 int nbType =0;205 int nbType = 0; 210 206 for (Entry<String, Boolean> entry: typeMap.entrySet()) { 211 207 if (entry.getValue()) { … … 214 210 } 215 211 216 if (nbType >1) {212 if (nbType > 1) { 217 213 String msg = marktr("Mixed type duplicated nodes"); 218 214 errors.add(new TestError( … … 364 360 // object to keep track of the nodes at this position. 365 361 // 366 Node n1 = (Node) potentialDuplicates.get(n);362 Node n1 = (Node) potentialDuplicates.get(n); 367 363 List<Node> nodes = new ArrayList<>(2); 368 364 nodes.add(n1); … … 372 368 // we have multiple nodes at the same position. 373 369 // 374 List<Node> nodes = (List<Node>) potentialDuplicates.get(n);370 List<Node> nodes = (List<Node>) potentialDuplicates.get(n); 375 371 nodes.add(n); 376 372 } … … 413 409 } 414 410 415 return null; // undoRedo handling done in mergeNodes411 return null; // undoRedo handling done in mergeNodes 416 412 } 417 413 -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java
r8444 r8510 55 55 @Override 56 56 public int hashCode() { 57 return role.hashCode()+(int) relId+tags.hashCode()+type.hashCode()+coor.hashCode();57 return role.hashCode()+(int) relId+tags.hashCode()+type.hashCode()+coor.hashCode(); 58 58 } 59 59 … … 62 62 if (!(obj instanceof RelMember)) return false; 63 63 RelMember rm = (RelMember) obj; 64 return rm.role.equals(role) && rm.type.equals(type) && rm.relId ==relId && rm.tags.equals(tags) && rm.coor.equals(coor);64 return rm.role.equals(role) && rm.type.equals(type) && rm.relId == relId && rm.tags.equals(tags) && rm.coor.equals(coor); 65 65 } 66 66 … … 233 233 for (OsmPrimitive osm : sel) 234 234 if (osm instanceof Relation && !osm.isDeleted()) { 235 relFix.add((Relation) osm);235 relFix.add((Relation) osm); 236 236 } 237 237 … … 296 296 for (OsmPrimitive osm : sel) 297 297 if (osm instanceof Relation) { 298 relations.add((Relation) osm);298 relations.add((Relation) osm); 299 299 } 300 300 -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java
r8382 r8510 67 67 private static class WayPairNoTags { 68 68 private final List<LatLon> coor; 69 69 70 public WayPairNoTags(List<LatLon> coor) { 70 71 this.coor = coor; 71 72 } 73 72 74 @Override 73 75 public int hashCode() { 74 76 return coor.hashCode(); 75 77 } 78 76 79 @Override 77 80 public boolean equals(Object obj) { … … 125 128 if (sameway.size() > 1) { 126 129 //Report error only if at least some tags are different, as otherwise the error was already reported as duplicated ways 127 Map<String, String> tags0 =null;128 boolean skip =true;130 Map<String, String> tags0 = null; 131 boolean skip = true; 129 132 130 133 for (OsmPrimitive o : sameway) { 131 if (tags0 ==null) {132 tags0 =o.getKeys();134 if (tags0 == null) { 135 tags0 = o.getKeys(); 133 136 removeUninterestingKeys(tags0); 134 137 } else { 135 Map<String, String> tagsCmp =o.getKeys();138 Map<String, String> tagsCmp = o.getKeys(); 136 139 removeUninterestingKeys(tagsCmp); 137 140 if (!tagsCmp.equals(tags0)) { 138 skip =false;141 skip = false; 139 142 break; 140 143 } … … 158 161 */ 159 162 public void removeUninterestingKeys(Map<String, String> wkeys) { 160 for (String key : OsmPrimitive.getDiscardableKeys()) {163 for (String key : OsmPrimitive.getDiscardableKeys()) { 161 164 wkeys.remove(key); 162 165 } … … 207 210 int lowestIndex = 0; 208 211 long lowestNodeId = wNodes.get(0).getUniqueId(); 209 for (int i =1; i<wNodes.size(); i++) {212 for (int i = 1; i < wNodes.size(); i++) { 210 213 if (wNodes.get(i).getUniqueId() < lowestNodeId) { 211 214 lowestNodeId = wNodes.get(i).getUniqueId(); … … 213 216 } 214 217 } 215 for (int i =lowestIndex; i<wNodes.size()-1; i++) {218 for (int i = lowestIndex; i < wNodes.size()-1; i++) { 216 219 wNodesToUse.add(wNodes.get(i)); 217 220 } 218 for (int i =0; i<lowestIndex; i++) {221 for (int i = 0; i < lowestIndex; i++) { 219 222 wNodesToUse.add(wNodes.get(i)); 220 223 } … … 241 244 for (OsmPrimitive osm : sel) { 242 245 if (osm instanceof Way && !osm.isDeleted()) { 243 ways.add((Way) osm);246 ways.add((Way) osm); 244 247 } 245 248 } … … 301 304 302 305 //Do not automatically fix same ways with different tags 303 if (testError.getCode() !=DUPLICATE_WAY) return false;306 if (testError.getCode() != DUPLICATE_WAY) return false; 304 307 305 308 // We fix it only if there is no more than one way that is relation member. … … 309 312 for (OsmPrimitive osm : sel) { 310 313 if (osm instanceof Way) { 311 ways.add((Way) osm);314 ways.add((Way) osm); 312 315 } 313 316 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/InternetTags.java
r7937 r8510 132 132 String errMsg = validator.getErrorMessage(); 133 133 // Special treatment to allow URLs without protocol. See UrlValidator#isValid 134 if (tr("URL contains an invalid protocol: {0}", (String) null).equals(errMsg)) {134 if (tr("URL contains an invalid protocol: {0}", (String) null).equals(errMsg)) { 135 135 String proto = validator instanceof EmailValidator ? "mailto://" : "http://"; 136 136 return doValidateTag(p, k, proto+value, validator, code); -
trunk/src/org/openstreetmap/josm/data/validation/tests/LongSegment.java
r8455 r8510 35 35 public void visit(Way w) { 36 36 Double length = w.getLongestSegmentLength(); 37 if (length > maxlength) {37 if (length > maxlength) { 38 38 length /= 1000.0; 39 39 errors.add(new TestError(this, Severity.WARNING, tr("Long segments"), -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r8509 r8510 424 424 static String insertArguments(Selector matchingSelector, String s, OsmPrimitive p) { 425 425 if (s != null && matchingSelector instanceof Selector.ChildOrParentSelector) { 426 return insertArguments(((Selector.ChildOrParentSelector) matchingSelector).right, s, p);426 return insertArguments(((Selector.ChildOrParentSelector) matchingSelector).right, s, p); 427 427 } else if (s == null || !(matchingSelector instanceof GeneralSelector)) { 428 428 return s; … … 583 583 for (Selector s : rule.selectors) { 584 584 if (s instanceof AbstractSelector) { 585 for (Condition c : ((AbstractSelector) s).getConditions()) {585 for (Condition c : ((AbstractSelector) s).getConditions()) { 586 586 if (c instanceof ClassCondition) { 587 587 result.add(((ClassCondition) c).id); -
trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
r8509 r8510 79 79 for (Test t : OsmValidator.getEnabledTests(false)) { 80 80 if (t instanceof UnclosedWays) { 81 keysCheckedByAnotherTest.addAll(((UnclosedWays) t).getCheckedKeys());81 keysCheckedByAnotherTest.addAll(((UnclosedWays) t).getCheckedKeys()); 82 82 break; 83 83 } … … 94 94 GeneralPath result = new GeneralPath(); 95 95 result.moveTo((float) nodes.get(0).getCoor().lat(), (float) nodes.get(0).getCoor().lon()); 96 for (int i =1; i<nodes.size(); i++) {96 for (int i = 1; i < nodes.size(); i++) { 97 97 Node n = nodes.get(i); 98 98 result.lineTo((float) n.getCoor().lat(), (float) n.getCoor().lon()); -
trunk/src/org/openstreetmap/josm/data/validation/tests/NameMismatch.java
r8455 r8510 40 40 public NameMismatch() { 41 41 super(tr("Missing name:* translation"), 42 tr("This test finds multilingual objects whose ''name'' attribute is not equal to some ''name:*'' attribute and not a composition of ''name:*'' attributes, e.g., Italia - Italien - Italy.")); 42 tr("This test finds multilingual objects whose ''name'' attribute is not equal to some ''name:*'' attribute " + 43 "and not a composition of ''name:*'' attributes, e.g., Italia - Italien - Italy.")); 43 44 } 44 45 -
trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java
r8382 r8510 63 63 " r.getErrors = function() {return [];};" + 64 64 " return r;" + 65 " } catch (err) {" +65 " } catch (err) {" + 66 66 " return {" + 67 67 " getWarnings: function() {return [];}," + -
trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java
r8444 r8510 40 40 41 41 /** Bag of all way segments */ 42 private MultiMap<Pair<Node, Node>, WaySegment> nodePairs;42 private MultiMap<Pair<Node, Node>, WaySegment> nodePairs; 43 43 44 44 protected static final int OVERLAPPING_HIGHWAY = 101; -
trunk/src/org/openstreetmap/josm/data/validation/tests/PowerLines.java
r8382 r8510 122 122 List<List<Node>> nodesLists = new ArrayList<>(); 123 123 if (station instanceof Way) { 124 nodesLists.add(((Way) station).getNodes());124 nodesLists.add(((Way) station).getNodes()); 125 125 } else if (station instanceof Relation) { 126 126 Multipolygon polygon = MultipolygonCache.getInstance().get(Main.map.mapView, (Relation) station); … … 147 147 if (it.hasNext()) { 148 148 return new ChangePropertyCommand(it.next(), 149 "power", towerPoleTagMap.get(((PowerLineError) testError).line));149 "power", towerPoleTagMap.get(((PowerLineError) testError).line)); 150 150 } 151 151 } … … 155 155 @Override 156 156 public boolean isFixable(TestError testError) { 157 return testError instanceof PowerLineError && towerPoleTagMap.containsKey(((PowerLineError) testError).line);157 return testError instanceof PowerLineError && towerPoleTagMap.containsKey(((PowerLineError) testError).line); 158 158 } 159 159 … … 207 207 protected class PowerLineError extends TestError { 208 208 private final Way line; 209 209 210 public PowerLineError(Node n, Way line) { 210 211 super(PowerLines.this, Severity.WARNING, … … 212 213 this.line = line; 213 214 } 215 214 216 public final Node getNode() { 215 217 // primitives list can be empty if all primitives have been purged -
trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java
r8461 r8510 85 85 86 86 private static class RolePreset { 87 private final List<Role> roles; 88 private final String name; 89 87 90 public RolePreset(List<Role> roles, String name) { 88 91 this.roles = roles; 89 92 this.name = name; 90 93 } 91 private final List<Role> roles;92 private final String name;93 94 } 94 95 … … 118 119 119 120 private Map<String, RoleInfo> buildRoleInfoMap(Relation n) { 120 Map<String, RoleInfo> map = new HashMap<>();121 Map<String, RoleInfo> map = new HashMap<>(); 121 122 for (RelationMember m : n.getMembers()) { 122 123 String role = m.getRole(); … … 150 151 } 151 152 if (matches && r != null) { 152 for (Role role: r.roles) {153 for (Role role: r.roles) { 153 154 String key = role.key; 154 155 List<Role> roleGroup = null; … … 213 214 // verify if preset accepts such member 214 215 OsmPrimitive primitive = member.getMember(); 215 if (!primitive.isUsable()) {216 if (!primitive.isUsable()) { 216 217 // if member is not usable (i.e. not present in working set) 217 218 // we can't verify expression - so we just skip it … … 219 220 } else { 220 221 // verify expression 221 if (r.memberExpression.match(primitive)) {222 if (r.memberExpression.match(primitive)) { 222 223 return true; 223 224 } else { … … 283 284 284 285 // verify role counts based on whole role sets 285 for (RolePreset rp: allroles.values()) {286 for (RolePreset rp: allroles.values()) { 286 287 for (Role r: rp.roles) { 287 288 String keyname = r.key; -
trunk/src/org/openstreetmap/josm/data/validation/tests/SimilarNamedWays.java
r8404 r8510 37 37 38 38 /** All ways, grouped by cells */ 39 private Map<Point2D, List<Way>> cellWays;39 private Map<Point2D, List<Way>> cellWays; 40 40 /** The already detected errors */ 41 41 private MultiMap<Way, Way> errorWays; … … 130 130 if (m == 0) 131 131 return n; 132 d = new int[n + 1][m +1];132 d = new int[n+1][m+1]; 133 133 134 134 // Step 2 … … 198 198 // check plain strings 199 199 int distance = getLevenshteinDistance(name, name2); 200 boolean similar = distance >0 && distance<=2;200 boolean similar = distance > 0 && distance <= 2; 201 201 202 202 // try all rules -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r8470 r8510 265 265 } 266 266 // TODO directionKeys are no longer in OsmPrimitive (search pattern is used instead) 267 /* for (String a : OsmPrimitive.getDirectionKeys())267 /* for (String a : OsmPrimitive.getDirectionKeys()) 268 268 presetsValueData.add(a); 269 269 */ … … 345 345 withErrors.put(p, "ICK"); 346 346 } 347 if (checkValues && (value !=null && value.length() > 255) && !withErrors.contains(p, "LV")) {347 if (checkValues && (value != null && value.length() > 255) && !withErrors.contains(p, "LV")) { 348 348 errors.add(new TestError(this, Severity.ERROR, tr("Tag value longer than allowed"), 349 349 tr(s, key), MessageFormat.format(s, key), LONG_VALUE, p)); 350 350 withErrors.put(p, "LV"); 351 351 } 352 if (checkKeys && (key !=null && key.length() > 255) && !withErrors.contains(p, "LK")) {352 if (checkKeys && (key != null && key.length() > 255) && !withErrors.contains(p, "LK")) { 353 353 errors.add(new TestError(this, Severity.ERROR, tr("Tag key longer than allowed"), 354 354 tr(s, key), MessageFormat.format(s, key), LONG_KEY, p)); 355 355 withErrors.put(p, "LK"); 356 356 } 357 if (checkValues && (value ==null || value.trim().isEmpty()) && !withErrors.contains(p, "EV")) {357 if (checkValues && (value == null || value.trim().isEmpty()) && !withErrors.contains(p, "EV")) { 358 358 errors.add(new TestError(this, Severity.WARNING, tr("Tags with empty values"), 359 359 tr(s, key), MessageFormat.format(s, key), EMPTY_VALUES, p)); … … 392 392 } 393 393 for (String a : ignoreDataEquals) { 394 if (key.equals(a)) {394 if (key.equals(a)) { 395 395 ignore = true; 396 396 } 397 397 } 398 398 for (String a : ignoreDataEndsWith) { 399 if (key.endsWith(a)) {399 if (key.endsWith(a)) { 400 400 ignore = true; 401 401 } … … 508 508 a.anchor = GridBagConstraints.EAST; 509 509 510 testPanel.add(new JLabel(name+" :"), GBC.eol().insets(3, 0,0,0));510 testPanel.add(new JLabel(name+" :"), GBC.eol().insets(3, 0, 0, 0)); 511 511 512 512 prefCheckKeys = new JCheckBox(tr("Check property keys."), Main.pref.getBoolean(PREF_CHECK_KEYS, true)); 513 513 prefCheckKeys.setToolTipText(tr("Validate that property keys are valid checking against list of words.")); 514 testPanel.add(prefCheckKeys, GBC.std().insets(20, 0,0,0));514 testPanel.add(prefCheckKeys, GBC.std().insets(20, 0, 0, 0)); 515 515 516 516 prefCheckKeysBeforeUpload = new JCheckBox(); … … 520 520 prefCheckComplex = new JCheckBox(tr("Use complex property checker."), Main.pref.getBoolean(PREF_CHECK_COMPLEX, true)); 521 521 prefCheckComplex.setToolTipText(tr("Validate property values and tags using complex rules.")); 522 testPanel.add(prefCheckComplex, GBC.std().insets(20, 0,0,0));522 testPanel.add(prefCheckComplex, GBC.std().insets(20, 0, 0, 0)); 523 523 524 524 prefCheckComplexBeforeUpload = new JCheckBox(); … … 547 547 prefCheckValues = new JCheckBox(tr("Check property values."), Main.pref.getBoolean(PREF_CHECK_VALUES, true)); 548 548 prefCheckValues.setToolTipText(tr("Validate that property values are valid checking against presets.")); 549 testPanel.add(prefCheckValues, GBC.std().insets(20, 0,0,0));549 testPanel.add(prefCheckValues, GBC.std().insets(20, 0, 0, 0)); 550 550 551 551 prefCheckValuesBeforeUpload = new JCheckBox(); … … 555 555 prefCheckFixmes = new JCheckBox(tr("Check for FIXMES."), Main.pref.getBoolean(PREF_CHECK_FIXMES, true)); 556 556 prefCheckFixmes.setToolTipText(tr("Looks for nodes or ways with FIXME in any property value.")); 557 testPanel.add(prefCheckFixmes, GBC.std().insets(20, 0,0,0));557 testPanel.add(prefCheckFixmes, GBC.std().insets(20, 0, 0, 0)); 558 558 559 559 prefCheckFixmesBeforeUpload = new JCheckBox(); … … 667 667 private Pattern getPattern(String str) throws PatternSyntaxException { 668 668 if (str.endsWith("/i")) 669 return Pattern.compile(str.substring(1, str.length()-2), Pattern.CASE_INSENSITIVE);669 return Pattern.compile(str.substring(1, str.length()-2), Pattern.CASE_INSENSITIVE); 670 670 if (str.endsWith("/")) 671 return Pattern.compile(str.substring(1, str.length()-1));671 return Pattern.compile(str.substring(1, str.length()-1)); 672 672 673 673 throw new IllegalStateException(); 674 674 } 675 675 676 public CheckerElement(String exp) throws PatternSyntaxException { 676 677 Matcher m = Pattern.compile("(.+)([!=]=)(.+)").matcher(exp); -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnclosedWays.java
r8390 r8510 174 174 175 175 for (OsmPrimitive parent: w.getReferrers()) { 176 if (parent instanceof Relation && ((Relation) parent).isMultipolygon())176 if (parent instanceof Relation && ((Relation) parent).isMultipolygon()) 177 177 return; 178 178 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
r8509 r8510 423 423 return ret; 424 424 for (int i = 1; i < size; ++i) { 425 if (i < size-1) {425 if (i < size-1) { 426 426 addNode(w.getNode(i), middlenodes); 427 427 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java
r8444 r8510 127 127 OsmPrimitive member = m.getMember(); 128 128 if (member instanceof Way && member.isUsable() && !member.isTagged()) { 129 waysUsedInRelations.add((Way) member);129 waysUsedInRelations.add((Way) member); 130 130 } 131 131 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/WayConnectedToArea.java
r7937 r8510 40 40 List<OsmPrimitive> r = w.firstNode().getReferrers(); 41 41 for (OsmPrimitive p : r) { 42 if (p != w && p.hasKey("highway")) {42 if (p != w && p.hasKey("highway")) { 43 43 hasway = true; 44 44 break; … … 53 53 r = w.lastNode().getReferrers(); 54 54 for (OsmPrimitive p : r) { 55 if (p != w && p.hasKey("highway")) {55 if (p != w && p.hasKey("highway")) { 56 56 hasway = true; 57 57 break; -
trunk/src/org/openstreetmap/josm/data/validation/util/Entities.java
r8395 r8510 382 382 } 383 383 } else { // escaped value content is an entity name 384 if (mapNameToValue == null) {384 if (mapNameToValue == null) { 385 385 mapNameToValue = new HashMap<>(); 386 386 for (String[] pair : ARRAY) -
trunk/src/org/openstreetmap/josm/data/validation/util/ValUtil.java
r8444 r8510 33 33 * @return A list with all the cells the way starts or ends 34 34 */ 35 public static List<List<Way>> getWaysInCell(Way w, Map<Point2D, List<Way>> cellWays) {35 public static List<List<Way>> getWaysInCell(Way w, Map<Point2D, List<Way>> cellWays) { 36 36 if (w.getNodesCount() == 0) 37 37 return Collections.emptyList();
Note:
See TracChangeset
for help on using the changeset viewer.