Changeset 17411 in josm for trunk/src/org
- Timestamp:
- 2020-12-17T08:27:26+01:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/validation/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/DirectionNodes.java
r17368 r17411 8 8 import java.util.List; 9 9 import java.util.Map.Entry; 10 import java.util.stream.Collectors; 10 11 11 12 import org.openstreetmap.josm.data.osm.Node; … … 25 26 private static final int END_NODE_CODE = 4001; 26 27 private static final int NO_WAY_CODE = 4002; 28 private static final int NO_SUITABLE_WAY = 4003; 27 29 28 private static final String DIR_VERIF_PROBLEM_MSG = tr("Invalid usage of direction on node"); 30 private static final String INVALID_USE_MSG = tr("Invalid usage of direction on node"); 31 private static final String DISPUTED_USE_MSG = tr("Disputed usage of direction on node"); 29 32 30 33 /** … … 54 57 final List<Way> ways = new ArrayList<>(); 55 58 int count = 0; 59 int countHighWays = 0; 56 60 for (Way w : n.getParentWays()) { 57 61 if (isSuitableParentWay(w)) { 58 62 ways.add(w); 63 if (w.hasKey("highway")) 64 countHighWays++; 59 65 } 60 66 count++; 61 67 } 62 boolean needsParentWays = n.isNew() || (!n.isOutsideDownloadArea() && n.getDataSet().getDataSourceArea() != null); 68 69 // ignore minor highways (footway, path etc) if a major highway is found 70 if (countHighWays > 1 && (n.hasKey("highway") || n.hasTag("traffic_sign", "city_limit"))) { 71 List<Way> minor = ways.stream().filter(w -> !w.hasTag("highway", Highways.CLASSIFIED_HIGHWAYS)) 72 .collect(Collectors.toList()); 73 if (minor.size() != countHighWays) { 74 ways.removeAll(minor); 75 } 76 } 77 boolean needsParentWays = n.isNew() 78 || (!n.isOutsideDownloadArea() && n.getDataSet().getDataSourceArea() != null); 63 79 TestError.Builder builder = null; 64 80 if (ways.isEmpty() && needsParentWays) { 65 81 if (count == 0) { 66 builder = TestError.builder(this, Severity.WARNING, NO_WAY_CODE).message(DIR_VERIF_PROBLEM_MSG, 67 marktr("Unconnected node with {0}"), tag); 82 builder = TestError.builder(this, Severity.ERROR, NO_WAY_CODE).message(INVALID_USE_MSG, 83 marktr("Unconnected node with {0}. Use angle or cardinal direction"), tag); 84 } else { 85 builder = TestError.builder(this, Severity.WARNING, NO_SUITABLE_WAY).message(INVALID_USE_MSG, 86 marktr("Node with {0} should be connected to a linear way"), tag); 68 87 } 69 70 88 } else if (ways.size() == 1) { 71 89 Way w = ways.get(0); 72 90 if (w.firstNode() == n || w.lastNode() == n) { 73 builder = TestError.builder(this, Severity. WARNING, END_NODE_CODE).message(DIR_VERIF_PROBLEM_MSG,91 builder = TestError.builder(this, Severity.OTHER, END_NODE_CODE).message(DISPUTED_USE_MSG, 74 92 marktr("Node with {0} on end of way"), tag); 75 93 } 76 94 } else if (ways.size() > 1) { 77 builder = TestError.builder(this, Severity. WARNING, MULTIPLE_WAYS_CODE).message(DIR_VERIF_PROBLEM_MSG,95 builder = TestError.builder(this, Severity.OTHER, MULTIPLE_WAYS_CODE).message(DISPUTED_USE_MSG, 78 96 marktr("Node with {0} on a connection of multiple ways"), tag); 79 97 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java
r16382 r17411 46 46 */ 47 47 // CHECKSTYLE.OFF: SingleSpaceSeparator 48 privatestatic final List<String> CLASSIFIED_HIGHWAYS = Arrays.asList(48 static final List<String> CLASSIFIED_HIGHWAYS = Arrays.asList( 49 49 "motorway", "motorway_link", 50 50 "trunk", "trunk_link",
Note:
See TracChangeset
for help on using the changeset viewer.