src/main/java/de/blau/android/osm/StorageDelegator.java
/**
     * Way geometry has to be invalidated -before- nodes are moved
     * 
     * @param nodes List of nodes that are going to change
     */
Way geometry has to be invalidated -before- nodes are moved

@param nodes List of nodes that are going to change
Way geometry has to be invalidated - before - nodes are moved @param nodes List of nodes that are going to change
private void invalidateWayBoundingBox(@NonNull Collection<Node> nodes) {
        if (!nodes.isEmpty()) {
            Iterator<Node> it = nodes.iterator();
            Node n = it.next();
            ViewBox box = new ViewBox(n.lon, n.lat);
            while (it.hasNext()) {
                n = it.next();
                box.union(n.lon, n.lat);
            }
            List<Way> ways = currentStorage.getWays(box);
            for (Way w : ways) {
                box.union(w.getBounds());
            }
            box.expand(BaseValidator.MAX_CONNECTION_TOLERANCE);
            ways = currentStorage.getWays(box);
            if (ways.size() == 1) { 
                Way w = ways.get(0);
                invalidateWay(w);
            } else {
                for (Way w : new HashSet<>(ways)) {
                    invalidateWay(w);
                }
            }
        }
    }
private void invalidateWayBoundingBox ( @ NonNull Collection < Node > nodes ) { if ( ! nodes . isEmpty ( ) ) { Iterator < Node > it = nodes . iterator ( ) ; Node n = it . next ( ) ; ViewBox box = new ViewBox ( n . lon , n . lat ) ; while ( it . hasNext ( ) ) { n = it . next ( ) ; box . union ( n . lon , n . lat ) ; } List < Way > ways = currentStorage . getWays ( box ) ; for ( Way w : ways ) { box . union ( w . getBounds ( ) ) ; } box . expand ( BaseValidator . MAX_CONNECTION_TOLERANCE ) ; ways = currentStorage . getWays ( box ) ; if ( ways . size ( ) == 1 ) { Way w = ways . get ( 0 ) ; invalidateWay ( w ) ; } else { for ( Way w : new HashSet < > ( ways ) ) { invalidateWay ( w ) ; } } } }
Way geometry has to be invalidated -before- nodes are moved
Way geometry has to be invalidated - before - nodes are moved
// this would seem to be very complicated, however // a trivial implementation would be very expensive // even just for a single long way. // This way of doing it collects all candidate ways // first and then invalidates each of them max. once. // optimize the common case