src/main/java/de/blau/android/validation/BaseValidator.java
/**
     * Check if the node is too near any ways within the tolerance
     * 
     * The warning is suppressed if the node is connected to the nearby way via a (single) further way
     * 
     * @param tagKey tag key the ways need to have to be candidates
     * @param w the Way we are validating
     * @param logic the current Logic instance
     * @param layer the layer of w
     * @param n the Node we are checking for
     * 
     * @throws OsmException if something goes wrong creating the bounding box
     */
Check if the node is too near any ways within the tolerance

The warning is suppressed if the node is connected to the nearby way via a (single) further way



@throws OsmException if something goes wrong creating the bounding box
Check if the node is too near any ways within the tolerance The warning is suppressed if the node is connected to the nearby way via a ( single ) further way @throws OsmException if something goes wrong creating the bounding box
private void checkNearbyWays(@NonNull String tagKey, @NonNull Way w, @NonNull Logic logic, int layer, @NonNull Node n) throws OsmException {
        final int lat = n.getLat();
        final int lon = n.getLon();
        if (App.getDelegator().isInDownload(lon, lat)) { 
            BoundingBox box = GeoMath.createBoundingBoxForCoordinates(lat / 1E7D, lon / 1E7D, tolerance);
            List<Way> nearbyWays = App.getDelegator().getCurrentStorage().getWays(box);
            List<Way> connectedWays = new ArrayList<>();
            BoundingBox bb = w.getBounds();
            for (Way maybeConnected : new ArrayList<>(nearbyWays)) {
                if (!maybeConnected.hasTagKey(tagKey) || maybeConnected.equals(w)) {
                    nearbyWays.remove(maybeConnected);
                    continue;
                }
                if (bb.intersects(maybeConnected.getBounds()) && maybeConnected.hasCommonNode(w)) {
                    connectedWays.add(maybeConnected);
                    nearbyWays.remove(maybeConnected);
                }
            }
            for (Way nearbyWay : nearbyWays) {
                if (!hasConnection(nearbyWay, connectedWays) && layer == getLayer(nearbyWay)) {
                    connectedValidation(logic, tolerance, nearbyWay, n);
                    if ((n.getCachedProblems() & Validator.UNCONNECTED_END_NODE) != 0) {
                        break;
                    }
                }
            }
        }
    }
private void checkNearbyWays ( @ NonNull String tagKey , @ NonNull Way w , @ NonNull Logic logic , int layer , @ NonNull Node n ) throws OsmException { final int lat = n . getLat ( ) ; final int lon = n . getLon ( ) ; if ( App . getDelegator ( ) . isInDownload ( lon , lat ) ) { BoundingBox box = GeoMath . createBoundingBoxForCoordinates ( lat / 1E7D , lon / 1E7D , tolerance ) ; List < Way > nearbyWays = App . getDelegator ( ) . getCurrentStorage ( ) . getWays ( box ) ; List < Way > connectedWays = new ArrayList < > ( ) ; BoundingBox bb = w . getBounds ( ) ; for ( Way maybeConnected : new ArrayList < > ( nearbyWays ) ) { if ( ! maybeConnected . hasTagKey ( tagKey ) || maybeConnected . equals ( w ) ) { nearbyWays . remove ( maybeConnected ) ; continue ; } if ( bb . intersects ( maybeConnected . getBounds ( ) ) && maybeConnected . hasCommonNode ( w ) ) { connectedWays . add ( maybeConnected ) ; nearbyWays . remove ( maybeConnected ) ; } } for ( Way nearbyWay : nearbyWays ) { if ( ! hasConnection ( nearbyWay , connectedWays ) && layer == getLayer ( nearbyWay ) ) { connectedValidation ( logic , tolerance , nearbyWay , n ) ; if ( ( n . getCachedProblems ( ) & Validator . UNCONNECTED_END_NODE ) != 0 ) { break ; } } } } }
Check if the node is too near any ways within the tolerance
Check if the node is too near any ways within the tolerance
// only check for nodes in download